context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE fish_catch_data (species VARCHAR(255), region VARCHAR(255), biomass FLOAT); INSERT INTO fish_catch_data (species, region, biomass) VALUES ('Salmon', 'North Atlantic', 5000), ('Salmon', 'Mediterranean', 1200), ('Cod', 'North Atlantic', 7000), ('Halibut', 'Pacific', 8000), ('Tuna', 'Mediterranean', 9000), ('... | What is the total biomass of fish caught for each species in the Mediterranean? | SELECT species, region, SUM(biomass) as total_biomass FROM fish_catch_data WHERE region = 'Mediterranean' GROUP BY species, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_competency_scores (id INT, worker_id INT, score INT); CREATE TABLE cultural_competency_training (id INT, worker_id INT); INSERT INTO cultural_competency_scores (id, worker_id, score) VALUES (1, 1, 85), (2, 2, 95), (3, 3, 75); INSERT INTO cultural_competency_training (id, worker_id) VALUES (1, 1), ... | What is the average cultural competency score of community health workers who have completed cultural competency training? | SELECT AVG(ccs.score) FROM cultural_competency_scores ccs INNER JOIN cultural_competency_training cct ON ccs.worker_id = cct.worker_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtMovementSales (ArtMovement VARCHAR(255), ArtWork VARCHAR(255), Year INT, Revenue DECIMAL(10,2)); INSERT INTO ArtMovementSales (ArtMovement, ArtWork, Year, Revenue) VALUES ('Post-Impressionism', 'Artwork 1', 2022, 500.00), ('Post-Impressionism', 'Artwork 2', 2022, 400.00), ('Pop Art', 'Artwork 3', 2022, ... | What was the total revenue for each art movement's works sold in 2022? | SELECT ArtMovement, SUM(Revenue) as TotalRevenue FROM ArtMovementSales WHERE Year = 2022 GROUP BY ArtMovement; | gretelai_synthetic_text_to_sql |
CREATE TABLE Directors (id INT, director_name VARCHAR(100), gender VARCHAR(10)); CREATE TABLE Movies (id INT, title VARCHAR(100), director_id INT, runtime INT, release_year INT); INSERT INTO Directors (id, director_name, gender) VALUES (1, 'Director1', 'Female'), (2, 'Director2', 'Male'), (3, 'Director3', 'Female'); IN... | What is the total runtime of movies directed by female directors and released after 2010? | SELECT SUM(runtime) FROM Movies WHERE director_id IN (SELECT id FROM Directors WHERE gender = 'Female') AND release_year > 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT, organization VARCHAR(255), region VARCHAR(255), amount DECIMAL(10,2)); | What is the total amount of funding received by refugee support organizations in Asia? | SELECT SUM(amount) FROM funding WHERE region = 'Asia' AND organization LIKE '%refugee support%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE foia_requests (id INT, city VARCHAR, year INT, submitted BOOLEAN); INSERT INTO foia_requests (id, city, year, submitted) VALUES (1, 'Toronto', 2020, TRUE); | How many freedom of information requests were submitted to the city of Toronto in 2020? | SELECT COUNT(*) FROM foia_requests WHERE city = 'Toronto' AND year = 2020 AND submitted = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (initiative_name VARCHAR(50), location VARCHAR(50), year INT, budget INT); INSERT INTO climate_communication (initiative_name, location, year, budget) VALUES ('African Climate Congress', 'Kenya', 2021, 100000); INSERT INTO climate_communication (initiative_name, location, year, budget... | What is the number of climate communication initiatives and their total budget in Africa in the year 2021? | SELECT COUNT(*) as num_initiatives, SUM(budget) as total_budget FROM climate_communication WHERE year = 2021 AND location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT, name VARCHAR(255), start_date DATE); | Show all peacekeeping operations that started after 2015 | SELECT * FROM peacekeeping_operations WHERE start_date > '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name TEXT, country TEXT); INSERT INTO ports (port_id, port_name, country) VALUES (1, 'Port A', 'USA'), (2, 'Port B', 'Canada'); CREATE TABLE shipments (shipment_id INT, port_id INT, cargo_weight INT); INSERT INTO shipments (shipment_id, port_id, cargo_weight) VALUES (1, 1, 5000), (... | What is the total cargo weight handled by each port? | SELECT ports.port_name, SUM(shipments.cargo_weight) FROM ports JOIN shipments ON ports.port_id = shipments.port_id GROUP BY ports.port_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (id INT, name VARCHAR(50), age INT, region VARCHAR(20), innovation_score FLOAT); | Delete records from the 'Farmers' table where the 'region' is 'North' | DELETE FROM Farmers WHERE region = 'North'; | gretelai_synthetic_text_to_sql |
CREATE TABLE part_suppliers (id INT, part_id INT, supplier_id INT, rating INT); INSERT INTO part_suppliers (id, part_id, supplier_id, rating) VALUES (1, 1, 1, 90), (2, 1, 2, 85), (3, 2, 1, 92), (4, 2, 2, 95); | What is the name of the supplier with the highest rating for part 'P1'? | SELECT supplier_id FROM part_suppliers WHERE part_id = 1 ORDER BY rating DESC LIMIT 1; SELECT name FROM suppliers WHERE id = (SELECT supplier_id FROM part_suppliers WHERE part_id = 1 ORDER BY rating DESC LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, category VARCHAR(20), billing_amount DECIMAL(10, 2), opened_date DATE); | Find the total billing amount for cases in the family law category that were opened before 2020-01-01. | SELECT SUM(billing_amount) FROM cases WHERE category = 'family' AND opened_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO users (id, name, region) VALUES (1, 'John Doe', 'US'), (2, 'Jane Smith', 'CA'); CREATE TABLE posts (id INT, user_id INT, content TEXT, date DATE); INSERT INTO posts (id, user_id, content, date) VALUES (1, 1, 'Hello World!', '2021-01-01'), (2... | What is the average number of posts per day for users in 'US' region? | SELECT AVG(COUNT(posts.date)) FROM posts JOIN users ON posts.user_id = users.id WHERE users.region = 'US' GROUP BY users.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE wildlife (id INT PRIMARY KEY, animal_type TEXT, region TEXT, conservation_status TEXT); INSERT INTO wildlife (id, animal_type, region, conservation_status) VALUES (1, 'Mammal', 'Europe', 'Endangered'); | Delete records in the wildlife table where the animal_type is 'Mammal' and region is 'Europe' | DELETE FROM wildlife WHERE animal_type = 'Mammal' AND region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_hearings (hearing_id INT, hearing_name VARCHAR(255), state VARCHAR(255), region VARCHAR(255), hearing_date DATE); INSERT INTO public_hearings (hearing_id, hearing_name, state, region, hearing_date) VALUES (1, 'Hearing A', 'Florida', 'South', '2022-03-01'), (2, 'Hearing B', 'Georgia', 'South', '2022-... | What is the name and date of the most recent public hearing in the South? | SELECT hearing_name, hearing_date FROM public_hearings WHERE region = 'South' ORDER BY hearing_date DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, cause VARCHAR(50), donation DECIMAL(10, 2), donation_date DATE); | What is the total amount donated to effective altruism causes in the last 5 years? | SELECT SUM(donation) FROM donations WHERE cause = 'Effective Altruism' AND donation_date >= DATEADD(year, -5, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_admissions (id INT, admission_id INT, patient_id INT, issue VARCHAR(50), admission_date DATE, age INT, country VARCHAR(50)); INSERT INTO hospital_admissions (id, admission_id, patient_id, issue, admission_date, age, country) VALUES (1, 2001, 901, 'Heart Disease', '2021-01-01', 75, 'India'); INSERT... | Identify the top 3 health issues affecting the elderly population in India, based on hospital admission records. | SELECT issue, COUNT(*) AS admissions FROM hospital_admissions WHERE country = 'India' AND age >= 60 GROUP BY issue ORDER BY admissions DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_revenue (restaurant_name TEXT, category TEXT, daily_revenue NUMERIC, date DATE); INSERT INTO daily_revenue (restaurant_name, category, daily_revenue, date) VALUES ('ABC Bistro', 'Italian', 250, '2022-01-01'), ('ABC Bistro', 'Italian', 250, '2022-01-02'), ('XYZ Café', 'Coffee Shop', 150, '2022-01-01')... | What was the average daily revenue for each restaurant category in 2022? | SELECT category, AVG(daily_revenue) as avg_daily_revenue FROM daily_revenue WHERE date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (customer_id INT, name VARCHAR(50), region VARCHAR(20)); INSERT INTO regions (customer_id, name, region) VALUES (1, 'John Doe', 'Asia-Pacific'), (2, 'Jane Smith', 'Europe'), (3, 'Alice Johnson', 'Asia-Pacific'), (4, 'Bob Brown', 'Americas'); CREATE TABLE transactions_5 (transaction_id INT, customer... | What is the maximum transaction amount for a customer in the Asia-Pacific region? | SELECT MAX(amount) FROM transactions_5 t JOIN regions r ON t.customer_id = r.customer_id WHERE r.region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mlb_home_runs (player_id INT, player_name VARCHAR(50), home_run_distance FLOAT); INSERT INTO mlb_home_runs (player_id, player_name, home_run_distance) VALUES (1, 'Aaron Judge', 449.6), (2, 'Giancarlo Stanton', 434.7), (3, 'Nelson Cruz', 423.5); | What are the average home run distances for athletes in the MLB? | SELECT AVG(home_run_distance) FROM mlb_home_runs; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (item_id INT, item_name VARCHAR(255), category VARCHAR(255)); CREATE TABLE sales (sales_id INT, item_id INT, sales_amount DECIMAL(5,2)); INSERT INTO menu VALUES (1, 'Cheese Pizza', 'Pizza'), (2, 'Margherita Pizza', 'Pizza'), (3, 'Chicken Alfredo', 'Pasta'), (4, 'Beef Lasagna', 'Pasta'); INSERT INTO sa... | What is the total sales for each category of menu items? | SELECT menu.category, SUM(sales.sales_amount) FROM menu JOIN sales ON menu.item_id = sales.item_id GROUP BY menu.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (country_id INT, country_name VARCHAR(255)); INSERT INTO Country (country_id, country_name) VALUES (1, 'CountryA'), (2, 'CountryB'); CREATE TABLE Initiatives (init_id INT, country_id INT, initiative_name VARCHAR(255), description VARCHAR(255)); INSERT INTO Initiatives (init_id, country_id, initiati... | List the circular economy initiatives and their descriptions in 'CountryA'. | SELECT Country.country_name, Initiatives.initiative_name, Initiatives.description FROM Country INNER JOIN Initiatives ON Country.country_id = Initiatives.country_id WHERE Country.country_name = 'CountryA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor (id INT, type VARCHAR(255)); INSERT INTO sensor (id, type) VALUES (1, 'temperature'), (2, 'humidity'), (3, 'moisture'), (4, 'temperature'), (5, 'temperature'); | Count the number of sensors of each type | SELECT type, COUNT(*) FROM sensor GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE courses (course_id INT, course_name_duration VARCHAR(50)); | Pivot the 'courses' table to display course name and duration in separate columns | SELECT course_id, SPLIT_PART(course_name_duration, ' ', 1) AS course_name, SPLIT_PART(course_name_duration, ' ', 2) AS course_duration FROM courses; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_plastic_waste (country_name TEXT, last_report_date DATE); | List all countries that have not reported their plastic waste contribution in the last 2 years. | SELECT country_name FROM country_plastic_waste WHERE last_report_date < NOW() - INTERVAL '2 year'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_name TEXT, compliance_status TEXT, ocean TEXT, year INT); INSERT INTO vessels (vessel_name, compliance_status, ocean, year) VALUES ('VesselA', 'compliant', 'Indian', 2018), ('VesselB', 'non-compliant', 'Indian', 2018), ('VesselC', 'compliant', 'Indian', 2018), ('VesselA', 'compliant', 'Indi... | List the vessels that have complied with maritime law in the Indian Ocean for the last 5 years. | SELECT vessel_name FROM vessels WHERE compliance_status = 'compliant' AND ocean = 'Indian' AND year BETWEEN 2017 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA manufacturing;CREATE TABLE ethical_manufacturers (id INT PRIMARY KEY, name TEXT, region TEXT);INSERT INTO ethical_manufacturers (id, name, region) VALUES (1, 'Ethical Manufacturer A', 'North'); INSERT INTO ethical_manufacturers (id, name, region) VALUES (2, 'Ethical Manufacturer B', 'South'); | Remove the ethical manufacturing record with ID 1 | DELETE FROM ethical_manufacturers WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtistDemographics (ArtistID INT, ArtistAge INT, ArtistGender VARCHAR(10)); INSERT INTO ArtistDemographics (ArtistID, ArtistAge, ArtistGender) VALUES (1, 37, 'Female'), (2, 56, 'Male'), (3, 81, 'Non-binary'), (4, 62, 'Female'), (5, 28, 'Female'); | What is the average age of female artists in the 'ArtistDemographics' table? | SELECT AVG(ArtistAge) AS AvgFemaleArtistAge FROM ArtistDemographics WHERE ArtistGender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, country TEXT); INSERT INTO companies (id, name, country) VALUES (1, 'Company1', 'Egypt'), (2, 'Company2', 'Egypt'), (3, 'Company3', 'France'), (4, 'Company4', 'Germany'); CREATE TABLE ad_spend (company_id INT, amount DECIMAL, date DATE); INSERT INTO ad_spend (company_id, amoun... | What is the maximum advertising spend by companies from Egypt, in April 2022? | SELECT MAX(ad_spend.amount) FROM ad_spend JOIN companies ON ad_spend.company_id = companies.id WHERE companies.country = 'Egypt' AND ad_spend.date >= '2022-04-01' AND ad_spend.date <= '2022-04-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipment (id INT, source_country VARCHAR(255), destination_country VARCHAR(255), items_quantity INT, shipment_date DATE); INSERT INTO Shipment (id, source_country, destination_country, items_quantity, shipment_date) VALUES (1, 'Mexico', 'Spain', 150, '2021-05-01'), (2, 'Spain', 'Mexico', 100, '2021-05-03')... | What are the total items shipped between Mexico and Spain in May 2021? | SELECT SUM(items_quantity) FROM Shipment WHERE (source_country = 'Mexico' AND destination_country = 'Spain') OR (source_country = 'Spain' AND destination_country = 'Mexico') AND shipment_date BETWEEN '2021-05-01' AND '2021-05-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ferries (id INT PRIMARY KEY, route_id INT, station VARCHAR(20), bike_racks BOOLEAN); | Show ferry routes with bike racks for the 'South Harbor' | SELECT DISTINCT route_id, station FROM ferries WHERE station = 'South Harbor' AND bike_racks = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_date DATE); CREATE TABLE exit_strategy (id INT, company_id INT, exit_date DATE, exit_type TEXT); | How many companies have had an IPO as an exit strategy for each year? | SELECT YEAR(exit_strategy.exit_date), COUNT(*) FROM company JOIN exit_strategy ON company.id = exit_strategy.company_id WHERE exit_strategy.exit_type = 'IPO' GROUP BY YEAR(exit_strategy.exit_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (id INT, carrier VARCHAR(50), delivery_time INT); INSERT INTO shipments (id, carrier, delivery_time) VALUES (1, 'Carrier A', 5), (2, 'Carrier B', 7), (3, 'Carrier A', 6), (4, 'Carrier C', 4); | What is the average delivery time for each carrier, calculated across all shipments? | SELECT carrier, AVG(delivery_time) as avg_delivery_time FROM shipments GROUP BY carrier; | gretelai_synthetic_text_to_sql |
CREATE TABLE port (port_id INT, name TEXT);CREATE TABLE crane (crane_id INT, port_id INT, name TEXT);CREATE TABLE container (container_id INT, crane_id INT, weight INT);INSERT INTO port VALUES (1, 'Seattle'); | What is the average weight of containers handled by each crane in port 'Seattle'? | SELECT crane.name, AVG(container.weight) FROM crane JOIN port ON crane.port_id = port.port_id JOIN container ON crane.crane_id = container.crane_id WHERE port.name = 'Seattle' GROUP BY crane.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (name TEXT, id INTEGER, region TEXT, waste_generation FLOAT); INSERT INTO factories (name, id, region, waste_generation) VALUES ('Factory L', 12, 'Europe', 1000), ('Factory M', 13, 'Europe', 1200), ('Factory N', 14, 'Asia', 1500); | What is the waste generation for factories in the European region? | SELECT SUM(waste_generation) FROM factories WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (id INT PRIMARY KEY, name VARCHAR(100), age INT, gender VARCHAR(10), city VARCHAR(50)); | Show average age of fans by city | SELECT city, AVG(age) as avg_age FROM fans GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE afrobeats_streams (id INT, user_id INT, genre TEXT, location TEXT, streams INT); INSERT INTO afrobeats_streams (id, user_id, genre, location, streams) VALUES (1, 100, 'Afrobeats', 'Nigeria', 500), (2, 200, 'Afrobeats', 'Ghana', 300), (3, 300, 'Afrobeats', 'Nigeria', 600); | What is the average number of streams for Afrobeats music in Nigeria? | SELECT AVG(streams) FROM afrobeats_streams WHERE genre = 'Afrobeats' AND location = 'Nigeria'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_features (hotel_id INT, hotel_name TEXT, country TEXT, ai_concierge BOOLEAN); | What is the number of hotels in Oceania that have implemented AI concierge services? | SELECT COUNT(*) FROM hotel_features WHERE country = 'Oceania' AND ai_concierge = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, quantity INT, sale_date DATE, is_fair_trade BOOLEAN); INSERT INTO sales (sale_id, product_id, quantity, sale_date, is_fair_trade) VALUES (1, 1, 15, '2021-01-01', true); CREATE TABLE products (product_id INT, product_name VARCHAR(255)); INSERT INTO products (product_id, p... | What is the total quantity of Fair Trade certified products sold, pivoted by week? | SELECT EXTRACT(WEEK FROM sale_date) AS week, is_fair_trade, SUM(quantity) AS total_quantity FROM sales JOIN products ON sales.product_id = products.product_id WHERE is_fair_trade = true GROUP BY week, is_fair_trade; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameDesign (GameID INT, Name VARCHAR(50), Genre VARCHAR(20), NumLevels INT); INSERT INTO GameDesign (GameID, Name, Genre, NumLevels) VALUES (1, 'VR Racer', 'Racing', 10), (2, 'Solar System', 'Simulation', 1), (3, 'VR Puzzler', 'Puzzle', 15), (4, 'Space Shooter', 'Shooter', 20), (5, 'Mystery Game', 'Adventu... | Display the names and genres of games with the most levels, along with the total number of levels across all games. | SELECT Name, Genre FROM GameDesign WHERE NumLevels = (SELECT MAX(NumLevels) FROM GameDesign) UNION ALL SELECT 'Total Levels', CAST(SUM(NumLevels) as VARCHAR(10)) FROM GameDesign; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID INT, Size TEXT); INSERT INTO Customers (CustomerID, Size) VALUES (1, 'Small'), (2, 'Medium'), (3, 'Large'), (4, 'X-Large'), (5, 'XX-Large'); | How many customers in each size category are there for our plus-size clothing line? | SELECT Size, COUNT(*) FROM Customers WHERE Size IN ('X-Large', 'XX-Large') GROUP BY Size; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT, name TEXT, location TEXT, capacity INT, current_stock INT); | List all the warehouses with available capacity and their respective locations, ordered by the available capacity in descending order. | SELECT * FROM warehouse WHERE current_stock < capacity ORDER BY capacity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name TEXT, genre TEXT); INSERT INTO artists (id, name, genre) VALUES (1, 'Artist A', 'Electronic'), (2, 'Artist B', 'Rock'), (3, 'Artist C', 'Electronic'), (4, 'Artist D', 'Pop'), (5, 'Artist E', 'Pop'); CREATE TABLE sales (song_id INT, artist_id INT, revenue INT); INSERT INTO sales (song_... | Who are the top 5 artists by revenue? | SELECT artists.name, SUM(sales.revenue) as total_revenue FROM artists JOIN sales ON artists.id = sales.artist_id GROUP BY artists.name ORDER BY total_revenue DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT, name VARCHAR(100), location VARCHAR(50), capacity FLOAT); INSERT INTO renewable_energy (id, name, location, capacity) VALUES (1, 'Solar Farm A', 'US Midwest', 100.5); INSERT INTO renewable_energy (id, name, location, capacity) VALUES (2, 'Wind Farm C', 'US Midwest', 150.6); | Identify renewable energy infrastructure projects in the 'US Midwest' and their respective capacities | SELECT name, capacity FROM renewable_energy WHERE location = 'US Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts(id INT, name VARCHAR(255), birth_date DATE, gender VARCHAR(10), missions INT); INSERT INTO astronauts(id, name, birth_date, gender, missions) VALUES (1, 'Jane Doe', '1990-05-18', 'Female', 2), (2, 'John Doe', '1985-02-21', 'Male', 1); | What is the average number of missions flown by each astronaut? | SELECT AVG(missions) FROM astronauts; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProjectTimeline (permit_id INT, project_type VARCHAR(255), duration INT); INSERT INTO ProjectTimeline (permit_id, project_type, duration) VALUES (1, 'residential', 120), (2, 'commercial', 180); | What is the average project duration for residential permits? | SELECT AVG(duration) FROM ProjectTimeline WHERE project_type = 'residential'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers (id INT, name VARCHAR(50), department VARCHAR(50), is_ethical BOOLEAN); INSERT INTO workers (id, name, department, is_ethical) VALUES (1, 'John Doe', 'manufacturing', TRUE), (2, 'Jane Smith', 'engineering', FALSE); | How many workers are employed in 'ethical manufacturing'? | SELECT COUNT(*) FROM workers WHERE is_ethical = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_cars (make VARCHAR(255), model VARCHAR(255), horsepower INT); INSERT INTO electric_cars (make, model, horsepower) VALUES ('Tesla', 'Model 3', 261), ('Tesla', 'Model S', 469); | What is the horsepower of the Tesla Model 3? | SELECT horsepower FROM electric_cars WHERE make = 'Tesla' AND model = 'Model 3'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workouts (Id INT, MemberId INT, WorkoutType VARCHAR(50), Duration INT, Date DATE); INSERT INTO Workouts (Id, MemberId, WorkoutType, Duration, Date) VALUES (1, 1, 'Running', 30, '2022-01-01'), (2, 2, 'Swimming', 60, '2022-01-02'), (3, 1, 'Yoga', 45, '2022-01-03'); | List all the distinct workout types done by members aged 40 or older? | SELECT DISTINCT WorkoutType FROM Workouts WHERE MemberId IN (SELECT Id FROM Members WHERE Age >= 40); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), JobTitle VARCHAR(50), LeadershipTraining BOOLEAN); INSERT INTO Employees (EmployeeID, FirstName, LastName, JobTitle, LeadershipTraining) VALUES (1, 'Joseph', 'Lee', 'Software Engineer', false); INSERT INTO Employees (EmployeeID, FirstN... | Count the number of employees who have completed leadership training, by job title | SELECT JobTitle, COUNT(*) as NumberOfEmployees FROM Employees WHERE LeadershipTraining = true GROUP BY JobTitle; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, SupplierName TEXT, IsSustainable BOOLEAN); INSERT INTO Suppliers (SupplierID, SupplierName, IsSustainable) VALUES (1, 'Green Vista', false), (2, 'Farm Fresh', true), (3, 'Sustainable Harvest', true); CREATE TABLE Products (ProductID INT, SupplierID INT, Calories INT); INSERT INTO... | Delete records for products delivered by 'Green Vista' that are not sustainable. | DELETE FROM Products WHERE SupplierID IN (SELECT SupplierID FROM Suppliers WHERE SupplierName = 'Green Vista' AND IsSustainable = false); | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselArrivals (ID INT, VesselName VARCHAR(50), ArrivalPort VARCHAR(50), ArrivalDate DATE, AverageSpeed DECIMAL(5,2)); INSERT INTO VesselArrivals (ID, VesselName, ArrivalPort, ArrivalDate, AverageSpeed) VALUES (1, 'Test Vessel 1', 'Accra', '2022-01-01', 10.0), (2, 'Test Vessel 2', 'Accra', '2022-01-02', 12... | What are the names of the vessels with the lowest average speed that arrived in Accra? | SELECT VesselName FROM (SELECT VesselName, ROW_NUMBER() OVER (ORDER BY AverageSpeed) AS rn FROM VesselArrivals WHERE ArrivalPort = 'Accra') t WHERE rn = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, region VARCHAR(20), financial_wellbeing_score DECIMAL(3, 1)); INSERT INTO customers (customer_id, region, financial_wellbeing_score) VALUES (1, 'Northeast', 6.5), (2, 'Midwest', 7.2), (3, 'West', 6.8); | What is the minimum financial wellbeing score for customers in the West? | SELECT MIN(financial_wellbeing_score) FROM customers WHERE region = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (attorney_id INT, name TEXT, region TEXT); INSERT INTO Attorneys (attorney_id, name, region) VALUES (1, 'John Doe', 'New York'), (2, 'Jane Smith', 'California'); CREATE TABLE Cases (case_id INT, attorney_id INT, billing_amount INT); INSERT INTO Cases (case_id, attorney_id, billing_amount) VALUES ... | What is the average billing amount for cases handled by attorneys from the 'New York' region? | SELECT AVG(Cases.billing_amount) FROM Cases INNER JOIN Attorneys ON Cases.attorney_id = Attorneys.attorney_id WHERE Attorneys.region = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Plans (Plan VARCHAR(20), Type VARCHAR(20), DataLimit INT); INSERT INTO Plans (Plan, Type, DataLimit) VALUES ('Residential', 'Broadband', 20000), ('Business', 'Broadband', 50000); CREATE TABLE DataUsage (Plan VARCHAR(20), Usage INT); INSERT INTO DataUsage (Plan, Usage) VALUES ('Residential', 18000), ('Busin... | Which 'Broadband' plan has the highest average data usage? | SELECT p.Type, MAX(AVG(du.Usage)) as MaxAvgDataUsage FROM Plans p JOIN DataUsage du ON p.Plan = du.Plan GROUP BY p.Type HAVING p.Type = 'Broadband'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students_mental_health (student_id INT, school_id INT, mental_health_score INT); | What is the average mental health score of students per school in the "students_mental_health" table? | SELECT school_id, AVG(mental_health_score) as avg_mental_health_score FROM students_mental_health GROUP BY school_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_demographics (player_id INT, player_name TEXT, age INT, country TEXT, is_vr_player BOOLEAN); INSERT INTO player_demographics (player_id, player_name, age, country, is_vr_player) VALUES (1, 'Alex Garcia', 30, 'Brazil', true), (2, 'Li Mei', 28, 'China', true), (3, 'Jordan Bennett', 35, 'Canada', false... | What is the average age of players who play VR games, by country? | SELECT countries.country, AVG(player_demographics.age) FROM player_demographics JOIN countries ON player_demographics.country = countries.country WHERE player_demographics.is_vr_player = true GROUP BY countries.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(50), department VARCHAR(50), enrollment_date DATE); | Insert a new record for a graduate student named Maria Garcia. | INSERT INTO graduate_students (id, name, department, enrollment_date) VALUES (4, 'Maria Garcia', 'Computer Science', '2022-08-22'); | gretelai_synthetic_text_to_sql |
CREATE TABLE MenuItems(menu_item_id INT, item_name VARCHAR(255), last_ordered_date DATE); | Delete menu items that have not been ordered in the last 6 months | DELETE FROM MenuItems WHERE last_ordered_date < DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name TEXT, location TEXT); INSERT INTO ports (id, name, location) VALUES (1, 'Port of Shanghai', 'Shanghai, China'); CREATE TABLE shipments (id INT, container_weight FLOAT, departure_port_id INT, arrival_region TEXT, shipment_date DATE); INSERT INTO shipments (id, container_weight, departure... | What is the maximum weight of containers shipped from the Port of Shanghai to Europe in the past month? | SELECT MAX(container_weight) FROM shipments WHERE departure_port_id = (SELECT id FROM ports WHERE name = 'Port of Shanghai') AND arrival_region = 'Europe' AND shipment_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchProjects (ProjectName VARCHAR(50), PrincipalInvestigator VARCHAR(50)); INSERT INTO ResearchProjects (ProjectName, PrincipalInvestigator) VALUES ('Project1', 'John Doe'); | What is the total number of marine research projects, along with the name of the principal investigator for each project? | SELECT ProjectName, PrincipalInvestigator, COUNT(*) OVER () AS 'Total Projects' FROM ResearchProjects; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, post_type VARCHAR(50), likes INT); | What is the total number of likes received by posts in the posts table, grouped by post_type? | SELECT post_type, SUM(likes) FROM posts GROUP BY post_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, attorney_name VARCHAR(50)); INSERT INTO attorneys (attorney_id, attorney_name) VALUES (1, 'Alex Rodriguez'), (2, 'Fiona Clark'), (3, 'Jayden Moore'); CREATE TABLE cases (case_id INT, attorney_id INT, case_outcome VARCHAR(10)); INSERT INTO cases (case_id, attorney_id, case_outcom... | Show attorneys who have never won a case. | SELECT a.attorney_name FROM attorneys a LEFT JOIN cases c ON a.attorney_id = c.attorney_id WHERE c.case_outcome IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Yields (FarmingType VARCHAR(20), Crop VARCHAR(20), Yield FLOAT); INSERT INTO Yields (FarmingType, Crop, Yield) VALUES ('Agroecological', 'Soybeans', 30.5), ('Agroecological', 'Soybeans', 38.7), ('Conventional', 'Soybeans', 50.2); | What is the minimum and maximum yield for soybeans in agroecological farming? | SELECT MIN(Yield), MAX(Yield) FROM Yields WHERE FarmingType = 'Agroecological' AND Crop = 'Soybeans'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet (id INT, type TEXT, model TEXT, year INT); INSERT INTO fleet (id, type, model, year) VALUES (1, 'bus', 'Artic', 2015), (2, 'bus', 'Midi', 2018), (3, 'tram', 'Cantrib', 2010), (4, 'train', 'EMU', 2000); | How many vehicles of type 'bus' and 'tram' are currently in the 'fleet' table? | SELECT type, COUNT(*) as count FROM fleet WHERE type IN ('bus', 'tram') GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (PolicyID INT, State VARCHAR(20)); CREATE TABLE Claims (PolicyID INT, ClaimAmount DECIMAL(10,2)); INSERT INTO Policies (PolicyID, State) VALUES (1, 'California'), (2, 'California'), (3, 'Texas'), (4, 'Texas'), (5, 'Florida'); INSERT INTO Claims (PolicyID, ClaimAmount) VALUES (1, 500), (2, 1200), (... | What is the total claim amount for policies issued in each state, in descending order? | SELECT P.State, SUM(C.ClaimAmount) AS TotalClaimAmount FROM Policies P INNER JOIN Claims C ON P.PolicyID = C.PolicyID GROUP BY P.State ORDER BY TotalClaimAmount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_development (name TEXT, cost FLOAT); INSERT INTO biosensor_development (name, cost) VALUES ('BioSensor1', 25000); INSERT INTO biosensor_development (name, cost) VALUES ('BioSensor2', 30000); | Identify biosensors with a development cost higher than the average. | SELECT name, cost FROM biosensor_development WHERE cost > (SELECT AVG(cost) FROM biosensor_development); | gretelai_synthetic_text_to_sql |
CREATE TABLE aisafety_conferences (conference VARCHAR(255), num_papers INT); INSERT INTO aisafety_conferences (conference, num_papers) VALUES ('AAAI Safety', 15), ('NeurIPS Ethics', 20), ('IJCAI Safety', 12); | Find the average number of papers in all AI safety conferences. | SELECT AVG(num_papers) FROM aisafety_conferences | gretelai_synthetic_text_to_sql |
CREATE TABLE heart_rates (heart_rate_id INT, member_id INT, heart_rate INT, heart_rate_date DATE); INSERT INTO heart_rates (heart_rate_id, member_id, heart_rate, heart_rate_date) VALUES (1, 1, 80, '2022-01-01'), (2, 1, 85, '2022-01-02'), (3, 2, 90, '2022-01-01'); | Calculate the average heart rate for each member by day | SELECT member_id, DATE_FORMAT(heart_rate_date, '%Y-%m-%d') as date, AVG(heart_rate) as avg_heart_rate FROM heart_rates GROUP BY member_id, date ORDER BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE Funding (program_name VARCHAR(255), funding_source VARCHAR(255), amount_received DECIMAL(10,2)); INSERT INTO Funding (program_name, funding_source, amount_received) VALUES ('Music for the Community', 'Private Donor', 15000.00), ('Music for the Community', 'Corporate Sponsor', 25000.00), ('Music for the Com... | What is the total funding received by 'Music for the Community' from private sources? | SELECT SUM(amount_received) FROM Funding WHERE program_name = 'Music for the Community' AND funding_source = 'Private Donor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_categories (category_id INT, name TEXT, state TEXT); INSERT INTO product_categories (category_id, name, state) VALUES (1, 'Category X', 'Colorado'), (2, 'Category Y', 'Colorado'), (3, 'Category Z', 'California'); CREATE TABLE sales (sale_id INT, category_id INT, amount DECIMAL); INSERT INTO sales (... | What is the total revenue generated by each product category in Colorado, ordered by revenue from highest to lowest? | SELECT c.name, SUM(s.amount) AS total_revenue FROM product_categories c JOIN sales s ON c.category_id = s.category_id WHERE c.state = 'Colorado' GROUP BY c.name ORDER BY total_revenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (animal_id SERIAL PRIMARY KEY, name VARCHAR(255), species VARCHAR(255)); CREATE VIEW animal_view AS SELECT animal_id, name, species FROM animals; | List all the animal ids and their names from the "animal_view" view | SELECT animal_id, name FROM animal_view; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (CityName VARCHAR(20), NumPublicLibraries INT); INSERT INTO Cities (CityName, NumPublicLibraries) VALUES ('CityE', 4), ('CityF', 6); | What is the total number of public libraries in 'CityE' and 'CityF'? | SELECT SUM(NumPublicLibraries) FROM Cities WHERE CityName IN ('CityE', 'CityF'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Rural_Patients (Patient_ID INT, Age INT, Gender VARCHAR(10), Diagnosis VARCHAR(20)); INSERT INTO Rural_Patients (Patient_ID, Age, Gender, Diagnosis) VALUES (1, 35, 'Male', NULL); INSERT INTO Rural_Patients (Patient_ID, Age, Gender, Diagnosis) VALUES (2, 42, 'Female', 'Asthma'); CREATE TABLE Asthma_Diagnosi... | How many female patients were diagnosed with a disease before 2020? | SELECT COUNT(Rural_Patients.Patient_ID) FROM Rural_Patients INNER JOIN Asthma_Diagnosis ON Rural_Patients.Diagnosis = Asthma_Diagnosis.Diagnosis WHERE Rural_Patients.Gender = 'Female' AND Asthma_Diagnosis.Diagnosis_Date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CircularEconomyInitiatives (InitiativeID INT, InitiativeName VARCHAR(50), Program VARCHAR(50), StartDate DATE, EndDate DATE, City VARCHAR(50)); INSERT INTO CircularEconomyInitiatives (InitiativeID, InitiativeName, Program, StartDate, EndDate, City) VALUES (3, 'Waste Management Program', 'Education Campaign... | How many circular economy initiatives took place in Tokyo during or after 2021? | SELECT City, COUNT(DISTINCT InitiativeName) as NumInitiatives FROM CircularEconomyInitiatives WHERE (StartDate BETWEEN '2021-01-01' AND '2021-12-31' OR EndDate >= '2021-01-01') AND City = 'Tokyo' GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor (labor_id INT, state VARCHAR(50), employed_date DATE, gender VARCHAR(50), profession VARCHAR(50)); INSERT INTO labor (labor_id, state, employed_date, gender, profession) VALUES (1, 'Texas', '2021-01-01', 'Male', 'Construction'); INSERT INTO labor (labor_id, state, employed_date, gender, profession) V... | How many construction laborers were employed in Texas in 2021, by gender? | SELECT state, gender, COUNT(*) FROM labor WHERE profession = 'Construction' AND employed_date BETWEEN '2021-01-01' AND '2021-12-31' AND state = 'Texas' GROUP BY state, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE workouts (id INT, user_location VARCHAR(50), workout_date DATE, workout_time INT); INSERT INTO workouts (id, user_location, workout_date, workout_time) VALUES (1, 'Tokyo', '2022-01-01', 90), (2, 'Sydney', '2022-01-02', 60); | Show the total workout time in minutes for each user location. | SELECT user_location, SUM(workout_time) FROM workouts GROUP BY user_location; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities.building_data (city VARCHAR(255), energy_consumption FLOAT); | What is the total energy consumption of green buildings in each city in the 'smart_cities' schema? | SELECT city, SUM(energy_consumption) FROM smart_cities.building_data WHERE city IN (SELECT city FROM (SELECT DISTINCT city FROM smart_cities.building_data) AS unique_cities) GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergencies (emergency_id INT, emergency_type VARCHAR(255), response_time INT, borough_id INT); INSERT INTO emergencies VALUES (1, 'Fire', 300, 1), (2, 'Medical', 400, 2); CREATE TABLE boroughs (borough_id INT, borough_name VARCHAR(255)); INSERT INTO boroughs VALUES (1, 'Manhattan'), (2, 'Brooklyn'); | What is the average response time for fire emergencies in each borough? | SELECT borough_id, AVG(response_time) as avg_response_time FROM emergencies WHERE emergency_type = 'Fire' GROUP BY borough_id | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farm (farm_id INT, location VARCHAR(20), num_fish INT); INSERT INTO fish_farm (farm_id, location, num_fish) VALUES (1, 'Indian ocean', 8000), (2, 'Atlantic ocean', 10000), (3, 'Indian ocean', 9000), (4, 'Atlantic ocean', 11000); | What is the total number of fish raised in all farms in the Indian ocean and the Atlantic ocean? | SELECT SUM(num_fish) FROM fish_farm WHERE location IN ('Indian ocean', 'Atlantic ocean'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_production (country TEXT, year INTEGER, production INTEGER); INSERT INTO fish_production (country, year, production) VALUES ('Norway', 2018, 2300000); INSERT INTO fish_production (country, year, production) VALUES ('Norway', 2019, 2450000); INSERT INTO fish_production (country, year, production) VALUE... | List the top 3 countries with the highest fish production in 2020 from the fish_production table? | SELECT country, SUM(production) FROM fish_production WHERE year = 2020 GROUP BY country ORDER BY SUM(production) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (city_id INT, city_name VARCHAR(255)); CREATE TABLE crimes (crime_id INT, crime_type VARCHAR(255), city_id INT); INSERT INTO cities VALUES (1, 'Chicago'), (2, 'New York'); INSERT INTO crimes VALUES (1, 'Theft', 1), (2, 'Vandalism', 2); | What is the distribution of crime types in different cities? | SELECT city_id, crime_type, COUNT(*) as num_crimes FROM crimes GROUP BY city_id, crime_type ORDER BY city_id, num_crimes DESC | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, workforce_development BOOLEAN, product_type TEXT, production_volume INT); INSERT INTO companies (id, name, workforce_development, product_type, production_volume) VALUES (1, 'ABC Corp', TRUE, 'Widget', 1000), (2, 'DEF Corp', FALSE, 'Gizmo', 2000), (3, 'GHI Corp', TRUE, 'Widget... | Show the total production volume for each product type in companies with a strong focus on workforce development. | SELECT product_type, SUM(production_volume) FROM companies WHERE workforce_development = TRUE GROUP BY product_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty_members (id INT PRIMARY KEY, name VARCHAR(255), department VARCHAR(50)); CREATE TABLE disability_accommodations (id INT PRIMARY KEY, student_id INT, faculty_id INT, accommodation_type VARCHAR(50), start_date DATE, end_date DATE); | Retrieve the name, department, and start date of all disability accommodations for faculty member with id 1 | SELECT faculty_members.name, faculty_members.department, disability_accommodations.start_date FROM faculty_members INNER JOIN disability_accommodations ON faculty_members.id = disability_accommodations.faculty_id WHERE faculty_members.id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE travel_advisory (id INT PRIMARY KEY, country TEXT, advisory TEXT, updated_date DATE); | Update the "travel_advisory" table to reflect a new advisory for "Canada" regarding winter weather | UPDATE travel_advisory SET advisory = 'Be prepared for winter weather conditions.' WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (incident_date DATE, incident_region TEXT); INSERT INTO safety_incidents (incident_date, incident_region) VALUES ('2021-01-01', 'Asia'), ('2021-03-15', 'Asia'), ('2021-06-01', 'Africa'); | How many AI safety incidents were reported in Asia in 2021? | SELECT COUNT(*) FROM safety_incidents WHERE incident_date BETWEEN '2021-01-01' AND '2021-12-31' AND incident_region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE costs (id INT, project_cost FLOAT, state TEXT, sustainable BOOLEAN); INSERT INTO costs (id, project_cost, state, sustainable) VALUES (1, 100000.00, 'Alberta', true), (2, 200000.00, 'Alberta', true); | What is the total cost of all sustainable construction projects in 'Alberta'? | SELECT SUM(project_cost) FROM costs WHERE state = 'Alberta' AND sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (id INT, name VARCHAR(255), country VARCHAR(255), age INT); INSERT INTO Astronauts (id, name, country, age) VALUES (1, 'Rodolfo Neri Vela', 'Mexico', 74); INSERT INTO Astronauts (id, name, country, age) VALUES (2, 'Iván Bella', 'Argentina', 53); INSERT INTO Astronauts (id, name, country, age) VA... | What is the average age of astronauts from Brazil? | SELECT AVG(age) FROM Astronauts WHERE country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_strategy (strategy_id INT PRIMARY KEY, strategy_name VARCHAR(30), strategy_description TEXT); | Add a new record to the 'cybersecurity_strategy' table with the following details: strategy_id 123, strategy_name 'Firewall Implementation', strategy_description 'Detailed description of firewall implementation strategy' | INSERT INTO cybersecurity_strategy (strategy_id, strategy_name, strategy_description) VALUES (123, 'Firewall Implementation', 'Detailed description of firewall implementation strategy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE epl_players (player_id INT, name VARCHAR(50), team VARCHAR(50), goals INT); INSERT INTO epl_players (player_id, name, team, goals) VALUES (1, 'Harry Kane', 'Tottenham Hotspur', 25); INSERT INTO epl_players (player_id, name, team, goals) VALUES (2, 'Mohamed Salah', 'Liverpool', 30); | Which soccer players have scored the most goals in the English Premier League? | SELECT name, SUM(goals) FROM epl_players GROUP BY name ORDER BY SUM(goals) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, industry TEXT, funding FLOAT, employees INT, founding_year INT); INSERT INTO startups VALUES (1, 'StartupF', 'EdTech', 20000000, 60, 2017); | What is the total funding received by startups in the 'EdTech' sector founded after 2016 having more than 50 employees? | SELECT SUM(funding) FROM startups WHERE industry = 'EdTech' AND founding_year > 2016 AND employees > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_practices (id INT PRIMARY KEY, supplier_id INT, practice VARCHAR(255), verified BOOLEAN, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); INSERT INTO labor_practices (id, supplier_id, practice, verified) VALUES (1, 1, 'Fair wages', true), (2, 2, 'Safe working conditions', false); | Update labor_practices table for supplier_id 2 | UPDATE labor_practices SET verified = true WHERE supplier_id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE victims (id INT PRIMARY KEY, name VARCHAR(255), age INT, state VARCHAR(2)); | Update the age of the victim with id 1 | UPDATE victims SET age = 23 WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (article_id INT, author VARCHAR(50), title VARCHAR(100), publication_date DATE, category VARCHAR(20)); CREATE TABLE article_word_count (article_id INT, word_count INT, category VARCHAR(20)); INSERT INTO news_articles (article_id, author, title, publication_date, category) VALUES (1, 'John Doe... | What is the total word count of articles in each category from the 'news_articles' and 'article_word_count' tables? | SELECT n.category, SUM(awc.word_count) as total_word_count FROM news_articles n JOIN article_word_count awc ON n.article_id = awc.article_id GROUP BY n.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founding_year INT, founder_race TEXT); INSERT INTO startups (id, name, founding_year, founder_race) VALUES (1, 'Acme Inc', 2010, 'Asian'); INSERT INTO startups (id, name, founding_year, founder_race) VALUES (2, 'Beta Corp', 2015, 'White'); INSERT INTO startups (id, name, foundin... | Get the total number of startups founded by people of color | SELECT COUNT(*) FROM startups WHERE founder_race IN ('Asian', 'Black', 'Hispanic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_category_3 (sale_id INT, sale_date DATE, category VARCHAR(20), quantity INT); INSERT INTO sales_category_3 (sale_id, sale_date, category, quantity) VALUES (1, '2021-01-05', 'Skirts', 6), (2, '2021-02-10', 'Trousers', 14), (3, '2021-03-20', 'Skirts', 10), (4, '2021-04-15', 'Jackets', 7), (5, '2021-05-... | How many garments of the 'Skirts' category were sold in the first half of 2021? | SELECT SUM(quantity) FROM sales_category_3 WHERE category = 'Skirts' AND sale_date BETWEEN '2021-01-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_complaints (id INT, complaint_type VARCHAR(50), city VARCHAR(50)); INSERT INTO criminal_complaints (id, complaint_type, city) VALUES (1, 'Murder', 'New York City'), (2, 'Robbery', 'New York City'), (3, 'Grand Larceny', 'New York City'); | What is the total number of criminal complaints by type in New York City? | SELECT complaint_type, COUNT(*) as total FROM criminal_complaints WHERE city = 'New York City' GROUP BY complaint_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE patents(id INT, name TEXT, technology TEXT, country TEXT, filed_date DATE); INSERT INTO patents VALUES(1, 'BioSensor 1.0', 'Biosensor', 'Germany', '2021-01-01'); INSERT INTO patents VALUES(2, 'BioSensor 2.0', 'Biosensor', 'France', '2020-01-01'); | Identify the number of biosensor technology patents filed in the European Union in the last 5 years. | SELECT COUNT(*) FROM patents WHERE technology = 'Biosensor' AND country LIKE '%European Union%' AND filed_date >= DATEADD(year, -5, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE location_waste (location_name VARCHAR(50), waste_amount NUMERIC(10, 2)); INSERT INTO location_waste (location_name, waste_amount) VALUES ('San Francisco', 1000.00), ('New York', 1500.00), ('Los Angeles', 500.00); | What is the total waste generated for each location? | SELECT location_name, SUM(waste_amount) AS total_waste FROM location_waste GROUP BY location_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (order_id INT, order_date DATE, region VARCHAR(50)); CREATE TABLE order_details (order_id INT, menu_id INT, quantity_sold INT); CREATE TABLE menu (menu_id INT, menu_name VARCHAR(255), is_gluten_free BOOLEAN, price DECIMAL(5,2)); INSERT INTO orders (order_id, order_date, region) VALUES (1, '2022-01-0... | Show the number of gluten-free menu items sold in the North region. | SELECT SUM(quantity_sold) as total_sold FROM order_details od JOIN menu m ON od.menu_id = m.menu_id WHERE is_gluten_free = TRUE AND region = 'North'; | gretelai_synthetic_text_to_sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.