context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28 values |
|---|---|---|---|
CREATE TABLE therapists (therapist_id INT, name VARCHAR(20), sessions INT); INSERT INTO therapists (therapist_id, name, sessions) VALUES (1, 'Therapist A', 25); INSERT INTO therapists (therapist_id, name, sessions) VALUES (2, 'Therapist B', 30); INSERT INTO therapists (therapist_id, name, sessions) VALUES (3, 'Therapist C', 20); | What is the total number of sessions for each therapist? | SELECT name, SUM(sessions) FROM therapists GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Region TEXT, VolunteerHours INT, EventDate DATE); INSERT INTO Volunteers VALUES (1, 'Ahmed Al-Hassan', 'Middle East and North Africa', 20, '2022-01-01'), (2, 'Fatima Al-Farsi', 'Middle East and North Africa', 15, '2022-02-01'); | Identify the volunteers who have shown the greatest increase in participation over the last 12 months, in the Middle East and North Africa region. | SELECT VolunteerName, MAX(VolunteerHours) - MIN(VolunteerHours) as Increase FROM Volunteers WHERE Region = 'Middle East and North Africa' AND EventDate >= DATEADD(year, -1, CURRENT_DATE) GROUP BY VolunteerName ORDER BY Increase DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE models_canada (model_id INT, name VARCHAR(255), country VARCHAR(255), safety_score FLOAT); INSERT INTO models_canada (model_id, name, country, safety_score) VALUES (1, 'ModelA', 'Canada', 0.92), (2, 'ModelB', 'Canada', 0.88), (3, 'ModelC', 'Canada', 0.95); | Update the name of model 3 from Canada to Model D. | UPDATE models_canada SET name = 'Model D' WHERE model_id = 3 AND country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE high_priority_vulnerabilities (id INT, sector VARCHAR(255), severity FLOAT, priority VARCHAR(255)); INSERT INTO high_priority_vulnerabilities (id, sector, severity, priority) VALUES (1, 'transportation', 7.5, 'high'); | What is the minimum severity of a high-priority vulnerability in the transportation sector? | SELECT MIN(severity) FROM high_priority_vulnerabilities WHERE sector = 'transportation' AND priority = 'high'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (name TEXT, state TEXT, avg_income INTEGER); INSERT INTO cities (name, state, avg_income) VALUES ('City1', 'Montana', 60000), ('City2', 'Montana', 50000), ('City3', 'Montana', 70000), ('City4', 'Montana', 40000), ('City5', 'Montana', 80000); | What is the name of the city with the lowest average income in Montana? | SELECT name FROM cities WHERE state = 'Montana' ORDER BY avg_income ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriber_type (subscriber_id INT, subscriber_type VARCHAR(50), area_type VARCHAR(50)); INSERT INTO subscriber_type (subscriber_id, subscriber_type, area_type) VALUES (1, 'Mobile', 'Urban'), (2, 'Broadband', 'Rural'), (3, 'Mobile', 'Urban'); | What is the total number of mobile subscribers and broadband subscribers in each area type? | SELECT subscriber_type, area_type, COUNT(*) as total_subscribers FROM subscriber_type GROUP BY subscriber_type, area_type; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists blockchain; CREATE TABLE if not exists blockchain.regulatory_updates ( update_id INT AUTO_INCREMENT, topic VARCHAR(255), update_details TEXT, update_date DATE, PRIMARY KEY (update_id)); INSERT INTO blockchain.regulatory_updates (topic, update_details, update_date) VALUES ('DeFi', 'Interim Compliance Framework for DeFi platforms', '2023-01-15'); | What is the latest regulatory update related to DeFi? | SELECT update_details FROM blockchain.regulatory_updates WHERE topic = 'DeFi' ORDER BY update_date DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE); INSERT INTO Satellites (id, name, country, launch_date) VALUES (1, 'USA-193', 'USA', '2009-04-22'), (2, 'KH-11-20', 'USA', '2013-03-25'), (3, 'Chang Zheng-1C', 'China', '1975-04-26'), (4, 'GSAT-12', 'India', '2011-07-15'), (5, 'Express-AM6', 'Russia', '2014-03-22'); | What are the top 5 countries with the most satellites in orbit? | SELECT country, COUNT(id) as total_satellites FROM Satellites GROUP BY country ORDER BY total_satellites DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_building_certifications (id INT, building_id INT, certification_type VARCHAR(255), certification_year INT, PRIMARY KEY(id)); INSERT INTO green_building_certifications (id, building_id, certification_type, certification_year) VALUES (1, 1004, 'EDGE', 2022), (2, 1005, 'LEED', 2020), (3, 1006, 'BREEAM', 2019), (4, 1007, 'Green Star', 2021); | What are the buildings with the most recent certifications? | SELECT building_id, certification_type, certification_year, ROW_NUMBER() OVER (PARTITION BY building_id ORDER BY certification_year DESC) as ranking FROM green_building_certifications WHERE ranking = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE south_american_countries (id INT, name VARCHAR(50)); CREATE TABLE mining_operations (id INT, country_id INT, region VARCHAR(20), annual_co2_emissions INT); INSERT INTO south_american_countries (id, name) VALUES (1, 'Brazil'), (2, 'Argentina'); INSERT INTO mining_operations (id, country_id, region, annual_co2_emissions) VALUES (1, 1, 'South America', 5000), (2, 2, 'South America', 4000); | List all mining operations in South America with their environmental impact stats? | SELECT m.id, m.region, m.annual_co2_emissions FROM mining_operations m INNER JOIN south_american_countries c ON m.country_id = c.id WHERE c.name IN ('Brazil', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (project_id INT, name TEXT, start_date DATE); INSERT INTO military_innovation (project_id, name, start_date) VALUES (1, 'Project A', '2022-01-01'), (2, 'Project B', '2023-01-01'), (3, 'Project C', NULL); | What are the names of all military innovation projects that have not yet started? | SELECT name FROM military_innovation WHERE start_date IS NULL | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (id INT, region VARCHAR(255), year INT, co2_emission INT); INSERT INTO co2_emissions (id, region, year, co2_emission) VALUES (1, 'South America', 2005, 450); | What is the maximum CO2 emission reduction in South America in a single year, and in which year did this occur? | SELECT region, MAX(co2_emission) AS max_co2, year FROM co2_emissions WHERE region = 'South America' GROUP BY region, year HAVING max_co2 = (SELECT MAX(co2_emission) FROM co2_emissions WHERE region = 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hydro_plants (id INT PRIMARY KEY, name VARCHAR(100), country VARCHAR(50), capacity FLOAT); | Delete all records in the 'hydro_plants' table where the 'country' is 'Brazil' | DELETE FROM hydro_plants WHERE country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy_initiatives(district_name TEXT, initiative_name TEXT); INSERT INTO circular_economy_initiatives(district_name, initiative_name) VALUES('DistrictA', 'Recycling Program'), ('DistrictB', 'Composting Program'), ('DistrictA', 'Waste Reduction Campaign'), ('DistrictC', 'Materials Exchange Program'); | Find the number of circular economy initiatives for each district, and rank them in descending order. | SELECT district_name, COUNT(initiative_name) AS initiatives_count, RANK() OVER(ORDER BY COUNT(initiative_name) DESC) AS rank FROM circular_economy_initiatives GROUP BY district_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE FoodRecalls (recall_id INT, recall_date DATE, region VARCHAR(255)); INSERT INTO FoodRecalls (recall_id, recall_date, region) VALUES (1, '2021-03-15', 'Southeast'), (2, '2021-06-28', 'Midwest'), (3, '2021-08-10', 'Southeast'); | How many food recalls occurred in the Southeast region in 2021? | SELECT COUNT(*) FROM FoodRecalls WHERE region = 'Southeast' AND EXTRACT(YEAR FROM recall_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (order_id INT, order_date DATE, order_shipped_from VARCHAR(50), order_has_complaint BOOLEAN); | What is the percentage of orders shipped from factories in Cambodia that have received a complaint in the last year? | SELECT (COUNT(*) FILTER (WHERE order_shipped_from = 'Cambodia' AND order_has_complaint = TRUE) * 100.0 / COUNT(*)) AS percentage FROM Orders WHERE order_date > NOW() - INTERVAL '1 year'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Grants (ID INT, Category VARCHAR(50), Amount FLOAT, Year INT); INSERT INTO Grants (ID, Category, Amount, Year) VALUES (1, 'Robotics', 600000, 2021), (2, 'AI', 500000, 2020); | What is the average research grant amount for the 'Robotics' category? | SELECT AVG(Amount) FROM Grants WHERE Category = 'Robotics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales(id INT, seller VARCHAR(255), buyer VARCHAR(255), equipment VARCHAR(255), quantity INT, sale_price DECIMAL(10,2), sale_date DATE); | How many military equipment items were sold by 'Yellow Defense' in the last month? | SELECT SUM(quantity) FROM Sales WHERE seller = 'Yellow Defense' AND sale_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE explainability_scores_2 (id INT, model_name VARCHAR(50), sector VARCHAR(50), region VARCHAR(50), score FLOAT); INSERT INTO explainability_scores_2 VALUES (1, 'EnergyModel1', 'Energy', 'Oceania', 0.75), (2, 'EnergyModel2', 'Energy', 'Oceania', 0.82), (3, 'EnergyModel3', 'Energy', 'Europe', 0.93); | What is the minimum explainability score for AI models in the energy sector in Oceania? | SELECT MIN(score) FROM explainability_scores_2 WHERE sector = 'Energy' AND region = 'Oceania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_resolution (id INT, region VARCHAR(255), days_to_resolve INT); INSERT INTO incident_resolution (id, region, days_to_resolve) VALUES (1, 'AMER', 3), (2, 'EMEA', 5), (3, 'APAC', 7); | What is the average number of days to resolve security incidents for each region? | SELECT region, AVG(days_to_resolve) FROM incident_resolution GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (project_id INT, project_name VARCHAR(50), budget INT, area_id INT); CREATE TABLE community_development (area_id INT, area_name VARCHAR(50)); | Retrieve the names and total budgets of rural infrastructure projects in 'rural_area_2' from the 'rural_infrastructure' and 'community_development' tables | SELECT r.project_name, SUM(r.budget) FROM rural_infrastructure r INNER JOIN community_development c ON r.area_id = c.area_id WHERE c.area_name = 'rural_area_2' GROUP BY r.project_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name TEXT, biodiversity_index FLOAT); CREATE TABLE oceans (id INT, name TEXT); INSERT INTO marine_protected_areas VALUES (1, 'Great Barrier Reef', 8.5), (2, 'Galapagos Islands', 9.0), (3, 'Palau', 7.5), (4, 'Socorro Island', 8.0); INSERT INTO oceans VALUES (1, 'Pacific'), (2, 'Indian'), (3, 'Pacific'), (4, 'Pacific'); | Which marine protected areas have the most biodiverse ecosystems? | SELECT mpa.name, o.name as ocean_name, mpa.biodiversity_index FROM marine_protected_areas mpa INNER JOIN oceans o ON o.id = (SELECT oa.ocean_id FROM oceans oa WHERE mpa.id = oa.marine_protected_area_id LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, cause_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, cause_id, amount, donation_date) VALUES (1, 1, 50.00, '2021-07-01'), (2, 2, 100.00, '2021-07-15'), (3, 1, 75.00, '2021-08-03'), (4, 3, 200.00, '2021-09-01'), (5, 2, 150.00, '2021-07-30'), (6, 1, 125.00, '2021-08-25'); | What is the average donation amount for each cause in Q3 2021? | SELECT cause_id, AVG(amount) as avg_donation_amount FROM donations WHERE donation_date BETWEEN '2021-07-01' AND '2021-09-30' GROUP BY cause_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductionWorkers (WorkerID int, ProductCategoryID int); INSERT INTO ProductionWorkers (WorkerID, ProductCategoryID) VALUES (1, 1), (2, 1), (3, 2), (4, 3), (5, 1), (6, 4), (7, 2), (8, 1), (9, 3), (10, 4); CREATE TABLE ProductCategories (ProductCategoryID int, ProductCategoryName varchar(50)); INSERT INTO ProductCategories (ProductCategoryID, ProductCategoryName) VALUES (1, 'Fashion'), (2, 'Furniture'), (3, 'Electronics'), (4, 'Home Appliances'); | Identify the number of workers involved in the production of each product category. | SELECT pc.ProductCategoryName, COUNT(pw.WorkerID) AS WorkerCount FROM ProductionWorkers pw JOIN ProductCategories pc ON pw.ProductCategoryID = pc.ProductCategoryID GROUP BY pc.ProductCategoryName; | gretelai_synthetic_text_to_sql |
CREATE TABLE garments_summary (garment_type VARCHAR(50), quantity INT); INSERT INTO garments_summary (garment_type, quantity) VALUES ('Dress', 250), ('Shirt', 300), ('Pants', 400); | How many garments of each type are there, ordered from most to least? | SELECT garment_type, COUNT(*) as quantity FROM garments_summary GROUP BY garment_type ORDER BY quantity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ZakatBank (id INT, loan_type VARCHAR(20), amount DECIMAL(10,2), issue_date DATE); | What is the total amount of Shariah-compliant loans issued by Zakat Bank in 2020, segmented by loan type? | SELECT loan_type, SUM(amount) FROM ZakatBank WHERE YEAR(issue_date) = 2020 GROUP BY loan_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_virtual_tour (hotel_id INT, hotel_name TEXT, country TEXT, virtual_tour TEXT, engagement_time INT); INSERT INTO hotel_virtual_tour (hotel_id, hotel_name, country, virtual_tour, engagement_time) VALUES (1, 'The Desert Retreat', 'UAE', 'yes', 300), (2, 'The Ocean View Hotel', 'UAE', 'yes', 250), (3, 'The Heritage Hotel', 'Saudi Arabia', 'no', NULL), (4, 'The Business Hotel', 'Qatar', 'yes', 400); | What is the distribution of virtual tour engagement times for hotels in the Middle East? | SELECT country, COUNT(hotel_id) AS total_hotels, AVG(engagement_time) AS avg_engagement_time, STDDEV(engagement_time) AS stddev_engagement_time FROM hotel_virtual_tour WHERE country = 'Middle East' AND virtual_tour = 'yes' GROUP BY country | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai_models (model_id INT, model_name TEXT, region TEXT, fairness_score FLOAT); INSERT INTO explainable_ai_models (model_id, model_name, region, fairness_score) VALUES (1, 'Lime', 'North America', 0.75), (2, 'Shap', 'South America', 0.85), (3, 'Skater', 'North America', 0.82); | Which explainable AI models have the lowest fairness scores in North America? | SELECT model_name, fairness_score FROM explainable_ai_models WHERE region = 'North America' ORDER BY fairness_score ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales(equipment_id INT, manufacturer VARCHAR(255), purchaser VARCHAR(255), sale_date DATE, quantity INT);INSERT INTO Military_Equipment_Sales(equipment_id, manufacturer, purchaser, sale_date, quantity) VALUES (1, 'Boeing', 'NATO', '2019-04-01', 30), (2, 'Boeing', 'NATO', '2019-06-15', 25); | What is the maximum quantity of military equipment sold in a single transaction by Boeing to NATO countries in Q2 2019? | SELECT MAX(quantity) FROM Military_Equipment_Sales WHERE manufacturer = 'Boeing' AND purchaser = 'NATO' AND sale_date BETWEEN '2019-04-01' AND '2019-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_name VARCHAR(50), country VARCHAR(50), event_type VARCHAR(50)); CREATE TABLE attendees (attendee_id INT, event_id INT, country VARCHAR(50)); | Find the top 3 countries with the highest number of art & culture events | SELECT e.country, COUNT(e.event_id) as event_count FROM events e JOIN attendees a ON e.event_id = a.event_id GROUP BY e.country ORDER BY event_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
fleet(vessel_id, vessel_name, max_capacity, build_year, type, flag) | Add a new vessel to the fleet | INSERT INTO fleet (vessel_id, vessel_name, max_capacity, build_year, type, flag) VALUES (3002, 'Sea Titan', 12000, 2015, 'Container', 'Panama'); | gretelai_synthetic_text_to_sql |
CREATE TABLE species (species_id INT, species_name TEXT);CREATE TABLE carbon_sequestration (sequestration_id INT, species_id INT, sequestration_rate FLOAT); INSERT INTO species (species_id, species_name) VALUES (1, 'Oak'), (2, 'Pine'), (3, 'Maple'); INSERT INTO carbon_sequestration (sequestration_id, species_id, sequestration_rate) VALUES (1, 1, 12.5), (2, 1, 13.2), (3, 2, 15.3), (4, 2, 15.6), (5, 3, 10.8), (6, 3, 11.1); | What is the minimum and maximum carbon sequestration rate for each species? | SELECT species_id, species_name, MIN(sequestration_rate), MAX(sequestration_rate) FROM species JOIN carbon_sequestration ON species.species_id = carbon_sequestration.species_id GROUP BY species_id, species_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE City_Hotels (city VARCHAR(50), hotel_count INT); INSERT INTO City_Hotels (city, hotel_count) VALUES ('New York', 250), ('Los Angeles', 300), ('Chicago', 180); | What is the number of hotels in each city in the 'City_Hotels' table? | SELECT city, hotel_count FROM City_Hotels; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (district_id INT, district_name VARCHAR(50)); INSERT INTO districts VALUES (1, 'District A'), (2, 'District B'), (3, 'District C'); CREATE TABLE student_enrollment (student_id INT, district_id INT); INSERT INTO student_enrollment VALUES (1, 1), (1, 2), (2, 2), (2, 3), (3, 1), (3, 3), (4, 2), (4, 3), (5, 1); | Find the number of students who have ever enrolled in each district, ordered by the number of enrollments. | SELECT district_id, district_name, COUNT(DISTINCT student_id) as enrollment_count FROM districts JOIN student_enrollment ON districts.district_id = student_enrollment.district_id GROUP BY district_id, district_name ORDER BY enrollment_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (id INT PRIMARY KEY, name VARCHAR(255), age INT, gender VARCHAR(10), location VARCHAR(255), farmer_id INT); CREATE TABLE Equipment (id INT PRIMARY KEY, type VARCHAR(255), model VARCHAR(255), purchased_date DATE, last_service_date DATE, status VARCHAR(255), farmer_id INT, FOREIGN KEY (farmer_id) REFERENCES Farmers(farmer_id)); | Update the status of a farmer's equipment in Kenya to available? | UPDATE Equipment SET status = 'available' WHERE Equipment.farmer_id = 5 AND Farmers.location = 'Kenya'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryVehicles (id INT PRIMARY KEY, manufacturer VARCHAR(50), vehicle_type VARCHAR(50), price DECIMAL(10,2)); INSERT INTO MilitaryVehicles (id, manufacturer, vehicle_type, price) VALUES (1, 'CompanyA', 'Tank', 5000000.00), (2, 'CompanyB', 'Humvee', 150000.00), (3, 'CompanyA', 'Helicopter', 12000000.00); | What is the average price of military vehicles by manufacturer? | SELECT manufacturer, AVG(price) as avg_price FROM MilitaryVehicles GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT, Budget DECIMAL(10,2)); INSERT INTO Programs VALUES (1, 'Education', 1000.00), (2, 'Environment', 2000.00), (3, 'Health', 0.00); | What is the average budget allocated to each program in the first quarter of 2020, excluding programs with a budget of zero? | SELECT ProgramName, AVG(Budget) as AvgBudget FROM Programs WHERE QUARTER(BudgetDate) = 1 AND Budget > 0 GROUP BY ProgramName; | gretelai_synthetic_text_to_sql |
ARTIST(artist_id, name, gender, country); ARTWORK(artwork_id, title, date_created, period, artist_id) | Find the number of unique artists from each country in the art collection | SELECT a.country, COUNT(DISTINCT a.artist_id) FROM ARTIST a INNER JOIN ARTWORK ar ON a.artist_id = ar.artist_id GROUP BY a.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (id INT, state VARCHAR(2)); CREATE TABLE Cases (id INT, attorney_id INT, precedent VARCHAR(100)); INSERT INTO Attorneys (id, state) VALUES (1, 'NY'), (2, 'CA'), (3, 'IL'); INSERT INTO Cases (id, attorney_id, precedent) VALUES (1, 1, 'Precedent1'), (2, 1, 'Precedent2'), (3, 2, 'Precedent3'), (4, 3, 'Precedent4'); | List the unique legal precedents cited in cases handled by attorneys from New York or California. | SELECT DISTINCT precedent FROM Cases INNER JOIN Attorneys ON Cases.attorney_id = Attorneys.id WHERE Attorneys.state IN ('NY', 'CA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT); CREATE TABLE Volunteers (VolunteerID INT, ProgramID INT, VolunteerDate DATE); INSERT INTO Programs (ProgramID, ProgramName) VALUES (1, 'Feeding Program'), (2, 'Education Support'), (3, 'Health Awareness'); INSERT INTO Volunteers (VolunteerID, ProgramID, VolunteerDate) VALUES (1, 1, '2023-01-01'), (2, 3, '2023-01-02'), (3, 3, '2023-01-03'); | Identify the total number of volunteers who participated in the 'Health Awareness' program in 2023. | SELECT COUNT(DISTINCT Volunteers.VolunteerID) FROM Volunteers INNER JOIN Programs ON Volunteers.ProgramID = Programs.ProgramID WHERE Programs.ProgramName = 'Health Awareness' AND YEAR(VolunteerDate) = 2023; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA trans schemas.trans; CREATE TABLE min_daily_bus_fares (bus_number INT, fare FLOAT, fare_date DATE); INSERT INTO min_daily_bus_fares (bus_number, fare, fare_date) VALUES (4101, 10.00, '2021-07-01'), (4101, 10.50, '2021-07-02'), (4101, 9.75, '2021-07-03'), (4101, 11.00, '2021-07-04'), (4101, 12.50, '2021-07-05'), (4102, 13.25, '2021-07-01'), (4102, 14.00, '2021-07-02'), (4102, 16.00, '2021-07-03'), (4102, 15.50, '2021-07-04'), (4102, 17.00, '2021-07-05'); | What was the minimum fare collected for each bus number in the first week of July 2021? | SELECT bus_number, MIN(fare) OVER (PARTITION BY bus_number) FROM min_daily_bus_fares WHERE fare_date BETWEEN '2021-07-01' AND '2021-07-05'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerDailyGames (PlayerID INT, PlayDate DATE, GamesPlayed INT); INSERT INTO PlayerDailyGames (PlayerID, PlayDate, GamesPlayed) VALUES (1, '2021-04-01', 3), (1, '2021-04-02', 2), (2, '2021-04-01', 1), (2, '2021-04-03', 4), (3, '2021-04-02', 5), (3, '2021-04-03', 3); | What is the maximum number of games played in a single day by a player from 'Canada'? | SELECT MAX(GamesPlayed) FROM PlayerDailyGames INNER JOIN Players ON PlayerDailyGames.PlayerID = Players.PlayerID WHERE Country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (country VARCHAR(50), year INT, landfill_capacity FLOAT, population INT); INSERT INTO landfill_capacity (country, year, landfill_capacity, population) VALUES ('Egypt', 2020, 1000, 100000000), ('Nigeria', 2020, 1200, 200000000), ('South Africa', 2020, 800, 60000000); | What is the average landfill capacity per person for African countries in 2020? | SELECT AVG(landfill_capacity / population) FROM landfill_capacity WHERE country IN (SELECT country FROM countries WHERE continent = 'Africa') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, manufacturer VARCHAR(20), mass FLOAT); INSERT INTO Spacecraft (id, manufacturer, mass) VALUES (1, 'SpaceCorp', 15000.0); INSERT INTO Spacecraft (id, manufacturer, mass) VALUES (2, 'Galactic', 12000.0); INSERT INTO Spacecraft (id, manufacturer, mass) VALUES (3, 'SpaceCorp', 14000.0); | Find the number of spacecraft manufactured by SpaceCorp | SELECT COUNT(*) FROM Spacecraft WHERE manufacturer = 'SpaceCorp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name TEXT, isp TEXT, city TEXT, data_usage FLOAT); INSERT INTO customers (id, name, isp, city, data_usage) VALUES (1, 'John Doe', 'ABC Internet', 'Chicago', 12.5), (2, 'Jane Smith', 'DEF Internet', 'NYC', 4.0), (3, 'Mike Johnson', 'DEF Internet', 'NYC', 7.5); | Update 'Mike Johnson's data usage to 8 GB. | UPDATE customers SET data_usage = 8.0 WHERE name = 'Mike Johnson'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, department VARCHAR(20), activity VARCHAR(20)); INSERT INTO teacher_pd (teacher_id, department, activity) VALUES (1, 'math', 'workshop'), (2, 'english', 'conference'), (3, 'math', 'online_course'); | How many teachers participated in professional development activities in the 'math' department? | SELECT COUNT(*) FROM teacher_pd WHERE department = 'math'; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts (id INT, name VARCHAR); INSERT INTO traditional_arts (id, name) VALUES (1, 'Traditional Art A'), (2, 'Traditional Art B'); CREATE TABLE community_events (id INT, art_id INT, event_type VARCHAR); INSERT INTO community_events (id, art_id, event_type) VALUES (1, 1, 'Community Engagement'), (2, 2, 'Educational'); | List all traditional arts and their associated community engagement events. | SELECT traditional_arts.name, community_events.event_type FROM traditional_arts INNER JOIN community_events ON traditional_arts.id = community_events.art_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (id INT, name VARCHAR(100), country VARCHAR(50)); INSERT INTO Users (id, name, country) VALUES (1, 'Alice', 'USA'), (2, 'Bob', 'Canada'); CREATE TABLE Transactions (id INT, user_id INT, blockchain VARCHAR(50), amount DECIMAL(10,2)); INSERT INTO Transactions (id, user_id, blockchain) VALUES (1, 1, 'Ethereum'), (2, 2, 'Bitcoin'); | What is the total number of Ethereum transactions made by users from the US? | SELECT COUNT(*) FROM Transactions t INNER JOIN Users u ON t.user_id = u.id WHERE u.country = 'USA' AND t.blockchain = 'Ethereum'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_ops (country VARCHAR(255), num_personnel INT); | What is the average number of peacekeeping personnel by country? | SELECT country, AVG(num_personnel) FROM peacekeeping_ops GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(id INT, product_category VARCHAR(255), revenue DECIMAL(10, 2), sale_date DATE); INSERT INTO sales(id, product_category, revenue, sale_date) VALUES (1, 'Electronics', 1000.00, '2022-01-01'), (2, 'Furniture', 1500.00, '2022-01-05'), (3, 'Electronics', 1200.00, '2022-01-10'); | What is the total revenue generated from each product category in the last month? | SELECT product_category, SUM(revenue) FROM sales WHERE sale_date >= CURDATE() - INTERVAL 30 DAY GROUP BY product_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor_mapping (id INT, location TEXT, depth FLOAT); | Find the maximum and minimum depths in the ocean floor mapping data? | SELECT MAX(depth), MIN(depth) FROM ocean_floor_mapping; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_pricing (country VARCHAR(255), revenue FLOAT); INSERT INTO carbon_pricing (country, revenue) VALUES ('Canada', 3000), ('Chile', 1500), ('Colombia', 1000); | What is the total carbon pricing revenue in Canada, Chile, and Colombia? | SELECT SUM(revenue) FROM carbon_pricing WHERE country IN ('Canada', 'Chile', 'Colombia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ArcticAnimals (id INT PRIMARY KEY, name VARCHAR(100), population INT, region VARCHAR(100), conservation_status VARCHAR(100)); INSERT INTO ArcticAnimals (id, name, population, region, conservation_status) VALUES (1, 'Polar Bear', 25000, 'Arctic', 'Endangered'); | What is the minimum and maximum population of endangered arctic animals? | SELECT MIN(a.population), MAX(a.population) FROM ArcticAnimals a WHERE a.conservation_status = 'Endangered' AND a.region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellite (ID INT, Name TEXT, Country TEXT, LaunchDate DATE); INSERT INTO Satellite (ID, Name, Country, LaunchDate) VALUES (1, 'GSAT-1', 'India', '2004-06-18'), (2, 'INSAT-3A', 'India', '2003-04-10'), (3, 'RS-1', 'Russia', '2012-06-17'); | List all the satellites deployed by India until 2020-01-01, ordered by their launch date. | SELECT * FROM Satellite WHERE Country = 'India' AND LaunchDate <= '2020-01-01' ORDER BY LaunchDate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (species VARCHAR(255), animal_count INT, country VARCHAR(255)); CREATE TABLE countries (country VARCHAR(255), region VARCHAR(255)); | Identify the top 5 countries with the most diverse wildlife, based on the number of species, in the "animal_population" and "countries" tables | SELECT e1.country, COUNT(DISTINCT e1.species) as num_species FROM animal_population e1 INNER JOIN countries c1 ON e1.country = c1.country GROUP BY e1.country ORDER BY num_species DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_cargo (vessel_id INT, load_date DATE, port VARCHAR(255), cargo_quantity INT); | List all unique ports and the average cargo quantity in Q4 2022. | SELECT port, AVG(cargo_quantity) FROM vessel_cargo WHERE QUARTER(load_date) = 4 AND YEAR(load_date) = 2022 GROUP BY port; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, product_id INT, source_country VARCHAR(50), delivery_time INT); INSERT INTO Shipments (id, product_id, source_country, delivery_time) VALUES (1, 1, 'Africa', 14), (2, 2, 'Asia', 10); | What is the average delivery time for textile shipments from Africa? | SELECT AVG(delivery_time) FROM Shipments WHERE source_country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue_virtual_world (transaction_id INT, region TEXT, revenue FLOAT); INSERT INTO revenue_virtual_world (transaction_id, region, revenue) VALUES (1, 'Africa', 500), (2, 'South America', 700); | What is the total revenue of virtual tours in Africa and South America? | SELECT SUM(revenue) FROM revenue_virtual_world WHERE region IN ('Africa', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE esports_matches (match_id INT, team_id INT, match_result VARCHAR(10)); | Delete records with a 'match_result' of 'loss' from the 'esports_matches' table | DELETE FROM esports_matches WHERE match_result = 'loss'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(100), address VARCHAR(255), city VARCHAR(100), country VARCHAR(100)); | Add a new record to the suppliers table | INSERT INTO suppliers (id, name, address, city, country) VALUES (1, 'Green Garden', '123 Main St', 'Springfield', 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_change_projects_funding(project_id INT, year INT, amount FLOAT); INSERT INTO climate_change_projects_funding (project_id, year, amount) VALUES (18, 2018, 100000.0), (19, 2019, 120000.0), (20, 2020, 150000.0); | What was the maximum funding allocated for climate change projects in a single year? | SELECT MAX(amount) FROM climate_change_projects_funding; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (plant_id INT, chemical TEXT, quantity INT, quarter INT, year INT); INSERT INTO production (plant_id, chemical, quantity, quarter, year) VALUES (1, 'ChemX', 500, 3, 2020), (2, 'ChemY', 700, 3, 2020), (3, 'ChemX', 450, 3, 2020), (4, 'ChemY', 600, 3, 2020), (5, 'ChemX', 300, 3, 2020), (6, 'ChemX', 800, 4, 2020); CREATE TABLE plants (id INT, name TEXT, location TEXT, PRIMARY KEY (id)); INSERT INTO plants (id, name, location) VALUES (1, 'PlantA', 'IN'), (2, 'PlantB', 'CA'), (3, 'PlantC', 'CN'), (4, 'PlantD', 'AU'), (5, 'PlantE', 'IN'), (6, 'PlantF', 'BR'); | What is the total quantity of chemical X produced in Q3 2020, for plants located in India? | SELECT SUM(quantity) FROM production INNER JOIN plants ON production.plant_id = plants.id WHERE chemical = 'ChemX' AND location = 'IN' AND quarter = 3 AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment (id INT, region VARCHAR(255), veteran_employed INT); INSERT INTO veteran_employment (id, region, veteran_employed) VALUES (1, 'Northeast', 500), (2, 'Southeast', 700), (3, 'Midwest', 600), (4, 'West', 800); | Find the total number of veterans employed by region | SELECT region, SUM(veteran_employed) FROM veteran_employment GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition_Visitors (id INT, visitor_state VARCHAR(255)); INSERT INTO Exhibition_Visitors (id, visitor_state) VALUES (1, 'California'), (2, 'Texas'), (3, 'Florida'), (4, 'California'), (5, 'California'), (6, 'Texas'), (7, 'California'), (8, 'Florida'); | How many visitors attended exhibitions in each state? | SELECT visitor_state, COUNT(*) FROM Exhibition_Visitors GROUP BY visitor_state; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, region VARCHAR(50), membership_start_date DATE, membership_end_date DATE, membership_fee DECIMAL(5,2)); INSERT INTO members (member_id, region, membership_start_date, membership_end_date, membership_fee) VALUES (1, 'New York', '2021-01-01', '2022-01-01', 500), (2, 'California', '2021-01-01', '2022-01-01', 600), (3, 'New York', '2021-01-01', '2022-01-01', 450), (4, 'Texas', '2021-01-01', '2022-01-01', 700), (5, 'California', '2021-01-01', '2022-01-01', 800); | How many members have a membership fee greater than the average membership fee? | SELECT COUNT(*) FROM members WHERE membership_fee > (SELECT AVG(membership_fee) FROM members); | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (project_id INT, state VARCHAR(255), is_sustainable BOOLEAN, cost FLOAT, start_date DATE); INSERT INTO Projects (project_id, state, is_sustainable, cost, start_date) VALUES (1, 'Florida', false, 500000, '2022-01-01'), (2, 'Florida', true, 700000, '2022-02-01'); | What is the average construction cost for non-sustainable building projects in Florida per month in 2022? | SELECT AVG(cost) FROM Projects WHERE state = 'Florida' AND is_sustainable = false AND YEAR(start_date) = 2022 GROUP BY EXTRACT(MONTH FROM start_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency ( id INT PRIMARY KEY, category VARCHAR(50), energy_savings INT, country VARCHAR(50)); | Insert a new record in the "energy_efficiency" table with values "Lighting" for "category", 50 for "energy_savings", and "US" for "country" | INSERT INTO energy_efficiency (category, energy_savings, country) VALUES ('Lighting', 50, 'US'); | gretelai_synthetic_text_to_sql |
CREATE TABLE threats (id INT, category VARCHAR(255), risk_score FLOAT); INSERT INTO threats (id, category, risk_score) VALUES (1, 'malware', 8.2), (2, 'phishing', 7.5), (3, 'malware', 8.5); | What is the average risk score of threats associated with the 'malware' category? | SELECT AVG(risk_score) FROM threats WHERE category = 'malware'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterQuality (ID INT, LocationID INT, MeasurementDate DATE, pH FLOAT, Turbidity FLOAT); INSERT INTO WaterQuality (ID, LocationID, MeasurementDate, pH, Turbidity) VALUES (1, 1, '2022-07-20', 7.5, 30); INSERT INTO WaterQuality (ID, LocationID, MeasurementDate, pH, Turbidity) VALUES (2, 2, '2022-07-25', 7.2, 20); | What is the average pH value for each location in the 'WaterQuality' table for the last month? | SELECT LocationID, AVG(pH) FROM WaterQuality WHERE MeasurementDate BETWEEN DATEADD(month, -1, GETDATE()) AND GETDATE() GROUP BY LocationID; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (id INT, region VARCHAR(20), ticket_price DECIMAL(10, 2)); INSERT INTO concerts (id, region, ticket_price) VALUES (1, 'Midwest', 100.00), (2, 'Northeast', 125.00), (3, 'Midwest', 110.00); | What is the average ticket price for concerts in the Midwest region? | SELECT AVG(ticket_price) FROM concerts WHERE region = 'Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TopPlayers (PlayerID INT, PlayerName TEXT, Country TEXT, Rank INT, Score INT); INSERT INTO TopPlayers (PlayerID, PlayerName, Country, Rank, Score) VALUES (1, 'John Doe', 'USA', 1, 100), (2, 'Jane Smith', 'Canada', 2, 200), (3, 'Bob Johnson', 'USA', 3, 150), (4, 'Alice Williams', 'Canada', 4, 250), (5, 'Charlie Brown', 'Mexico', 5, 300); | How many players from each country are in the 'Top Players' leaderboard? | SELECT Country, COUNT(*) AS NumPlayers FROM TopPlayers GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE american_football_teams (team_id INT, team_name VARCHAR(50), city VARCHAR(50), conference VARCHAR(50), division VARCHAR(50)); | Update the 'team_name' column to 'Las Vegas Raiders' for the record with 'team_id' 45 in the 'american_football_teams' table | UPDATE american_football_teams SET team_name = 'Las Vegas Raiders' WHERE team_id = 45; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, segment VARCHAR(20), price DECIMAL(5,2)); INSERT INTO products (product_id, segment, price) VALUES (1, 'Natural', 15.99), (2, 'Organic', 20.99), (3, 'Natural', 12.49); | What is the average price of products in the Natural segment? | SELECT AVG(price) FROM products WHERE segment = 'Natural'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerEvents (EventID INT, VolunteerID INT, EventDate DATE); | Show the names of volunteers who have not yet signed up for any events | SELECT Volunteers.FirstName, Volunteers.LastName FROM Volunteers LEFT JOIN VolunteerEvents ON Volunteers.VolunteerID = VolunteerEvents.VolunteerID WHERE VolunteerEvents.VolunteerID IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, name VARCHAR(50), type VARCHAR(10)); INSERT INTO mining_sites (id, name, type) VALUES (1, 'Site A', 'Employee'), (2, 'Site B', 'Contractor'), (3, 'Site C', 'Employee'); | What's the total number of employees and contractors for each mining site? | SELECT type, SUM(id) as total FROM mining_sites GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, tour_name TEXT, country TEXT, rating FLOAT); INSERT INTO virtual_tours (tour_id, tour_name, country, rating) VALUES (1, 'Virtual Heritage Walk', 'India', 4.5), (2, 'Online Museum Tour', 'India', 4.2); | What is the average visitor review score for virtual tours in India? | SELECT AVG(rating) FROM virtual_tours WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation (province VARCHAR(50), investment INT, year INT, country VARCHAR(50)); INSERT INTO climate_mitigation (province, investment, year, country) VALUES ('Guangdong', 500000, 2019, 'China'), ('Beijing', 700000, 2019, 'China'), ('Guangdong', 600000, 2020, 'China'), ('Beijing', 800000, 2020, 'China'); | Calculate the total amount of climate mitigation investments for each province in China in 2019 and 2020. | SELECT province, SUM(investment) as total_investment FROM climate_mitigation WHERE year IN (2019, 2020) AND country = 'China' GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE facilities (id INT, name VARCHAR(255), impact_score FLOAT); INSERT INTO facilities (id, name, impact_score) VALUES (1, 'Facility D', 88.3), (2, 'Facility E', 91.5), (3, 'Facility F', 85.1); | What are the names of facilities with environmental impact scores above 90? | SELECT name FROM facilities WHERE impact_score > 90; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transport_trips (id INT, trip_date DATE, vehicle_type VARCHAR(255), trips INT); INSERT INTO public_transport_trips (id, trip_date, vehicle_type, trips) VALUES (1, '2022-01-01', 'Bus', 1000); | What is the total number of public transport trips in the "public_transport_trips" table? | SELECT SUM(trips) FROM public_transport_trips; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA followers;CREATE TABLE followers.user_followers (user_id INT, follower_count INT);INSERT INTO followers.user_followers VALUES (1,10000),(2,20000),(3,30000),(4,40000),(5,50000),(6,60000); | Who are the top 10 users with the most followers on the 'followers' schema? | SELECT user_id, follower_count FROM followers.user_followers ORDER BY follower_count DESC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_manufacturing ( id INT PRIMARY KEY, company_name VARCHAR(255), location VARCHAR(255), emissions_reduction_target VARCHAR(64), renewable_energy_usage DECIMAL(5,2) ); INSERT INTO ethical_manufacturing (id, company_name, location, emissions_reduction_target, renewable_energy_usage) VALUES (1, 'LMN Corp', 'New York, USA', '10% by 2023', 0.25); | Update the "ethical_manufacturing" table to change the "location" to "Seoul, South Korea" for the record with "company_name" as "LMN Corp" | UPDATE ethical_manufacturing SET location = 'Seoul, South Korea' WHERE company_name = 'LMN Corp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_policies (id INT, policy_id VARCHAR(255), policy_name VARCHAR(255), category VARCHAR(255), last_updated DATETIME); INSERT INTO security_policies (id, policy_id, policy_name, category, last_updated) VALUES (1, 'POL-002', 'Incident Response', 'Detection', '2021-07-01 11:00:00'); | Update security policies' category | UPDATE security_policies SET category = 'Monitoring' WHERE policy_id = 'POL-002'; | gretelai_synthetic_text_to_sql |
CREATE TABLE JobOpenings (OpeningID INT, JobTitle VARCHAR(50), JobCategory VARCHAR(30), OpeningDate DATE, CloseDate DATE); INSERT INTO JobOpenings (OpeningID, JobTitle, JobCategory, OpeningDate, CloseDate) VALUES (1, 'Software Engineer', 'IT', '2021-01-01', '2021-01-15'), (2, 'HR Manager', 'HR', '2021-02-01', '2021-03-01'), (3, 'Data Analyst', 'IT', '2021-03-01', '2021-04-15'); | What is the average time to fill job openings, broken down by job category? | SELECT JobCategory, AVG(DATEDIFF(CloseDate, OpeningDate)) FROM JobOpenings GROUP BY JobCategory; | gretelai_synthetic_text_to_sql |
CREATE TABLE australia_tourists (id INT, visit_month INT, visit_year INT, num_tourists INT); INSERT INTO australia_tourists (id, visit_month, visit_year, num_tourists) VALUES (1, 1, 2022, 10000), (2, 2, 2022, 12000), (3, 3, 2022, 15000), (4, 4, 2022, 18000), (5, 5, 2022, 20000), (6, 6, 2022, 22000), (7, 7, 2022, 25000), (8, 8, 2022, 27000), (9, 9, 2022, 25000), (10, 10, 2022, 22000), (11, 11, 2022, 18000), (12, 12, 2022, 15000); | Count of tourists who visited Australia by month in 2022 | SELECT visit_month, SUM(num_tourists) as total_tourists FROM australia_tourists WHERE visit_year = 2022 GROUP BY visit_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE ad_interactions (id INT, user_id INT, timestamp TIMESTAMP); | Update ad interaction timestamp to '2023-01-01 12:00:00' for ad interaction with ID 1234 | UPDATE ad_interactions SET timestamp = '2023-01-01 12:00:00' WHERE id = 1234; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, has_cba BOOLEAN); INSERT INTO unions (id, has_cba) VALUES (1, true), (2, false), (3, true); CREATE TABLE workers (id INT, union_id INT, sector VARCHAR(20)); INSERT INTO workers (id, union_id, sector) VALUES (1, 1, 'service'), (2, 2, 'service'), (3, 3, 'service'), (4, 1, 'service'), (5, 3, 'service'); | What percentage of workers in the 'service' sector are represented by unions with collective bargaining agreements? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM workers)) as percentage FROM workers JOIN unions ON workers.union_id = unions.id WHERE sector = 'service' AND has_cba = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_wellbeing (fan_id INT, first_name VARCHAR(50), last_name VARCHAR(50), dob DATE, joined_wellbeing_program DATE); INSERT INTO fan_wellbeing (fan_id, first_name, last_name, dob, joined_wellbeing_program) VALUES (1, 'John', 'Doe', '1990-05-01', '2022-02-01'), (2, 'Jane', 'Smith', '1985-08-12', '2022-02-15'); | Insert a new record for a fan who wants to join the wellbeing program | INSERT INTO fan_wellbeing (fan_id, first_name, last_name, dob, joined_wellbeing_program) VALUES (3, 'Emma', 'Wang', '2000-04-20', '2022-03-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, state TEXT, amount DECIMAL(10,2)); INSERT INTO donations (id, state, amount) VALUES (1, 'Florida', 50.00), (2, 'Florida', 30.00), (3, 'Florida', 100.00); | What is the minimum donation amount in the state of Florida? | SELECT MIN(amount) FROM donations WHERE state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (threat_id INT, threat_level INT, region TEXT, threat_date DATE); | What is the maximum threat level recorded for any region in the last month? | SELECT MAX(threat_level) FROM threat_intelligence WHERE threat_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.startups (id INT, name VARCHAR(100), founder_gender VARCHAR(10), funding FLOAT); INSERT INTO biotech.startups (id, name, founder_gender, funding) VALUES (1, 'StartupA', 'Female', 5000000.0), (2, 'StartupB', 'Male', 7000000.0), (3, 'StartupC', 'Female', 6000000.0); | Update the funding amount for the startup with an ID of 2 to 8000000. | UPDATE biotech.startups SET funding = 8000000.0 WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfills (name TEXT, country TEXT, capacity INTEGER); INSERT INTO landfills (name, country, capacity) VALUES ('Landfill A', 'USA', 120000), ('Landfill B', 'USA', 150000), ('Landfill C', 'Australia', 180000); | Delete all records of landfills in the United States from the landfills table. | DELETE FROM landfills WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE international_tourists (year INT, country TEXT, tourists_count INT); INSERT INTO international_tourists (year, country, tourists_count) VALUES (2020, 'Spain', 15000000), (2021, 'Spain', 18000000); | How many international tourists visited Spain in 2020 and 2021? | SELECT SUM(tourists_count) FROM international_tourists WHERE country = 'Spain' AND year IN (2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_prices (id INT, country VARCHAR(255), price FLOAT, date DATE); | What is the average carbon price in Europe over the last 12 months? | SELECT AVG(price) FROM carbon_prices WHERE country = 'Europe' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 12 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback (City VARCHAR(20), Year INT, Category VARCHAR(20), Score INT); INSERT INTO Feedback (City, Year, Category, Score) VALUES ('Beijing', 2020, 'Public Transportation', 70), ('Beijing', 2020, 'Public Transportation', 75); | What was the average citizen feedback score for public transportation in Beijing in 2020? | SELECT AVG(Score) FROM Feedback WHERE City = 'Beijing' AND Year = 2020 AND Category = 'Public Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE trainings (id INT, region VARCHAR(10), quarter INT, year INT, sessions INT); INSERT INTO trainings (id, region, quarter, year, sessions) VALUES (1, 'APAC', 1, 2021, 5); INSERT INTO trainings (id, region, quarter, year, sessions) VALUES (2, 'EMEA', 2, 2021, 10); INSERT INTO trainings (id, region, quarter, year, sessions) VALUES (3, 'AMER', 3, 2021, 15); INSERT INTO trainings (id, region, quarter, year, sessions) VALUES (4, 'APAC', 4, 2021, 20); | How many training sessions were conducted in the APAC region in Q3 2021? | SELECT SUM(sessions) as total_sessions FROM trainings WHERE region = 'APAC' AND quarter = 3 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(20), num_circular_products INT); INSERT INTO suppliers (supplier_id, supplier_name, num_circular_products) VALUES (1, 'Supplier A', 10), (2, 'Supplier B', 5), (3, 'Supplier C', 15), (4, 'Supplier D', 20), (5, 'Supplier E', 2); | Who are the top 5 suppliers with the most products that are part of a circular supply chain? | SELECT supplier_name, num_circular_products FROM suppliers ORDER BY num_circular_products DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE LakeFarm1 (species VARCHAR(20), biomass FLOAT); INSERT INTO LakeFarm1 (species, biomass) VALUES ('Catfish', 1200), ('Bass', 1500), ('Carp', 1800); | What is the total biomass (kg) for each species in LakeFarm1? | SELECT species, SUM(biomass) FROM LakeFarm1 GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_applications (app_name VARCHAR(255), user_interactions INT); INSERT INTO creative_ai_applications (app_name, user_interactions) VALUES ('App A', 50), ('App B', 150), ('App C', 120), ('App D', 75); | Which creative AI applications have more than 100 user interactions? | SELECT app_name, user_interactions FROM creative_ai_applications WHERE user_interactions > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE membership_info (member_id INT, country VARCHAR(50)); INSERT INTO membership_info (member_id, country) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'), (4, 'Brazil'), (5, 'Argentina'); | List the top 3 countries with the highest membership count. | SELECT country, COUNT(*) as membership_count FROM membership_info GROUP BY country ORDER BY membership_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID int, Name varchar(50), Budget money); CREATE TABLE Volunteers (VolunteerID int, Name varchar(50), Age int, ProgramID int); INSERT INTO Programs (ProgramID, Name, Budget) VALUES (1, 'Education', 10000), (2, 'Healthcare', 15000); INSERT INTO Volunteers (VolunteerID, Name, Age, ProgramID) VALUES (1, 'Alice', 25, 1), (2, 'Bob', 22, 1), (3, 'Charlie', 30, 2), (4, 'David', 28, 2); | List the programs and the number of unique volunteers who participated in each program in Q1 2022. | SELECT P.Name, COUNT(DISTINCT V.VolunteerID) as UniqueVolunteers FROM Programs P JOIN Volunteers V ON P.ProgramID = V.ProgramID WHERE MONTH(V.VolunteerDate) BETWEEN 1 AND 3 GROUP BY P.Name; | 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.