context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE regions (region_id INT, region_name VARCHAR(50)); INSERT INTO regions (region_id, region_name) VALUES (1, 'North America'), (2, 'Europe'), (3, 'Asia'), (4, 'Africa'), (5, 'South America'); CREATE TABLE model_fairness (model_id INT, region_id INT, fairness_score FLOAT); | What is the average fairness score of models trained on different geographical regions? | SELECT AVG(mf.fairness_score) FROM model_fairness mf JOIN regions r ON mf.region_id = r.region_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (region VARCHAR(255), date DATE, metric1 FLOAT, metric2 FLOAT, metric3 FLOAT); INSERT INTO threat_intelligence (region, date, metric1, metric2, metric3) VALUES ('Northeast', '2020-01-01', 12.3, 45.6, 78.9), ('Midwest', '2020-01-01', 23.4, 56.7, 89.0), ('South', '2020-01-01', 34.5, 67.8,... | What are the average threat intelligence metrics for each region in 2020? | SELECT region, AVG(metric1) as avg_metric1, AVG(metric2) as avg_metric2, AVG(metric3) as avg_metric3 FROM threat_intelligence WHERE date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE WastewaterTreatment (id INT, facility VARCHAR, year INT, volume INT); INSERT INTO WastewaterTreatment (id, facility, year, volume) VALUES (1, 'Sacramento', 2018, 12000000), (2, 'Sacramento', 2019, 12500000), (3, 'San Diego', 2018, 14000000); | What is the total volume of wastewater treated by the water treatment facility in Sacramento in 2018? | SELECT SUM(volume) FROM WastewaterTreatment WHERE facility = 'Sacramento' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (hospital_id INT, hospital_name VARCHAR(255)); CREATE TABLE doctors (doctor_id INT, doctor_name VARCHAR(255), hospital_id INT); INSERT INTO hospitals (hospital_id, hospital_name) VALUES (1, 'Hospital A'), (2, 'Hospital B'); INSERT INTO doctors (doctor_id, doctor_name, hospital_id) VALUES (1, 'Dr.... | Delete the records of doctors who are not assigned to any hospital from the doctors table. | DELETE FROM doctors WHERE hospital_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouses (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); CREATE TABLE Freights (id INT PRIMARY KEY, warehouse_id INT, status VARCHAR(255), quantity INT, pickup_date DATETIME); CREATE VIEW PendingFreights AS SELECT * FROM Freights WHERE status = 'pending'; | What are the names of warehouses with no pending freights? | SELECT w.name FROM Warehouses w LEFT JOIN PendingFreights p ON w.id = p.warehouse_id WHERE p.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA Biosensors; CREATE TABLE Patents (patent_name VARCHAR(50), grant_year INT); INSERT INTO Patents VALUES ('Patent1', 2018), ('Patent2', 2019); | How many biosensor technology patents were granted in each year in the 'Patents' table? | SELECT grant_year, COUNT(*) as num_patents FROM Biosensors.Patents GROUP BY grant_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists VisitorContinents (Continent VARCHAR(50), Country VARCHAR(50), Visitors INT); INSERT INTO VisitorContinents (Continent, Country, Visitors) VALUES ('Africa', 'Egypt', 120000), ('Asia', 'Japan', 240000), ('Europe', 'France', 300000), ('South America', 'Brazil', 140000), ('North America', 'Canad... | What was the total number of visitors to each continent in 2021? | SELECT a.Continent, SUM(a.Visitors) AS TotalVisitors FROM VisitorContinents a WHERE a.Year = 2021 GROUP BY a.Continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infection_Rates (ID INT, Year INT, Disease TEXT, Region TEXT, Rate FLOAT); INSERT INTO Infection_Rates (ID, Year, Disease, Region, Rate) VALUES (1, 2017, 'Malaria', 'Tropical', 0.15); INSERT INTO Infection_Rates (ID, Year, Disease, Region, Rate) VALUES (2, 2018, 'Dengue Fever', 'Temperate', 0.07); | What is the infection rate of Malaria and Dengue Fever in tropical and temperate regions over the past 5 years? | SELECT Region, Disease, AVG(Rate) FROM Infection_Rates WHERE Year BETWEEN 2017 AND 2021 GROUP BY Region, Disease; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_complaints (complaint_id INT, brand_name VARCHAR(255), complaint_date DATE); CREATE TABLE brand_catalog (brand_id INT, brand_name VARCHAR(255)); | How many complaints were filed in the last 6 months for a specific brand? | SELECT COUNT(*) FROM product_complaints JOIN brand_catalog ON product_complaints.brand_id = brand_catalog.brand_id WHERE brand_name = 'Example Brand' AND complaint_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE news_agencies (id INT, name TEXT); INSERT INTO news_agencies VALUES (1, 'Acme News Agency'); INSERT INTO news_agencies VALUES (2, 'Global News'); CREATE TABLE articles (id INT, agency_id INT, title TEXT, location TEXT); INSERT INTO articles VALUES (1, 1, 'Article 1', 'Germany'); INSERT INTO articles VALU... | Find the number of articles published by 'Acme News Agency' in 'Germany' and 'France'? | SELECT COUNT(articles.id) FROM articles INNER JOIN news_agencies ON articles.agency_id = news_agencies.id WHERE news_agencies.name = 'Acme News Agency' AND articles.location IN ('Germany', 'France'); | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emission (country VARCHAR(50), year INT, industry VARCHAR(50), co2_emission FLOAT); INSERT INTO co2_emission (country, year, industry, co2_emission) VALUES ('Canada', 2000, 'Oil', 100.0), ('Canada', 2001, 'Oil', 120.0), ('Norway', 2000, 'Gas', 80.0); | What is the total CO2 emission in the Arctic by industry since 2000? | SELECT c.country, c.industry, SUM(c.co2_emission) as total_emission FROM co2_emission c GROUP BY c.country, c.industry; | gretelai_synthetic_text_to_sql |
CREATE TABLE Locations (LocId INT, Type VARCHAR(50)); CREATE TABLE Crimes (CrimeId INT, LocId INT, Date DATE, Time TIME); | What is the maximum number of crimes committed in a single day in each location type? | SELECT L.Type, MAX(C.Count) FROM Locations L INNER JOIN (SELECT LocId, COUNT(*) AS Count FROM Crimes GROUP BY LocId, Date, Time) C ON L.LocId = C.LocId GROUP BY L.Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE aquatic_farms (id INT, country VARCHAR(50), biomass FLOAT); INSERT INTO aquatic_farms (id, country, biomass) VALUES (1, 'Norway', 350000), (2, 'Chile', 280000), (3, 'China', 740000); | What is the total biomass of farmed fish in each country's aquatic farms? | SELECT country, SUM(biomass) as total_biomass FROM aquatic_farms GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_date DATE, amount DECIMAL(10,2)); INSERT INTO donations (id, donation_date, amount) VALUES (1, '2021-01-01', 100.00), (2, '2021-01-15', 250.50), (3, '2021-03-01', 150.25); | What was the total donation amount in Q1 2021? | SELECT SUM(amount) FROM donations WHERE donation_date BETWEEN '2021-01-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sites (id INT, name VARCHAR(255), annual_emission_limit INT); INSERT INTO sites (id, name, annual_emission_limit) VALUES (1, 'Site A', 1000), (2, 'Site B', 1200), (3, 'Site C', 1500); INSERT INTO sites (id, name, annual_emission_limit, yearly_emissions) VALUES (1, 'Site A', 1000, 1100), (2, 'Site B', 1200,... | Which sites have exceeded their annual emission limits? | SELECT name FROM (SELECT name, yearly_emissions, annual_emission_limit, ROW_NUMBER() OVER (PARTITION BY name ORDER BY yearly_emissions DESC) as row_num FROM sites) subquery WHERE row_num = 1 AND yearly_emissions > annual_emission_limit; | gretelai_synthetic_text_to_sql |
CREATE TABLE AlgorithmicFairness (ID INT, Algorithm VARCHAR(255), Category VARCHAR(255), Score FLOAT, Date DATE); INSERT INTO AlgorithmicFairness (ID, Algorithm, Category, Score, Date) VALUES (1, 'Algo1', 'CategoryA', 0.85, '2020-01-01'), (2, 'Algo2', 'CategoryB', 0.78, '2020-01-05'), (3, 'Algo3', 'CategoryA', 0.91, '2... | What is the minimum algorithmic fairness score for algorithms created in H1 2020, per category? | SELECT Category, MIN(Score) as Min_Score FROM AlgorithmicFairness WHERE Date BETWEEN '2020-01-01' AND '2020-06-30' GROUP BY Category; | gretelai_synthetic_text_to_sql |
CREATE TABLE hiv_data (id INT, city TEXT, year INT, cases INT); INSERT INTO hiv_data (id, city, year, cases) VALUES (1, 'Los Angeles', 2018, 500), (2, 'Los Angeles', 2019, 600); | What is the change in the number of HIV cases between consecutive years, for each city? | SELECT city, year, cases, LAG(cases) OVER (PARTITION BY city ORDER BY year) as prev_year_cases, cases - LAG(cases) OVER (PARTITION BY city ORDER BY year) as change FROM hiv_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(255), manufacturer VARCHAR(255), budget DECIMAL(10, 2)); INSERT INTO Spacecraft (id, name, manufacturer, budget) VALUES (1, 'Voyager I', 'AeroSpace Inc.', 800000000.00), (2, 'Voyager II', 'AeroSpace Inc.', 850000000.00), (3, 'Dragon C106', 'SpaceX', 150000000.00); | What is the total budget for all spacecraft manufactured by 'AeroSpace Inc.' and 'SpaceX'? | SELECT SUM(budget) FROM Spacecraft WHERE manufacturer IN ('AeroSpace Inc.', 'SpaceX'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales(ticket_id INT, game_id INT, location VARCHAR(50), tickets_sold INT); | Identify the total number of tickets sold for games held in New York or Los Angeles. | SELECT SUM(tickets_sold) FROM ticket_sales WHERE location IN ('New York', 'Los Angeles'); | gretelai_synthetic_text_to_sql |
CREATE TABLE spaceships (id INT, name VARCHAR(50), max_speed FLOAT, launch_date DATE); INSERT INTO spaceships (id, name, max_speed, launch_date) VALUES (1, 'Viking 1', 21000, '1975-08-20'); INSERT INTO spaceships (id, name, max_speed, launch_date) VALUES (2, 'Curiosity Rover', 13000, '2011-11-26'); | What is the average speed of spaceships that landed on Mars? | SELECT AVG(max_speed) FROM spaceships WHERE name IN ('Viking 1', 'Curiosity Rover') AND launch_date LIKE '19__-__-__' OR launch_date LIKE '20__-__-__'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (id INT, project_id INT, year INT, CO2_emissions_tonnes INT); INSERT INTO emissions (id, project_id, year, CO2_emissions_tonnes) VALUES (1, 1, 2018, 1000); | How can I update the CO2 emissions for a specific project? | UPDATE emissions SET CO2_emissions_tonnes = 1200 WHERE project_id = 1 AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE years (year_id INT, year INT); CREATE TABLE projects (project_id INT, project_type VARCHAR(255), year_id INT); | How many rural infrastructure projects were completed in 2021, categorized by project type? | SELECT p.project_type, COUNT(p.project_id) as project_count FROM projects p JOIN years y ON p.year_id = y.year_id WHERE y.year = 2021 GROUP BY p.project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(255), Salary FLOAT); | Find the average salary of employees in the 'HumanResources' department who have a salary higher than the overall average salary. | SELECT AVG(Salary) FROM Employees WHERE Department = 'HumanResources' AND Salary > (SELECT AVG(Salary) FROM Employees); | gretelai_synthetic_text_to_sql |
CREATE TABLE MakeupProducts (product_id INT, product_name VARCHAR(255), price DECIMAL(5,2), is_organic BOOLEAN, country VARCHAR(50)); | What is the maximum price of organic makeup products sold in Australia? | SELECT MAX(price) FROM MakeupProducts WHERE is_organic = TRUE AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, speed FLOAT, departed_port TEXT, departed_date DATE); INSERT INTO vessels (id, name, speed, departed_port, departed_date) VALUES (1, 'VesselA', 15.2, 'Oakland', '2020-01-01'); INSERT INTO vessels (id, name, speed, departed_port, departed_date) VALUES (2, 'VesselB', 17.8, 'Oaklan... | What is the average speed of vessels that departed from the port of Oakland in January 2020? | SELECT AVG(speed) FROM vessels WHERE departed_port = 'Oakland' AND departed_date >= '2020-01-01' AND departed_date < '2020-02-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_initiatives (id INT, name VARCHAR(255), description TEXT, total_carbon_offset FLOAT); | Find the total carbon offset of all carbon offset initiatives in the database. | SELECT SUM(total_carbon_offset) FROM carbon_offset_initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval_2019 (drug VARCHAR(50), year INT, status VARCHAR(50)); INSERT INTO drug_approval_2019 (drug, year, status) VALUES ('DrugA', 2019, 'Approved'), ('DrugD', 2019, 'Approved'), ('DrugE', 2019, 'Approved'); CREATE TABLE drug_sales_q4_2020 (drug VARCHAR(50), quarter VARCHAR(5), year INT, revenue INT... | List all drugs that were approved in 2019 and have sales revenue greater than $150,000 in Q4 2020? | SELECT drug_sales_q4_2020.drug FROM drug_sales_q4_2020 INNER JOIN drug_approval_2019 ON drug_sales_q4_2020.drug = drug_approval_2019.drug WHERE drug_sales_q4_2020.quarter = 'Q4' AND drug_sales_q4_2020.year = 2020 AND drug_sales_q4_2020.revenue > 150000 AND drug_approval_2019.year = 2019 AND drug_approval_2019.status = ... | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists dapps (dapp_id INT, dapp_name VARCHAR(255), country VARCHAR(255)); INSERT INTO dapps (dapp_id, dapp_name, country) VALUES (1, 'Uniswap', 'USA'), (2, 'Aave', 'UK'), (3, 'Compound', 'USA'), (4, 'Balancer', 'Switzerland'), (5, 'Yearn Finance', 'USA'), (6, 'Tether', 'Hong Kong'), (7, 'Binance DEX... | Which decentralized applications have been banned in China? | SELECT dapp_name FROM dapps WHERE country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtistGrants (grantID INT, grantAmount DECIMAL(10,2), grantType VARCHAR(50)); INSERT INTO ArtistGrants (grantID, grantAmount, grantType) VALUES (1, 12000.00, 'Indigenous Artist Grant'), (2, 8000.00, 'Emerging Artist Grant'), (3, 15000.00, 'Established Artist Grant'); | What is the maximum funding received by any Indigenous artist grant program? | SELECT MAX(grantAmount) FROM ArtistGrants WHERE grantType = 'Indigenous Artist Grant'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_fairness (ai_category TEXT, fairness_metric TEXT, value FLOAT); | How many algorithmic fairness entries have a value greater than 0.8 for each AI category in the 'ai_fairness' table? | SELECT ai_category, COUNT(*) FROM ai_fairness WHERE value > 0.8 GROUP BY ai_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_impact_ca (sector VARCHAR(20), reduction FLOAT); INSERT INTO drought_impact_ca (sector, reduction) VALUES ('Industrial', 0.1), ('Agriculture', 0.2), ('Domestic', 0.15); | What is the drought impact on industrial water usage in California in terms of water usage reduction? | SELECT reduction FROM drought_impact_ca WHERE sector = 'Industrial'; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), tour_type VARCHAR(255)); INSERT INTO virtual_tours (id, name, location, tour_type) VALUES (1, 'Paris Virtual Tour', 'Paris', 'museum_tour'); INSERT INTO virtual_tours (id, name, location, tour_type) VALUES (2, 'Rome Virtual Tour',... | Delete all records in the virtual_tours table where the tour_type is 'city_tour' | DELETE FROM virtual_tours WHERE tour_type = 'city_tour'; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability_2 (id INT, country VARCHAR(20), capability DECIMAL(3, 2)); INSERT INTO financial_capability_2 (id, country, capability) VALUES (1, 'Switzerland', 0.87), (2, 'Denmark', 0.86), (3, 'Netherlands', 0.85); | Find the top 2 countries with the highest financial capability. | SELECT country, capability FROM (SELECT country, capability, ROW_NUMBER() OVER (ORDER BY capability DESC) rn FROM financial_capability_2) t WHERE rn <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales (id INT, region VARCHAR, sale_value DECIMAL, sale_date DATE); INSERT INTO military_sales (id, region, sale_value, sale_date) VALUES (1, 'Canada', 12000, '2020-01-05'); INSERT INTO military_sales (id, region, sale_value, sale_date) VALUES (2, 'Canada', 15000, '2020-03-30'); | What was the total value of military equipment sales to Canada in Q1 2020? | SELECT SUM(sale_value) FROM military_sales WHERE region = 'Canada' AND sale_date BETWEEN '2020-01-01' AND '2020-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, name TEXT, region TEXT, collective_bargaining BOOLEAN, member_count INT); | Show the names of unions with collective bargaining agreements in the 'southwest' region that have more than 100 members. | SELECT name FROM unions WHERE region = 'southwest' AND collective_bargaining = true AND member_count > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (drug varchar(255), year int, trials int); INSERT INTO clinical_trials (drug, year, trials) VALUES ('DrugA', 2020, 1), ('DrugB', 2020, 3); | How many clinical trials were conducted for each drug in 2020? | SELECT drug, SUM(trials) FROM clinical_trials WHERE year = 2020 GROUP BY drug; | gretelai_synthetic_text_to_sql |
CREATE TABLE crimes (id INT, city VARCHAR(255), type VARCHAR(255), number_of_crimes INT); INSERT INTO crimes (id, city, type, number_of_crimes) VALUES (1, 'New_York_City', 'Theft', 50000), (2, 'New_York_City', 'Assault', 30000); | What is the most common type of crime in New York City? | SELECT type, COUNT(*) AS count FROM crimes WHERE city = 'New_York_City' GROUP BY type ORDER BY count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (practice VARCHAR(20), water_usage INT); INSERT INTO water_usage (practice, water_usage) VALUES ('Hydroponics', 500), ('Aquaponics', 400), ('Vertical Farming', 600), ('Rooftop Farming', 300), ('Urban Ranching', 700), ('Community Gardens', 200); | List the urban farming practices utilizing the least amount of water. | SELECT practice FROM water_usage WHERE water_usage IN (SELECT MIN(water_usage) FROM water_usage); | gretelai_synthetic_text_to_sql |
CREATE TABLE Indian_TV (title TEXT, year INTEGER); INSERT INTO Indian_TV (title, year) VALUES ('TVShow1', 2016), ('TVShow2', 2017), ('TVShow3', 2018), ('TVShow4', 2019), ('TVShow5', 2020), ('TVShow6', 2021); | How many TV shows were produced in India in the last 5 years? | SELECT COUNT(*) FROM Indian_TV WHERE year BETWEEN 2016 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Digital_Divide (project_id INT, project_name VARCHAR(100), completion_year INT); INSERT INTO Digital_Divide (project_id, project_name, completion_year) VALUES (1, 'Project X', 2019), (2, 'Project Y', 2020), (3, 'Project Z', 2018); | Which digital divide initiatives were completed in 2020? | SELECT project_name FROM Digital_Divide WHERE completion_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Resilience_Measures (project_id INT, project_name VARCHAR(50), location VARCHAR(50)); INSERT INTO Resilience_Measures (project_id, project_name, location) VALUES (1, 'Levee Construction', 'Mississippi'); INSERT INTO Resilience_Measures (project_id, project_name, location) VALUES (2, 'Coastal Restoration', ... | What are the names of the flood control projects in the 'Resilience_Measures' table? | SELECT project_name FROM Resilience_Measures WHERE project_name LIKE '%Flood%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, speed FLOAT, dock_date DATE); | What is the average speed of vessels that docked in the Port of Los Angeles in the last month? | SELECT AVG(speed) FROM vessels WHERE dock_date >= DATEADD(month, -1, GETDATE()) AND dock_port = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_consumption (city VARCHAR(50), consumption FLOAT, month INT, year INT); INSERT INTO water_consumption (city, consumption, month, year) VALUES ('Miami', 12.3, 1, 2021), ('Miami', 13.1, 2, 2021), ('Miami', 11.9, 3, 2021); | Compute the moving average water consumption for the past 3 months in Miami. | SELECT city, AVG(consumption) OVER (PARTITION BY city ORDER BY year, month ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) FROM water_consumption; | gretelai_synthetic_text_to_sql |
CREATE TABLE PrizePools (EventID INT, Region VARCHAR(50), PrizePool INT); INSERT INTO PrizePools (EventID, Region, PrizePool) VALUES (1, 'North America', 100000), (2, 'Europe', 150000), (4, 'Asia', 250000); | What is the average prize pool for esports events in Asia? | SELECT AVG(PrizePool) FROM PrizePools WHERE Region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (name VARCHAR(255), location VARCHAR(255), depth FLOAT); INSERT INTO marine_trenches (name, location, depth) VALUES ('Mariana Trench', 'USA', 10994.0), ('Tonga Trench', 'Tonga', 10882.0), ('Kermadec Trench', 'New Zealand', 10047.0); | Identify the top three deepest marine trenches using window functions. | SELECT name, location, depth, ROW_NUMBER() OVER (ORDER BY depth DESC) as rn FROM marine_trenches WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Parks( park_id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), area FLOAT, created_date DATE); | Add a new record to the 'Parks' table | INSERT INTO Parks (park_id, name, location, area, created_date) VALUES (4, 'Stanley Park', 'Vancouver', 1001.00, '2000-01-04'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, name TEXT, population INT);INSERT INTO cities (id, name, population) VALUES (1, 'CityA', 150000), (2, 'CityB', 80000), (3, 'CityC', 120000), (4, 'CityD', 200000); | What is the minimum population of any city in the cities table? | SELECT MIN(population) FROM cities; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, program VARCHAR, community VARCHAR); INSERT INTO programs (id, program, community) VALUES (1, 'Youth Mentoring', 'Underrepresented'), (2, 'Women Empowerment', 'Underrepresented'), (3, 'Community Service', 'Underrepresented'), (4, 'Education Support', 'Underrepresented'); | Delete the program 'Education Support' from the programs table | DELETE FROM programs WHERE program = 'Education Support'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_art (type VARCHAR(255), location VARCHAR(255), date DATE); | Insert a new record into the 'public_art' table for a new public art sculpture. | INSERT INTO public_art (type, location, date) VALUES ('Sculpture', 'City Park', '2023-02-14'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchVessels (VesselID INT, Name VARCHAR(50), SpeciesSpotted INT); INSERT INTO ResearchVessels (VesselID, Name, SpeciesSpotted) VALUES (1, 'RV1', 100), (2, 'RV2', 150), (3, 'RV3', 250), (4, 'RV4', 50); | What are the names of the vessels that have spotted more than 200 marine species? | SELECT Name FROM ResearchVessels WHERE SpeciesSpotted > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE species ( id INT PRIMARY KEY, name VARCHAR(255) ); INSERT INTO species (id, name) VALUES (1, 'polar_bear'), (2, 'arctic_fox'); CREATE TABLE observations ( id INT PRIMARY KEY, species_id INT, observation_date DATE, FOREIGN KEY (species_id) REFERENCES species(id) ); INSERT INTO observations (id, species_id, ... | What is the number of different species observed in 2022? | SELECT COUNT(DISTINCT species_id) FROM observations WHERE observation_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE material_prices (id INT, material VARCHAR(50), price DECIMAL(10, 2)); INSERT INTO material_prices (id, material, price) VALUES (1, 'organic silk', 35.00), (2, 'organic linen', 18.50); | Which sustainable material has the highest average price? | SELECT material, AVG(price) as avg_price FROM material_prices GROUP BY material ORDER BY avg_price DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE language_preservation (id INT, country VARCHAR(50), program VARCHAR(50), region VARCHAR(50)); INSERT INTO language_preservation (id, country, program, region) VALUES (1, 'USA', 'Native American Language Program', 'North America'), (2, 'France', 'French Language Program', 'Europe'); | Compare the number of language preservation programs in North America and Europe. | SELECT COUNT(*) FROM language_preservation WHERE region = 'North America' INTERSECT SELECT COUNT(*) FROM language_preservation WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_pv (id INT, country TEXT, year INT, capacity_mw FLOAT); INSERT INTO solar_pv (id, country, year, capacity_mw) VALUES (1, 'Japan', 2020, 60.5), (2, 'Japan', 2021, 65.6), (3, 'Germany', 2022, 70.7); | What is the total installed solar PV capacity (MW) in Germany as of 2022? | SELECT SUM(capacity_mw) FROM solar_pv WHERE country = 'Germany' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(50), industry VARCHAR(50), founding_year INT, founder_gender VARCHAR(10)); INSERT INTO companies (id, name, industry, founding_year, founder_gender) VALUES (1, 'Delta Inc', 'Retail', 2016, 'Female'), (2, 'Echo Corp', 'Tech', 2017, 'Male'), (3, 'Foxtrot LLC', 'Retail', 2018, ... | What is the total funding raised for companies with a female founder? | SELECT SUM(f.round_amount) FROM companies c JOIN funding_rounds f ON c.id = f.company_id WHERE c.founder_gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(100), country VARCHAR(100)); CREATE TABLE purchases (id INT, player_id INT, purchase_date DATE); INSERT INTO players (id, name, country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'USA'), (3, 'Alex Brown', 'Canada'); INSERT INTO purchases (id, player_id, purchase_date) V... | Delete players from the US who haven't made any purchases in the last year? | DELETE FROM players WHERE id IN (SELECT p.id FROM players p JOIN purchases pu ON p.id = pu.player_id WHERE p.country = 'USA' AND pu.purchase_date < (CURRENT_DATE - INTERVAL '1 year')); | gretelai_synthetic_text_to_sql |
CREATE TABLE staff (id INT, name VARCHAR(50), position VARCHAR(50), salary INT); INSERT INTO staff (id, name, position, salary) VALUES (1, 'Jane Smith', 'Editor', 70000), (2, 'Mike Johnson', 'Reporter', 50000); | What is the maximum salary of editors in the "staff" table? | SELECT MAX(salary) FROM staff WHERE position = 'Editor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ingredient_Sourcing (SupplierID INT, ProductID INT, Organic BOOLEAN, Country VARCHAR(50)); INSERT INTO Ingredient_Sourcing (SupplierID, ProductID, Organic, Country) VALUES (1001, 101, TRUE, 'Brazil'), (1002, 102, FALSE, 'Brazil'), (1003, 101, TRUE, 'Argentina'), (1004, 103, FALSE, 'Argentina'), (1005, 102,... | Which country sources the most organic ingredients for cosmetic products? | SELECT Country, SUM(Organic) as TotalOrganic FROM Ingredient_Sourcing GROUP BY Country ORDER BY TotalOrganic DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargos (id INT PRIMARY KEY, name VARCHAR(50), date_received DATE); | Delete all cargos from the 'cargos' table that are over 10 years old. | DELETE FROM cargos WHERE date_received < DATE_SUB(CURDATE(), INTERVAL 10 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE la_prop(id INT, owner1 VARCHAR(20), owner2 VARCHAR(20), lease_exp DATE); INSERT INTO la_prop VALUES (1, 'Ivy', 'Jack', '2023-03-01'), (2, 'Karen', 'Luke', '2023-01-15'); | Find the unique property co-owners in Los Angeles with a lease expiration date in the next 3 months. | SELECT DISTINCT owner1, owner2 FROM la_prop WHERE (owner1 <> owner2) AND (lease_exp BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 3 MONTH)); | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyIncidents(IncidentID INT, VesselID INT, IncidentType TEXT, IncidentDate DATETIME); INSERT INTO SafetyIncidents(IncidentID, VesselID, IncidentType, IncidentDate) VALUES (1, 1, 'Collision', '2022-03-05 11:00:00'), (2, 2, 'Grounding', '2022-03-15 09:00:00'), (3, 3, 'Mechanical Failure', '2022-03-30 16:3... | List all safety incidents recorded in the last 30 days | SELECT * FROM SafetyIncidents WHERE IncidentDate BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE GeopoliticalRiskAssessments (AssessmentID INT, Country VARCHAR(50), RiskRating VARCHAR(10), AssessmentDate DATE); INSERT INTO GeopoliticalRiskAssessments (AssessmentID, Country, RiskRating, AssessmentDate) VALUES (1, 'Iran', 'High', '2021-06-01'), (2, 'India', 'Medium', '2022-08-12'); | Retrieve the most recent geopolitical risk rating for India. | SELECT Country, RiskRating FROM GeopoliticalRiskAssessments WHERE AssessmentDate = (SELECT MAX(AssessmentDate) FROM GeopoliticalRiskAssessments WHERE Country = 'India'); | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryAircrafts(id INT PRIMARY KEY, name VARCHAR(50), model VARCHAR(50), country VARCHAR(50));INSERT INTO MilitaryAircrafts(id, name, model, country) VALUES (1, 'F-15 Eagle', 'F-15EX', 'USA'); | What is the name and model of military aircrafts manufactured in the USA? | SELECT name, model FROM MilitaryAircrafts WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_initiatives (initiative_id INT, site_id INT, initiative_date DATE, initiative_description TEXT); INSERT INTO pollution_initiatives (initiative_id, site_id, initiative_date, initiative_description) VALUES (1, 1, '2022-08-01', 'Installed new filters'), (2, 3, '2022-07-15', 'Regular cleaning schedul... | What is the earliest pollution control initiative date for each site? | SELECT site_id, MIN(initiative_date) FROM pollution_initiatives GROUP BY site_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Districts (DistrictID INT, Name VARCHAR(50)); CREATE TABLE EmergencyCalls (CallID INT, DistrictID INT, ResponseTime FLOAT); | What is the maximum response time for emergency calls in each district? | SELECT D.Name, MAX(E.ResponseTime) as MaxResponseTime FROM Districts D INNER JOIN EmergencyCalls E ON D.DistrictID = E.DistrictID GROUP BY D.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_manufacturing (id INT PRIMARY KEY, certification VARCHAR(100), certification_date DATE); | Insert new records into the 'ethical_manufacturing' table with the following data: (1, 'Fair Trade Certified', '2021-01-01') | INSERT INTO ethical_manufacturing (id, certification, certification_date) VALUES (1, 'Fair Trade Certified', '2021-01-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE enrollments (id INT, enrollment_date DATE, student_id INT, program VARCHAR(50)); INSERT INTO enrollments (id, enrollment_date, student_id, program) VALUES (1, '2021-07-01', 1001, 'Open Pedagogy'), (2, '2021-08-15', 1002, 'Open Pedagogy'), (3, '2022-01-10', 1003, 'Traditional Program'), (4, '2022-02-01', 10... | How many students have enrolled in the open pedagogy program in the past 6 months? | SELECT COUNT(DISTINCT student_id) as num_enrolled FROM enrollments WHERE program = 'Open Pedagogy' AND enrollment_date >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
player (player_id, name, email, age, gender, country, total_games_played) | Update email of players from 'US' to 'new_email@usa.com' | UPDATE player SET email = 'new_email@usa.com' WHERE country = 'US' | gretelai_synthetic_text_to_sql |
CREATE TABLE Accidents (AccidentID INT, Date DATE, Location VARCHAR(50), AircraftType VARCHAR(50), Description TEXT, Fatalities INT); INSERT INTO Accidents (AccidentID, Date, Location, AircraftType, Description, Fatalities) VALUES (7, '2018-05-05', 'Moscow', 'Boeing 737', 'Electrical issues', 1), (8, '2020-06-06', 'Tok... | Determine the most common aircraft type involved in accidents and its count. | SELECT AircraftType, COUNT(*) AS Count FROM Accidents GROUP BY AircraftType ORDER BY COUNT(*) DESC FETCH FIRST 1 ROW ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_aid_organizations (org_id INT, name VARCHAR(50), cases_handled INT, state VARCHAR(2)); INSERT INTO legal_aid_organizations (org_id, name, cases_handled, state) VALUES (1, 'California Legal Aid', 200, 'CA'), (2, 'New York Legal Aid', 300, 'NY'), (3, 'Texas Legal Aid', 150, 'TX'), (4, 'Florida Legal Ai... | Identify the legal aid organization with the most cases in California | SELECT name, MAX(cases_handled) FROM legal_aid_organizations WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (dish_name TEXT, category TEXT, price DECIMAL); INSERT INTO menu VALUES ('Margherita Pizza', 'Pizza', 9.99), ('Pepperoni Pizza', 'Pizza', 10.99), ('Vegetarian Pizza', 'Pizza', 11.99); | Find the dish with the highest price in the 'Pizza' category | SELECT dish_name, MAX(price) FROM menu WHERE category = 'Pizza' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID INT, Size VARCHAR(10), Country VARCHAR(255)); INSERT INTO Customers (CustomerID, Size, Country) VALUES (1, 'XS', 'Brazil'), (2, 'S', 'Argentina'), (3, 'M', 'Chile'), (4, 'L', 'Peru'), (5, 'XL', 'Colombia'), (6, 'XS', 'Argentina'), (7, 'L', 'Brazil'); | Which size has the most customers in the 'South America' region? | SELECT Size, COUNT(*) AS Count FROM Customers WHERE Country = 'South America' GROUP BY Size ORDER BY Count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (id INT, policyholder_id INT, amount DECIMAL(10, 2), risk_category VARCHAR(25)); | What is the total claim amount per risk assessment category? | SELECT risk_category, SUM(amount) as total_claim_amount FROM claims GROUP BY risk_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supp_id INT, name VARCHAR(50), country VARCHAR(50)); INSERT INTO suppliers VALUES (1, 'Green Earth', 'Germany'); INSERT INTO suppliers VALUES (2, 'EcoVita', 'Germany'); CREATE TABLE products (product_id INT, name VARCHAR(50), type VARCHAR(20), price DECIMAL(5,2)); INSERT INTO products VALUES (1,... | List the suppliers and their respective total revenue for vegan products in Germany. | SELECT s.name, SUM(p.price) FROM suppliers s JOIN products p ON s.name = p.name WHERE s.country = 'Germany' AND p.type = 'vegan' GROUP BY s.name; | gretelai_synthetic_text_to_sql |
create table PressureData (Device varchar(255), Pressure int, Timestamp datetime); insert into PressureData values ('Device1', 50, '2022-01-01 01:00:00'), ('Device2', 70, '2022-01-01 02:00:00'), ('Device1', 60, '2022-01-01 03:00:00'); | What is the maximum pressure recorded per device per hour? | select Device, DATE_PART('hour', Timestamp) as Hour, MAX(Pressure) as MaxPressure from PressureData group by Device, Hour; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, quantity INT, sale_date DATE, is_small_business BOOLEAN); INSERT INTO sales (sale_id, product_id, quantity, sale_date, is_small_business) VALUES (1, 1, 5, '2021-01-01', true); CREATE TABLE products (product_id INT, product_name VARCHAR(255)); INSERT INTO products (produc... | What is the maximum quantity of products sold by small businesses, pivoted by day? | SELECT EXTRACT(DAY FROM sale_date) AS day, is_small_business, MAX(quantity) AS max_quantity FROM sales JOIN products ON sales.product_id = products.product_id WHERE is_small_business = true GROUP BY day, is_small_business; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, PlayerName, Country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'Canada'); CREATE TABLE EsportsEvents (EventID INT, PlayerID INT, EventName VARCHAR(50)); INSERT INTO EsportsEvents (EventID, PlayerID, E... | Which players from the United States and Canada have not participated in any esports events? | (SELECT Players.PlayerName FROM Players WHERE Players.Country IN ('USA', 'Canada') EXCEPT SELECT EsportsEvents.PlayerName FROM EsportsEvents) | gretelai_synthetic_text_to_sql |
CREATE TABLE time_series_data (incident_id INT, incident_type VARCHAR(50), incident_year INT); INSERT INTO time_series_data (incident_id, incident_type, incident_year) VALUES (1, 'Data Privacy', 2021), (2, 'Model Malfunction', 2020), (3, 'Data Privacy', 2021); | What is the distribution of AI safety incidents by type in the last 3 years? | SELECT incident_type, COUNT(*) as num_incidents, incident_year FROM time_series_data WHERE incident_year >= 2019 GROUP BY incident_type, incident_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE yearly_acidification (year INT, level FLOAT); INSERT INTO yearly_acidification (year, level) VALUES (2015, 7.6), (2016, 7.7), (2017, 7.8), (2018, 7.8), (2019, 7.7), (2020, 7.6); | What was the minimum ocean acidification level by year? | SELECT year, MIN(level) FROM yearly_acidification; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(50), country VARCHAR(50), techniques VARCHAR(50), costs FLOAT); INSERT INTO projects (id, name, country, techniques, costs) VALUES (1, 'ProjectX', 'UK', 'Biosensor technology, bioinformatics', 20000); INSERT INTO projects (id, name, country, techniques, costs) VALUES (2, 'Pro... | What is the total biosensor technology development cost for projects in the UK? | SELECT SUM(costs) FROM projects WHERE country = 'UK' AND techniques LIKE '%Biosensor technology%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name TEXT, location TEXT, num_employees INT); INSERT INTO mining_operations (id, name, location, num_employees) VALUES (1, 'Operation X', 'Australia-NSW', 250), (2, 'Operation Y', 'Australia-QLD', 300), (3, 'Operation Z', 'Australia-NSW', 200); | What is the average number of employees per mining operation in Australia, partitioned by state? | SELECT location, AVG(num_employees) FROM mining_operations WHERE location LIKE 'Australia-%' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE matches (id INT, player_id INT, opponent_id INT, winner_id INT); INSERT INTO matches VALUES (1, 1, 2, 1); INSERT INTO matches VALUES (2, 2, 1, 2); INSERT INTO matches VALUES (3, 1, 3, 1); INSERT INTO matches VALUES (4, 3, 1, 3); | What is the win rate for each player in the 'matches' table? | SELECT player_id, COUNT(*) * 100.0 / SUM(CASE WHEN player_id IN (player_id, opponent_id) THEN 1 ELSE 0 END) as win_rate FROM matches GROUP BY player_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_advocacy_tx (id INT, union_name TEXT, state TEXT, involved_in_advocacy BOOLEAN, members INT); INSERT INTO union_advocacy_tx (id, union_name, state, involved_in_advocacy, members) VALUES (1, 'Union A', 'Texas', true, 500), (2, 'Union B', 'Texas', true, 600), (3, 'Union C', 'Texas', false, 400); | What is the number of members in unions advocating for labor rights in Texas? | SELECT SUM(members) FROM union_advocacy_tx WHERE state = 'Texas' AND involved_in_advocacy = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE platformD (genre TEXT, revenue INT); CREATE TABLE platformE (genre TEXT, revenue INT); CREATE TABLE platformF (genre TEXT, revenue INT); | Display the total revenue for the "jazz" genre from all platforms, excluding any platforms that have a revenue lower than $5,000 for that genre. | SELECT genre, SUM(revenue) FROM (SELECT genre, revenue FROM platformD WHERE genre = 'jazz' AND revenue >= 5000 UNION ALL SELECT genre, revenue FROM platformE WHERE genre = 'jazz' AND revenue >= 5000 UNION ALL SELECT genre, revenue FROM platformF WHERE genre = 'jazz' AND revenue >= 5000) AS combined_platforms GROUP BY g... | gretelai_synthetic_text_to_sql |
CREATE TABLE atlantic_ocean (id INT, year INT, species TEXT, sightings INT); INSERT INTO atlantic_ocean (id, year, species, sightings) VALUES (1, 2020, 'Blue Whale', 250); | How many whales have been spotted in the Atlantic Ocean in 2020? | SELECT SUM(sightings) FROM atlantic_ocean WHERE year = 2020 AND species = 'Blue Whale'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_engineering(dish VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2), restaurant VARCHAR(255)); | Update the 'Organic Chicken' dish price to $14.00 in the 'Bistro' restaurant. | UPDATE menu_engineering SET price = 14.00 WHERE dish = 'Organic Chicken' AND restaurant = 'Bistro'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Waste_Production (Plant VARCHAR(255), Waste_Amount INT, Waste_Date DATE); INSERT INTO Waste_Production (Plant, Waste_Amount, Waste_Date) VALUES ('Plant1', 50, '2022-06-01'), ('Plant1', 60, '2022-06-02'), ('Plant2', 30, '2022-06-01'), ('Plant2', 40, '2022-06-02'); | Calculate the average amount of waste produced per day for each manufacturing plant, for the past month, and rank them in descending order. | SELECT Plant, AVG(Waste_Amount) AS Avg_Waste_Per_Day, RANK() OVER (ORDER BY AVG(Waste_Amount) DESC) AS Rank FROM Waste_Production WHERE Waste_Date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY Plant; | gretelai_synthetic_text_to_sql |
CREATE TABLE fare (fare_id INT, amount DECIMAL, collected_date DATE, route_id INT); INSERT INTO fare VALUES (1, 2.50, '2022-07-01', 1); INSERT INTO fare VALUES (2, 3.00, '2022-07-01', 1); INSERT INTO fare VALUES (3, 2.00, '2022-07-02', 2); INSERT INTO fare VALUES (4, 4.00, '2022-07-02', 2); CREATE TABLE route (route_id... | Find the average fare for each route | SELECT r.name, AVG(f.amount) FROM fare f JOIN route r ON f.route_id = r.route_id GROUP BY f.route_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT, project_name VARCHAR(50), location VARCHAR(50)); INSERT INTO genetic_research (id, project_name, location) VALUES (1, 'Project K', 'USA'); INSERT INTO genetic_research (id, project_name, location) VALUES (2, 'Project L', 'Canada'); | Calculate the total number of genetic research projects in the USA. | SELECT COUNT(*) FROM genetic_research WHERE location = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, category VARCHAR(20), volunteer_id INT); INSERT INTO projects (id, category, volunteer_id) VALUES (1, 'Education', 100), (2, 'Environment', 100), (3, 'Health', 200), (4, 'Education', 300); | What are the names of volunteers who have worked on projects in both 'Education' and 'Environment' categories? | SELECT volunteer_id FROM projects WHERE category = 'Education' INTERSECT SELECT volunteer_id FROM projects WHERE category = 'Environment'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_sequestration (id INT, country VARCHAR(255), year INT, sequestration FLOAT, hectares FLOAT); INSERT INTO carbon_sequestration (id, country, year, sequestration, hectares) VALUES (1, 'Canada', 2018, 1000.2, 12000000.5), (2, 'Australia', 2019, 1100.1, 15000000.3), (3, 'Brazil', 2018, 1300.0, 20000000.... | Update the carbon sequestration values for Canada in 2020 by 5% | UPDATE carbon_sequestration SET sequestration = sequestration * 1.05 WHERE country = 'Canada' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Brands (brand_id INT, brand_name VARCHAR(50), ethical BOOLEAN, region VARCHAR(50)); CREATE TABLE Deliveries (delivery_id INT, delivery_date DATE, brand_id INT); | What is the average delivery time for each fair labor practice brand in Asia? | SELECT B.brand_name, AVG(DATEDIFF(delivery_date, order_date)) as avg_delivery_time FROM Deliveries D INNER JOIN Orders O ON D.delivery_id = O.order_id INNER JOIN Brands B ON D.brand_id = B.brand_id WHERE B.ethical = TRUE AND B.region = 'Asia' GROUP BY B.brand_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Naval_Ships (id INT, country VARCHAR(50), type VARCHAR(50), acquisition_date DATE, maintenance_cost FLOAT); | What is the average maintenance cost per month for naval ships in Canada? | SELECT AVG(maintenance_cost/MONTHS_BETWEEN(acquisition_date, CURRENT_DATE)) FROM Naval_Ships WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetics_investment(id INT, investment VARCHAR(50), date DATE, amount DECIMAL(10,2)); INSERT INTO genetics_investment VALUES (1, 'InvestmentA', '2022-03-15', 1000000.00), (2, 'InvestmentB', '2022-01-30', 1200000.00), (3, 'InvestmentC', '2022-02-28', 1500000.00); | What is the total investment in genetics research in Q1 2022? | SELECT SUM(amount) FROM genetics_investment WHERE date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name VARCHAR(50), type VARCHAR(50), country VARCHAR(50)); INSERT INTO organizations (id, name, type, country) VALUES (1, 'Greenpeace Africa', 'NGO', 'Africa'); INSERT INTO organizations (id, name, type, country) VALUES (2, 'Friends of the Earth Africa', 'NGO', 'Africa'); INSERT INTO ... | What's the total funding received by environmental NGOs based in Africa since 2015? | SELECT o.name, o.country, sum(f.funding) as total_funding FROM organizations o INNER JOIN funding_received f ON o.id = f.organization_id WHERE o.type = 'NGO' AND o.country = 'Africa' AND f.year >= 2015 GROUP BY o.name, o.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai_projects (project_id INT, country VARCHAR(20), completion_year INT); INSERT INTO ethical_ai_projects (project_id, country, completion_year) VALUES (1, 'USA', 2020), (2, 'Canada', 2019), (3, 'Mexico', 2021), (4, 'USA', 2018); | How many ethical AI projects were completed in North America last year? | SELECT COUNT(*) FROM ethical_ai_projects WHERE country IN ('USA', 'Canada') AND completion_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE visitor_stats (visitor_id INT, city TEXT, visit_date DATE); INSERT INTO visitor_stats (visitor_id, city, visit_date) VALUES (1, 'Paris', '2020-01-01'), (2, 'Paris', '2020-02-14'), (3, 'London', '2020-03-03'), (4, 'Paris', '2020-04-20'); | How many international visitors arrived in Paris by month in 2020? | SELECT city, EXTRACT(MONTH FROM visit_date) AS month, COUNT(DISTINCT visitor_id) AS num_visitors FROM visitor_stats WHERE city = 'Paris' AND EXTRACT(YEAR FROM visit_date) = 2020 GROUP BY city, month ORDER BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, department VARCHAR(20), incident_date DATE); INSERT INTO security_incidents (id, department, incident_date) VALUES (1, 'HR', '2022-01-15'), (2, 'Finance', '2022-02-07'), (3, 'HR', '2022-03-20'), (4, 'HR', '2022-01-01'); | What is the average number of security incidents per month for the 'HR' department in 2022? | SELECT AVG(COUNT(*)) FROM security_incidents WHERE department = 'HR' AND YEAR(incident_date) = 2022 GROUP BY MONTH(incident_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (country VARCHAR(50), year INT, co2_emissions INT); INSERT INTO emissions (country, year, co2_emissions) VALUES ('USA', 2020, 5135), ('China', 2020, 10096), ('India', 2020, 2720), ('Russia', 2020, 2653), ('Japan', 2020, 1140), ('Germany', 2020, 736), ('Iran', 2020, 551), ('Saudi Arabia', 2020, 53... | Calculate the total CO2 emissions for each country in 2020 from the 'emissions' table | SELECT country, SUM(co2_emissions) as total_emissions FROM emissions WHERE year = 2020 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ca_renewable_energy (id INT, source TEXT, capacity_mw FLOAT); INSERT INTO ca_renewable_energy (id, source, capacity_mw) VALUES (1, 'Wind', 500.0), (2, 'Solar', 1000.0), (3, 'Geothermal', 750.0); | What is the total installed capacity (MW) of renewable energy sources in California? | SELECT SUM(capacity_mw) FROM ca_renewable_energy WHERE source IN ('Wind', 'Solar', 'Geothermal'); | 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.