context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE canada_public_transportation_trips (id INT, trip_date DATE, city VARCHAR(20), trips INT); INSERT INTO canada_public_transportation_trips (id, trip_date, city, trips) VALUES (1, '2022-01-01', 'Toronto', 500), (2, '2022-01-02', 'Toronto', 600), (3, '2022-01-03', 'Toronto', 700); | Find the total number of public transportation trips in the last month in Toronto? | SELECT SUM(trips) FROM canada_public_transportation_trips WHERE city = 'Toronto' AND trip_date >= DATEADD(day, -30, CURRENT_TIMESTAMP); | gretelai_synthetic_text_to_sql |
CREATE TABLE agriculture_innovation (id INT, country VARCHAR(50), sector VARCHAR(50), cost FLOAT); INSERT INTO agriculture_innovation (id, country, sector, cost) VALUES (1, 'Kenya', 'Agriculture', 500000); | What is the total cost of infrastructure projects in the agriculture innovation sector in Kenya? | SELECT SUM(cost) FROM agriculture_innovation WHERE country = 'Kenya' AND sector = 'Agriculture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Incidents (incident_id INT, aircraft_type VARCHAR(50), incident_date DATE, incident_description VARCHAR(255)); INSERT INTO Aircraft_Incidents (incident_id, aircraft_type, incident_date, incident_description) VALUES (1, 'A320', '2015-02-03', 'Engine failure during takeoff'), (2, '787', '2012-07-16'... | Which aircraft types have had incidents related to engine issues since 2010? | SELECT DISTINCT a.aircraft_type, a.manufacturer FROM Aircraft_Incidents i INNER JOIN Aircraft_Types a ON i.aircraft_type = a.aircraft_type WHERE i.incident_date >= '2010-01-01' AND incident_description LIKE '%engine%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_sales (id INT, garment_type VARCHAR(50), sustainability_rating INT, country VARCHAR(50), price DECIMAL(5,2)); INSERT INTO garment_sales (id, garment_type, sustainability_rating, country, price) VALUES (1, 'jacket', 5, 'Japan', 250.99), (2, 'coat', 3, 'Japan', 299.99); | What is the maximum retail price of eco-friendly outerwear sold in Japan? | SELECT MAX(price) FROM garment_sales WHERE garment_type IN ('jacket', 'coat') AND country = 'Japan' AND sustainability_rating >= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_biomass (species TEXT, biomass FLOAT, location TEXT); INSERT INTO marine_species_biomass (species, biomass, location) VALUES ('Krill', 0.5, 'Southern Ocean'); INSERT INTO marine_species_biomass (species, biomass, location) VALUES ('Blue Whale', 200.0, 'Southern Ocean'); | Calculate the total biomass of all marine species in the Southern Ocean. | SELECT SUM(biomass) FROM marine_species_biomass WHERE location = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE cargo_operations (id INT, port_id INT, company VARCHAR(50), type VARCHAR(50)); INSERT INTO ports (id, name, country) VALUES (1, 'Port of Oakland', 'USA'), (2, 'Port of Singapore', 'Singapore'), (3, 'Port of Hong Kong', 'China'), (4, 'Port ... | Count the number of distinct countries where cargo operations were conducted by the company 'Neptune Shipping' | SELECT COUNT(DISTINCT country) FROM ports INNER JOIN cargo_operations ON ports.id = cargo_operations.port_id WHERE cargo_operations.company = 'Neptune Shipping'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalCompetency (CC_ID INT, CC_Level VARCHAR(50)); CREATE TABLE MentalHealthScores (MH_ID INT, CC_ID INT, MentalHealthScore INT); INSERT INTO CulturalCompetency (CC_ID, CC_Level) VALUES (1, 'Low'), (2, 'Medium'), (3, 'High'); INSERT INTO MentalHealthScores (MH_ID, CC_ID, MentalHealthScore) VALUES (1, 1,... | What is the mental health score difference between cultural competency levels? | SELECT c.CC_Level, AVG(mhs.MentalHealthScore) as Avg_Score FROM MentalHealthScores mhs JOIN CulturalCompetency c ON mhs.CC_ID = c.CC_ID GROUP BY c.CC_Level; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendance (student_id INT, course_id INT, attendance INT); INSERT INTO attendance (student_id, course_id, attendance) VALUES (1, 101, 90), (1, 102, 95), (2, 101, 85), (2, 102, 80), (3, 101, 92), (3, 102, 98); CREATE TABLE open_pedagogy_courses (course_id INT, course_name VARCHAR(20)); INSERT INTO open_ped... | Which students have the highest attendance in open pedagogy courses? | SELECT student_id, SUM(attendance) as total_attendance FROM attendance JOIN open_pedagogy_courses ON attendance.course_id = open_pedagogy_courses.course_id WHERE course_name IN ('Open Science', 'Open Art') GROUP BY student_id ORDER BY total_attendance DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE field (id INT, name VARCHAR(255)); CREATE TABLE satellite_image (id INT, field_id INT, brightness INT, contrast INT, ndvi FLOAT, timestamp TIMESTAMP); INSERT INTO field VALUES (1, 'Field A'), (2, 'Field B'); INSERT INTO satellite_image VALUES (1, 1, 100, 50, 0.6, '2022-02-01 10:00:00'), (2, 2, 80, 60, 0.5,... | List all the satellite images with potential water stress issues for the past month, indicating the field name and timestamp of the image. | SELECT f.name, si.timestamp FROM field f INNER JOIN satellite_image si ON f.id = si.field_id WHERE si.ndvi < (SELECT AVG(ndvi) - 2 * STDDEV(ndvi) FROM satellite_image WHERE timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW()) AND si.timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW(); | gretelai_synthetic_text_to_sql |
CREATE TABLE age_groups (age_group_id INT, age_group VARCHAR(10), start_age INT, end_age INT); | Calculate the average financial wellbeing score for each age group and gender | CREATE TABLE financial_wellbeing_scores (score_id INT, score DECIMAL(18,2), age_group_id INT, gender VARCHAR(50)); SELECT age_group, gender, AVG(score) FROM age_groups INNER JOIN financial_wellbeing_scores ON age_groups.age_group_id = financial_wellbeing_scores.age_group_id GROUP BY age_group, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE co_ownership_property (id INT, property_id INT, property_tax DECIMAL(5,2), neighborhood_id INT); INSERT INTO co_ownership_property (id, property_id, property_tax, neighborhood_id) VALUES (1, 1, 3000, 1), (2, 1, 4000, 1), (3, 2, 5000, 2), (4, 2, 6000, 2); | What is the maximum property tax in each neighborhood for co-ownership properties? | SELECT n.name AS neighborhood, MAX(cp.property_tax) AS max_property_tax FROM co_ownership_property cp JOIN neighborhood n ON cp.neighborhood_id = n.id GROUP BY n.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, industry TEXT, country TEXT, num_members INT, total_workforce INT); INSERT INTO unions (id, industry, country, num_members, total_workforce) VALUES (1, 'technology', 'UK', 1000, 50000), (2, 'manufacturing', 'UK', 3000, 100000), (3, 'retail', 'UK', 2000, 80000); | Which industries in the UK have the lowest union membership rates, and what are those rates? | SELECT industry, ROUND(100.0 * num_members / total_workforce, 2) as union_membership_rate FROM unions WHERE country = 'UK' ORDER BY union_membership_rate ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE biodynamic_field_2 (date DATE, temperature FLOAT); INSERT INTO biodynamic_field_2 (date, temperature) VALUES ('2022-01-01', 12.0), ('2022-01-02', 14.0); CREATE TABLE biodynamic_field_4 (date DATE, temperature FLOAT); INSERT INTO biodynamic_field_4 (date, temperature) VALUES ('2022-01-01', 15.0), ('2022-01-... | Determine the temperature difference between biodynamic_field_2 and biodynamic_field_4 | SELECT AVG(biodynamic_field_2.temperature) - AVG(biodynamic_field_4.temperature) FROM biodynamic_field_2, biodynamic_field_4 WHERE biodynamic_field_2.date = biodynamic_field_4.date AND biodynamic_field_2.date IN ('2022-01-01', '2022-01-02'); | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(2)); INSERT INTO users (id, country) VALUES (1, 'US'), (2, 'CA'), (3, 'US'); CREATE TABLE posts (id INT, user_id INT, likes INT, timestamp DATETIME); INSERT INTO posts (id, user_id, likes, timestamp) VALUES (1, 1, 10, '2022-01-01 00:00:00'), (2, 1, 15, '2022-01-05 12:34:56'),... | How many users have posted more than 5 times in the past week? | SELECT COUNT(DISTINCT posts.user_id) FROM posts WHERE posts.timestamp >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) HAVING COUNT(posts.id) > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE BuildingEmissions (id INT, city VARCHAR(20), co2_emission FLOAT); INSERT INTO BuildingEmissions (id, city, co2_emission) VALUES (1, 'London', 1000.5), (2, 'London', 900.2), (3, 'New York', 1200.3); | What is the minimum CO2 emission of buildings in London? | SELECT MIN(co2_emission) FROM BuildingEmissions WHERE city = 'London'; | gretelai_synthetic_text_to_sql |
CREATE TABLE department (id INT, name TEXT); CREATE TABLE employee (id INT, department_id INT); | List all departments that have no employees in the "department" and "employee" tables | SELECT d.name FROM department d WHERE NOT EXISTS (SELECT 1 FROM employee e WHERE e.department_id = d.id); | gretelai_synthetic_text_to_sql |
CREATE TABLE Artifacts (ArtifactID int, ArtifactName text, Weight int, Material text); | What is the total weight of all obsidian artifacts? | SELECT SUM(Weight) FROM Artifacts WHERE Material = 'Obsidian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy (id INT, city VARCHAR(20), country VARCHAR(20), year INT, energy_consumption FLOAT); INSERT INTO energy (id, city, country, year, energy_consumption) VALUES (1, 'Tokyo', 'Japan', 2019, 12000), (2, 'Tokyo', 'Japan', 2020, 15000), (3, 'Tokyo', 'Japan', 2021, 16000); | What is the total energy consumption of smart city initiatives in Tokyo, Japan, for the year 2020? | SELECT SUM(energy_consumption) FROM energy WHERE city = 'Tokyo' AND country = 'Japan' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, Name TEXT, Nationality TEXT, Sales FLOAT); INSERT INTO Artists (ArtistID, Name, Nationality, Sales) VALUES (1, 'Pablo Picasso', 'Spanish', 30000000); INSERT INTO Artists (ArtistID, Name, Nationality, Sales) VALUES (2, 'Claude Monet', 'French', 25000000); INSERT INTO Artists (ArtistID... | Which artists from France and Japan had the highest total art sales? | SELECT Name FROM Artists WHERE Nationality IN ('French', 'Japanese') GROUP BY Name ORDER BY SUM(Sales) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name VARCHAR(255), location VARCHAR(255), sustainability_rating INT, monthly_revenue DECIMAL(10,2)); INSERT INTO restaurants (id, name, location, sustainability_rating, monthly_revenue) VALUES (1, 'Green Garden', 'NY', 5, 30000), (2, 'Quick Bites', 'CA', 2, 18000), (3, 'Healthy Bites',... | Identify restaurants with a sustainability rating greater than 3 and a monthly revenue greater than $25,000. | SELECT name, location FROM restaurants WHERE sustainability_rating > 3 AND monthly_revenue > 25000; | gretelai_synthetic_text_to_sql |
CREATE TABLE fulltime_workers (id INT, industry VARCHAR(20), salary FLOAT, union_member BOOLEAN); INSERT INTO fulltime_workers (id, industry, salary, union_member) VALUES (1, 'manufacturing', 50000.0, true), (2, 'technology', 70000.0, true), (3, 'finance', 80000.0, true), (4, 'finance', 85000.0, true), (5, 'finance', 9... | What is the count of full-time workers who are union members in the 'technology' industry and have a salary greater than $75,000? | SELECT COUNT(*) FROM fulltime_workers WHERE industry = 'technology' AND union_member = true AND salary > 75000; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_requests (request_id INT, request_date DATE, equipment_id INT); INSERT INTO maintenance_requests VALUES (1, '2021-01-01', 100), (2, '2021-02-03', 101), (3, '2021-02-05', 100); | How many military equipment maintenance requests were made in each month? | SELECT DATE_TRUNC('month', request_date) AS request_month, COUNT(*) AS num_requests FROM maintenance_requests GROUP BY request_month ORDER BY request_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE appliance_efficiency (id INT, country VARCHAR(255), year INT, efficiency_rating INT); INSERT INTO appliance_efficiency (id, country, year, efficiency_rating) VALUES (1, 'Indonesia', 2021, 4), (2, 'Malaysia', 2021, 5); | What was the average energy efficiency rating of appliances sold in Indonesia and Malaysia in 2021? | SELECT AVG(efficiency_rating) FROM appliance_efficiency WHERE country IN ('Indonesia', 'Malaysia') AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name VARCHAR(50), type VARCHAR(20), location VARCHAR(50)); | Update the "programs" table to reflect a new program location | UPDATE programs SET location = 'New York City' WHERE id = 3002; | gretelai_synthetic_text_to_sql |
CREATE TABLE philanthropy.donation_history (donation_id INT, donor_id INT, cause_id INT, donation_date DATE); | How many donors have donated to causes in each category in the 'philanthropy.causes' table? | SELECT c.cause_category, COUNT(DISTINCT dh.donor_id) FROM philanthropy.donation_history dh JOIN philanthropy.causes c ON dh.cause_id = c.cause_id GROUP BY c.cause_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, country TEXT, date DATE); INSERT INTO virtual_tours (tour_id, country, date) VALUES (1, 'Japan', '2022-03-01'), (2, 'China', '2022-03-05'), (3, 'India', '2022-03-09'); | How many virtual tours have been conducted in Asia in the past month? | SELECT COUNT(*) FROM virtual_tours WHERE country IN ('Japan', 'China', 'India') AND date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contractor VARCHAR(255), year INT, value FLOAT); INSERT INTO defense_contracts (contractor, year, value) VALUES ('Lockheed Martin', 2020, 59.8), ('Raytheon', 2020, 26.2), ('Boeing', 2020, 23.2), ('Northrop Grumman', 2020, 22.3), ('General Dynamics', 2020, 21.8); | What are the top 5 defense contractors by total contract value for the year 2020? | SELECT contractor, SUM(value) as total_value FROM defense_contracts WHERE year = 2020 GROUP BY contractor ORDER BY total_value DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_outlets (id INT, name TEXT, country TEXT); CREATE TABLE disinformation_reports (id INT, media_outlet_id INT, report_date DATE, is_disinformation BOOLEAN); INSERT INTO media_outlets VALUES (1, 'Outlet A', 'USA'), (2, 'Outlet B', 'Canada'), (3, 'Outlet C', 'Mexico'); INSERT INTO disinformation_rep... | Which countries have the highest disinformation rate? | SELECT mo.country, COUNT(dr.id) as disinformation_count FROM media_outlets mo JOIN disinformation_reports dr ON mo.id = dr.media_outlet_id WHERE dr.is_disinformation = true GROUP BY mo.country ORDER BY disinformation_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, game_genre VARCHAR(255), player_id INT); CREATE TABLE players (player_id INT, player_country VARCHAR(255)); | What is the total number of games played by players from South Korea, for games in the 'Action' genre? | SELECT COUNT(game_id) FROM games JOIN players ON games.player_id = players.player_id WHERE players.player_country = 'South Korea' AND game_genre = 'Action'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, num_species INTEGER); INSERT INTO marine_protected_areas (area_name, num_species) VALUES ('Galapagos Islands', 5000), ('Great Barrier Reef', 1500); | What is the number of marine protected areas with more than 3000 marine species? | SELECT COUNT(*) FROM marine_protected_areas WHERE num_species > 3000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Invoices (id INT, WarehouseId INT, Product VARCHAR(50), Quantity INT, Revenue DECIMAL(5, 2), InvoiceDate DATE); INSERT INTO Invoices (id, WarehouseId, Product, Quantity, Revenue, InvoiceDate) VALUES (1, 1, 'Laptop', 50, 3750.00, '2022-01-01'); INSERT INTO Invoices (id, WarehouseId, Product, Quantity, Reven... | What is the total revenue generated per warehouse per month? | SELECT WarehouseId, DATE_FORMAT(InvoiceDate, '%Y-%m') AS Month, SUM(Revenue) AS TotalRevenue FROM Invoices GROUP BY WarehouseId, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE TotalTourists2020 (country VARCHAR(255), tourists INT); INSERT INTO TotalTourists2020 (country, tourists) VALUES ('Canada', 1200000), ('Brazil', 1500000), ('Russia', 1000000); | What is the rank of Canada, Brazil, and Russia in terms of total international tourists in 2020? | SELECT country, RANK() OVER (ORDER BY tourists DESC) AS rank FROM TotalTourists2020 WHERE country IN ('Canada', 'Brazil', 'Russia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name VARCHAR(50), budget DECIMAL(10,2)); CREATE TABLE expenses (id INT, program_id INT, amount DECIMAL(10,2)); | List all programs with their total budget and actual expenses | SELECT p.name, p.budget as total_budget, SUM(e.amount) as total_expenses FROM programs p JOIN expenses e ON p.id = e.program_id GROUP BY p.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_works (id INT, name VARCHAR(50), location VARCHAR(50), start_date DATE); | Find the number of projects in the 'public_works' table that were started in each month of the year, for the year 2020. | SELECT DATEPART(year, start_date) as year, DATEPART(month, start_date) as month, COUNT(*) as num_projects FROM public_works WHERE start_date >= '2020-01-01' AND start_date < '2021-01-01' GROUP BY DATEPART(year, start_date), DATEPART(month, start_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE istanbul_waste_trends (city varchar(255), year int, generation int); INSERT INTO istanbul_waste_trends (city, year, generation) VALUES ('Istanbul', 2016, 150000), ('Istanbul', 2017, 155000), ('Istanbul', 2018, 160000), ('Istanbul', 2019, 165000), ('Istanbul', 2020, 170000), ('Istanbul', 2021, 175000); | What is the waste generation trend in the city of Istanbul between 2016 and 2021? | SELECT year, generation FROM istanbul_waste_trends WHERE city = 'Istanbul' AND year BETWEEN 2016 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(255), establishment_date DATE); INSERT INTO Suppliers (id, name, country, establishment_date) VALUES (1, 'Supplier A', 'USA', '2000-01-01'); INSERT INTO Suppliers (id, name, country, establishment_date) VALUES (2, 'Supplier B', 'Canada', '20... | What are the names of suppliers from the UK and France? | SELECT name FROM Suppliers WHERE country IN ('UK', 'France') | gretelai_synthetic_text_to_sql |
CREATE TABLE automotive_training (country VARCHAR(50), apprenticeship BOOLEAN, workers NUMERIC); INSERT INTO automotive_training (country, apprenticeship, workers) VALUES ('Germany', true, 500000), ('France', false, 400000), ('Spain', true, 300000), ('Italy', false, 250000), ('UK', true, 200000); | What is the percentage of workers in the automotive industry who have completed an apprenticeship program, by country? | SELECT country, (SUM(workers)*100.0 / (SELECT SUM(workers) FROM automotive_training) ) as pct_workers FROM automotive_training WHERE apprenticeship = true GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE region (id INT, name VARCHAR(255)); CREATE TABLE military_personnel (id INT, region_id INT, stationed_at TIMESTAMP); INSERT INTO region (id, name) VALUES (1, 'Europe'), (2, 'Asia'); INSERT INTO military_personnel (id, region_id, stationed_at) VALUES (1, 1, '2022-01-01 00:00:00'); | How many military personnel are currently stationed in each region, grouped by region? | SELECT r.name, COUNT(mp.id) as num_personnel FROM military_personnel mp JOIN region r ON mp.region_id = r.id WHERE mp.stationed_at >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY) GROUP BY r.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE iot_sensors (id INT, name TEXT, country TEXT); INSERT INTO iot_sensors (id, name, country) VALUES (1, 'IS1', 'Brazil'), (2, 'IS2', 'Argentina'); CREATE TABLE solar_radiation (id INT, sensor_id INT, timestamp TIMESTAMP, radiation FLOAT); INSERT INTO solar_radiation (id, sensor_id, timestamp, radiation) VALU... | Find the top 2 solar radiation values for each day in 'Brazil' for the month of January? | SELECT sensor_id, timestamp, radiation FROM (SELECT sensor_id, timestamp, radiation, RANK() OVER (PARTITION BY timestamp ORDER BY radiation DESC) rnk FROM solar_radiation WHERE country = 'Brazil' AND EXTRACT(MONTH FROM timestamp) = 1) t WHERE rnk <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Complaints (Complaint_ID INT, District_Name VARCHAR(255), Complaint_Date DATE); INSERT INTO Complaints VALUES (1, 'District A', '2022-01-01'), (2, 'District B', '2022-02-01'), (3, 'District A', '2022-03-31'); | How many citizen complaints were received in each district in the last month? | SELECT District_Name, COUNT(*) OVER (PARTITION BY District_Name) AS Complaints_Count FROM Complaints WHERE Complaint_Date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
INSERT INTO policyholders (id, name, age, gender, policy_type, state) VALUES (3, 'Mike Johnson', 55, 'Male', 'Auto', 'California'); | How many policyholders do not have any claims in California? | SELECT COUNT(DISTINCT policyholders.id) FROM policyholders LEFT JOIN claims ON policyholders.id = claims.policyholder_id WHERE claims.id IS NULL AND policyholders.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_date DATE, industry TEXT, headquarters TEXT, black_founder BOOLEAN); CREATE TABLE funding_rounds (id INT, company_id INT, funding_amount INT, round_type TEXT, date DATE); | What is the maximum amount of funding received by a company founded by a black founder? | SELECT MAX(funding_amount) FROM funding_rounds JOIN company ON funding_rounds.company_id = company.id WHERE black_founder = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (id INT, project_name VARCHAR(50), location_latitude FLOAT, location_longitude FLOAT, ocean VARCHAR(50)); INSERT INTO research_projects (id, project_name, location_latitude, location_longitude, ocean) VALUES (1, 'Deep-Sea Coral Study', 40.7128, -74.0060, 'Atlantic'), (2, 'Marine Mammal Re... | How many marine research projects are conducted in the Atlantic Ocean? | SELECT COUNT(*) FROM research_projects WHERE ocean = 'Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections (restaurant_name VARCHAR(255), inspection_date DATE, score INT); INSERT INTO food_safety_inspections (restaurant_name, inspection_date, score) VALUES ('Tasty Tacos', '2022-01-01', 90); INSERT INTO food_safety_inspections (restaurant_name, inspection_date, score) VALUES ('Tasty Tacos... | Delete food safety inspection records with a score lower than 80 for 'Tasty Tacos' restaurant. | DELETE FROM food_safety_inspections WHERE restaurant_name = 'Tasty Tacos' AND score < 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmergencyCalls (id INT, district VARCHAR(20), call_type VARCHAR(20), response_time INT); INSERT INTO EmergencyCalls (id, district, call_type, response_time) VALUES (1, 'Downtown', 'Medical Emergency', 10); INSERT INTO EmergencyCalls (id, district, call_type, response_time) VALUES (2, 'Uptown', 'Medical Eme... | What is the total number of medical emergency response calls, grouped by district? | SELECT district, COUNT(*) as total_medical_calls FROM EmergencyCalls WHERE call_type = 'Medical Emergency' GROUP BY district; | gretelai_synthetic_text_to_sql |
CREATE TABLE Galleries (GalleryID int, GalleryName varchar(50)); CREATE TABLE Artists (ArtistID int, ArtistName varchar(50), Gender varchar(10), BirthYear int); CREATE TABLE Artworks (ArtworkID int, ArtistID int, GalleryID int, ArtworkTitle varchar(50)); | Which are the galleries that have exhibited artworks from female artists born before 1900? | SELECT Galleries.GalleryName FROM Galleries INNER JOIN Artworks ON Galleries.GalleryID = Artworks.GalleryID INNER JOIN Artists ON Artworks.ArtistID = Artists.ArtistID WHERE Artists.Gender = 'female' AND Artists.BirthYear < 1900; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_sequestration (id INT, name VARCHAR(50), sequestration_tons FLOAT); | What is the total carbon sequestration in tons? | SELECT SUM(sequestration_tons) FROM carbon_sequestration; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_info (content_id INT, content_type VARCHAR(20), content_category VARCHAR(20), creation_date DATE, content_length INT); | How many hours of content have been created in each content category in the last year? | SELECT content_category, SUM(content_length / 60) as total_hours FROM content_info WHERE creation_date >= CURDATE() - INTERVAL 1 YEAR GROUP BY content_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (id INT, name VARCHAR(50), industry VARCHAR(50), country VARCHAR(50), founding_year INT, founder_gender VARCHAR(10)); INSERT INTO Companies (id, name, industry, country, founding_year, founder_gender) VALUES (1, 'InnoTech', 'Tech', 'USA', 2015, 'Male'); INSERT INTO Companies (id, name, industry, ... | What is the distribution of companies by founding year and gender? | SELECT founding_year, founder_gender, COUNT(*) as company_count FROM Companies GROUP BY founding_year, founder_gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, name VARCHAR(100), department VARCHAR(50), country VARCHAR(50)); INSERT INTO Employees (id, name, department, country) VALUES (1, 'John Doe', 'IT', 'United States'), (2, 'Jane Smith', 'Marketing', 'Canada'), (3, 'Mike Johnson', 'IT', 'France'), (4, 'Sara Connor', 'HR', 'United States'), ... | Delete all employees who work in the IT department. | DELETE FROM Employees WHERE department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (student_id INT, name VARCHAR(50), country VARCHAR(50)); INSERT INTO graduate_students (student_id, name, country) VALUES (1, 'Alice', 'USA'), (2, 'Bob', 'Canada'), (3, 'Carlos', 'Mexico'); CREATE TABLE academic_publications (publication_id INT, student_id INT, title VARCHAR(50)); INSERT ... | What is the number of academic publications per graduate student? | SELECT gs.name, COUNT(ap.publication_id) AS num_publications FROM graduate_students gs JOIN academic_publications ap ON gs.student_id = ap.student_id GROUP BY gs.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ChemicalProduction (date DATE, chemical VARCHAR(10), mass FLOAT); INSERT INTO ChemicalProduction (date, chemical, mass) VALUES ('2021-01-01', 'A', 100), ('2021-01-01', 'B', 150), ('2021-01-02', 'A', 120), ('2021-01-02', 'B', 170); | What is the maximum mass of a single chemical production? | SELECT chemical, MAX(mass) as MaxMass FROM ChemicalProduction; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies_finance (id INT, sector VARCHAR(20), risk_rating FLOAT); INSERT INTO companies_finance (id, sector, risk_rating) VALUES (1, 'Finance', 3.0), (2, 'Finance', 4.0), (3, 'Finance', 2.5); | Average risk rating for companies in the finance sector? | SELECT AVG(risk_rating) FROM companies_finance WHERE sector = 'Finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR(50), last_donation_year INT, email VARCHAR(50)); | Insert a new record of a donor who donated in 2022 in the "donors" table. | INSERT INTO donors (id, name, last_donation_year, email) VALUES (11, 'New Donor', 2022, 'new_donor@example.com'); | gretelai_synthetic_text_to_sql |
CREATE TABLE pharmacies (name TEXT, state TEXT, prescription_volume INTEGER); INSERT INTO pharmacies (name, state, prescription_volume) VALUES ('CVS Pharmacy', 'Texas', 5000), ('Walgreens', 'Texas', 4500), ('HEB Pharmacy', 'Texas', 4000); | What is the total number of pharmacies in the state of Texas? | SELECT COUNT(*) FROM pharmacies WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_water_usage (house_id INT, city VARCHAR(255), usage_liters INT, year INT, month INT); INSERT INTO monthly_water_usage (house_id, city, usage_liters, year, month) VALUES (1, 'Cape Town', 16000, 2020, 1), (2, 'Cape Town', 14000, 2020, 2), (3, 'Cape Town', 18000, 2020, 3); | What is the number of households with water consumption above 15000 liters per month in the city of Cape Town, South Africa for the year 2020? | SELECT COUNT(*) FROM monthly_water_usage WHERE city = 'Cape Town' AND usage_liters > 15000 AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity (id INT, name VARCHAR(50), gender VARCHAR(10), ethnicity VARCHAR(30), position VARCHAR(20)); INSERT INTO diversity (id, name, gender, ethnicity, position) VALUES (1, 'Fatima Ahmed', 'Female', 'Middle Eastern', 'Assistant Professor'), (2, 'Jun Kim', 'Male', 'Asian', 'Associate Professor'); | Delete all records from the diversity table. | DELETE FROM diversity; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerName TEXT, Country TEXT); INSERT INTO Players (PlayerID, PlayerName, Country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'China'); CREATE TABLE Scores (ScoreID INT, PlayerID INT, Score INT); INSERT INTO Scores (ScoreID, PlayerID, Score) VALUES (1, 1, 90), (2, 1, 95), (3, ... | List the top 5 highest scoring players from Asia? | SELECT Players.PlayerName, Scores.Score FROM Players JOIN Scores ON Players.PlayerID = Scores.PlayerID WHERE Players.Country = 'China' ORDER BY Scores.Score DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE client_billing (client_id INT, case_id INT, hours_billed INT, PRIMARY KEY (client_id, case_id)); CREATE TABLE client_demographics (client_id INT, client_name VARCHAR(255), PRIMARY KEY (client_id)); | List all clients with their average billing per case | SELECT client_name, AVG(hours_billed) as avg_billing_per_case FROM client_billing JOIN client_demographics ON client_billing.client_id = client_demographics.client_id GROUP BY client_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_pricing.carbon_prices (country varchar(2), year int, price decimal(5,2)); INSERT INTO carbon_pricing.carbon_prices (country, year, price) VALUES ('FR', 2020, 30.5), ('FR', 2021, 32.0), ('DE', 2020, 28.0), ('DE', 2021, 30.2); | What is the average carbon price for all countries in the 'carbon_pricing' schema? | SELECT AVG(price) FROM carbon_pricing.carbon_prices; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorker (WorkerID int, Age int, Gender varchar(10)); INSERT INTO CommunityHealthWorker (WorkerID, Age, Gender) VALUES (1, 35, 'Female'), (2, 42, 'Male'), (3, 38, 'Female'), (4, 50, 'Male'); | What is the average age of community health workers, partitioned by gender? | SELECT Gender, AVG(Age) OVER (PARTITION BY Gender) AS AvgAge FROM CommunityHealthWorker; | gretelai_synthetic_text_to_sql |
CREATE TABLE IncomeLevelTechAccessibility (IncomeLevelID INT PRIMARY KEY, IncomeLevel VARCHAR(50), TechAccessibilityScore INT); INSERT INTO IncomeLevelTechAccessibility (IncomeLevelID, IncomeLevel, TechAccessibilityScore) VALUES (1, 'Low Income', 50), (2, 'Middle Income', 70), (3, 'High Income', 90); | What is the average technology accessibility score for each income level? | SELECT IncomeLevel, AVG(TechAccessibilityScore) as AvgTechAccessibilityScore FROM IncomeLevelTechAccessibility GROUP BY IncomeLevel; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, site_name TEXT, total_resources_available INT);CREATE TABLE resources_depleted (site_id INT, amount_depleted INT); | What is the total amount of resources depleted by each mining site, and which sites have depleted more than 75% of their total resources? | SELECT s.site_name, SUM(r.amount_depleted) as total_depleted, s.total_resources_available FROM mining_sites s JOIN resources_depleted r ON s.id = r.site_id GROUP BY s.site_name HAVING SUM(r.amount_depleted) / s.total_resources_available > 0.75; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales(ticket_id INT, city VARCHAR(50), tickets_sold INT); | Identify the top 3 cities with the highest number of ticket sales. | SELECT city, SUM(tickets_sold) AS total_sales FROM ticket_sales GROUP BY city ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE aid (id INT, organization VARCHAR(255), location VARCHAR(255), amount DECIMAL(10, 2), provide_date DATE); INSERT INTO aid (id, organization, location, amount, provide_date) VALUES (1, 'World Vision', 'Europe', 5000.50, '2017-08-12'), (2, 'CARE', 'Europe', 6000.25, '2018-05-23'), (3, 'UNHCR', 'Europe', 4500... | Which disaster response organization has provided the highest total aid in Europe between 2017 and 2020? | SELECT organization, SUM(amount) as total_amount FROM aid WHERE location = 'Europe' AND provide_date BETWEEN '2017-01-01' AND '2020-12-31' GROUP BY organization ORDER BY total_amount DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_hours (id INT, volunteer_id INT, hours DECIMAL, volunteer_start_date DATE); INSERT INTO volunteer_hours (id, volunteer_id, hours, volunteer_start_date) VALUES (1, 1, 5.0, '2021-01-01'), (2, 2, 10.0, '2021-01-05'), (3, 3, 7.5, '2021-01-10'), (4, 1, 4.0, '2021-01-15'), (5, 3, 8.0, '2021-01-20'); | What is the total number of volunteers and total number of hours they have volunteered in the past month? | SELECT COUNT(DISTINCT volunteer_id) AS total_volunteers, SUM(hours) AS total_hours FROM volunteer_hours WHERE volunteer_hours.volunteer_start_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_data_usage (customer_region VARCHAR(20), usage_gb DECIMAL(5,2), usage_month DATE); INSERT INTO customer_data_usage (customer_region, usage_gb, usage_month) VALUES ('Northeast', 15.5, '2021-01-01'), ('Southwest', 12.3, '2021-01-01'), ('Midwest', 13.8, '2021-01-01'), ('Northeast', 16.2, '2021-02-01'... | What is the average data usage in GB per month for each customer region? | SELECT customer_region, AVG(usage_gb) FROM customer_data_usage GROUP BY customer_region, EXTRACT(MONTH FROM usage_month); | gretelai_synthetic_text_to_sql |
CREATE TABLE taxis (id INT, type VARCHAR(10), capacity INT, accessible BOOLEAN); INSERT INTO taxis (id, type, capacity, accessible) VALUES (1, 'Sedan', 4, FALSE), (2, 'SUV', 6, FALSE), (3, 'Wheelchair', 4, TRUE); | How many wheelchair accessible taxis are available in the fleet? | SELECT COUNT(*) FROM taxis WHERE type = 'Wheelchair' AND accessible = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, city VARCHAR(20), visitors INT); INSERT INTO Exhibitions (id, city, visitors) VALUES (1, 'Paris', 3000), (2, 'London', 4000), (3, 'New York', 5000); CREATE TABLE Visitors (id INT, exhibition_id INT, age INT); INSERT INTO Visitors (id, exhibition_id, age) VALUES (1, 1, 32), (2, 1, 45), ... | What is the average age of visitors who attended exhibitions in London? | SELECT AVG(v.age) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.id WHERE e.city = 'London' | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(255), state VARCHAR(255)); INSERT INTO customers (id, name, state) VALUES (1, 'Customer A', 'CA'), (2, 'Customer B', 'NY'), (3, 'Customer C', 'TX'), (4, 'Customer D', 'FL'); CREATE TABLE orders (id INT PRIMARY KEY, customer_id INT, product_id INT, FOREIGN KEY (cu... | List all customers who have made purchases from suppliers in 'Brazil' or 'Argentina'? | SELECT DISTINCT c.name FROM customers c INNER JOIN orders o ON c.id = o.customer_id INNER JOIN products p ON o.product_id = p.id INNER JOIN suppliers s ON p.supplier_id = s.id WHERE s.country IN ('Brazil', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Services (Year INT, Region VARCHAR(20), Service VARCHAR(20), Quantity INT); INSERT INTO Services (Year, Region, Service, Quantity) VALUES (2019, 'South', 'Healthcare', 1200), (2020, 'North', 'Education', 1500), (2019, 'East', 'Healthcare', 1000); | How many healthcare services were provided in the South region in 2019? | SELECT SUM(Quantity) FROM Services WHERE Year = 2019 AND Region = 'South' AND Service = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (country VARCHAR(50), region VARCHAR(50), year INT, score INT); INSERT INTO defense_diplomacy (country, region, year, score) VALUES ('USA', 'North America', 2015, 85), ('Canada', 'North America', 2015, 78), ('Mexico', 'North America', 2015, 62), ('Brazil', 'South America', 2015, 70), ('Ar... | What is the average defense diplomacy score for each region from 2015 to 2020? | SELECT region, AVG(score) as avg_score FROM defense_diplomacy WHERE year BETWEEN 2015 AND 2020 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name VARCHAR(255), country VARCHAR(255), balance DECIMAL(10, 2)); INSERT INTO customers (id, name, country, balance) VALUES (1, 'John Doe', 'USA', 5000.00), (2, 'Jane Smith', 'Canada', 7000.00); | What is the total balance for all customers from the United States? | SELECT SUM(balance) FROM customers WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name TEXT, country TEXT);CREATE TABLE shipments (shipment_id INT, shipment_weight INT, ship_date DATE, port_id INT); INSERT INTO ports VALUES (1, 'Port of Santos', 'Brazil'), (2, 'Port of Rio de Janeiro', 'Brazil'); INSERT INTO shipments VALUES (1, 2000, '2021-01-01', 1), (2, 2500,... | What is the maximum weight of containers shipped from the Port of Santos to Brazil in 2021? | SELECT MAX(shipment_weight) FROM shipments JOIN ports ON shipments.port_id = ports.port_id WHERE ports.country = 'Brazil' AND ports.port_name IN ('Port of Santos', 'Port of Rio de Janeiro') AND ship_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Country VARCHAR(50)); | Insert a new record for an artist from Argentina into the Artists table. | INSERT INTO Artists (ArtistID, ArtistName, Country) VALUES (3, 'Los Fabulosos Cadillacs', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_menu(menu_item VARCHAR(255), location VARCHAR(255), revenue INT); INSERT INTO sustainable_menu(menu_item, location, revenue) VALUES ('Pizza', 'Location2', 3000), ('Tofu', 'Location2', 2000), ('Salad', 'Location2', 4000); | What is the total revenue for sustainable menu items in Location2? | SELECT SUM(revenue) FROM sustainable_menu WHERE location = 'Location2' AND menu_item IN (SELECT menu_item FROM sustainable_menu WHERE veg = TRUE); | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts (id INT, name VARCHAR(50), organization VARCHAR(50), mission VARCHAR(50)); INSERT INTO astronauts VALUES (1, 'Neil Armstrong', 'NASA', 'Apollo 11'), (2, 'Buzz Aldrin', 'NASA', 'Apollo 11'), (3, 'Pete Conrad', 'NASA', 'Gemini 5'), (4, 'Pete Conrad', 'NASA', 'Apollo 12'); | Who are the astronauts that have flown on multiple NASA missions? | SELECT name, organization, mission FROM astronauts WHERE name IN (SELECT name FROM astronauts GROUP BY name HAVING COUNT(*) > 1) ORDER BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_projects_eu (project_name VARCHAR(50), budget DECIMAL(10,2), year INT); INSERT INTO autonomous_projects_eu (project_name, budget, year) VALUES ('Project Horizon', 6000000, 2019), ('Project Ada', 4000000, 2020), ('Project Aria', 5000000, 2021), ('Project Apollo', 7000000, 2018), ('Project Artemis... | List all autonomous driving research projects with a budget between $3 million and $7 million. | SELECT * FROM autonomous_projects_eu WHERE budget BETWEEN 3000000 AND 7000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_farm (id INT, name VARCHAR(255), location VARCHAR(255)); INSERT INTO solar_farm (id, name, location) VALUES (1, 'Sample Solar Farm', 'Texas'); | Find the number of solar_farm projects in 'Texas'. | SELECT COUNT(*) FROM solar_farm WHERE location = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (id INT, plant_id INT, incident_date DATE); CREATE TABLE manufacturing_plants (id INT, plant_name VARCHAR(100), state VARCHAR(50)); INSERT INTO manufacturing_plants (id, plant_name, state) VALUES (1, 'California Plant 1', 'California'), (2, 'California Plant 2', 'California'); INSERT INTO ... | How many safety incidents occurred in the chemical manufacturing plants in California in the year 2020? | SELECT COUNT(*) FROM safety_incidents JOIN manufacturing_plants ON safety_incidents.plant_id = manufacturing_plants.id WHERE manufacturing_plants.state = 'California' AND EXTRACT(YEAR FROM incident_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_id INT, product_id INT, weight FLOAT, country VARCHAR(50)); INSERT INTO ingredients VALUES (1, 1, 2.5, 'US'), (2, 1, 3.5, 'CA'), (3, 2, 1.5, 'US'), (4, 2, 4.5, 'MX'); | What is the total weight of ingredients sourced from the US for a given product? | SELECT SUM(weight) FROM ingredients WHERE product_id = 1 AND country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Rural_Resources (Resource_ID INT, Resource_Name VARCHAR(20), Allocation INT, Community_Type VARCHAR(20)); INSERT INTO Rural_Resources (Resource_ID, Resource_Name, Allocation, Community_Type) VALUES (1, 'Clinic', 50000, 'Indigenous'); INSERT INTO Rural_Resources (Resource_ID, Resource_Name, Allocation, Comm... | What is the total number of medical resources allocated to Indigenous communities in Canada? | SELECT SUM(Rural_Resources.Allocation) FROM Rural_Resources WHERE Rural_Resources.Community_Type = 'Indigenous'; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment (id INT, name VARCHAR(255), sale_price DECIMAL(10,2)); INSERT INTO equipment (id, name, sale_price) VALUES (1, 'Tank', 5000000.00), (2, 'Fighter Jet', 10000000.00); CREATE TABLE sales (id INT, equipment_id INT, region VARCHAR(255), sale_price DECIMAL(10,2)); INSERT INTO sales (id, equipment_id, r... | Which military equipment has the highest average sale price in the Asia-Pacific region? | SELECT AVG(s.sale_price) as avg_sale_price, e.name FROM sales s JOIN equipment e ON s.equipment_id = e.id WHERE s.region = 'Asia-Pacific' GROUP BY e.name ORDER BY avg_sale_price DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Name VARCHAR(50), Specialty VARCHAR(50)); | Update the specialty of community health worker with WorkerID 3 to 'Cultural Competency'. | UPDATE CommunityHealthWorkers SET Specialty = 'Cultural Competency' WHERE WorkerID = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (id INT, artist_name VARCHAR(255), country VARCHAR(255), tickets_sold INT); INSERT INTO Concerts (id, artist_name, country, tickets_sold) VALUES (1, 'Taylor Swift', 'USA', 10000), (2, 'BTS', 'South Korea', 15000), (3, 'Ed Sheeran', 'UK', 12000), (4, 'Rihanna', 'Barbados', 8000), (5, 'Shakira', 'Co... | What is the total number of concert tickets sold for each country and artist in the Concerts table? | SELECT country, artist_name, SUM(tickets_sold) as total_tickets_sold FROM Concerts GROUP BY country, artist_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(255)); INSERT INTO smart_contracts (id, name, country) VALUES (1, 'Contract1', 'USA'), (2, 'Contract2', 'Canada'); | Which smart contracts were deployed in the United States? | SELECT name FROM smart_contracts WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (id INT, name VARCHAR(50)); INSERT INTO Company (id, name) VALUES (1, 'Acme Inc'); INSERT INTO Company (id, name) VALUES (2, 'Beta Corp'); INSERT INTO Company (id, name) VALUES (3, 'Gamma Startup'); CREATE TABLE Diversity (company_id INT, gender VARCHAR(10), employee_count INT); INSERT INTO Diversi... | What is the total number of employees, and the percentage of non-binary employees at each company? | SELECT company_id, SUM(employee_count) as total_employees, AVG(CASE WHEN gender = 'Non-binary' THEN 100.0 ELSE 0.0 END) as non_binary_percentage FROM Diversity GROUP BY company_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, name VARCHAR(50), species VARCHAR(50), location VARCHAR(50)); INSERT INTO animals (id, name, species, location) VALUES (1, 'Great White', 'shark', 'Atlantic Ocean'); INSERT INTO animals (id, name, species, location) VALUES (2, 'Whale Shark', 'shark', 'Indian Ocean'); | Delete all records in the 'animals' table where the 'species' is 'shark' | DELETE FROM animals WHERE species = 'shark'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (vehicle_id INT, vehicle_type VARCHAR(50), registration_date TIMESTAMP, city VARCHAR(50)); CREATE TABLE trips (trip_id INT, max_speed FLOAT, vehicle_id INT); INSERT INTO vehicles (vehicle_id, vehicle_type, registration_date, city) VALUES (1, 'electric', '2021-01-01', 'London'); INSERT INTO trips (... | What is the maximum speed reached by an electric vehicle in London? | SELECT MAX(max_speed) FROM trips JOIN vehicles ON trips.vehicle_id = vehicles.vehicle_id WHERE vehicle_type = 'electric' AND city = 'London'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_recalls (recall_id INT, recall_category VARCHAR(50), recall_description TEXT); INSERT INTO food_recalls (recall_id, recall_category, recall_description) VALUES (1, 'Contamination', 'Listeria in cheese'), (2, 'Mislabeling', 'Undeclared peanuts in chocolate'), (3, 'Contamination', 'Salmonella in almonds... | Calculate the total number of food recalls for each product category in the food_recalls table. | SELECT recall_category, COUNT(*) FROM food_recalls GROUP BY recall_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExhibitionVisitors (exhibition_id INT, country VARCHAR(20), visitor_count INT); INSERT INTO ExhibitionVisitors (exhibition_id, country, visitor_count) VALUES (1, 'Canada', 100), (2, 'Canada', 120), (3, 'Mexico', 150); | What is the maximum number of visitors for a single exhibition in Canada? | SELECT MAX(visitor_count) FROM ExhibitionVisitors WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceDebris (DebrisId INT, ObjectName VARCHAR(50), LaunchDate DATE, Source VARCHAR(50), Altitude FLOAT); INSERT INTO SpaceDebris (DebrisId, ObjectName, LaunchDate, Source, Altitude) VALUES (5, 'RH360', '2013-07-01', 'India', 700); | What is the average altitude of space debris from India launched after 2010? | SELECT Source, AVG(Altitude) FROM SpaceDebris WHERE Source = 'India' AND LaunchDate > '2010-01-01' GROUP BY Source; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (CityID INTEGER, CityName TEXT, State TEXT); CREATE TABLE InfrastructureProjects (ProjectID INTEGER, ProjectCityID INTEGER, ProjectSpending INTEGER); | What is the total spending on infrastructure projects in each city in the state of New York? | SELECT C.CityName, SUM(IP.ProjectSpending) FROM Cities C INNER JOIN InfrastructureProjects IP ON C.CityID = IP.ProjectCityID WHERE C.State = 'New York' GROUP BY C.CityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Movies (region VARCHAR(20), production_budget DECIMAL(8,2)); INSERT INTO Movies (region, production_budget) VALUES ('Asia', 100000000.00), ('Asia', 150000000.00), ('US', 200000000.00); | Find the movie with the highest production budget in Asia. | SELECT * FROM Movies WHERE region = 'Asia' AND production_budget = (SELECT MAX(production_budget) FROM Movies WHERE region = 'Asia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name VARCHAR(50), country VARCHAR(50)); INSERT INTO ports VALUES (1, 'Port of Los Angeles', 'USA'), (2, 'Port of Rotterdam', 'Netherlands'); CREATE TABLE deliveries (delivery_id INT, port_id INT, delivery_time INT); | What is the average delivery time for each port? | SELECT port_name, AVG(delivery_time) AS avg_delivery_time FROM deliveries D JOIN ports P ON D.port_id = P.port_id GROUP BY port_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Game (GameID INT, HomeTeam VARCHAR(20), AwayTeam VARCHAR(20), SeasonYear INT); INSERT INTO Game (GameID, HomeTeam, AwayTeam, SeasonYear) VALUES (1, 'Lightning', 'Panthers', 2023); | How many home games did each team in the 'Atlantic Division' play in the 2022-2023 season? | SELECT HomeTeam, COUNT(*) AS HomeGames FROM Game WHERE SeasonYear = 2023 AND HomeTeam IN ('Lightning', 'Panthers', 'Maple Leafs', 'Senators', 'Canadiens', 'Bruins', 'Red Wings', 'Flyers') GROUP BY HomeTeam; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, building_name VARCHAR(50), city VARCHAR(50), certification VARCHAR(50)); INSERT INTO green_buildings (id, building_name, city, certification) VALUES (1, 'Empire State Building', 'New York', 'Gold'), (2, 'Sears Tower', 'Chicago', 'Silver'), (3, 'Burj Khalifa', 'Dubai', 'Silver'); | Update the certification level to 'Gold' for the building named 'Burj Khalifa' in the 'green_buildings' table. | UPDATE green_buildings SET certification = 'Gold' WHERE building_name = 'Burj Khalifa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_revenue(date DATE, revenue INT); INSERT INTO daily_revenue VALUES ('2022-01-01', 1000), ('2022-01-02', 1200), ('2022-01-03', 1100), ('2021-01-04', 1300), ('2021-01-05', 1500), ('2021-01-06', 1600), ('2021-01-07', 1700); | What is the daily revenue trend for the past year? | SELECT date, revenue, ROW_NUMBER() OVER (ORDER BY revenue DESC) as ranking FROM daily_revenue WHERE date >= CURRENT_DATE - INTERVAL '1 year' ORDER BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE europium_production (year INT, quantity INT); INSERT INTO europium_production (year, quantity) VALUES (2019, 4500), (2020, 5000), (2021, 5500); | What is the total europium production for the past 3 years? | SELECT SUM(quantity) FROM europium_production WHERE year BETWEEN 2019 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Factories (id INT, name TEXT, location TEXT);CREATE TABLE Materials (id INT, supplier_id INT, factory_id INT, material TEXT, quantity INT, date DATE);INSERT INTO Factories VALUES (5, 'FactoryA', 'LocationA'), (6, 'FactoryB', 'LocationB');INSERT INTO Materials VALUES (1, 1, 5, 'MaterialX', 100, '2021-06-01'... | Which factories have received MaterialZ in the current year but not in the previous year? | SELECT DISTINCT m.factory_id FROM Materials m WHERE m.material = 'MaterialZ' AND m.date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND CURRENT_DATE AND m.factory_id NOT IN (SELECT m2.factory_id FROM Materials m2 WHERE m2.material = 'MaterialZ' AND m2.date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR) AND DATE_SU... | 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.