context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE buildings (id INT, city VARCHAR, size INT, green_certified BOOLEAN); | What is the average square footage of green-certified buildings in the city of Seattle? | SELECT AVG(size) FROM buildings WHERE city = 'Seattle' AND green_certified = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (name VARCHAR(100), sport VARCHAR(50), country VARCHAR(50), age INT); | Update age of 'Alice Johnson' to 25 in 'athletes' table | UPDATE athletes SET age = 25 WHERE name = 'Alice Johnson'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Age INT, Gender VARCHAR(10), MembershipType VARCHAR(20)); INSERT INTO Members (MemberID, Age, Gender, MembershipType) VALUES (1, 35, 'Female', 'Premium'), (2, 45, 'Male', 'Basic'), (3, 30, 'Female', 'Premium'); CREATE TABLE Workouts (WorkoutID INT, MemberID INT, Duration INT, Workout... | List the top 5 members who have burned the most calories from running workouts. | SELECT m.MemberID, SUM(w.Calories) AS TotalCalories FROM Members m JOIN Workouts w ON m.MemberID = w.MemberID WHERE w.WorkoutType = 'Running' GROUP BY m.MemberID ORDER BY TotalCalories DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satisfaction (Year INT, District VARCHAR(255), Score FLOAT); INSERT INTO Satisfaction (Year, District, Score) VALUES (2022, 'District A', 4.2); INSERT INTO Satisfaction (Year, District, Score) VALUES (2022, 'District B', 4.5); INSERT INTO Satisfaction (Year, District, Score) VALUES (2022, 'District C', 4.3... | What is the average citizen satisfaction score for public services in each district of City X in 2022? | SELECT District, AVG(Score) as AverageScore FROM Satisfaction WHERE Year = 2022 GROUP BY District; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_vehicles (vehicle_id INT, trip_duration FLOAT, start_speed FLOAT, end_speed FLOAT, start_time TIMESTAMP, end_time TIMESTAMP, city VARCHAR(50)); INSERT INTO electric_vehicles (vehicle_id, trip_duration, start_speed, end_speed, start_time, end_time, city) VALUES (1, 30.0, 0.0, 20.0, '2021-01-01 00:0... | What is the total number of electric vehicle trips in Berlin? | SELECT COUNT(*) FROM electric_vehicles WHERE city = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Classes (ClassID int, ClassType varchar(10), ClassDuration int, ClassDate date); INSERT INTO Classes (ClassID, ClassType, ClassDuration, ClassDate) VALUES (1, 'Yoga', 60, '2021-03-01'); | What is the total duration of yoga classes offered in the entire month of March 2021? | SELECT SUM(ClassDuration) FROM Classes WHERE ClassType = 'Yoga' AND MONTH(ClassDate) = 3 AND YEAR(ClassDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE DelayRecords (Id INT, VesselName VARCHAR(50), Area VARCHAR(50), DelayDate DATETIME, Delay INT); | What is the average number of delays for vessels in the Indian Ocean in the past year? | SELECT AVG(Delay) FROM DelayRecords WHERE Area = 'Indian Ocean' AND DelayDate >= DATEADD(YEAR, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (loan_date DATE, loan_type VARCHAR(50), loan_amount DECIMAL(10,2)); | What is the average amount of socially responsible loans issued per month? | SELECT EXTRACT(MONTH FROM loan_date) AS month, AVG(loan_amount) FROM loans WHERE loan_type = 'socially responsible' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name TEXT, country TEXT, production FLOAT); INSERT INTO wells (well_id, well_name, country, production) VALUES (1, 'Well A', 'USA', 1500000); INSERT INTO wells (well_id, well_name, country, production) VALUES (2, 'Well B', 'Canada', 1200000); | Find the number of wells drilled in each country and the total production for each well | SELECT country, COUNT(well_id) AS num_wells, SUM(production) AS total_production FROM wells GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_sources (id INT PRIMARY KEY, source VARCHAR(50), capacity_mw FLOAT, country VARCHAR(50)); INSERT INTO energy_sources (id, source, capacity_mw, country) VALUES (1, 'Wind', 60000.0, 'Germany'), (2, 'Solar', 45000.0, 'Germany'), (3, 'Hydro', 5000.0, 'Germany'); | What is the total installed capacity (in MW) of renewable energy sources in Germany? | SELECT SUM(capacity_mw) FROM energy_sources WHERE source IN ('Wind', 'Solar', 'Hydro') AND country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_certifications (hotel_id INT, certification VARCHAR(50)); INSERT INTO hotel_certifications (hotel_id, certification) VALUES (1, 'GreenLeaders'), (2, 'EarthCheck'), (3, 'GreenGlobe'), (4, 'Sustainable Tourism'); CREATE TABLE hotel_revenue (hotel_id INT, revenue INT, date DATE); INSERT INTO hotel_reven... | What is the total revenue generated by hotels with sustainable tourism certifications in the last 3 months? | SELECT SUM(revenue) FROM hotel_revenue hr JOIN hotel_certifications hc ON hr.hotel_id = hc.hotel_id WHERE hc.certification IN ('GreenLeaders', 'EarthCheck', 'GreenGlobe', 'Sustainable Tourism') AND hr.date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE nutrition_facts (id INT PRIMARY KEY, food VARCHAR(255), calories INT, protein INT, carbs INT, fats INT); CREATE VIEW low_calorie_foods AS SELECT * FROM nutrition_facts WHERE calories < 100; | Delete food 'Apple' from 'nutrition_facts' table | DELETE FROM nutrition_facts WHERE food = 'Apple'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (organization_id INT, name TEXT); INSERT INTO organizations (organization_id, name) VALUES (1, 'World Wildlife Fund'), (2, 'Doctors Without Borders'), (3, 'American Red Cross'), (4, 'UNICEF'); | Insert a new organization with ID 5 and name 'Greenpeace' | INSERT INTO organizations (organization_id, name) VALUES (5, 'Greenpeace'); | gretelai_synthetic_text_to_sql |
CREATE TABLE laboratories (name TEXT, state TEXT, tests_performed INTEGER); INSERT INTO laboratories (name, state, tests_performed) VALUES ('Quest Diagnostics', 'New York', 10000), ('LabCorp', 'New York', 9000), ('BioReference Laboratories', 'New York', 8000); | What is the total number of laboratories in the state of New York? | SELECT COUNT(*) FROM laboratories WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, SupplierName VARCHAR(50), Country VARCHAR(50), Industry VARCHAR(50), SustainabilityRating DECIMAL(3,2), EthicalManufacturing BOOLEAN); INSERT INTO Suppliers (SupplierID, SupplierName, Country, Industry, SustainabilityRating, EthicalManufacturing) VALUES (1, 'Green Supplies Inc.',... | What is the contact information for all suppliers from India who provide textiles and have a sustainability rating above 3.5? | SELECT SupplierName, Country, Industry FROM Suppliers WHERE Country = 'India' AND Industry = 'Textiles' AND SustainabilityRating > 3.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE game (game_id INT, game_title VARCHAR(50), game_genre VARCHAR(20), revenue INT); INSERT INTO game (game_id, game_title, game_genre, revenue) VALUES (1, 'League of Legends', 'MOBA', 1000000); INSERT INTO game (game_id, game_title, game_genre, revenue) VALUES (2, 'Mario Kart', 'Racing', 500000); INSERT INTO ... | What is the total revenue generated from VR games? | SELECT SUM(revenue) FROM game WHERE game_genre = 'VR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country_Renewable_Energy (country VARCHAR(255), capacity INT); INSERT INTO Country_Renewable_Energy (country, capacity) VALUES ('Germany', 100000), ('Spain', 55000), ('Brazil', 125000), ('India', 90000); | Identify the top 3 countries with the highest installed renewable energy capacity, ranked by capacity in descending order. | SELECT country, capacity FROM (SELECT country, capacity, RANK() OVER (ORDER BY capacity DESC) AS rank FROM Country_Renewable_Energy) AS ranked_countries WHERE rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (id INT, name VARCHAR(100), country VARCHAR(50), year INT); | List the top 3 countries with the highest number of eSports events in 2022. | SELECT country, COUNT(*) FROM Events WHERE year = 2022 GROUP BY country ORDER BY COUNT(*) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo (id INT, vessel_name VARCHAR(255), vessel_type VARCHAR(255), cargo_weight INT, port VARCHAR(255), unload_date DATE); INSERT INTO cargo (id, vessel_name, vessel_type, cargo_weight, port, unload_date) VALUES (1, 'VesselA', 'Tanker', 25000, 'Colombo', '2022-02-10'); | What is the total cargo weight transported by each vessel type in the Indian Ocean, ordered by the total weight? | SELECT vessel_type, SUM(cargo_weight) as total_weight FROM cargo WHERE port IN ('Mumbai', 'Colombo', 'Durban', 'Maputo', 'Mombasa') GROUP BY vessel_type ORDER BY total_weight DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE alternative_justice_tx (case_id INT, state VARCHAR(20)); INSERT INTO alternative_justice_tx VALUES (1, 'Texas'), (2, 'Texas'), (3, 'Texas'); CREATE TABLE alternative_justice_fl (case_id INT, state VARCHAR(20)); INSERT INTO alternative_justice_fl VALUES (4, 'Florida'), (5, 'Florida'), (6, 'Florida'); | How many criminal cases were resolved through alternative justice measures in Texas and Florida? | SELECT COUNT(*) FROM alternative_justice_tx UNION ALL SELECT COUNT(*) FROM alternative_justice_fl; | gretelai_synthetic_text_to_sql |
CREATE TABLE GarmentProduction (garment_type VARCHAR(50), quantity INT); INSERT INTO GarmentProduction (garment_type, quantity) VALUES ('T-Shirt', 500), ('Jeans', 300), ('Hoodie', 200); | List all garment types and their respective production quantities from the 'GarmentProduction' table, ordered by production quantity in descending order. | SELECT garment_type, quantity FROM GarmentProduction ORDER BY quantity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_manufacturing (manufacturer_id INT, certification_status TEXT); INSERT INTO ethical_manufacturing (manufacturer_id, certification_status) VALUES (1, 'Fair Trade Pending'), (2, 'Not Certified'), (3, 'Fair Trade Certified'), (4, 'ManufacturerD'), (5, 'ManufacturerE'), (6, 'ManufacturerF'), (7, 'Manuf... | Delete the record for 'ManufacturerI' from the ethical_manufacturing table as they are not a valid manufacturer. | DELETE FROM ethical_manufacturing WHERE manufacturer_id = 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ports (PortID INT, PortName VARCHAR(50)); CREATE TABLE Incidents (IncidentID INT, IncidentType VARCHAR(50), PortID INT, IncidentDate DATE); INSERT INTO Ports (PortID, PortName) VALUES (1, 'PortA'), (2, 'PortB'); INSERT INTO Incidents (IncidentID, IncidentType, PortID, IncidentDate) VALUES (1, 'Collision', ... | List all ports and the number of safety incidents that occurred there in the last month | SELECT PortName, COUNT(*) FROM Incidents INNER JOIN Ports ON Incidents.PortID = Ports.PortID WHERE IncidentDate >= DATEADD(month, -1, GETDATE()) GROUP BY PortName; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, type TEXT, status TEXT, last_inspection_date DATE); INSERT INTO vessels (id, name, type, status, last_inspection_date) VALUES (1, 'Vessel A', 'Cargo', 'Non-compliant', '2021-03-15'); INSERT INTO vessels (id, name, type, status, last_inspection_date) VALUES (2, 'Vessel B', 'Tanke... | List all vessels that have not complied with maritime law in the Mediterranean sea since 2020-01-01? | SELECT name FROM vessels WHERE status = 'Non-compliant' AND last_inspection_date < '2020-01-01' AND location = 'Mediterranean sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, category VARCHAR(20), completed DATE); INSERT INTO Infrastructure (id, category, completed) VALUES (1, 'UrbanDevelopment', '2020-01-01'), (2, 'WaterSupply', '2019-01-01'), (3, 'UrbanDevelopment', '2021-01-01'), (4, 'RenewableEnergy', '2020-05-01'); | How many projects were completed in 'UrbanDevelopment' and 'RenewableEnergy' categories? | SELECT COUNT(*) FROM Infrastructure WHERE category IN ('UrbanDevelopment', 'RenewableEnergy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidification_levels (location TEXT, acidification_level REAL, measurement_date DATE); CREATE TABLE arctic_region (region_name TEXT, region_description TEXT); | What is the minimum ocean acidification level recorded in the Arctic region in the last 5 years?" | SELECT MIN(oal.acidification_level) FROM ocean_acidification_levels oal INNER JOIN arctic_region ar ON oal.location LIKE '%Arctic%' AND oal.measurement_date >= (CURRENT_DATE - INTERVAL '5 years'); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists cybersecurity_strategies (region VARCHAR(50), strategy_name VARCHAR(50), year INT); | Which cybersecurity strategies have been implemented in the 'North' region since 2016? | SELECT strategy_name FROM cybersecurity_strategies WHERE region = 'North' AND year >= 2016; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artifacts (ArtifactID INT, ArtifactType VARCHAR(50), Quantity INT); INSERT INTO Artifacts (ArtifactID, ArtifactType, Quantity) VALUES (1, 'Pottery', 25), (2, 'Tools', 12), (3, 'Pottery', 30); | Update artifact quantities based on their type? | UPDATE Artifacts SET Quantity = CASE ArtifactType WHEN 'Pottery' THEN Quantity * 1.1 WHEN 'Tools' THEN Quantity * 1.2 END; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (id INT, student_id INT, accommodation_type VARCHAR(255), cost FLOAT); INSERT INTO accommodations (id, student_id, accommodation_type, cost) VALUES (1, 123, 'visual_aids', 250.0), (2, 456, 'audio_aids', 100.0), (3, 789, 'large_print_materials', 120.0), (4, 890, 'mobility_aids', 300.0); | Delete all records with accommodation type "large_print_materials" from the "accommodations" table | DELETE FROM accommodations WHERE accommodation_type = 'large_print_materials'; | gretelai_synthetic_text_to_sql |
CREATE TABLE flight_emissions (flight_number VARCHAR(255), origin VARCHAR(255), destination VARCHAR(255), year INT, co2_emission INT); INSERT INTO flight_emissions (flight_number, origin, destination, year, co2_emission) VALUES ('QF1', 'Los Angeles, USA', 'Sydney, Australia', 2015, 113000), ('CX1', 'Hong Kong, China', ... | What is the average CO2 emission per international flight arriving in Australia? | SELECT AVG(co2_emission) FROM flight_emissions WHERE destination = 'Sydney, Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_info (policy_id INT, premium FLOAT, sum_insured INT); INSERT INTO policy_info (policy_id, premium, sum_insured) VALUES (1, 1200.50, 60000), (2, 2500.00, 70000), (3, 1800.00, 90000); | Select the policy_id, premium, sum_insured from policy_info where sum_insured > 50000 | SELECT policy_id, premium, sum_insured FROM policy_info WHERE sum_insured > 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_emissions (year INT, region VARCHAR(255), emissions_reduction FLOAT); INSERT INTO carbon_emissions (year, region, emissions_reduction) VALUES (2020, 'Africa', 200), (2020, 'Europe', 300), (2021, 'Africa', 250); | What was the total carbon emissions reduction due to energy efficiency measures in Africa in 2020? | SELECT emissions_reduction FROM carbon_emissions WHERE year = 2020 AND region = 'Africa' | gretelai_synthetic_text_to_sql |
Ingredients (ingredient_id, name, source, last_updated) | Find ingredients sourced from a specific country | SELECT * FROM Ingredients WHERE source LIKE '%country%' | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (article_id INT, city VARCHAR(255)); | What are the top 3 cities with the most news articles published about them in the "news_articles" table, and their corresponding article counts? | SELECT city, COUNT(*) AS article_count FROM news_articles GROUP BY city ORDER BY article_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Gulf_of_Mexico_Pollution (pollutant TEXT, frequency INTEGER); INSERT INTO Gulf_of_Mexico_Pollution (pollutant, frequency) VALUES ('Oil Spills', 32), ('Plastic Waste', 55); | What are the most common types of ocean pollution in the Gulf of Mexico? | SELECT pollutant, frequency FROM Gulf_of_Mexico_Pollution ORDER BY frequency DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT PRIMARY KEY, operation_name VARCHAR(50), location VARCHAR(50), num_employees INT); | What is the maximum number of employees in a single mining operation? | SELECT MAX(num_employees) FROM mining_operations; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (location varchar(255), date date); INSERT INTO incidents (location, date) VALUES ('Pacific Ocean', '2021-08-23'), ('Atlantic Ocean', '2022-02-12'), ('Indian Ocean', '2021-11-18'); | How many maritime safety incidents occurred in the Pacific Ocean in the last year? | SELECT COUNT(*) FROM incidents WHERE location = 'Pacific Ocean' AND date >= '2021-01-01' AND date < '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers(subscriber_id INT, last_complaint_date DATE); INSERT INTO mobile_subscribers(subscriber_id, last_complaint_date) VALUES (1, '2021-07-01'), (2, '2021-02-15'), (3, '2021-05-05'), (4, '2021-12-31'); CREATE TABLE broadband_subscribers(subscriber_id INT, last_complaint_date DATE); INSERT INTO... | What is the total number of mobile and broadband subscribers who have not made a complaint in the last 6 months? | SELECT COUNT(*) FROM (SELECT subscriber_id FROM mobile_subscribers WHERE last_complaint_date < DATEADD(month, -6, GETDATE()) EXCEPT SELECT subscriber_id FROM broadband_subscribers WHERE last_complaint_date < DATEADD(month, -6, GETDATE())); | gretelai_synthetic_text_to_sql |
CREATE TABLE public.green_buildings (id SERIAL PRIMARY KEY, building_name VARCHAR(255), energy_efficiency_rating INTEGER); INSERT INTO public.green_buildings (building_name, energy_efficiency_rating) VALUES ('SolarTower', 98), ('WindScraper', 97), ('GeoDome', 96); | Update the energy efficiency rating of a green building in the green_buildings table | WITH updated_rating AS (UPDATE public.green_buildings SET energy_efficiency_rating = 99 WHERE building_name = 'SolarTower' RETURNING *) INSERT INTO public.green_buildings (id, building_name, energy_efficiency_rating) SELECT id, building_name, 99 FROM updated_rating; | gretelai_synthetic_text_to_sql |
CREATE TABLE Venus_Missions (Mission_ID INT, Mission_Name VARCHAR(50), Country VARCHAR(50), Launch_Year INT, PRIMARY KEY (Mission_ID)); INSERT INTO Venus_Missions (Mission_ID, Mission_Name, Country, Launch_Year) VALUES (1, 'Venera 7', 'Soviet Union', 1970), (2, 'Magellan', 'United States', 1989), (3, 'Akatsuki', 'Japan... | Which countries participated in space exploration missions to Venus? | SELECT DISTINCT Country FROM Venus_Missions; | gretelai_synthetic_text_to_sql |
CREATE TABLE district (name VARCHAR(20), income FLOAT); INSERT INTO district (name, income) VALUES ('North', 45000.0), ('East', 50000.0), ('West', 40000.0), ('South', 55000.0), ('East', 53000.0), ('West', 42000.0); | What is the average income in the "East" and "West" districts? | SELECT AVG(income) FROM district WHERE name IN ('East', 'West'); | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (claim_id INT, policy_number INT, claim_amount DECIMAL(10,2), claim_date DATE); | List policy numbers, claim amounts, and claim dates for claims that were processed between '2020-01-01' and '2020-12-31' | SELECT policy_number, claim_amount, claim_date FROM claims WHERE claim_date BETWEEN '2020-01-01' AND '2020-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather (country VARCHAR(255), region VARCHAR(255), month INT, temperature FLOAT, precipitation FLOAT); INSERT INTO weather (country, region, month, temperature, precipitation) VALUES ('Brazil', 'Northeast', 6, 25.3, 120.5); | What is the average temperature and precipitation in Brazil's Northeast region in June? | SELECT AVG(temperature), AVG(precipitation) FROM weather WHERE country = 'Brazil' AND region = 'Northeast' AND month = 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO employees (id, name, department) VALUES (1, 'John Doe', 'Compliance'), (2, 'Jane Smith', 'Risk Management'); CREATE TABLE transactions (employee_id INT, transaction_count INT); INSERT INTO transactions (employee_id, transaction_count... | How many transactions were made by each employee in the Compliance department? | SELECT e.name, SUM(t.transaction_count) as total_transactions FROM employees e JOIN transactions t ON e.id = t.employee_id GROUP BY e.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, site_name VARCHAR(255), environmental_impact_score INT); INSERT INTO mining_sites (id, site_name, environmental_impact_score) VALUES (1, 'Site A', 80), (2, 'Site B', 60), (3, 'Site C', 90); CREATE TABLE accidents (id INT, mining_site_id INT, accident_count INT); INSERT INTO accidents ... | List all mining sites with their respective environmental impact scores and the number of accidents that occurred at each site. | SELECT s.site_name, s.environmental_impact_score, COALESCE(a.accident_count, 0) as total_accidents FROM mining_sites s LEFT JOIN accidents a ON s.id = a.mining_site_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (GameID INT, MaxPlayers INT, Players INT); INSERT INTO Games (GameID, MaxPlayers, Players) VALUES (1, 10, 5); | What is the maximum number of players in a multiplayer game? | SELECT MAX(MaxPlayers) FROM Games; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(50), runtime INT, country VARCHAR(50)); | Find all the titles in the movies table that have a runtime over 180 minutes and were produced in the US or Canada. | SELECT title FROM movies WHERE runtime > 180 AND (country = 'US' OR country = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerDailyPlaytime (PlayerID INT, PlayDate DATE, Playtime INT); INSERT INTO PlayerDailyPlaytime (PlayerID, PlayDate, Playtime) VALUES (1, '2022-01-01', 100); INSERT INTO PlayerDailyPlaytime (PlayerID, PlayDate, Playtime) VALUES (2, '2022-01-02', 150); | What is the average playtime per day for each player, in the past month? | SELECT PlayerID, AVG(Playtime) as AvgPlaytime FROM PlayerDailyPlaytime WHERE PlayDate >= '2022-01-01' AND PlayDate <= '2022-01-31' GROUP BY PlayerID | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (id INT, department VARCHAR(50), budget INT); | What is the total budget for defense diplomacy by each department, only for departments that have spent more than $5 million? | SELECT department, SUM(budget) FROM DefenseDiplomacy GROUP BY department HAVING SUM(budget) > 5000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT, Budget DECIMAL(10,2), FocusArea TEXT); | What is the total budget for programs focused on environmental sustainability? | SELECT SUM(Budget) FROM Programs WHERE FocusArea = 'Environmental Sustainability'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (ArtworkID INT, ArtworkName VARCHAR(100)); CREATE TABLE Visits (VisitID INT, VisitorID INT, ArtworkID INT, VisitDate DATE, Gender VARCHAR(10)); INSERT INTO Artworks (ArtworkID, ArtworkName) VALUES (1, 'Mona Lisa'), (2, 'Starry Night'), (3, 'Sunflowers'), (4, 'David'); INSERT INTO Visits (VisitID, ... | Which artworks were visited the most by female visitors? | SELECT A.ArtworkName, COUNT(*) AS Visits FROM Artworks A JOIN Visits B ON A.ArtworkID = B.ArtworkID WHERE Gender = 'Female' GROUP BY A.ArtworkName ORDER BY Visits DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE AdoptionStatistics (Id INT, Country VARCHAR(100), Year INT, AdoptionRate FLOAT); INSERT INTO AdoptionStatistics (Id, Country, Year, AdoptionRate) VALUES (5, 'Norway', 2018, 61.5), (6, 'Sweden', 2018, 7.0), (7, 'Norway', 2019, 65.7), (8, 'Sweden', 2019, 9.0); | What is the median adoption rate of electric vehicles in Europe? | SELECT MEDIAN(AdoptionRate) FROM AdoptionStatistics WHERE Country IN ('Norway', 'Sweden') AND Year >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (state VARCHAR(255), year INT, capacity INT); INSERT INTO landfill_capacity (state, year, capacity) VALUES ('New York', 2020, 50000), ('New York', 2020, 60000), ('New York', 2020, 40000); | What is the maximum landfill capacity in the state of New York in 2020? | SELECT MAX(capacity) FROM landfill_capacity WHERE state = 'New York' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs_2 (id INT, title TEXT, rating FLOAT, genre TEXT); INSERT INTO songs_2 (id, title, rating, genre) VALUES (1, 'Song1', 4.8, 'hip-hop'), (2, 'Song2', 4.5, 'hip-hop'); | What is the maximum rating of songs in the 'hip-hop' genre? | SELECT MAX(rating) FROM songs_2 WHERE genre = 'hip-hop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_engagement (ce_id INT, country_id INT, year INT, participants INT); INSERT INTO community_engagement VALUES (1, 1, 2015, 5000), (2, 1, 2016, 5500), (3, 2, 2015, 7000), (4, 2, 2016, 8000), (5, 3, 2015, 6000), (6, 3, 2016, 7000); | Which countries have the most community engagement? | SELECT country_id, SUM(participants) FROM community_engagement GROUP BY country_id ORDER BY SUM(participants) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name TEXT, nationality TEXT, birth_year INT, death_year INT); INSERT INTO Artists (id, name, nationality, birth_year, death_year) VALUES (1, 'Claude Monet', 'French', 1840, 1926), (2, 'Paul Cezanne', 'French', 1839, 1906); | How many artworks were created by artists from France in the 19th century? | SELECT COUNT(*) FROM Artists WHERE nationality = 'French' AND birth_year <= 1900 AND death_year >= 1800; | gretelai_synthetic_text_to_sql |
CREATE TABLE Social_Budget (half INT, year INT, amount INT); INSERT INTO Social_Budget (half, year, amount) VALUES (1, 2021, 400000), (2, 2021, 500000), (1, 2022, 450000), (2, 2022, 550000); | What was the total budget allocated for social services in H1 2021? | SELECT SUM(amount) as Total_Budget FROM Social_Budget WHERE half = 1 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID INT, VesselName VARCHAR(50), Manufacturer VARCHAR(50)); INSERT INTO Vessels (VesselID, VesselName, Manufacturer) VALUES (1, 'Ocean Titan', 'ABC Shipyard'), (2, 'Maritime Queen', 'Indian Ocean Shipbuilders'); CREATE TABLE SafetyInspections (InspectionID INT, VesselID INT, InspectionDate DA... | Update the compliance status to 'Non-Compliant' for vessels that have not been inspected in the last year. | UPDATE Vessels v INNER JOIN SafetyInspections s ON v.VesselID = s.VesselID SET v.ComplianceStatus = 'Non-Compliant' WHERE s.InspectionDate < DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (id INT, well_name VARCHAR(255), location VARCHAR(255), drill_year INT, company VARCHAR(255)); INSERT INTO wells (id, well_name, location, drill_year, company) VALUES (1, 'Well001', 'Texas', 2020, 'CompanyA'); INSERT INTO wells (id, well_name, location, drill_year, company) VALUES (2, 'Well002', 'Col... | Find the number of wells drilled by CompanyD | SELECT COUNT(*) FROM wells WHERE company = 'CompanyD'; | gretelai_synthetic_text_to_sql |
CREATE TABLE injuries (id INT, industry VARCHAR(255), injury_date DATE, rate DECIMAL(5, 2)); INSERT INTO injuries (id, industry, injury_date, rate) VALUES (1, 'Manufacturing', '2022-01-01', 4.5), (2, 'Construction', '2022-02-15', 6.2), (3, 'Manufacturing', '2022-03-05', 4.8), (4, 'Construction', '2022-04-10', 5.9), (5,... | What is the three-month rolling average of workplace injury rates, partitioned by industry? | SELECT industry, AVG(rate) OVER (PARTITION BY industry ORDER BY injury_date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) as rolling_avg FROM injuries; | gretelai_synthetic_text_to_sql |
CREATE TABLE coal_mines (mine_name VARCHAR(50), yearly_production INT); INSERT INTO coal_mines (mine_name, yearly_production) VALUES ('ABC Coal Mine', 550000), ('DEF Coal Mine', 400000), ('GHI Coal Mine', 600000); | List all unique mine_names from 'coal_mines' table where 'yearly_production' is greater than 500000? | SELECT mine_name FROM coal_mines WHERE yearly_production > 500000; | gretelai_synthetic_text_to_sql |
vessel_voyage(voyage_id, cargo_type, cargo_weight) | Update the cargo type of voyage V007 to 'containers' | UPDATE vessel_voyage SET cargo_type = 'containers' WHERE voyage_id = 'V007'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workers (Id INT, Name VARCHAR(50), ProjectId INT, Hours FLOAT, State VARCHAR(50)); INSERT INTO Workers (Id, Name, ProjectId, Hours, State) VALUES (1, 'John Doe', 1, 80, 'California'); | Who are the top 5 construction workers with the most working hours in California? | SELECT Name, SUM(Hours) AS TotalHours FROM Workers WHERE State = 'California' GROUP BY Name ORDER BY TotalHours DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_development (id INT, sensor_type VARCHAR(50), data TEXT, date DATE); INSERT INTO biosensor_development (id, sensor_type, data, date) VALUES (1, 'optical', 'Sensor data 1', '2022-01-01'); INSERT INTO biosensor_development (id, sensor_type, data, date) VALUES (2, 'electrochemical', 'Sensor data 2',... | Show the biosensor technology development data for the most recent date in the biosensor_development table | SELECT * FROM biosensor_development WHERE date = (SELECT MAX(date) FROM biosensor_development); | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales (sale_date DATE, customer_country VARCHAR(50), sale_value INT); CREATE TABLE Geopolitical_Risk_Assessments (assessment_date DATE, customer_country VARCHAR(50), risk_score INT); INSERT INTO Military_Equipment_Sales (sale_date, customer_country, sale_value) VALUES ('2018-01-01', 'Rus... | What is the geopolitical risk assessment score for Russia on the latest military equipment sale date? | SELECT R.customer_country, MAX(M.sale_date) AS latest_sale_date, R.risk_score AS risk_assessment_score FROM Military_Equipment_Sales M JOIN Geopolitical_Risk_Assessments R ON M.customer_country = R.customer_country WHERE M.sale_date = (SELECT MAX(sale_date) FROM Military_Equipment_Sales) GROUP BY R.customer_country, R.... | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), num_employees INT, environmental_impact_score INT); | Find the mining operations that have a high environmental impact score and also a low number of employees. | SELECT name FROM mining_operations WHERE num_employees < (SELECT AVG(num_employees) FROM mining_operations) AND environmental_impact_score > (SELECT AVG(environmental_impact_score) FROM mining_operations); | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouses (WarehouseID INT, WarehouseName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Warehouses (WarehouseID, WarehouseName, Country) VALUES (1, 'Seoul Warehouse', 'South Korea'); CREATE TABLE Shipments (ShipmentID INT, WarehouseID INT, DeliveryTime INT); | What is the average delivery time for shipments from South Korea, partitioned by warehouse? | SELECT WarehouseID, AVG(DeliveryTime) OVER (PARTITION BY WarehouseID) AS AvgDeliveryTime FROM Shipments WHERE Country = 'South Korea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_budget (state VARCHAR(20), service VARCHAR(20), allocation INT); INSERT INTO state_budget (state, service, allocation) VALUES ('Sunshine', 'Healthcare', 1500000), ('Sunshine', 'Education', 2000000); | What are the total budget allocations for healthcare and education services in the state of 'Sunshine'? | SELECT SUM(allocation) FROM state_budget WHERE state = 'Sunshine' AND service IN ('Healthcare', 'Education'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Equipment (Id INT, Name VARCHAR(50), Type VARCHAR(50), Agency VARCHAR(50), Cost FLOAT); INSERT INTO Equipment (Id, Name, Type, Agency, Cost) VALUES (1, 'M1 Abrams', 'Tank', 'Army', 8000000); INSERT INTO Equipment (Id, Name, Type, Agency, Cost) VALUES (2, 'F-35', 'Fighter Jet', 'Air Force', 100000000); INSE... | What is the total cost of military equipment for the Air Force? | SELECT SUM(Cost) FROM Equipment WHERE Agency = 'Air Force'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, name VARCHAR(20), type VARCHAR(10)); INSERT INTO cities VALUES (1, 'CityA', 'Urban'), (2, 'CityB', 'Rural'); CREATE TABLE budget_allocation (service VARCHAR(20), city_id INT, amount INT); INSERT INTO budget_allocation VALUES ('Healthcare', 1, 500000), ('Healthcare', 2, 300000), ('Education'... | What is the average budget allocation for healthcare services in urban areas? | SELECT AVG(amount) FROM budget_allocation WHERE service = 'Healthcare' AND city_id IN (SELECT id FROM cities WHERE type = 'Urban'); | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, artist_name VARCHAR(100), gender VARCHAR(10)); INSERT INTO artists (artist_id, artist_name, gender) VALUES (1, 'Taylor Swift', 'Female'), (2, 'Ed Sheeran', 'Male'), (3, 'Kendrick Lamar', 'Male'), (4, 'Ariana Grande', 'Female'); CREATE TABLE songs (song_id INT, song_name VARCHAR(100)... | How many songs were released by 'Female Artists' in the 'Pop' genre before 2010? | SELECT COUNT(*) FROM songs s INNER JOIN artists a ON s.artist_id = a.artist_id WHERE a.gender = 'Female' AND s.genre = 'Pop' AND s.release_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_species (id INT, species TEXT, sustainable BOOLEAN); CREATE TABLE farm_species (farm_id INT, species_id INT); INSERT INTO fish_species (id, species, sustainable) VALUES (1, 'Salmon', TRUE); INSERT INTO fish_species (id, species, sustainable) VALUES (2, 'Cod', FALSE); INSERT INTO farm_species (farm_id,... | List all fish species raised in sustainable farms in Norway. | SELECT species FROM fish_species fs JOIN farm_species fss ON fs.id = fss.species_id WHERE fss.farm_id IN (SELECT id FROM farms WHERE country = 'Norway' AND sustainable = TRUE); | gretelai_synthetic_text_to_sql |
CREATE TABLE critical_habitats (id INT, habitat_name VARCHAR(50), animal_name VARCHAR(50)); INSERT INTO critical_habitats VALUES (1, 'Rainforest', 'Jaguar'), (2, 'Savannah', 'Lion'); | What is the number of distinct habitats in 'critical_habitats' table? | SELECT COUNT(DISTINCT habitat_name) FROM critical_habitats; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, gender TEXT, sector TEXT, salary FLOAT); INSERT INTO employees (id, gender, sector, salary) VALUES (1, 'Female', 'Education', 50000.00), (2, 'Male', 'Healthcare', 60000.00), (3, 'Female', 'Education', 55000.00), (4, 'Male', 'Technology', 70000.00); | What is the average salary of female employees in the education sector? | SELECT AVG(salary) FROM employees WHERE gender = 'Female' AND sector = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT, name VARCHAR(255), area INT);CREATE TABLE animals (id INT, habitat_id INT, species VARCHAR(255)); INSERT INTO habitats (id, name, area) VALUES (1, 'Rainforest', 10000), (2, 'Savannah', 15000), (3, 'Mountains', 20000); INSERT INTO animals (id, habitat_id, species) VALUES (1, 1, 'Monkey'), ... | Calculate the total number of animals in each habitat, along with the total area, and display only habitats with more than 50 animals | SELECT h.name, SUM(h.area), COUNT(a.id) AS animal_count FROM habitats h INNER JOIN animals a ON h.id = a.habitat_id GROUP BY h.name HAVING COUNT(a.id) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT PRIMARY KEY, product_name TEXT, product_type TEXT, brand_id INT, is_organic BOOLEAN, price DECIMAL); INSERT INTO products (product_id, product_name, product_type, brand_id, is_organic, price) VALUES (1, 'Cleanser', 'Skincare', 1, true, 19.99), (2, 'Toner', 'Skincare', 2, true, 15.9... | What is the average price of organic skincare products? | SELECT AVG(price) FROM products WHERE product_type = 'Skincare' AND is_organic = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_plants (id INT, name TEXT, country TEXT, capacity FLOAT); INSERT INTO renewable_energy_plants (id, name, country, capacity) VALUES (1, 'Plant 1', 'USA', 75.0), (2, 'Plant 2', 'USA', 120.0); | What is the average capacity of renewable energy plants in the United States? | SELECT AVG(capacity) FROM renewable_energy_plants WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Field7 (date DATE, temperature FLOAT); INSERT INTO Field7 VALUES ('2021-07-01', 25), ('2021-07-02', 22); CREATE TABLE Field8 (date DATE, temperature FLOAT); INSERT INTO Field8 VALUES ('2021-07-01', 27), ('2021-07-02', 23); | What is the average temperature difference between Field7 and Field8 for each day in the month of July? | SELECT AVG(f7.temperature - f8.temperature) as avg_temperature_difference FROM Field7 f7 INNER JOIN Field8 f8 ON f7.date = f8.date WHERE EXTRACT(MONTH FROM f7.date) = 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPersonnel (id INT, name VARCHAR(100), rank VARCHAR(50), service VARCHAR(50), age INT); INSERT INTO MilitaryPersonnel (id, name, rank, service, age) VALUES (1, 'John Doe', 'Colonel', 'Air Force', 45); INSERT INTO MilitaryPersonnel (id, name, rank, service, age) VALUES (2, 'Jane Smith', 'Captain', 'N... | What is the average age of military personnel in the 'Air Force'? | SELECT AVG(age) FROM MilitaryPersonnel WHERE service = 'Air Force'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, rating FLOAT); INSERT INTO products (product_id, rating) VALUES (1, 4.5), (2, 4.8), (3, 3.2); | How many products have a rating of 4.8 or higher? | SELECT COUNT(*) FROM products WHERE rating >= 4.8; | gretelai_synthetic_text_to_sql |
CREATE TABLE TeacherProfessionalDevelopment (TeacherID INT, District VARCHAR(50), Date DATE, Hours INT); INSERT INTO TeacherProfessionalDevelopment (TeacherID, District, Date, Hours) VALUES (1, 'Urban Education', '2022-01-01', 10), (2, 'Suburban Education', '2022-01-15', 15), (3, 'Rural Education', '2022-02-01', 20); | What is the total number of hours of professional development completed by teachers in each district in the last quarter? | SELECT District, SUM(Hours) FROM TeacherProfessionalDevelopment WHERE Date >= DATEADD(quarter, -1, GETDATE()) GROUP BY District; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments_extended (id INT, department TEXT, worker INT); INSERT INTO departments_extended (id, department, worker) VALUES (1, 'mining', 250), (2, 'geology', 180), (3, 'drilling', 200); | How many workers are employed in each department?' | SELECT department, SUM(worker) AS total_workers FROM departments_extended GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (product_id VARCHAR(10), sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO sales (product_id, sale_date, revenue) VALUES ('XYZ123', '2022-01-01', 500), ('XYZ123', '2022-01-15', 700), ('XYZ123', '2022-03-03', 600); | What are the total sales for product 'XYZ123' in Q1 2022? | SELECT SUM(revenue) FROM sales WHERE product_id = 'XYZ123' AND sale_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapy_sessions (session_id INT, patient_id INT, therapist_id INT, session_date DATE, session_duration TIME); | What is the average session duration for therapy sessions that took place in the therapy_sessions table? | SELECT AVG(session_duration) FROM therapy_sessions; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_sales (sale_id int, sale_date date, is_ethical boolean, revenue decimal); | What is the monthly trend of ethical product sales in the past 2 years? | SELECT DATEPART(YEAR, sale_date) AS year, DATEPART(MONTH, sale_date) AS month, SUM(revenue) AS total_revenue FROM ethical_sales WHERE is_ethical = true GROUP BY DATEPART(YEAR, sale_date), DATEPART(MONTH, sale_date) ORDER BY year, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Defense_Contracts (ID INT, Quarter VARCHAR(50), Year INT, Amount INT); INSERT INTO Defense_Contracts (ID, Quarter, Year, Amount) VALUES (1, 'Q1', 2017, 1500000), (2, 'Q1', 2019, 2000000), (3, 'Q2', 2018, 1750000); | What was the total amount spent on defense contracts in Q1 of 2019? | SELECT Amount FROM Defense_Contracts WHERE Quarter = 'Q1' AND Year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (id INT, state VARCHAR(20)); CREATE TABLE Claims (claim_id INT, policyholder_id INT, amount FLOAT); | What is the sum of all claim amounts for policyholders residing in 'Texas'? | SELECT SUM(amount) FROM Claims INNER JOIN Policyholders ON Claims.policyholder_id = Policyholders.id WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT, dish_name VARCHAR(255), added_date DATE, price DECIMAL(5,2), original_price DECIMAL(5,2)); INSERT INTO dishes (dish_id, dish_name, added_date, price, original_price) VALUES (1, 'Margherita Pizza', '2022-01-01', 14.99, 12.99), (2, 'Chicken Alfredo', '2022-01-01', 15.99, 15.99), (3, 'Cae... | Identify dishes with a price increase of more than 10% since they were added | SELECT dish_id, dish_name, price, ROUND((price - original_price) / original_price * 100, 2) as price_increase_percentage FROM dishes WHERE (price - original_price) / original_price * 100 > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtworksDecade (ArtworkID INT, Name VARCHAR(100), Artist VARCHAR(100), Decade INT); | How many artworks were created in each decade of the 20th century? | SELECT Decade, COUNT(*) as ArtworksCount FROM (SELECT FLOOR(YearCreated / 10) * 10 as Decade, Name, Artist FROM Artworks WHERE YearCreated BETWEEN 1901 AND 2000) tmp GROUP BY Decade; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensors (id INT, organization TEXT, biosensor_count INT); INSERT INTO biosensors (id, organization, biosensor_count) VALUES (1, 'BioSense', 15); INSERT INTO biosensors (id, organization, biosensor_count) VALUES (2, 'BioTech Sensors', 25); | How many biosensors were developed by 'BioTech Sensors'? | SELECT biosensor_count FROM biosensors WHERE organization = 'BioTech Sensors'; | gretelai_synthetic_text_to_sql |
CREATE TABLE crimes (id INT, city VARCHAR(20), year INT, crime_type VARCHAR(20), number_of_crimes INT); | What is the total number of crimes committed in the city of Miami in the year 2020, grouped by crime type? | SELECT crime_type, SUM(number_of_crimes) FROM crimes WHERE city = 'Miami' AND year = 2020 GROUP BY crime_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet_management (id INT PRIMARY KEY, vessel_id INT, maintenance_type VARCHAR(255), maintenance_date DATE, is_complete BOOLEAN); | Update the maintenance status for a specific fleet management record in the "fleet_management" table | UPDATE fleet_management SET is_complete = false WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_equity_metrics (id INT, metric_name VARCHAR(50), metric_value INT, date DATE); INSERT INTO health_equity_metrics (id, metric_name, metric_value, date) VALUES (1, 'Accessibility Index', 85, '2021-01-01'), (2, 'Healthcare Quality Score', 78, '2021-01-01'); CREATE TABLE regions (id INT, name VARCHAR(50... | Show health equity metric trends in Texas for the past year. | SELECT metric_name, date, metric_value FROM health_equity_metrics INNER JOIN regions ON health_equity_metrics.date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) WHERE regions.name = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE all_time_high_scores (player_id INT, player_name TEXT, score INT, country TEXT); | Which player from Africa has the highest score in the 'all_time_high_scores' table? | SELECT player_name, MAX(score) as high_score FROM all_time_high_scores WHERE country = 'Africa' GROUP BY player_name ORDER BY high_score DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_number INT PRIMARY KEY, case_name VARCHAR(255), date_filed DATE, case_type VARCHAR(255), status VARCHAR(50), victim_id INT, defendant_id INT, program_id INT); | Delete a case from the 'cases' table | DELETE FROM cases WHERE case_number = 2022004; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (id INT, name VARCHAR(50), city_id INT, start_date DATE, end_date DATE, budget DECIMAL(10,2)); INSERT INTO Policy (id, name, city_id, start_date, end_date, budget) VALUES (19, 'PolicyG', 1, '2020-01-01', '2022-12-31', 800000), (20, 'PolicyH', 1, '2021-01-01', '2023-12-31', 900000), (21, 'PolicyI', 2... | What is the total budget for all policies in each city that were active in the year 2020? | SELECT C.name as city_name, SUM(budget) as total_budget FROM Policy P INNER JOIN City C ON P.city_id = C.id WHERE YEAR(start_date) <= 2020 AND YEAR(end_date) >= 2020 GROUP BY C.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE CenterFunding (id INT, year INT, funding FLOAT); INSERT INTO CenterFunding (id, year, funding) VALUES (1, 2017, 50000), (2, 2018, 55000), (3, 2019, 60000), (4, 2020, 65000); | What was the total funding received by the cultural center in the year 2019? | SELECT SUM(funding) FROM CenterFunding WHERE year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Recycling_Centers (country VARCHAR(20), center_type VARCHAR(20)); INSERT INTO Recycling_Centers (country, center_type) VALUES ('US', 'Glass'), ('US', 'Paper'), ('Canada', 'Glass'), ('Mexico', 'Plastic'); | How many recycling centers are there in each country? | SELECT country, COUNT(*) FROM Recycling_Centers GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (id INT PRIMARY KEY, model VARCHAR(50), engine VARCHAR(50)); INSERT INTO aircraft (id, model, engine) VALUES (101, '747', 'CFM56'), (102, 'A320', 'IAE V2500'), (103, 'A350', 'Rolls-Royce Trent XWB'), (104, '787', 'GE GEnx'), (105, '737', 'CFM56'); | Get all aircraft with the engine 'CFM56' | SELECT * FROM aircraft WHERE engine = 'CFM56'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Publications (PublicationID int, FacultyID int, Topic varchar(50)); INSERT INTO Publications (PublicationID, FacultyID, Topic) VALUES (1, 1, 'Quantum Mechanics'); INSERT INTO Publications (PublicationID, FacultyID, Topic) VALUES (2, 2, 'Particle Physics'); CREATE TABLE Faculty (FacultyID int, Name varchar(... | List all the unique research topics that have been published on by faculty members. | SELECT DISTINCT Publications.Topic FROM Publications; | 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.