context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE oneweb_satellites (satellite_id INT, company VARCHAR(20)); INSERT INTO oneweb_satellites (satellite_id, company) VALUES (1, 'OneWeb'), (2, 'OneWeb'), (3, 'OneWeb'), (4, 'OneWeb'); CREATE TABLE telesat_satellites (satellite_id INT, company VARCHAR(20)); INSERT INTO telesat_satellites (satellite_id, company)... | How many satellites were deployed by OneWeb and Telesat before 2021? | SELECT COUNT(*) FROM (SELECT satellite_id FROM oneweb_satellites WHERE satellite_id < 2021 UNION ALL SELECT satellite_id FROM telesat_satellites WHERE satellite_id < 2021) AS combined; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id SERIAL PRIMARY KEY, name TEXT, yield INT, region TEXT); INSERT INTO crops (name, yield, region) VALUES ('corn', 120, 'North America'), ('rice', 220, 'Asia'), ('wheat', 90, 'Europe'); | Create a view named "top_yielding_crops" that shows the top 3 crops by yield | CREATE VIEW top_yielding_crops AS SELECT * FROM crops ORDER BY yield DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitor_Engagement (id INT, visitor_id INT, exhibition_id INT, date DATE); CREATE TABLE Exhibitions (id INT, name VARCHAR(255), type VARCHAR(255), visitor_count INT); INSERT INTO Visitor_Engagement (id, visitor_id, exhibition_id, date) VALUES (1, 1001, 1, '2022-03-22'), (2, 1002, 2, '2022-02-15'), (3, 1003... | What is the total visitor engagement for indigenous artists' exhibitions? | SELECT SUM(visitor_engagement) FROM (SELECT COUNT(ve.id) AS visitor_engagement FROM Visitor_Engagement ve JOIN Exhibitions e ON ve.exhibition_id = e.id WHERE e.type = 'Permanent' AND e.name LIKE '%Indigenous%') AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, name VARCHAR(100), type VARCHAR(50), state VARCHAR(50)); INSERT INTO Infrastructure (id, name, type, state) VALUES (13, 'Mayo Clinic', 'Hospital', 'Minnesota'), (14, 'Johns Hopkins Hospital', 'Hospital', 'Maryland'); | Get the number of hospitals in each state | SELECT state, COUNT(*) FROM Infrastructure WHERE type = 'Hospital' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_water_usage (id INT, crop_id INT, type VARCHAR(255), water_usage FLOAT, timestamp DATETIME); | Find the top 3 crops with the lowest water usage in the past year. | SELECT type, SUM(water_usage) as total_water_usage FROM crop_water_usage WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 YEAR) GROUP BY type ORDER BY total_water_usage ASC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE victims (id INT PRIMARY KEY, name VARCHAR(50), age INT, gender VARCHAR(10), ethnicity VARCHAR(20), incident_date DATE); INSERT INTO victims (id, name, age, gender, ethnicity, incident_date) VALUES (1, 'John Doe', 35, 'Male', 'Caucasian', '2021-09-01'); | Insert records into 'victims' table | INSERT INTO victims (id, name, age, gender, ethnicity, incident_date) VALUES (1, 'John Doe', 35, 'Male', 'Caucasian', '2021-09-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Tourists (id INT, nationality VARCHAR(50), trip_duration INT); CREATE TABLE Eco_tourists (tourist_id INT, eco_friendly BOOLEAN); INSERT INTO Tourists VALUES (1, 'Canada', 7); INSERT INTO Tourists VALUES (2, 'Germany', 10); INSERT INTO Eco_tourists VALUES (1, true); INSERT INTO Eco_tourists VALUES (2, true)... | What is the average trip duration for eco-tourists from Canada and Germany? | SELECT AVG(Tourists.trip_duration) FROM Tourists INNER JOIN Eco_tourists ON Tourists.id = Eco_tourists.tourist_id WHERE Tourists.nationality IN ('Canada', 'Germany') AND Eco_tourists.eco_friendly = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, department VARCHAR(50), date DATE); | Which department has the highest number of security incidents in the 'security_incidents' table? | SELECT department, COUNT(*) as incident_count FROM security_incidents GROUP BY department ORDER BY incident_count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), DonorAge int, DonationCount int, TotalDonations numeric(18,2)); | What is the total number of donations and total amount donated by each age group in the 'Donors' table? | SELECT DonorAge, SUM(DonationCount) as TotalDonationsCount, SUM(TotalDonations) as TotalDonationsAmount FROM Donors GROUP BY DonorAge; | gretelai_synthetic_text_to_sql |
CREATE TABLE safe_dataset (id INT, data_type TEXT); INSERT INTO safe_dataset (id, data_type) VALUES (1, 'text'), (2, 'images'); | How many 'images' are present in the 'safe_dataset'? | SELECT COUNT(*) FROM safe_dataset WHERE data_type = 'images'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_orders(order_id INT, customer_id INT, garment_id INT, quantity INT, price FLOAT, sustainable BOOLEAN); INSERT INTO customer_orders(order_id, customer_id, garment_id, quantity, price, sustainable) VALUES (1, 101, 1, 2, 80.00, true), (2, 102, 2, 1, 70.00, false), (3, 101, 3, 3, 90.00, true); | Who are the top 5 customers in terms of total spent on sustainable garments? | SELECT customer_id, SUM(price * quantity) as total_spent FROM customer_orders WHERE sustainable = true GROUP BY customer_id ORDER BY total_spent DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShows (Id INT PRIMARY KEY, Name VARCHAR(50), City VARCHAR(50), Country VARCHAR(50), StartDate DATE, EndDate DATE); | Number of auto shows in Europe by country | SELECT Country, COUNT(*) FROM AutoShows WHERE Country IN ('Germany', 'France', 'Italy', 'Spain', 'United Kingdom') GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT PRIMARY KEY, waste_type_id INT, generation_rate FLOAT); INSERT INTO waste_generation (id, waste_type_id, generation_rate) VALUES (1, 1, 50.5), (2, 2, 40.3); | Find the maximum waste generation rate | SELECT MAX(generation_rate) FROM waste_generation; | gretelai_synthetic_text_to_sql |
CREATE TABLE hydro_plants (id INT, country VARCHAR(255), year INT, energy_produced INT); INSERT INTO hydro_plants (id, country, year, energy_produced) VALUES (1, 'Norway', 2020, 5000), (2, 'Sweden', 2020, 6000); | What is the total energy produced by hydroelectric power plants in Norway and Sweden in 2020? | SELECT SUM(energy_produced) FROM hydro_plants WHERE country IN ('Norway', 'Sweden') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(50)); CREATE TABLE Donations (DonationID INT, ProgramID INT, DonationAmount DECIMAL(10, 2), DonationDate DATE); INSERT INTO Programs (ProgramID, ProgramName) VALUES (1, 'Art Education'), (2, 'Theater Production'), (3, 'Music Conservatory'); INSERT INTO Donations... | What is the average donation amount for each program in 2022? | SELECT p.ProgramName, AVG(d.DonationAmount) as AvgDonationAmount FROM Donations d INNER JOIN Programs p ON d.ProgramID = p.ProgramID WHERE d.DonationDate >= '2022-01-01' AND d.DonationDate < '2023-01-01' GROUP BY p.ProgramName; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy.energy_projects (project_type VARCHAR(50), consumption FLOAT); INSERT INTO renewable_energy.energy_projects (project_type, consumption) VALUES ('Solar Farm', 1234.5), ('Wind Turbine', 2345.6), ('Hydro Plant', 3456.7), ('Geothermal Plant', 4567.8), ('Biomass Plant', 5678.9); | What is the average energy consumption of buildings in the 'renewable_energy' schema, grouped by project_type, and only for projects with consumption > 2000? | SELECT project_type, AVG(consumption) FROM renewable_energy.energy_projects WHERE consumption > 2000 GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE models (id INT, dataset VARCHAR(20), satisfaction FLOAT, region VARCHAR(20)); INSERT INTO models VALUES (1, 'datasetA', 4.3, 'Europe'), (2, 'datasetA', 4.5, 'Asia'), (3, 'datasetB', 3.9, 'Africa'), (4, 'datasetB', 4.1, 'Africa'), (5, 'datasetA', 4.2, 'North America'), (6, 'datasetB', 3.7, 'North America'); | What is the difference between the average satisfaction score of models trained on dataset A and dataset B, for each region? | SELECT region, AVG(m.satisfaction) - (SELECT AVG(satisfaction) FROM models m2 WHERE m.region = m2.region AND m2.dataset = 'datasetB') FROM models m WHERE m.dataset = 'datasetA' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements (id INT, industry VARCHAR, state VARCHAR, duration INT); INSERT INTO cb_agreements (id, industry, state, duration) VALUES (1, 'Healthcare', 'California', 24); | What is the minimum duration of a collective bargaining agreement in the healthcare industry in California? | SELECT industry, MIN(duration) as min_duration FROM cb_agreements WHERE industry = 'Healthcare' AND state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tunnels (TunnelID INT, Name VARCHAR(255), Location VARCHAR(255), Company VARCHAR(255), ConstructionYear INT); INSERT INTO Tunnels VALUES (1, 'Tunnel A', 'New York', 'TUNNELCO', 1990); INSERT INTO Tunnels VALUES (2, 'Tunnel B', 'New Jersey', 'PIPECO', 1995); INSERT INTO Tunnels VALUES (3, 'Tunnel C', 'New Y... | What are the names and locations of all tunnels in New York and New Jersey, along with their respective construction companies and the year they were constructed? | SELECT Name, Location, Company, ConstructionYear FROM Tunnels WHERE Location IN ('New York', 'New Jersey'); | gretelai_synthetic_text_to_sql |
CREATE TABLE UnionMembership (id INT, sector VARCHAR(255), membership DECIMAL(5,2)); INSERT INTO UnionMembership (id, sector, membership) VALUES (1, 'Retail', 0.25), (2, 'Construction', 0.75); | What is the minimum and maximum Union membership rate across all sectors? | SELECT MIN(membership), MAX(membership) FROM UnionMembership; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workshops (WorkshopID INT, TeacherID INT, WorkshopName VARCHAR(100), Attendance INT); | Create a table named 'Workshops' with columns 'WorkshopID', 'TeacherID', 'WorkshopName', 'Attendance' | CREATE TABLE Workshops (WorkshopID INT, TeacherID INT, WorkshopName VARCHAR(100), Attendance INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founded_year INT, industry TEXT, total_funding DECIMAL(10,2)); INSERT INTO startups (id, name, founded_year, industry, total_funding) VALUES (1, 'Acme Inc', 2010, 'Tech', 1500000.00); INSERT INTO startups (id, name, founded_year, industry, total_funding) VALUES (2, 'Beta Corp', ... | What is the average total funding for startups founded in 2018 and in the 'E-commerce' industry? | SELECT AVG(total_funding) FROM startups WHERE founded_year = 2018 AND industry = 'E-commerce'; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft (name VARCHAR(50), type VARCHAR(50), country VARCHAR(50), launch_date DATE); | List all spacecraft and their respective launch dates, ordered by name. | SELECT name, launch_date FROM spacecraft ORDER BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE basketball_stadiums (stadium_name TEXT, location TEXT, capacity INT, games_hosted INT); CREATE TABLE basketball_attendance (stadium_name TEXT, date TEXT, fans_attended INT); | How many fans attended the basketball games in the top 5 stadiums in the US in 2021? | SELECT s.stadium_name, COUNT(a.fans_attended) FROM basketball_stadiums s JOIN basketball_attendance a ON s.stadium_name = a.stadium_name WHERE s.location = 'US' GROUP BY s.stadium_name ORDER BY COUNT(a.fans_attended) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Forests (id INT, name VARCHAR(50), hectares FLOAT, country VARCHAR(50)); INSERT INTO Forests (id, name, hectares, country) VALUES (1, 'Amazon Rainforest', 55000000.0, 'Brazil'); CREATE TABLE Carbon_Sequestration (id INT, forest_id INT, year INT, sequestration_tons FLOAT); INSERT INTO Carbon_Sequestration (... | What is the average carbon sequestration for forests in Australia between 2005 and 2015? | SELECT AVG(sequestration_tons) FROM Carbon_Sequestration WHERE forest_id IN (SELECT id FROM Forests WHERE country = 'Australia') AND year BETWEEN 2005 AND 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE BuildingPermits (id INT, state VARCHAR(20), year INT, permit_number VARCHAR(20)); INSERT INTO BuildingPermits (id, state, year, permit_number) VALUES (1, 'California', 2021, 'ABC123'), (2, 'California', 2020, 'DEF456'), (3, 'Texas', 2021, 'GHI789'); | List all the building permits issued in the state of California in 2021. | SELECT permit_number FROM BuildingPermits WHERE state = 'California' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name TEXT, cuisine TEXT, revenue FLOAT); INSERT INTO restaurants (id, name, cuisine, revenue) VALUES (1, 'Restaurant A', 'asian', 40000.00), (2, 'Restaurant B', 'latin american', 55000.00), (3, 'Restaurant C', 'asian', 35000.00), (4, 'Restaurant D', 'latin american', 65000.00), (5, 'Re... | What is the minimum revenue generated by a restaurant in the "latin american" cuisine type? | SELECT MIN(revenue) FROM restaurants WHERE cuisine = 'latin american'; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_site (site_id INTEGER, site_name TEXT, country TEXT); INSERT INTO excavation_site (site_id, site_name, country) VALUES (1, 'Pompeii', 'Italy'), (2, 'Angkor Wat', 'Cambodia'), (3, 'Machu Picchu', 'Peru'), (4, 'Petra', 'Jordan'), (5, 'Tikal', 'Guatemala'), (6, 'Palmyra', 'Syria'), (7, 'Easter Isla... | find the name of the country with the most excavation sites | SELECT country, COUNT(site_name) AS num_sites FROM excavation_site GROUP BY country ORDER BY num_sites DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (program_id INT PRIMARY KEY, name VARCHAR(255), description TEXT, category VARCHAR(255), budget DECIMAL(10,2)); | Update the budget for a support program | UPDATE support_programs SET budget = 60000.00 WHERE program_id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (Program VARCHAR(50), Budget DECIMAL(10,2), BudgetDate DATE); INSERT INTO Budget (Program, Budget, BudgetDate) VALUES ('Feeding the Homeless', 5000, '2021-04-01'), ('Tree Planting', 3000, '2021-04-01'); | What was the budget allocated for each program in Q2 2021? | SELECT Program, Budget FROM Budget WHERE BudgetDate = '2021-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturers (manufacturer_id INT, manufacturer_name TEXT, region TEXT); INSERT INTO manufacturers (manufacturer_id, manufacturer_name, region) VALUES (1, 'ManufacturerA', 'North America'), (2, 'ManufacturerB', 'Europe'), (3, 'ManufacturerC', 'Asia'), (4, 'ManufacturerD', 'Asia'), (5, 'ManufacturerE', 'So... | Insert a new record for 'ManufacturerG' into the manufacturers table, located in the 'Africa' region. | INSERT INTO manufacturers (manufacturer_id, manufacturer_name, region) VALUES (6, 'ManufacturerG', 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_states (state TEXT, drought_frequency INTEGER); INSERT INTO drought_states (state, drought_frequency) VALUES ('California', 4), ('Texas', 3), ('Arizona', 5), ('Nevada', 6), ('Colorado', 2); CREATE TABLE agricultural_water_usage (state TEXT, population INTEGER, consumption INTEGER); INSERT INTO agri... | Identify the drought-prone states with the lowest per capita water consumption in the agricultural sector. | SELECT ds.state, (agwu.consumption / agwu.population) AS consumption_per_capita FROM drought_states ds JOIN agricultural_water_usage agwu ON ds.state = agwu.state ORDER BY drought_frequency, consumption_per_capita; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftAltitude (id INT, model VARCHAR(20), altitude INT); | What is the max altitude achieved by SpaceCorp spacecraft, grouped by model? | SELECT model, MAX(altitude) FROM SpacecraftAltitude WHERE manufacturer = 'SpaceCorp' GROUP BY model; | gretelai_synthetic_text_to_sql |
CREATE TABLE facilities (facility_id INT, facility_name TEXT, num_beds INT, location TEXT); INSERT INTO facilities (facility_id, facility_name, num_beds, location) VALUES (6, 'Arkansas Rural Hospital', 30, 'Arkansas'); | List the names and locations of healthcare facilities in rural Arkansas with more than 25 beds. | SELECT facility_name, location FROM facilities WHERE num_beds > 25 AND location = 'Arkansas'; | gretelai_synthetic_text_to_sql |
INSERT INTO music_genres_ext (id, genre, popularity) VALUES (4, 'Hip Hop', 30000000); | as of 2022 | INSERT INTO music_genres_ext (id, genre, popularity, release_year) | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_cases_la (id INT, case_id INT, appearance_date DATE); INSERT INTO criminal_cases_la (id, case_id, appearance_date) VALUES (1, 1001, '2019-01-01'), (2, 1001, '2019-02-01'), (3, 1002, '2019-03-01'); | What is the average number of court appearances required for criminal cases in Los Angeles? | SELECT AVG(id) FROM criminal_cases_la WHERE case_id = 1001 AND appearance_date LIKE '2019%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, Name TEXT, LastDonation DATE); INSERT INTO Donors VALUES (1, 'John Doe', '2021-02-01'), (2, 'Jane Smith', '2022-01-01'), (3, 'Mike Johnson', '2021-08-01'); | List all donors who haven't donated in the last 6 months. | SELECT * FROM Donors WHERE LastDonation < DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_amount INT, organization_id INT, donation_date DATE); CREATE TABLE organizations (id INT, name TEXT, country TEXT); INSERT INTO donations (id, donation_amount, organization_id, donation_date) VALUES (1, 5000, 1, '2022-01-01'), (2, 10000, 2, '2021-12-01'), (3, 7000, 3, '2022-02-0... | List all the organizations in the database that have received donations in the last 3 months, along with the total amount donated to each organization. | SELECT organizations.name, SUM(donations.donation_amount) FROM organizations INNER JOIN donations ON organizations.id = donations.organization_id WHERE donations.donation_date >= DATE(NOW()) - INTERVAL 3 MONTH GROUP BY organizations.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE London_Housing (Location VARCHAR(255), Year INT, Units INT, Affordable BOOLEAN); INSERT INTO London_Housing (Location, Year, Units, Affordable) VALUES ('Greenwich', 2008, 30, true), ('Hackney', 2010, 50, true), ('Hammersmith', 2009, 40, false), ('Islington', 2012, 60, true); | Find the number of affordable housing units in London built since 2010. | SELECT COUNT(*) FROM London_Housing WHERE Year >= 2010 AND Affordable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (year INT, region VARCHAR(50), funding_type VARCHAR(50), amount INT);INSERT INTO climate_finance (year, region, funding_type, amount) VALUES (2020, 'Latin America', 'climate adaptation', 12000000); | What is the total funding allocated for climate adaptation projects in Latin America and the Caribbean? | SELECT SUM(amount) FROM climate_finance WHERE region = 'Latin America' AND funding_type = 'climate adaptation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_test (id INT, vehicle_id INT, rating INT); INSERT INTO safety_test (id, vehicle_id, rating) VALUES (1, 1, 4), (2, 2, 5), (3, 3, 4), (4, 4, 5), (5, 5, 3), (6, 6, 5), (7, 8, 4), (8, 9, 3), (9, 10, 5), (10, 11, 5), (11, 12, 4); CREATE TABLE vehicles (id INT, type VARCHAR(20)); INSERT INTO vehicles (id,... | What is the average safety rating for sedans? | SELECT AVG(safety_test.rating) FROM safety_test JOIN vehicles ON safety_test.vehicle_id = vehicles.id WHERE vehicles.type = 'Sedan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE latam_renewable_energy (country VARCHAR(20), energy_source VARCHAR(20), installed_capacity INT); INSERT INTO latam_renewable_energy (country, energy_source, installed_capacity) VALUES ('Brazil', 'Solar', 5000), ('Brazil', 'Wind', 12000), ('Brazil', 'Hydro', 95000), ('Argentina', 'Solar', 2000), ('Argentina... | What is the total installed capacity of renewable energy sources in Brazil and Argentina? | SELECT SUM(installed_capacity) FROM latam_renewable_energy WHERE country IN ('Brazil', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Activities (ActID INT, ActDate DATE, OrgID INT, Activity VARCHAR(255), Hours INT); INSERT INTO Activities (ActID, ActDate, OrgID, Activity, Hours) VALUES (1, '2021-10-01', 1, 'Training', 20), (2, '2021-11-15', 2, 'Workshop', 30), (3, '2021-12-20', 3, 'Seminar', 40); | How many total hours were spent on capacity building activities in Q4 2021? | SELECT SUM(Hours) as TotalHours FROM Activities WHERE QUARTER(ActDate) = 4 AND YEAR(ActDate) = 2021 AND Activity = 'Capacity Building'; | gretelai_synthetic_text_to_sql |
CREATE TABLE retailers (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(100)); CREATE TABLE sales (id INT PRIMARY KEY, retailer_id INT, quantity INT, revenue INT, city VARCHAR(100)); INSERT INTO retailers (id, name, location) VALUES (1, 'Retailer X', 'City X'), (2, 'Retailer Y', 'City Y'), (3, 'Retailer Z', 'Ci... | Display the retailers that have sales in both City X and City Y. | SELECT r.name FROM retailers r INNER JOIN sales s ON r.id = s.retailer_id WHERE s.city IN ('City X', 'City Y') GROUP BY r.name HAVING COUNT(DISTINCT s.city) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, name VARCHAR(50), state VARCHAR(50), plan VARCHAR(50)); INSERT INTO mobile_subscribers (subscriber_id, name, state, plan) VALUES (1, 'Jack Smith', 'New York', 'unlimited'); INSERT INTO mobile_subscribers (subscriber_id, name, state, plan) VALUES (2, 'Jill Doe', 'New Y... | How many mobile subscribers have an unlimited data plan in the state of New York? | SELECT COUNT(*) FROM mobile_subscribers WHERE state = 'New York' AND plan = 'unlimited'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (ArtworkID int, ArtworkName varchar(100), AddDate date); INSERT INTO Artworks (ArtworkID, ArtworkName, AddDate) VALUES (1, 'Starry Night', '2021-07-01'), (2, 'Mona Lisa', '2021-04-01'), (3, 'The Persistence of Memory', '2021-10-01'); | How many artworks were added to the Museum's collection in Q3 2021? | SELECT COUNT(*) FROM Artworks WHERE MONTH(AddDate) BETWEEN 7 AND 9 AND YEAR(AddDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, category VARCHAR(20), cost FLOAT); INSERT INTO Infrastructure (id, category, cost) VALUES (1, 'Transportation', 5000000), (2, 'WaterSupply', 3000000), (3, 'Transportation', 7000000); | Which projects have a higher cost than any project in 'WaterSupply' category? | SELECT * FROM Infrastructure i1 WHERE cost > (SELECT MAX(cost) FROM Infrastructure i2 WHERE i2.category = 'WaterSupply'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (projectID INT, projectType VARCHAR(50), totalCost DECIMAL(10,2), sqft DECIMAL(10,2));CREATE TABLE GreenBuildings (projectID INT, sustainableMaterial VARCHAR(50), sustainableMaterialCost DECIMAL(10,2)); | What is the total cost of construction projects per square foot for each project type in the 'Projects' and 'GreenBuildings' tables? | SELECT P.projectType, SUM(P.totalCost)/SUM(P.sqft) AS CostPerSqft FROM Projects P LEFT JOIN GreenBuildings GB ON P.projectID = GB.projectID GROUP BY P.projectType; | gretelai_synthetic_text_to_sql |
CREATE TABLE BuildingEnergyRatings (building TEXT, rating FLOAT); INSERT INTO BuildingEnergyRatings (building, rating) VALUES ('Building1', 90), ('Building2', 95), ('Building3', 100); | What is the maximum energy efficiency rating in the 'BuildingEnergyRatings' table? | SELECT rating FROM BuildingEnergyRatings ORDER BY rating DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensor; USE biosensor; CREATE TABLE if not exists gene_expression (sample_id INT, gene_name VARCHAR(255), expression DECIMAL(5,2)); INSERT INTO gene_expression (sample_id, gene_name, expression) VALUES (1, 'ABC', 3.45), (2, 'ABC', 3.56), (3, 'XYZ', 5.12), (4, 'DEF', 2.98), (5, 'XYZ', 6.25... | Which biosensor samples have expression levels higher than 5 for gene 'XYZ'? | SELECT sample_id, gene_name, expression FROM biosensor.gene_expression WHERE gene_name = 'XYZ' AND expression > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy(id INT, event_name VARCHAR(255), host VARCHAR(255), budget INT, event_year INT); INSERT INTO defense_diplomacy(id, event_name, host, budget, event_year) VALUES (1, 'African Union Defense Forum', 'AU', 6000000, 2016), (2, 'AU Peace and Security Council Meeting', 'AU', 4000000, 2017), (3, '... | What is the total number of defense diplomacy events hosted by the African Union with a budget over 5 million USD between 2016 and 2021, inclusive? | SELECT COUNT(*) FROM defense_diplomacy WHERE host = 'AU' AND budget > 5000000 AND event_year BETWEEN 2016 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE innovation_project (project_id INT, project_name VARCHAR(50), budget INT); INSERT INTO innovation_project (project_id, project_name, budget) VALUES (1, 'Precision Agriculture', 500000); | List all agricultural innovation projects and their corresponding budgets in the 'rural_development' database. | SELECT * FROM innovation_project; | gretelai_synthetic_text_to_sql |
CREATE TABLE all_users (id INT, state VARCHAR(20), water_usage FLOAT); INSERT INTO all_users (id, state, water_usage) VALUES (1, 'Texas', 1000.5), (2, 'Texas', 1200.3), (3, 'Florida', 800.2), (4, 'Florida', 900.1), (5, 'Georgia', 700.0), (6, 'Georgia', 850.1); | What is the total water usage by all users in the states of Texas, Florida, and Georgia? | SELECT SUM(water_usage) FROM all_users WHERE state IN ('Texas', 'Florida', 'Georgia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Equipment (Type VARCHAR(255), Cost FLOAT); INSERT INTO Equipment (Type, Cost) VALUES ('Tank', 12000), ('Plane', 35000), ('Ship', 70000); | What is the total maintenance cost for each equipment type? | SELECT Type, SUM(Cost) FROM Equipment GROUP BY Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Trips (District text, TripDate date); INSERT INTO Trips (District, TripDate) VALUES ('A', '2022-01-01'), ('B', '2022-01-02'); | How many public transportation trips were taken in each district for the last 3 months? | SELECT District, COUNT(*) as Trips, DATE_TRUNC('month', TripDate) as Month FROM Trips WHERE TripDate >= DATEADD(month, -3, CURRENT_DATE) GROUP BY District, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Community (Name TEXT, Country TEXT, ObesityRate FLOAT); INSERT INTO Community (Name, Country, ObesityRate) VALUES ('Community A', 'Canada', 20.0); INSERT INTO Community (Name, Country, ObesityRate) VALUES ('Community B', 'US', 25.0); | Which community has the lowest obesity rate in Canada? | SELECT Name, ObesityRate FROM Community WHERE Country = 'Canada' ORDER BY ObesityRate ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (product_id INT, country VARCHAR(50), co2_emissions INT); CREATE TABLE products (product_id INT, product_name VARCHAR(50)); INSERT INTO co2_emissions (product_id, country, co2_emissions) VALUES (1, 'UK', 10), (2, 'Sweden', 5), (3, 'UK', 15); INSERT INTO products (product_id, product_name) VAL... | What is the average CO2 emissions per product for products manufactured in the UK and Sweden? | SELECT AVG(co2_emissions) FROM co2_emissions INNER JOIN products ON co2_emissions.product_id = products.product_id WHERE products.country IN ('UK', 'Sweden'); | gretelai_synthetic_text_to_sql |
CREATE TABLE food_justice_contributors (id INT, name TEXT, contributions FLOAT); INSERT INTO food_justice_contributors (id, name, contributions) VALUES (1, 'Contributor 1', 10000.0), (2, 'Contributor 2', 15000.0), (3, 'Contributor 3', 20000.0), (4, 'Contributor 4', 25000.0); | Who are the top 3 contributors to food justice initiatives in Africa? | SELECT name, contributions FROM (SELECT name, contributions, ROW_NUMBER() OVER (ORDER BY contributions DESC) as rank FROM food_justice_contributors WHERE country = 'Africa') as ranked_contributors WHERE rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Faculty(Id INT, Name VARCHAR(100), Department VARCHAR(50), Gender VARCHAR(10), GrantAmount DECIMAL(10,2)); INSERT INTO Faculty(Id, Name, Department, Gender, GrantAmount) VALUES (1, 'Karen', 'Biology', 'Female', 60000.00), (2, 'Leon', 'Biology', 'Male', 70000.00); | What is the minimum research grant amount received by a faculty member in the Biology department? | SELECT MIN(GrantAmount) FROM Faculty WHERE Department = 'Biology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE asia_pacific_jobs (id INT, country VARCHAR(50), job VARCHAR(50), salary DECIMAL(10,2)); INSERT INTO asia_pacific_jobs (id, country, job, salary) VALUES (1, 'China', 'Engineer', 80000.00), (2, 'Japan', 'Assembler', 50000.00), (3, 'India', 'Engineer', 90000.00), (4, 'Australia', 'Assembler', 55000.00), (5, '... | Identify manufacturing jobs with salaries above the overall average salary for all manufacturing jobs in the Asia-Pacific region, and list the corresponding country and job title. | SELECT country, job, salary FROM asia_pacific_jobs WHERE salary > (SELECT AVG(salary) FROM asia_pacific_jobs); | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai (algorithm VARCHAR(255), technique VARCHAR(255), interpretability_score FLOAT); INSERT INTO explainable_ai (algorithm, technique, interpretability_score) VALUES ('SHAP', 'Model Explanations', 0.9), ('LIME', 'Feature Importance', 0.8), ('TreeExplainer', 'Tree Models', 0.7), ('DeepLIFT', 'Laye... | What is the average interpretability score and the number of techniques for each algorithm in the 'explainable_ai' table? | SELECT algorithm, AVG(interpretability_score) as avg_interpretability, COUNT(technique) as num_techniques FROM explainable_ai GROUP BY algorithm; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_facilities (facility_id INT, location TEXT, score INT); INSERT INTO mental_health_facilities (facility_id, location, score) VALUES (1, 'Urban', 80), (2, 'Rural', 75), (3, 'Suburban', 85); | What is the average cultural competency score for mental health facilities in urban areas? | SELECT AVG(score) FROM mental_health_facilities WHERE location = 'Urban'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, mental_health_score INT, participated_in_lifelong_learning BOOLEAN); INSERT INTO students (student_id, mental_health_score, participated_in_lifelong_learning) VALUES (1, 80, TRUE), (2, 70, FALSE), (3, 90, TRUE), (4, 60, FALSE); | What is the mental health score of the student with the lowest ID who has participated in lifelong learning activities? | SELECT mental_health_score FROM students WHERE student_id = (SELECT MIN(student_id) FROM students WHERE participated_in_lifelong_learning = TRUE); | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT, name VARCHAR(255)); INSERT INTO countries (id, name) VALUES (1, 'Brazil'); CREATE TABLE water_meter_readings (id INT, country_id INT, city_id INT, consumption FLOAT, reading_date DATE); INSERT INTO water_meter_readings (id, country_id, city_id, consumption, reading_date) VALUES (1, 1, 1,... | Identify the top 5 water consuming cities in Brazil in the last year | SELECT water_meter_readings.city_id, SUM(water_meter_readings.consumption) as total_consumption FROM water_meter_readings WHERE water_meter_readings.reading_date >= (CURRENT_DATE - INTERVAL '1 year')::date AND water_meter_readings.country_id IN (SELECT id FROM countries WHERE name = 'Brazil') GROUP BY water_meter_readi... | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicleAdoptionState (Model VARCHAR(20), State VARCHAR(10), AdoptionRate FLOAT); | List the number of electric vehicles adopted in each state in the US. | SELECT State, SUM(AdoptionRate) FROM ElectricVehicleAdoptionState WHERE State IS NOT NULL GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE education_programs (id INT, name VARCHAR(255));CREATE TABLE community_outreach (id INT, program_id INT, animals_reached INT); INSERT INTO education_programs (id, name) VALUES (1, 'Adopt an Animal'), (2, 'Wildlife Warriors'); INSERT INTO community_outreach (id, program_id, animals_reached) VALUES (1, 1, 50)... | List all education programs and the number of animals they protect | SELECT e.name AS program_name, SUM(co.animals_reached) AS total_animals FROM community_outreach co INNER JOIN education_programs e ON co.program_id = e.id GROUP BY e.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE machines (id INT, model VARCHAR(255), manufacturing_country VARCHAR(255), year INT); | Insert a new record into the 'machines' table with id 301, model 'CNC Milling Machine', manufacturing_country 'Japan', and year 2018 | INSERT INTO machines (id, model, manufacturing_country, year) VALUES (301, 'CNC Milling Machine', 'Japan', 2018); | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (artist_id INT, name VARCHAR(50), age INT, country VARCHAR(50)); INSERT INTO artists (artist_id, name, age, country) VALUES (1, 'Pablo Picasso', 91, 'Spain'); INSERT INTO artists (artist_id, name, age, country) VALUES (2, 'Francis Bacon', 82, 'Ireland'); | Who is the oldest artist in the 'artists' table? | SELECT name, MAX(age) FROM artists; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intel (report_date DATE, threat_category VARCHAR(255)); | What is the number of threat intelligence reports created per month for the 'Cyber' threat category in the threat_intel table for the year 2021? | SELECT EXTRACT(MONTH FROM report_date), COUNT(*) FROM threat_intel WHERE threat_category = 'Cyber' AND report_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY EXTRACT(MONTH FROM report_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE AZDispensaries (DispensaryID INT, Name VARCHAR(100), Location VARCHAR(100)); CREATE TABLE AZTransactions (TransactionID INT, DispensaryID INT, QuantitySold INT, TransactionDate DATE); | Delete records of transactions with a quantity of zero in Arizona dispensaries since January 2021 | DELETE FROM AZTransactions WHERE QuantitySold = 0 AND DispensaryID IN (SELECT DispensaryID FROM AZDispensaries WHERE State = 'Arizona') AND TransactionDate >= '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE plastic_waste(city VARCHAR(255), quarter INT, year INT, amount INT); INSERT INTO plastic_waste(city, quarter, year, amount) VALUES('CityC', 2, 2022, 345), ('CityD', 2, 2022, 567); | How many tons of plastic waste were generated in each city in Q2 2022? | SELECT city, SUM(amount) FROM plastic_waste WHERE quarter = 2 AND year = 2022 GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE tunnels (country VARCHAR(50), name VARCHAR(50), length INT); INSERT INTO tunnels (country, name, length) VALUES ('Canada', 'Eisenhower Tunnel', 5626), ('Canada', 'Chedicun Tunnel', 1707); | Find the number of tunnels and their total length in Canada? | SELECT COUNT(*), SUM(length) FROM tunnels WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT, study_name VARCHAR(50), method VARCHAR(50), data TEXT); INSERT INTO genetic_research (id, study_name, method, data) VALUES (1, 'Sequencing Study 1', 'DNA sequencing', 'ACTG...'); INSERT INTO genetic_research (id, study_name, method, data) VALUES (2, 'Sequencing Study 2', 'RNA sequ... | List the genetic research data from the genetic_research table related to DNA sequencing | SELECT * FROM genetic_research WHERE method = 'DNA sequencing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE UnionInfo (UnionName VARCHAR(50), HeadquarterCountry VARCHAR(50), Members VARINT); INSERT INTO UnionInfo (UnionName, HeadquarterCountry, Members) VALUES ('UnionA', 'USA', 70000), ('UnionB', 'Canada', 45000), ('UnionC', 'Mexico', 60000); | What are the names of unions and their respective headquarters' countries for unions with more than 50,000 members? | SELECT UnionName, HeadquarterCountry FROM UnionInfo WHERE Members > 50000 | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_info (id INT, vehicle_make VARCHAR, vehicle_model VARCHAR, vehicle_type VARCHAR, electric BOOLEAN); | Determine the percentage of electric vehicles in the 'vehicle_info' table, grouped by 'vehicle_type'. | SELECT vehicle_type, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM vehicle_info WHERE electric = true) AS percentage FROM vehicle_info WHERE electric = true GROUP BY vehicle_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE fares (id INT, fare_amount FLOAT, fare_type VARCHAR(50), fare_city VARCHAR(50)); | Calculate the average fare for public transportation in Rome | SELECT AVG(fare_amount) AS avg_fare FROM fares WHERE fare_city = 'Rome' AND fare_type = 'public'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteID INT, SiteName TEXT, Country TEXT); INSERT INTO ExcavationSites (SiteID, SiteName, Country) VALUES (1, 'MayanRuins', 'Guatemala'); | Add a new excavation site 'EgyptianPyramids' in Egypt and insert it into the ExcavationSites table. | INSERT INTO ExcavationSites (SiteID, SiteName, Country) VALUES (2, 'EgyptianPyramids', 'Egypt'); | gretelai_synthetic_text_to_sql |
CREATE TABLE concert_sales (id INT, artist VARCHAR(255), state VARCHAR(255), date DATE, tickets_sold INT, revenue FLOAT); INSERT INTO concert_sales (id, artist, state, date, tickets_sold, revenue) VALUES (1, 'Kendrick Lamar', 'California', '2022-08-01', 5000, 250000.00); | What is the total revenue generated from concert ticket sales and music streaming in the state of 'California'? | SELECT SUM(concert_sales.revenue + music_streaming.revenue) FROM concert_sales INNER JOIN music_streaming ON concert_sales.state = music_streaming.state WHERE concert_sales.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, factory_name TEXT, location TEXT, is_ethical BOOLEAN, num_employees INT); INSERT INTO factories (factory_id, factory_name, location, is_ethical, num_employees) VALUES (1, 'Green Factory', 'Southeast Asia', TRUE, 200), (2, 'Standard Factory', 'Southeast Asia', FALSE, 150); | How many employees work in ethical factories in Southeast Asia? | SELECT COUNT(*) FROM factories WHERE is_ethical = TRUE AND location = 'Southeast Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE indigenous_communities (id INT PRIMARY KEY, name VARCHAR(50), population INT, annual_precipitation FLOAT); | What is the average annual precipitation in indigenous communities with a population greater than 200? | SELECT AVG(indigenous_communities.annual_precipitation) FROM indigenous_communities WHERE indigenous_communities.population > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_companies (company_id INT, company_name TEXT, industry TEXT);CREATE TABLE gold_mine (company_id INT, quantity_mined INT);CREATE TABLE silver_mine (company_id INT, quantity_mined INT); | What are the total quantities of gold and silver mined by each company? | SELECT m.company_name, SUM(gm.quantity_mined) AS total_gold_mined, SUM(sm.quantity_mined) AS total_silver_mined FROM mining_companies m JOIN gold_mine gm ON m.company_id = gm.company_id JOIN silver_mine sm ON m.company_id = sm.company_id GROUP BY m.company_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (CountryID INT, Country VARCHAR(50)); INSERT INTO Countries (CountryID, Country) VALUES (1, 'USA'); INSERT INTO Countries (CountryID, Country) VALUES (2, 'Canada'); | What is the number of employees hired for diversity and inclusion initiatives in each country? | SELECT Countries.Country, COUNT(Employees.EmployeeID) as NumberOfEmployees FROM Countries INNER JOIN Employees ON Countries.CountryID = Employees.CountryID WHERE Employees.HireDate BETWEEN DATEADD(year, -1, GETDATE()) AND GETDATE() GROUP BY Countries.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE drilling_depths (platform_type text, location text, drilling_depth real); INSERT INTO drilling_depths (platform_type, location, drilling_depth) VALUES ('jackup', 'Gulf of Mexico', 10000), ('semisubmersible', 'Gulf of Mexico', 15000), ('drillship', 'Gulf of Mexico', 12000), ('jackup', 'North Sea', 8000), ('... | What is the average drilling depth for offshore drilling platforms in the Gulf of Mexico? | SELECT AVG(drilling_depth) FROM drilling_depths WHERE location = 'Gulf of Mexico' AND platform_type IN ('jackup', 'semisubmersible', 'drillship'); | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_financing(client_id INT, client_gender VARCHAR(6), country VARCHAR(25), amount FLOAT);INSERT INTO shariah_financing(client_id, client_gender, country, amount) VALUES (1, 'Female', 'Bahrain', 5000), (2, 'Male', 'UAE', 7000), (3, 'Female', 'Indonesia', 6000), (4, 'Male', 'Saudi Arabia', 8000), (5, 'F... | What is the average Shariah-compliant financing for female clients in each country? | SELECT country, AVG(amount) as avg_financing FROM shariah_financing WHERE client_gender = 'Female' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, region VARCHAR(10), last_maintenance_date DATE); INSERT INTO military_equipment VALUES (1, 'Pacific', '2021-05-20'), (2, 'Atlantic', '2021-06-01'), (3, 'Pacific', '2021-05-25'); | Identify military equipment needing maintenance in the Pacific region in June 2021. | SELECT equipment_id FROM military_equipment WHERE region = 'Pacific' AND last_maintenance_date < DATE '2021-06-01' AND last_maintenance_date >= DATE '2021-06-01' - INTERVAL '6 month'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicWorksProjects (id INT, city VARCHAR(50), country VARCHAR(50), completion_year INT); | What is the total number of public works projects completed in the country of India between 2010 and 2015? | SELECT COUNT(*) FROM PublicWorksProjects WHERE country = 'India' AND completion_year BETWEEN 2010 AND 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID INT, CustomerName VARCHAR(255), TotalFreightCharges DECIMAL(10, 2)); INSERT INTO Customers (CustomerID, CustomerName, TotalFreightCharges) VALUES (1, 'ABC Corp', 5000.00), (2, 'XYZ Inc', 7000.00), (3, 'LMN Ltd', 6000.00), (4, 'DEF Co', 8000.00), (5, 'GHI Pvt', 9000.00); | What are the top 5 customers by total freight charges? | SELECT CustomerName, TotalFreightCharges FROM Customers ORDER BY TotalFreightCharges DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE species_biomass (date DATE, species VARCHAR(50), biomass FLOAT); INSERT INTO species_biomass (date, species, biomass) VALUES ('2022-04-01', 'Tilapia', 3000); | What is the total biomass for each species in Q2 2022? | SELECT EXTRACT(QUARTER FROM date) as quarter, species, SUM(biomass) as total_biomass FROM species_biomass WHERE date >= '2022-04-01' AND date <= '2022-06-30' GROUP BY quarter, species; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patches (id INT, game_id INT, release_date DATE); INSERT INTO Patches (id, game_id, release_date) VALUES (1, 1, '2022-01-01'), (2, 1, '2022-02-15'), (3, 1, '2022-04-01'); CREATE TABLE Regions (id INT, name VARCHAR(50)); INSERT INTO Regions (id, name) VALUES (1, 'North America'), (2, 'Europe'), (3, 'Asia'),... | How many players have joined the game since the latest patch in each region? | SELECT R.name AS region, COUNT(P.id) AS new_players FROM Players P JOIN Regions R ON P.region_id = R.id JOIN Patches Q ON P.game_id = Q.game_id WHERE P.join_date >= Q.release_date AND Q.id = (SELECT MAX(id) FROM Patches WHERE game_id = P.game_id) GROUP BY R.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE AnimalPopulation (animal_id INT, species VARCHAR(50), conservation_status VARCHAR(50), animal_count INT); | List all endangered species in 'AnimalPopulation' and their respective counts | SELECT species, animal_count FROM AnimalPopulation WHERE conservation_status = 'Endangered' ORDER BY animal_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE team_performances_table (team_id INT, team_name VARCHAR(50), sport VARCHAR(20), wins INT, losses INT); INSERT INTO team_performances_table (team_id, team_name, sport, wins, losses) VALUES (1, 'Blue Lions', 'Basketball', 25, 15); INSERT INTO team_performances_table (team_id, team_name, sport, wins, losses) ... | Find the difference in wins between the team with the most wins and the team with the least wins in 'team_performances_table' | SELECT MAX(wins) - MIN(wins) AS win_difference FROM team_performances_table; | gretelai_synthetic_text_to_sql |
CREATE TABLE gadolinium_production (country VARCHAR(255), year INT, price DECIMAL(10,2)); INSERT INTO gadolinium_production (country, year, price) VALUES ('Russia', 2020, 65.30); | What is the average price of gadolinium produced in Russia in 2020? | SELECT AVG(price) FROM gadolinium_production WHERE country = 'Russia' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_investments(id INT, name TEXT, return_on_investment DECIMAL); | Which socially responsible investments have the highest returns? | SELECT name, return_on_investment FROM socially_responsible_investments ORDER BY return_on_investment DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethereum_smart_contracts (contract_address VARCHAR(42), risk_level VARCHAR(10)); INSERT INTO ethereum_smart_contracts (contract_address, risk_level) VALUES ('0x1234567890123456789012345678901234567890', 'High Risk'); | What's the total number of Ethereum smart contracts categorized as 'High Risk'? | SELECT COUNT(*) FROM ethereum_smart_contracts WHERE risk_level = 'High Risk'; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (researcher_id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), experience INT); | Update the "experience" field in the "researchers" table for the researcher with "researcher_id" 305 to 8. | UPDATE researchers SET experience = 8 WHERE researcher_id = 305; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (Program TEXT, Budget DECIMAL(10,2));CREATE TABLE Donations (DonationID INT, DonorID INT, Program TEXT, Amount DECIMAL(10,2), Success BOOLEAN); | What is the total budget allocated for each program, including the programs that have not received any funding? | SELECT P.Program, SUM(P.Budget) as TotalBudget FROM Programs P GROUP BY P.Program; | gretelai_synthetic_text_to_sql |
CREATE TABLE economic_diversification (country TEXT, year INT, jobs_created INT); INSERT INTO economic_diversification (country, year, jobs_created) VALUES ('Indonesia', 2017, 200), ('Indonesia', 2017, 300), ('Indonesia', 2018, 400), ('Indonesia', 2018, 500), ('Indonesia', 2019, 600), ('Indonesia', 2019, 700), ('Indone... | Which economic diversification efforts in Indonesia have been the most successful in the past 5 years, based on the number of jobs created? | SELECT year, MAX(jobs_created) AS max_jobs_created FROM economic_diversification WHERE country = 'Indonesia' AND year BETWEEN 2017 AND 2021 GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (trench_name VARCHAR(255), max_depth INTEGER); | Show the top 5 deepest marine trenches. | SELECT trench_name FROM marine_trenches ORDER BY max_depth DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_production (id INT, name VARCHAR(50), area_ha FLOAT, country VARCHAR(50)); | Insert a new record for a 50-hectare timber production area in Canada. | INSERT INTO timber_production (name, area_ha, country) VALUES ('Canadian Timber', 50.0, 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE social_impact_investments (id INT, sector VARCHAR(20)); INSERT INTO social_impact_investments (id, sector) VALUES (1, 'Renewable Energy'), (2, 'Affordable Housing'), (3, 'Healthcare'), (4, 'Education'); | How many social impact investments are in the 'Renewable Energy' sector? | SELECT COUNT(*) FROM social_impact_investments WHERE sector = 'Renewable Energy'; | 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.