context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE client (id INT, name VARCHAR(50), region VARCHAR(50), score INT); INSERT INTO client (id, name, region, score) VALUES (1, 'John', 'Africa', 60), (2, 'Jane', 'Asia', 70), (3, 'Jim', 'Europe', 80), (4, 'Joan', 'America', 90); | What is the average financial capability score for clients in each region? | SELECT region, AVG(score) as avg_score FROM client GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_name TEXT, amount DECIMAL, donation_date DATE); INSERT INTO donations (id, donor_name, amount, donation_date) VALUES (1, 'John Doe', 50.00, '2022-01-01'); INSERT INTO donations (id, donor_name, amount, donation_date) VALUES (2, 'Jane Smith', 100.00, '2022-02-01'); | How many donation records were deleted in the last month? | SELECT COUNT(*) FROM (SELECT * FROM donations WHERE DATE(donation_date) < DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) FOR UPDATE) AS deleted_donations; | gretelai_synthetic_text_to_sql |
CREATE TABLE fire_stations (id INT, city VARCHAR(255), number_of_stations INT); INSERT INTO fire_stations (id, city, number_of_stations) VALUES (1, 'Los_Angeles', 100), (2, 'San_Francisco', 80); | What is the total number of fire stations in the city of Los Angeles? | SELECT SUM(number_of_stations) FROM fire_stations WHERE city = 'Los_Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tree_data (region VARCHAR(255), species VARCHAR(255), height INTEGER); | Calculate the average tree height per region. | SELECT region, AVG(height) FROM tree_data GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (department_id INT, department VARCHAR(20));CREATE TABLE worker_salaries (worker_id INT, department_id INT, salary INT); | What is the maximum salary paid to a worker in the 'quality control' department? | SELECT MAX(worker_salaries.salary) FROM worker_salaries INNER JOIN departments ON worker_salaries.department_id = departments.department_id WHERE departments.department = 'quality control'; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarter (quarter VARCHAR(10), papers INTEGER); INSERT INTO quarter (quarter, papers) VALUES ('Q1 2021', 50), ('Q2 2021', 75), ('Q3 2021', 80), ('Q4 2021', 90), ('Q1 2022', 100), ('Q2 2022', 120); | How many AI safety research papers have been published in each quarter? | SELECT quarter, papers FROM quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainability (model_id INT, name VARCHAR(255), country VARCHAR(255), score FLOAT); INSERT INTO explainability (model_id, name, country, score) VALUES (1, 'Model1', 'UK', 0.85), (2, 'Model2', 'UK', 0.92), (3, 'Model3', 'Canada', 0.78), (4, 'Model4', 'USA', 0.88), (5, 'Model5', 'UK', 0.90); | What is the average explainability score for models from the UK? | SELECT AVG(score) FROM explainability WHERE country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_personnel (personnel_id INT, country VARCHAR(50), region VARCHAR(50), operation_type VARCHAR(50), num_personnel INT); INSERT INTO military_personnel (personnel_id, country, region, operation_type, num_personnel) VALUES (1, 'United States', 'North America', 'Peacekeeping', 500), (2, 'Canada', 'Nort... | What is the total number of military personnel by region and type of operation? | SELECT mp.region, mp.operation_type, SUM(mp.num_personnel) as total_personnel FROM military_personnel mp GROUP BY mp.region, mp.operation_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (country_code VARCHAR(3), country_name VARCHAR(50)); INSERT INTO country VALUES ('USA', 'United States'), ('CHN', 'China'), ('IND', 'India'); CREATE TABLE project (project_id INT, project_name VARCHAR(50), country_code VARCHAR(3), mitigation BOOLEAN); INSERT INTO project VALUES (1, 'Solar Farm', ... | What is the average annual climate finance committed by each country for adaptation projects? | SELECT c.country_name, AVG(f.amount/5) FROM country c JOIN project p ON c.country_code = p.country_code JOIN finance f ON p.project_id = f.project_id WHERE p.adaptation = true GROUP BY c.country_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine_operators (id INT PRIMARY KEY, name VARCHAR(50), role VARCHAR(50), gender VARCHAR(10), years_of_experience INT); INSERT INTO mine_operators (id, name, role, gender, years_of_experience) VALUES (1, 'John Doe', 'Mining Engineer', 'Male', 7); | Update the gender of the mining engineer with ID 1 to Female. | UPDATE mine_operators SET gender = 'Female' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE retailers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); INSERT INTO retailers (id, name, location) VALUES (1, 'Eco Fashion', 'London, UK'); CREATE TABLE purchases (id INT PRIMARY KEY, retailer_id INT, manufacturer_id INT, date DATE, sustainability_score FLOAT, FOREIGN KEY (retailer_id) RE... | Which retailers have purchased garments with a sustainability score above 8.5 in the last week? | SELECT r.name, p.sustainability_score FROM retailers r JOIN purchases p ON r.id = p.retailer_id WHERE p.sustainability_score > 8.5 AND p.date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 WEEK) AND CURDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (id INT, category VARCHAR(255), name VARCHAR(255)); INSERT INTO smart_contracts (id, category, name) VALUES (1, 'DeFi', 'Compound'), (2, 'DEX', 'Uniswap'), (3, 'DeFi', 'Aave'), (4, 'NFT', 'CryptoKitties'), (5, 'DEX', 'SushiSwap'), (6, 'DeFi', 'MakerDAO'), (7, 'Gaming', 'Axie Infinity'), (8,... | What are the top 3 smart contract categories with the most contracts? | SELECT category, COUNT(*) as total FROM smart_contracts GROUP BY category ORDER BY total DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (id INT, name TEXT, region TEXT, donation FLOAT); INSERT INTO Donors (id, name, region, donation) VALUES (1, 'Carol', 'Mid West', 120.5), (2, 'Dave', 'South East', 75.2); | How many donors from the 'Mid West' region made donations larger than $100? | SELECT COUNT(*) FROM Donors WHERE region = 'Mid West' AND donation > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (id INT, name TEXT); INSERT INTO Programs (id, name) VALUES (1, 'Youth Education'), (2, 'Women Empowerment'), (3, 'Clean Water'), (4, 'Refugee Support'); CREATE TABLE Volunteers (id INT, program INT, hours INT); INSERT INTO Volunteers (id, program, hours) VALUES (1, 1, 20), (2, 2, 30), (3, 3, 15),... | Find the number of unique volunteers and donors who have participated in each program. | SELECT Programs.name, COUNT(DISTINCT Volunteers.id) + COUNT(DISTINCT Donors.id) as total_participants FROM Programs LEFT JOIN Volunteers ON Programs.id = Volunteers.program FULL OUTER JOIN Donors ON Programs.id = Donors.program GROUP BY Programs.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE DisabilityAccommodations (year INT, budget DECIMAL(5,2)); INSERT INTO DisabilityAccommodations (year, budget) VALUES (2018, 500000.00), (2019, 750000.00); CREATE TABLE DisabilitySupportPrograms (year INT, budget DECIMAL(5,2)); INSERT INTO DisabilitySupportPrograms (year, budget) VALUES (2018, 550000.00), (... | What is the total budget allocated for disability accommodations and support programs in '2019'? | SELECT SUM(DisabilityAccommodations.budget) + SUM(DisabilitySupportPrograms.budget) FROM DisabilityAccommodations, DisabilitySupportPrograms WHERE DisabilityAccommodations.year = 2019 AND DisabilitySupportPrograms.year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE baseball_players (player_id INT, name VARCHAR(50), height DECIMAL(3,2), position VARCHAR(20), team VARCHAR(30)); | What is the average height of athletes in the 'baseball_players' table? | SELECT AVG(height) FROM baseball_players; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (CHW_ID INT, CHW_Name TEXT, Region TEXT); INSERT INTO CommunityHealthWorkers (CHW_ID, CHW_Name, Region) VALUES (1, 'John Doe', 'New York'), (2, 'Jane Smith', 'California'); CREATE TABLE CulturalCompetencyTrainings (Training_ID INT, CHW_ID INT, Training_Type TEXT); INSERT INTO Cultura... | How many cultural competency trainings have been attended by community health workers in each region? | SELECT c.Region, COUNT(cc.CHW_ID) as Number_of_Trainings FROM CommunityHealthWorkers c INNER JOIN CulturalCompetencyTrainings cc ON c.CHW_ID = cc.CHW_ID GROUP BY c.Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, hotel_name VARCHAR(50), country VARCHAR(50), continent VARCHAR(50), revenue INT); | What is the total revenue generated by the hotels table for each continent? | SELECT continent, SUM(revenue) FROM hotels GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_research_projects (id INT PRIMARY KEY, project_name VARCHAR(50), status VARCHAR(20)); | Delete all records with 'incomplete' status in the 'ai_research_projects' table | DELETE FROM ai_research_projects WHERE status = 'incomplete'; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment (employment_id INT, industry TEXT, state TEXT, employment_rate FLOAT, quarter TEXT); INSERT INTO veteran_employment (employment_id, industry, state, employment_rate, quarter) VALUES (1, 'Defense', 'New York', 0.85, 'Q1 2022'), (2, 'Defense', 'California', 0.82, 'Q1 2022'); | What is the employment rate for veterans in the defense industry in the state of New York in Q1 2022? | SELECT employment_rate FROM veteran_employment WHERE industry = 'Defense' AND state = 'New York' AND quarter = 'Q1 2022'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (id INT, name VARCHAR(50), type VARCHAR(50), budget FLOAT); INSERT INTO rural_infrastructure (id, name, type, budget) VALUES (1, 'Solar Irrigation', 'Agricultural Innovation', 150000.00), (2, 'Wind Turbines', 'Rural Infrastructure', 200000.00); | What are the names of the agricultural innovation projects in the 'rural_infrastructure' table that have a budget less than 150000? | SELECT name FROM rural_infrastructure WHERE type = 'Agricultural Innovation' AND budget < 150000; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers_patients (worker_id INT, limited_english BOOLEAN, last_two_years BOOLEAN); INSERT INTO community_health_workers_patients (worker_id, limited_english, last_two_years) VALUES (1, TRUE, TRUE), (2, FALSE, TRUE), (3, TRUE, FALSE); | Which community health workers have served the most patients with limited English proficiency in the last two years? | SELECT c.worker_id, c.limited_english FROM community_health_workers_patients c WHERE c.last_two_years = TRUE AND c.limited_english = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_farmers (farmer_id INT, crop VARCHAR(50), region VARCHAR(50)); INSERT INTO crop_farmers (farmer_id, crop, region) VALUES (1, 'Wheat', 'Great Plains'), (2, 'Corn', 'Midwest'), (3, 'Soybean', 'Midwest'); | Which regions grow 'Wheat' in the 'crop_farmers' table? | SELECT region FROM crop_farmers WHERE crop = 'Wheat'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists farms (id int, name varchar(50), region varchar(50), type varchar(50)); INSERT INTO farms (id, name, region, type) VALUES (1, 'Farm A', 'Asia', 'Tropical'); INSERT INTO farms (id, name, region, type) VALUES (2, 'Farm B', 'South America', 'Tropical'); CREATE TABLE if not exists water_temperatu... | What is the average water temperature in tropical aquaculture farms in the past 6 months, grouped by month and region, and only showing records with a temperature above 28 degrees Celsius? | SELECT AVG(temperature) as avg_temperature, DATE_FORMAT(date, '%Y-%m') as month, region FROM farms f JOIN water_temperature w ON f.id = w.farm_id WHERE temperature > 28 AND type = 'Tropical' AND date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY month, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShow (id INT, name VARCHAR(255), location VARCHAR(255), country VARCHAR(255), num_electric_vehicles INT); INSERT INTO AutoShow (id, name, location, country, num_electric_vehicles) VALUES (1, 'Detroit Auto Show', 'Detroit', 'USA', 50); | Which auto show has the most electric vehicle models on display? | SELECT name, location, MAX(num_electric_vehicles) FROM AutoShow; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_projects (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), funding_source VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO agricultural_projects (id, name, location, funding_source, start_date, end_date) VALUES (1, 'Solar Powered Irrigation', 'Rural Kenya', 'World Bank', '... | Show all agricultural projects in 'Rural Kenya' | SELECT * FROM agricultural_projects WHERE location = 'Rural Kenya'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Soldiers (SoldierID INT, Name VARCHAR(50), Rank VARCHAR(20), EntryYear INT); INSERT INTO Soldiers (SoldierID, Name, Rank, EntryYear) VALUES (1, 'John Doe', 'Captain', 1995), (2, 'Jane Smith', 'Lieutenant', 2002); | Insert a new record for a soldier with Name 'Mary Johnson', Rank 'Lieutenant', and EntryYear 2020. | INSERT INTO Soldiers (Name, Rank, EntryYear) VALUES ('Mary Johnson', 'Lieutenant', 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (species VARCHAR(255), animal_count INT); | Find the number of animals per species in the "animal_population" table | SELECT species, SUM(animal_count) FROM animal_population GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT, name VARCHAR(255), carbon_sequestration FLOAT); INSERT INTO species (id, name, carbon_sequestration) VALUES (1, 'Species1', 123.45); INSERT INTO species (id, name, carbon_sequestration) VALUES (2, 'Species2', 234.56); CREATE TABLE region (id INT, name VARCHAR(255)); INSERT INTO region (id,... | What is the total carbon sequestration for each species? | SELECT s.name, SUM(s.carbon_sequestration) as total_carbon FROM species s GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, EventName VARCHAR(20), Game VARCHAR(10), Participants INT); INSERT INTO Events (EventID, EventName, Game, Participants) VALUES (1, 'Event1', 'Esports', 1200); INSERT INTO Events (EventID, EventName, Game, Participants) VALUES (2, 'Event2', 'Esports', 800); | List the names of Esports events that have had more than 1000 participants. | SELECT EventName FROM Events WHERE Game = 'Esports' AND Participants > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (material VARCHAR(255), year INT, rate FLOAT); INSERT INTO recycling_rates (material, year, rate) VALUES ('Plastic', 2019, 12.0), ('Glass', 2019, 22.0), ('Paper', 2019, 35.0), ('Metal', 2019, 45.0); | What is the average recycling rate in percentage for the bottom 2 material types in 2019? | SELECT r.material, AVG(r.rate) as avg_rate FROM recycling_rates r WHERE r.year = 2019 AND r.material IN (SELECT material FROM recycling_rates WHERE year = 2019 ORDER BY rate LIMIT 2 OFFSET 2) GROUP BY r.material; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (artwork_id INT, title VARCHAR(50), year INT, artist_id INT, value INT, country VARCHAR(50)); INSERT INTO artworks (artwork_id, title, year, artist_id, value, country) VALUES (1, 'Guernica', 1937, 1, 20000000, 'Spain'); INSERT INTO artworks (artwork_id, title, year, artist_id, value, country) VALU... | What is the average value of artworks in the 'artworks' table? | SELECT AVG(value) FROM artworks; | gretelai_synthetic_text_to_sql |
CREATE TABLE AfricanPlate (volcano_name TEXT, location TEXT); INSERT INTO AfricanPlate (volcano_name, location) VALUES ('Tagoro', 'Atlantic Ocean'), ('Nazca', 'Atlantic Ocean'); | Which underwater volcanoes are within the African plate? | SELECT * FROM AfricanPlate WHERE location LIKE '%Atlantic Ocean%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_streaming (id INT, user_id INT, song_id INT, country VARCHAR(255), timestamp TIMESTAMP); | How many unique countries are represented in the music_streaming table? | SELECT COUNT(DISTINCT country) FROM music_streaming; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists 'disease_data' (id INT, state TEXT, disease TEXT, prevalence INT, PRIMARY KEY(id)); | Increase prevalence by 10 for disease 'Flu' in 'disease_data' | UPDATE 'disease_data' SET prevalence = prevalence + 10 WHERE disease = 'Flu'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, worker_name TEXT, state TEXT); INSERT INTO community_health_workers (worker_id, worker_name, state) VALUES (1, 'Jamila', 'Florida'), (2, 'Keith', 'California'); CREATE TABLE mental_health_patients (patient_id INT, worker_id INT, diagnosis TEXT); INSERT INTO mental_h... | What is the count of community health workers serving mental health patients in Florida? | SELECT COUNT(DISTINCT c.worker_id) FROM community_health_workers c JOIN mental_health_patients m ON c.worker_id = m.worker_id WHERE c.state = 'Florida' AND m.diagnosis IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, JoinYear INT, BillingAmount DECIMAL); INSERT INTO Attorneys (AttorneyID, JoinYear, BillingAmount) VALUES (1, 2016, 5000.00), (2, 2018, 3000.00), (3, 2015, 4000.00); CREATE TABLE Cases (CaseID INT, AttorneyID INT, CaseOutcome VARCHAR(10)); INSERT INTO Cases (CaseID, AttorneyID, Ca... | What is the total billing amount for cases won by attorneys who joined the firm in 2018 or later? | SELECT SUM(BillingAmount) FROM Attorneys JOIN Cases ON Attorneys.AttorneyID = Cases.AttorneyID WHERE CaseOutcome = 'Won' AND JoinYear >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment (id INT, project TEXT, location TEXT, investment_amount INT, year INT); INSERT INTO investment (id, project, location, investment_amount, year) VALUES (1, 'Potato Seed Project', 'Peru', 200000, 2018), (2, 'Corn Seed Project', 'Brazil', 300000, 2019), (3, 'Rice Seed Project', 'Colombia', 150000, ... | What was the total investment in agricultural innovation projects in Latin America in the past 5 years? | SELECT SUM(investment_amount) FROM investment WHERE location LIKE 'Latin%' AND year BETWEEN 2017 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtifactContext (ArtifactID INT, ArtifactName TEXT, HistoricalContext TEXT); INSERT INTO ArtifactContext (ArtifactID, ArtifactName, HistoricalContext) VALUES (1, 'Pompeii Amphora', 'Ancient Roman trade'); | What is the historical context of artifacts analyzed by French researchers? | SELECT ArtifactName, HistoricalContext FROM ArtifactContext INNER JOIN Artifacts ON ArtifactContext.ArtifactID = Artifacts.ArtifactID WHERE Artifacts.AnalyzedBy = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ad_interactions (user_id INT, ad_id INT, country VARCHAR(2), interaction_time FLOAT); INSERT INTO ad_interactions (user_id, ad_id, country, interaction_time) VALUES (1, 1001, 'JP', 25.3), (2, 1001, 'KR', 30.5); | What is the total number of users in Japan and South Korea who have interacted with a specific ad, and what was the total engagement time for these users? | SELECT SUM(CASE WHEN country IN ('JP', 'KR') THEN 1 ELSE 0 END) as total_users, SUM(interaction_time) as total_engagement_time FROM ad_interactions WHERE ad_id = 1001; | gretelai_synthetic_text_to_sql |
CREATE TABLE pacific_volcanoes (name VARCHAR(255), location VARCHAR(255)); | What is the total number of underwater volcanoes in the Pacific Ocean? | SELECT COUNT(*) FROM pacific_volcanoes WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TVShows (ShowID INT, Title VARCHAR(255), Country VARCHAR(50), MarketingExpenses DECIMAL(10,2), ProductionCompany VARCHAR(255)); CREATE TABLE ProductionCompanies (CompanyID INT, CompanyName VARCHAR(255)); | List the TV shows with the highest marketing expenses for each country and their corresponding production companies. | SELECT T1.Title, T1.Country, T1.MarketingExpenses, T2.CompanyName FROM TVShows T1 INNER JOIN (SELECT Country, MAX(MarketingExpenses) AS Max_Expenses FROM TVShows GROUP BY Country) T2 ON T1.Country = T2.Country AND T1.MarketingExpenses = T2.Max_Expenses INNER JOIN ProductionCompanies T3 ON T1.ProductionCompany = T3.Comp... | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (name VARCHAR(30), age INT, mission_name VARCHAR(30)); INSERT INTO Astronauts (name, age, mission_name) VALUES ('Gus Grissom', 36, 'Mercury-Redstone 4'), ('John Glenn', 40, 'Friendship 7'); | Who is the youngest astronaut to have participated in a space mission? | SELECT name, age FROM Astronauts ORDER BY age LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, name TEXT, identity TEXT); INSERT INTO community_health_workers (worker_id, name, identity) VALUES (1, 'John Doe', 'Straight'), (2, 'Jane Smith', 'Two-Spirit'), (3, 'Maria Garcia', 'Native Hawaiian'); | How many community health workers identify as Two-Spirit or Native Hawaiian? | SELECT COUNT(*) FROM community_health_workers WHERE identity IN ('Two-Spirit', 'Native Hawaiian'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, name VARCHAR(100), country VARCHAR(100)); INSERT INTO fans (fan_id, name, country) VALUES (1, 'John Doe', 'USA'); INSERT INTO fans (fan_id, name, country) VALUES (2, 'Jane Smith', 'Canada'); INSERT INTO fans (fan_id, name, country) VALUES (3, 'Jose Garcia', 'Mexico'); | Delete all records of fans from a specific country. | DELETE FROM fans WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE YttriumProduction (Refiner VARCHAR(50), Year INT, Production FLOAT); INSERT INTO YttriumProduction(Refiner, Year, Production) VALUES ('RefinerX', 2017, 123.5), ('RefinerX', 2018, 127.8), ('RefinerX', 2019, 134.5), ('RefinerY', 2017, 109.1), ('RefinerY', 2018, 113.5), ('RefinerY', 2019, 119.8); | Find the yttrium production difference between 2018 and 2017 for each refiner. | SELECT Refiner, Production - LAG(Production) OVER (PARTITION BY Refiner ORDER BY Year) as Difference FROM YttriumProduction WHERE Refiner IN ('RefinerX', 'RefinerY'); | gretelai_synthetic_text_to_sql |
CREATE TABLE annual_water_usage (year INT, user_type VARCHAR(10), water_usage INT); | What is the annual change in water usage for agricultural users in Colorado? | SELECT EXTRACT(YEAR FROM date_trunc('year', date)) as year, AVG(water_usage) - LAG(AVG(water_usage)) OVER (ORDER BY year) as annual_change FROM annual_water_usage JOIN (SELECT date_trunc('year', date) as date, user_type FROM water_consumption_by_day) tmp ON annual_water_usage.year = EXTRACT(YEAR FROM tmp.date) WHERE us... | gretelai_synthetic_text_to_sql |
CREATE TABLE tweets (tweet_id INT, user_id INT, tweet_date DATE);CREATE TABLE user_settings (user_id INT, location_sharing BOOLEAN); | What is the average number of tweets per day for users who have opted in to location sharing? | SELECT AVG(num_tweets_per_day) as avg_num_tweets FROM (SELECT u.user_id, COUNT(t.tweet_id) as num_tweets_per_day FROM user_settings u JOIN tweets t ON u.user_id = t.user_id WHERE u.location_sharing = TRUE GROUP BY u.user_id) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, dispensary_id INT, strain VARCHAR(255), quantity INT);CREATE TABLE dispensaries (dispensary_id INT, name VARCHAR(255), state VARCHAR(255)); | Find the total quantity of each strain sold in California and Washington. | SELECT strain, SUM(quantity) as total_quantity FROM sales JOIN dispensaries ON sales.dispensary_id = dispensaries.dispensary_id WHERE state IN ('California', 'Washington') GROUP BY strain; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredient_safety (ingredient_id INT, country_safety_score INT); INSERT INTO ingredient_safety (ingredient_id, country_safety_score) VALUES (1, 95), (2, 90), (3, 85), (4, 92), (5, 88), (6, 97), (7, 80), (8, 96), (9, 85), (10, 93), (11, 95), (12, 98); CREATE TABLE product_ingredients (product_id INT, ingred... | List all products that contain an ingredient sourced from a country with a high safety record, and the associated safety score of that country. | SELECT p.product_name, p.brand_name, i.country_name, i.country_safety_score FROM product_ingredients pi INNER JOIN cosmetic_products p ON pi.product_id = p.product_id INNER JOIN ingredient_sourcing i ON pi.ingredient_id = i.ingredient_id INNER JOIN ingredient_safety s ON i.country_name = s.country_name WHERE s.country_... | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (PatientID INT, Age INT, Gender VARCHAR(10), RuralHealthFacility VARCHAR(20), Disease VARCHAR(20)); INSERT INTO Patients (PatientID, Age, Gender, RuralHealthFacility, Disease) VALUES (1, 55, 'Male', 'Bumpkinsville RHF', 'Diabetes'); | What is the average age of patients diagnosed with diabetes in the rural county of "Bumpkinsville"? | SELECT AVG(Age) FROM Patients WHERE RuralHealthFacility = 'Bumpkinsville RHF' AND Disease = 'Diabetes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (id INT PRIMARY KEY, name VARCHAR(50), age INT, gender VARCHAR(10), state VARCHAR(50)); | Delete fan records from the "fans" table for fans who are over 60 | DELETE FROM fans WHERE age > 60; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (state VARCHAR(20), year INT, volume_m3 INT); INSERT INTO water_usage (state, year, volume_m3) VALUES ('Texas', 2017, 25000000), ('Texas', 2018, 26000000), ('Texas', 2019, 27000000), ('Texas', 2020, 28000000), ('Texas', 2021, 29000000); | What is the average water usage in Texas over the last 5 years? | SELECT AVG(volume_m3) FROM water_usage WHERE state = 'Texas' AND year BETWEEN 2017 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE PRODUCT ( id INT PRIMARY KEY, name TEXT, material TEXT, quantity INT, price INT, country TEXT, certifications TEXT, is_recycled BOOLEAN ); INSERT INTO PRODUCT (id, name, material, quantity, price, country, certifications, is_recycled) VALUES (1, 'Organic Cotton Shirt', 'Organic Cotton', 30, 50, 'USA', 'GOT... | Increase the price of all products made from recycled materials by 10%. | UPDATE PRODUCT SET price = price * 1.1 WHERE is_recycled = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts(name TEXT, missions INTEGER, days_in_space REAL); INSERT INTO astronauts(name, missions, days_in_space) VALUES('Neil Armstrong', 1, 265.5), ('Buzz Aldrin', 1, 216.4); | Who has spent the most time in space? | SELECT name, MAX(days_in_space) FROM astronauts; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchPapers(Id INT, Title VARCHAR(50), Author VARCHAR(50), Year INT, Domain VARCHAR(50)); INSERT INTO ResearchPapers(Id, Title, Author, Year, Domain) VALUES (1, 'Autonomous Driving Algorithms', 'Li, X.', 2020, 'Asia'); INSERT INTO ResearchPapers(Id, Title, Author, Year, Domain) VALUES (2, 'Deep Learning... | What is the total number of autonomous driving research papers published by Asian authors in 2020? | SELECT COUNT(*) FROM ResearchPapers WHERE Year = 2020 AND Domain = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiveSite (Name VARCHAR(50) PRIMARY KEY, Depth INT); | Add a new "DiveSite" record with a name of Blue Hole and a depth of 120 meters | INSERT INTO DiveSite (Name, Depth) VALUES ('Blue Hole', 120); | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_footprint (name VARCHAR(255), location VARCHAR(255), year INT, footprint DECIMAL(5,2)); INSERT INTO carbon_footprint (name, location, year, footprint) VALUES ('Resort Stay', 'Maldives', 2015, 21.34), ('Liveaboard', 'Maldives', 2015, 12.15); | What is the average carbon footprint of tourists visiting the Maldives? | SELECT AVG(footprint) FROM carbon_footprint WHERE location = 'Maldives'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR(50), race VARCHAR(50), ethnicity VARCHAR(50), years_of_experience INT); INSERT INTO community_health_workers (id, name, race, ethnicity, years_of_experience) VALUES (1, 'John Doe', 'White', 'Not Hispanic or Latino', 5), (2, 'Jane Smith', 'Black or African Amer... | Which community health workers have the most experience? | SELECT name, years_of_experience, RANK() OVER (ORDER BY years_of_experience DESC) as rank FROM community_health_workers; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (id INT, name VARCHAR(50), country VARCHAR(50)); INSERT INTO researchers (id, name, country) VALUES (1, 'Sanna Simula', 'Finland'), (2, 'Kristian Olsen', 'Greenland'), (3, 'Agnes Sorensen', 'Greenland'), (4, 'Joseph Okpik', 'Canada'); | Which countries have researchers in the database? | SELECT DISTINCT country FROM researchers; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_precedents (precedent_id INT, precedent_name VARCHAR(100)); CREATE TABLE civil_cases (case_id INT, case_type VARCHAR(20), precedent_id INT); CREATE TABLE criminal_cases (case_id INT, case_type VARCHAR(20), precedent_id INT); | Find the unique legal precedents that have been cited in cases from both the 'civil' and 'criminal' case type tables. | SELECT precedent_name FROM legal_precedents WHERE precedent_id IN (SELECT precedent_id FROM civil_cases) INTERSECT SELECT precedent_name FROM legal_precedents WHERE precedent_id IN (SELECT precedent_id FROM criminal_cases); | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerDemographics (PlayerID INT, Age INT, GamePreference VARCHAR(20)); INSERT INTO PlayerDemographics (PlayerID, Age, GamePreference) VALUES (1, 24, 'sports'); | How many players play sports games and are younger than 25? | SELECT COUNT(*) FROM PlayerDemographics WHERE Age < 25 AND GamePreference = 'sports'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MineTypes (MineID int, MineType varchar(50)); INSERT INTO MineTypes VALUES (1, 'Small-scale Mine'), (2, 'Medium-scale Mine'), (3, 'Large-scale Mine'); CREATE TABLE ExtractionData (MineID int, ExtractionDate date, Material varchar(10), Quantity int); INSERT INTO ExtractionData VALUES (1, '2022-01-01', 'Gold... | What is the total quantity of minerals extracted by small-scale mines in Zambia in 2022? | SELECT mt.MineType, SUM(ed.Quantity) as TotalExtraction FROM ExtractionData ed JOIN MineTypes mt ON ed.MineID = mt.MineID WHERE ed.ExtractionDate BETWEEN '2022-01-01' AND '2022-12-31' AND mt.MineType = 'Small-scale Mine' AND ed.Material = 'Gold' GROUP BY mt.MineType; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_trenches (name VARCHAR(255), region VARCHAR(255), depth FLOAT);INSERT INTO deep_sea_trenches (name, region, depth) VALUES ('Trench 1', 'Indian Ocean', 6000), ('Trench 2', 'Atlantic Ocean', 7000), ('Trench 3', 'Indian Ocean', 5000); | What is the minimum depth of all deep-sea trenches in the Indian Ocean? | SELECT MIN(depth) FROM deep_sea_trenches WHERE region = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MatchStats (MatchID int, PlayerID int, Kills int, Deaths int); INSERT INTO MatchStats VALUES (1, 1, 15, 5), (2, 2, 10, 8), (3, 1, 20, 10), (4, 3, 12, 7); | What is the maximum number of kills achieved by a player in a single match? | SELECT PlayerID, MAX(Kills) as MaxKills FROM MatchStats GROUP BY PlayerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (investment FLOAT, region VARCHAR(20)); INSERT INTO network_investments (investment, region) VALUES (120000, 'Western'), (150000, 'Northern'), (180000, 'Western'); | What is the maximum network investment for the telecom provider in the Western region? | SELECT MAX(investment) FROM network_investments WHERE region = 'Western'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (ID INT, Title VARCHAR(50), City VARCHAR(20), Country VARCHAR(20), Date DATE, TicketPrice INT); INSERT INTO Exhibitions (ID, Title, City, Country, Date, TicketPrice) VALUES (1, 'Traditional Japanese Art', 'Tokyo', 'Japan', '2019-03-01', 15); CREATE TABLE TicketSales (ID INT, ExhibitionID INT, Q... | What is the total revenue generated from ticket sales for exhibitions in Tokyo, Japan in 2019?' | SELECT SUM(TicketSales.Quantity * Exhibitions.TicketPrice) FROM TicketSales INNER JOIN Exhibitions ON TicketSales.ExhibitionID = Exhibitions.ID WHERE Exhibitions.City = 'Tokyo' AND Exhibitions.Country = 'Japan' AND Exhibitions.Date BETWEEN '2019-01-01' AND '2019-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, name VARCHAR(50), type VARCHAR(50), country VARCHAR(50), launch_date DATE, mass FLOAT); | Display the average mass of space debris in the space_debris table for the debris items from the USA | SELECT AVG(mass) as average_mass FROM space_debris WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10,2), LeftCompany BOOLEAN); | Update the salary of all employees in the accounting department | UPDATE Employees SET Salary = 65000 WHERE Department = 'Accounting'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inspections (inspection_id INT PRIMARY KEY, restaurant_id INT, inspection_date DATE, violation_code INT, description VARCHAR(255)); | List restaurants that have had a food safety violation in the last 3 months | SELECT r.restaurant_id, r.restaurant_name FROM restaurants r JOIN inspections i ON r.restaurant_id = i.restaurant_id WHERE i.inspection_date >= DATEADD(month, -3, GETDATE()) AND i.violation_code IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE italy_data (year INT, network VARCHAR(15), revenue FLOAT); INSERT INTO italy_data (year, network, revenue) VALUES (2020, 'Vodafone', 15000000), (2020, 'TIM', 12000000), (2020, 'Wind Tre', 13000000); | What is the total revenue generated by each mobile network in Italy for the year 2020? | SELECT network, SUM(revenue) as total_revenue FROM italy_data WHERE year = 2020 GROUP BY network; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers(FarmerID INT, Name VARCHAR(50), Local BOOLEAN);CREATE TABLE FruitsVeggies(FruitVeggieID INT, FarmerID INT, Product VARCHAR(50), Quantity INT, DeliveryDate DATE);INSERT INTO Farmers VALUES (1, 'Amy Johnson', TRUE), (2, 'Bob Smith', FALSE);INSERT INTO FruitsVeggies VALUES (1, 1, 'Apples', 300, '2022-... | Identify the total quantity of fruits and vegetables that were supplied by local farmers in the last month? | SELECT SUM(Quantity) FROM FruitsVeggies WHERE DeliveryDate >= DATEADD(month, -1, GETDATE()) AND Local = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE VeteranEmployment (VEID INT, Age INT, Gender VARCHAR(10), State VARCHAR(20), NumVeterans INT); INSERT INTO VeteranEmployment (VEID, Age, Gender, State, NumVeterans) VALUES (1, 25, 'Male', 'California', 100), (2, 35, 'Female', 'Texas', 200), (3, 45, 'Male', 'Florida', 150); | Find the number of veterans employed by age group and gender, in each state? | SELECT State, Gender, Age, COUNT(NumVeterans) as NumVeterans FROM VeteranEmployment GROUP BY State, Gender, Age; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(item VARCHAR(20), location VARCHAR(20), quantity INT, sale_date DATE); INSERT INTO sales (item, location, quantity, sale_date) VALUES ('Dress', 'Paris', 15, '2021-01-01'); INSERT INTO sales (item, location, quantity, sale_date) VALUES ('Top', 'Paris', 20, '2021-01-02'); | What was the total quantity of 'Dress' items sold in 'Paris' in 2021? | SELECT SUM(quantity) FROM sales WHERE item = 'Dress' AND location = 'Paris' AND sale_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicTransportation (TripID INT, TripDate DATE, Mode VARCHAR(255), Trips INT); INSERT INTO PublicTransportation (TripID, TripDate, Mode, Trips) VALUES (1, '2022-01-01', 'Bus', 50000), (2, '2022-01-02', 'Subway', 70000), (3, '2022-01-03', 'Bus', 55000); | What is the maximum number of public transportation trips taken in a single day for each mode of transportation? | SELECT MAX(Trips), Mode FROM PublicTransportation GROUP BY Mode; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(255), gender VARCHAR(6)); CREATE TABLE albums (id INT, artist_id INT, year INT); | How many female and male artists released albums in 2021? | SELECT artists.gender, COUNT(*) FROM albums JOIN artists ON albums.artist_id = artists.id WHERE albums.year = 2021 GROUP BY artists.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE tax_rates_3 (id INT, neighborhood TEXT, city TEXT, state TEXT, property_type TEXT, rate FLOAT); | Which neighborhood in Boston has the highest property tax? | SELECT MAX(rate) FROM tax_rates_3 WHERE city = 'Boston' AND property_type = 'Residential' GROUP BY neighborhood; | gretelai_synthetic_text_to_sql |
CREATE TABLE RevenueData (GameID INT, GameType VARCHAR(20), Revenue INT); INSERT INTO RevenueData (GameID, GameType, Revenue) VALUES (1, 'Action', 5000), (2, 'Adventure', 6000), (3, 'Simulation', 8000), (4, 'Action', 7000), (5, 'Simulation', 9000), (6, 'Adventure', 10000); | What is the average revenue for each game type? | SELECT GameType, AVG(Revenue) FROM RevenueData GROUP BY GameType; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_usage (city VARCHAR(50), date DATE, water_usage FLOAT); INSERT INTO daily_usage VALUES ('Dallas', '2022-01-01', 500000), ('Dallas', '2022-01-02', 600000), ('Dallas', '2022-01-03', 550000), ('Houston', '2022-01-01', 450000), ('Houston', '2022-01-02', 500000), ('Houston', '2022-01-03', 480000), ('Austi... | Find the daily water usage for the top 5 water consuming cities in Texas. | SELECT city, SUM(water_usage) as total_usage FROM daily_usage WHERE date >= '2022-01-01' AND date <= '2022-01-03' AND city IN ('Dallas', 'Houston', 'Austin', 'San Antonio', 'Fort Worth') GROUP BY city ORDER BY total_usage DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE seafood_exports (id INT, export_date DATE, export_country TEXT, import_country TEXT, quantity INT); INSERT INTO seafood_exports (id, export_date, export_country, import_country, quantity) VALUES (1, '2022-01-01', 'Thailand', 'Singapore', 500); INSERT INTO seafood_exports (id, export_date, export_country, i... | What was the total quantity of shrimp exported from Thailand to Singapore in 2022? | SELECT SUM(quantity) FROM seafood_exports WHERE export_country = 'Thailand' AND import_country = 'Singapore' AND EXTRACT(YEAR FROM export_date) = 2022 AND species = 'Shrimp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_type TEXT, donation_amount DECIMAL(10,2)); INSERT INTO donors VALUES (1, 'Individual', 50.00); INSERT INTO donors VALUES (2, 'Corporation', 5000.00); | What was the average donation amount for each donor type? | SELECT donor_type, AVG(donation_amount) as avg_donation FROM donors GROUP BY donor_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE if NOT EXISTS satellite_images (id int, location varchar(50), image_date datetime, purpose varchar(50)); INSERT INTO satellite_images (id, location, image_date, purpose) VALUES (1, 'Brazil', '2021-01-01 10:00:00', 'agriculture'), (2, 'Brazil', '2021-01-02 10:00:00', 'agriculture'); | What is the count of satellite images taken for agricultural purposes in Brazil in January 2021? | SELECT COUNT(*) FROM satellite_images WHERE location = 'Brazil' AND purpose = 'agriculture' AND image_date >= '2021-01-01' AND image_date < '2021-02-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT PRIMARY KEY, ArtistName VARCHAR(100), Gender VARCHAR(10), Genre VARCHAR(50), TicketsSold INT); INSERT INTO Artists (ArtistID, ArtistName, Gender, Genre, TicketsSold) VALUES (1, 'Artist A', 'Female', 'Jazz', 3000), (2, 'Artist B', 'Male', 'Jazz', 4000), (3, 'Artist C', 'Female', 'Jazz'... | Who are the female jazz artists with the highest ticket sales? | SELECT ArtistName FROM Artists WHERE Gender = 'Female' AND Genre = 'Jazz' ORDER BY TicketsSold DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE endangered_species (species VARCHAR(255), habitat_type VARCHAR(255), endangered BOOLEAN); CREATE TABLE habitat_preservation (habitat_type VARCHAR(255), location VARCHAR(255)); CREATE TABLE habitats (habitat_type VARCHAR(255), area_size FLOAT); | Calculate the percentage of endangered species for each habitat type, considering the total number of species in the "endangered_species", "habitat_preservation", and "habitats" tables | SELECT h1.habitat_type, (COUNT(e1.species) * 100.0 / (SELECT COUNT(DISTINCT e2.species) FROM endangered_species e2 WHERE e2.habitat_type = h1.habitat_type)) as endangered_percentage FROM endangered_species e1 INNER JOIN habitat_preservation h1 ON e1.habitat_type = h1.habitat_type INNER JOIN habitats h2 ON h1.habitat_ty... | gretelai_synthetic_text_to_sql |
CREATE TABLE MaxSalaries (id INT, company_id INT, job_role VARCHAR(50), salary INT); INSERT INTO MaxSalaries (id, company_id, job_role, salary) VALUES (1, 1, 'Engineer', 90000), (2, 1, 'Manager', 120000), (3, 2, 'Engineer', 95000), (4, 2, 'Engineer', 100000); | What is the maximum salary by company and job role? | SELECT company_id, job_role, MAX(salary) as max_salary FROM MaxSalaries GROUP BY company_id, job_role; | gretelai_synthetic_text_to_sql |
CREATE TABLE donor (id INT, name VARCHAR(50)); CREATE TABLE donation (id INT, donor_id INT, amount DECIMAL(10,2), donation_date DATE); CREATE TABLE volunteer (id INT, donor_id INT, volunteer_date DATE); | What is the number of volunteers who have not made a donation? | SELECT COUNT(DISTINCT v.id) as total_volunteers FROM volunteer v LEFT JOIN donation d ON v.donor_id = d.donor_id WHERE d.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (ExhibitionID INT, ExhibitionName VARCHAR(255)); INSERT INTO Exhibitions (ExhibitionID, ExhibitionName) VALUES (1, 'Modern Art'); INSERT INTO Exhibitions (ExhibitionID, ExhibitionName) VALUES (2, 'Natural History'); CREATE TABLE Visitors (VisitorID INT, VisitorName VARCHAR(255), HasVisitedMulti... | What is the total number of visitors who have attended multiple exhibitions? | SELECT COUNT(V.VisitorID) as TotalVisitors FROM Visitors V INNER JOIN VisitorExhibitionsVE ON V.VisitorID = VE.VisitorID GROUP BY V.VisitorID HAVING COUNT(VE.ExhibitionID) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE SUSTAINABILITY (store_id INT, waste_reduction FLOAT, water_conservation FLOAT); INSERT INTO SUSTAINABILITY VALUES (1, 0.15, 0.20), (2, 0.10, 0.15), (3, 0.20, 0.25), (4, 0.12, 0.18); | List stores that meet or exceed the specified sustainability thresholds for waste reduction and water conservation. | SELECT store_id, waste_reduction, water_conservation FROM SUSTAINABILITY WHERE waste_reduction >= 0.15 AND water_conservation >= 0.20; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (country VARCHAR(50), tech_type VARCHAR(50), quantity INT); INSERT INTO military_tech (country, tech_type, quantity) VALUES ('USA', 'Aircraft', 13000), ('USA', 'Vessels', 500), ('China', 'Aircraft', 5000), ('China', 'Vessels', 700), ('Russia', 'Aircraft', 4000), ('Russia', 'Vessels', 600); | What is the distribution of military technology types by country? | SELECT country, tech_type, quantity FROM military_tech; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (country VARCHAR(255), sector VARCHAR(255), investment_amount NUMERIC, region VARCHAR(255), year INT); | What is the total amount of climate finance invested in sustainable agriculture projects in the Middle East in 2023? | SELECT SUM(investment_amount) FROM climate_finance WHERE sector = 'sustainable agriculture' AND region = 'Middle East' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(50), location VARCHAR(50), un_code VARCHAR(10)); CREATE TABLE vessels (id INT, name VARCHAR(50), type VARCHAR(50), year_built INT, port_id INT); CREATE TABLE captains (id INT, name VARCHAR(50), age INT, license_number VARCHAR(20), vessel_id INT); CREATE TABLE cargo (id INT, desc... | What is the maximum cargo weight and corresponding port for cargo handled by the vessel 'Sea Serpent'? | SELECT ports.name, MAX(cargo.weight) AS max_cargo_weight FROM ports INNER JOIN (vessels INNER JOIN cargo ON vessels.id = cargo.vessel_id) ON ports.id = vessels.port_id WHERE vessels.name = 'Sea Serpent' GROUP BY ports.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE fortnite_scores (id INT, player TEXT, score INT, game TEXT); INSERT INTO fortnite_scores (id, player, score, game) VALUES (1, 'Mia', 120, 'Fortnite'), (2, 'Mia', 115, 'Fortnite'), (3, 'Max', 130, 'Fortnite'); | What is the maximum score achieved by player 'Mia' in the game 'Fortnite'? | SELECT MAX(score) FROM fortnite_scores WHERE player = 'Mia' AND game = 'Fortnite'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(255), country VARCHAR(255), num_employees INT, avg_salary DECIMAL(10,2));CREATE VIEW mining_companies AS SELECT * FROM company WHERE industry = 'Mining'; | Find the number of employees and total salary costs for mining companies in the top 2 countries with the highest total salary costs. | SELECT c.country, SUM(c.num_employees) as total_employees, SUM(c.num_employees * c.avg_salary) as total_salary_costs FROM mining_companies c JOIN (SELECT country, SUM(num_employees * avg_salary) as total_salary_costs FROM mining_companies GROUP BY country ORDER BY total_salary_costs DESC LIMIT 2) mc ON c.country = mc.c... | gretelai_synthetic_text_to_sql |
CREATE TABLE clinics (id INT, name VARCHAR(50), location VARCHAR(50), type VARCHAR(20), budget INT); | List all the dental clinics in rural areas of Australia with their budget. | SELECT name, budget FROM clinics WHERE location LIKE '%Australia%' AND location LIKE '%rural%' AND type = 'dental'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(255));CREATE TABLE veteran_employment (company_id INT, num_veterans INT);INSERT INTO companies (id, name) VALUES (1, 'Lockheed Martin'), (2, 'Boeing'), (3, 'Raytheon Technologies'), (4, 'Northrop Grumman');INSERT INTO veteran_employment (company_id, num_veterans) VALUES (1, ... | How many veterans have been employed by each company? | SELECT c.name, SUM(ve.num_veterans) as total_veterans FROM companies c JOIN veteran_employment ve ON c.id = ve.company_id GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency_scores (score INT); INSERT INTO energy_efficiency_scores (score) VALUES (90), (85), (88); | What is the maximum energy efficiency score? | SELECT MAX(score) FROM energy_efficiency_scores; | gretelai_synthetic_text_to_sql |
CREATE TABLE College_of_Engineering_Grants (faculty_gender VARCHAR(10), grant_year INT, grant_amount INT); INSERT INTO College_of_Engineering_Grants (faculty_gender, grant_year, grant_amount) VALUES ('Female', 2017, 50000), ('Male', 2017, 70000), ('Female', 2018, 60000), ('Male', 2018, 80000), ('Female', 2019, 75000), ... | What is the total amount of research grants awarded to female faculty members in the College of Engineering for each year since 2017? | SELECT grant_year, SUM(grant_amount) as total_grant_amount FROM College_of_Engineering_Grants WHERE faculty_gender = 'Female' GROUP BY grant_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Carbon_Sequestration (ID INT, Region VARCHAR(50), Area FLOAT); INSERT INTO Carbon_Sequestration (ID, Region, Area) VALUES (1, 'Region1', 30.2), (2, 'Region2', 45.6), (3, 'Region3', 60.8); | How many hectares of forest are dedicated to carbon sequestration in each region? | SELECT Region, Area FROM Carbon_Sequestration; | gretelai_synthetic_text_to_sql |
CREATE TABLE baseball_tickets (id INT, city VARCHAR(20), ticket_sales INT); | Show the top 3 cities with the highest number of ticket purchases for baseball games. | SELECT city, SUM(ticket_sales) AS total_sales FROM baseball_tickets GROUP BY city ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier_holmium (year INT, supplier VARCHAR(20), holmium_supply INT); INSERT INTO supplier_holmium VALUES (2015, 'Supplier A', 20), (2016, 'Supplier B', 25), (2017, 'Supplier C', 30), (2018, 'Supplier D', 35), (2019, 'Supplier E', 40); | Which supplier provided the most Holmium in 2017? | SELECT supplier, MAX(holmium_supply) FROM supplier_holmium WHERE year = 2017 GROUP BY supplier; | 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.