context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Companies (id INT, name TEXT, industry TEXT, total_funding FLOAT, num_investments INT); INSERT INTO Companies (id, name, industry, total_funding, num_investments) VALUES (1, 'Acme Inc', 'Software', 2500000, 2), (2, 'Beta Corp', 'Software', 5000000, 1), (3, 'Gamma Startup', 'Hardware', 1000000, 3), (4, 'Del... | Find the companies that have the same industry and total funding as the company with the maximum number of investment rounds. | SELECT c1.id, c1.name, c1.industry, c1.total_funding, c1.num_investments FROM Companies c1 INNER JOIN (SELECT industry, total_funding, MAX(num_investments) AS max_investments FROM Companies GROUP BY industry) c2 ON c1.industry = c2.industry AND c1.total_funding = c2.total_funding AND c1.num_investments = c2.max_investm... | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT PRIMARY KEY, name VARCHAR(50), latitude DECIMAL(9,6), longitude DECIMAL(9,6)); | Add a new mining site in Australia with the name "New Horizon" and coordinates (123.45, -67.89). | INSERT INTO mining_sites (name, latitude, longitude) VALUES ('New Horizon', 123.45, -67.89); | gretelai_synthetic_text_to_sql |
CREATE TABLE agrochemicals (id INT, name VARCHAR(255), location VARCHAR(255), emissions_tonnes FLOAT, date DATE); | What was the total CO2 emissions (in tonnes) from agrochemicals in the Americas in 2019? | SELECT SUM(emissions_tonnes) FROM agrochemicals WHERE YEAR(date) = 2019 AND location LIKE '%Americas%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_founding(id INT PRIMARY KEY, company_name VARCHAR(100), founder_country VARCHAR(50)); INSERT INTO company_founding VALUES (1, 'Acme Inc', 'India'); INSERT INTO company_founding VALUES (2, 'Beta Corp', 'USA'); INSERT INTO company_founding VALUES (3, 'Charlie LLC', 'Canada'); INSERT INTO company_foun... | Identify the top 3 countries with the most companies founded | SELECT founder_country, COUNT(*) as company_count FROM company_founding GROUP BY founder_country ORDER BY company_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_name TEXT, team TEXT, height FLOAT); INSERT INTO players (player_name, team, height) VALUES ('Charlie Davis', 'Los Angeles Lakers', 200.66); INSERT INTO players (player_name, team, height) VALUES ('Diana Williams', 'Los Angeles Lakers', 192.02); | What is the minimum height of players in the basketball team 'Los Angeles Lakers'? | SELECT MIN(height) FROM players WHERE team = 'Los Angeles Lakers'; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (id INT, city TEXT, views INT, clicks INT); INSERT INTO virtual_tours (id, city, views, clicks) VALUES (1, 'Sydney', 100, 50), (2, 'Melbourne', 150, 75), (3, 'Brisbane', 200, 100); | Identify the top 2 virtual tour cities with the most clicks in 'Australia'. | SELECT city, SUM(clicks) as total_clicks FROM virtual_tours WHERE city IN ('Sydney', 'Melbourne', 'Brisbane') GROUP BY city ORDER BY total_clicks DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (org_id INT, org_name TEXT);CREATE TABLE volunteers (vol_id INT, org_id INT, hours_contributed INT, volunteer_name TEXT); INSERT INTO organizations VALUES (1, 'Habitat for Humanity'); INSERT INTO organizations VALUES (2, 'Red Cross'); INSERT INTO volunteers VALUES (1, 1, 10, 'John Doe'); INSE... | What is the total number of volunteers for each organization, and the total hours they have contributed? | SELECT organizations.org_name, SUM(volunteers.hours_contributed) AS total_hours, COUNT(DISTINCT volunteers.vol_id) AS total_volunteers FROM organizations INNER JOIN volunteers ON organizations.org_id = volunteers.org_id GROUP BY organizations.org_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Collective_Bargaining (industry VARCHAR(20), agreement BOOLEAN); INSERT INTO Collective_Bargaining (industry, agreement) VALUES ('Manufacturing', true), ('Manufacturing', false), ('Service', true); | What is the distribution of collective bargaining agreements by industry? | SELECT industry, SUM(agreement) as total_agreements FROM Collective_Bargaining GROUP BY industry; | gretelai_synthetic_text_to_sql |
CREATE TABLE Trend (id INT PRIMARY KEY, name VARCHAR(50), popularity_score INT); | Add a new record to the 'Trend' table for the 'Animal Print' trend | INSERT INTO Trend (id, name, popularity_score) VALUES (20, 'Animal Print', 90); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR(50), age INT, language VARCHAR(20)); INSERT INTO community_health_workers (id, name, age, language) VALUES (1, 'John Doe', 45, 'English'), (2, 'Jane Smith', 35, 'Spanish'), (3, 'Alice Johnson', 40, 'Spanish'), (4, 'Bob Brown', 50, 'English'); | What are the names and ages of community health workers who speak English? | SELECT name, age FROM community_health_workers WHERE language = 'English'; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_us (region VARCHAR(255), year INT, avg_temp FLOAT);CREATE TABLE weather_canada (region VARCHAR(255), year INT, avg_temp FLOAT); | What is the average temperature change in the US and Canada from 2010 to 2020, and which regions had the highest increase? | SELECT w1.region, AVG(w1.avg_temp - w2.avg_temp) AS temp_change FROM weather_us w1 INNER JOIN weather_canada w2 ON w1.region = w2.region WHERE w1.year BETWEEN 2010 AND 2020 GROUP BY w1.region ORDER BY temp_change DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEngagement (country VARCHAR(50), events INT); INSERT INTO CommunityEngagement (country, events) VALUES ('Brazil', 50), ('Argentina', 30), ('Colombia', 40), ('Peru', 60), ('Chile', 70); | What is the number of community engagement events in South American countries for language preservation? | SELECT SUM(events) FROM CommunityEngagement WHERE country IN ('Brazil', 'Argentina', 'Colombia', 'Peru', 'Chile') AND region = 'South America' AND prompt_type = 'language preservation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agroecology_projects (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(100), farm_id INT, FOREIGN KEY (farm_id) REFERENCES farmers(id)); INSERT INTO agroecology_projects (id, name, location, farm_id) VALUES (1, 'Zimbabwe Agroecology Project', 'Zimbabwe', 1), (2, 'Kenya Agroecology Learning Network',... | How many agroecology projects are there in Africa? | SELECT COUNT(*) FROM agroecology_projects ap WHERE ap.location IN ('Zimbabwe', 'Kenya', 'Senegal'); | gretelai_synthetic_text_to_sql |
CREATE TABLE archaeologists (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), country VARCHAR(50)); CREATE TABLE artifact_analysis (id INT, archaeologist_id INT, artifact_id INT, analysis_date DATE); | Get the average age and number of artifacts analyzed by archaeologists of each gender in the 'archaeologists' and 'artifact_analysis' tables. | SELECT archaeologists.gender, AVG(archaeologists.age), COUNT(artifact_analysis.archaeologist_id) FROM archaeologists LEFT JOIN artifact_analysis ON archaeologists.id = artifact_analysis.archaeologist_id GROUP BY archaeologists.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE hiv_diagnoses (race TEXT, num_diagnoses INT); INSERT INTO hiv_diagnoses (race, num_diagnoses) VALUES ('White', 5000), ('Black', 8000), ('Hispanic', 6000), ('Asian', 3000), ('Other', 2000); | What is the number of HIV diagnoses for each race in the hiv_diagnoses table? | SELECT race, num_diagnoses FROM hiv_diagnoses; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, SupplierName VARCHAR(50), Country VARCHAR(50), Certification VARCHAR(50), Material VARCHAR(50), Quantity INT); INSERT INTO Suppliers (SupplierID, SupplierName, Country, Certification, Material, Quantity) VALUES (1, 'Supplier A', 'Vietnam', 'Fair Trade', 'Organic Cotton', 5000), (... | What is the average quantity of sustainable material used per fair-trade certified supplier? | SELECT AVG(Quantity) AS AverageQuantity FROM Suppliers WHERE Certification = 'Fair Trade'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (drug VARCHAR(50), year INT, status VARCHAR(50)); INSERT INTO drug_approval (drug, year, status) VALUES ('DrugX', 2018, 'Approved'), ('DrugY', 2017, 'Approved'), ('DrugZ', 2018, 'Approved'); CREATE TABLE sales (drug VARCHAR(50), quarter VARCHAR(5), year INT, revenue INT); INSERT INTO sales (d... | List all drugs that were approved in 2018 and have sales revenue greater than $100,000 in Q3 2019? | SELECT sales.drug FROM sales INNER JOIN drug_approval ON sales.drug = drug_approval.drug WHERE sales.quarter = 'Q3' AND sales.year = 2019 AND sales.revenue > 100000 AND drug_approval.year = 2018 AND drug_approval.status = 'Approved'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_personnel (operation_name VARCHAR(255), country VARCHAR(255), personnel INT, deployment_date DATE); | What is the maximum number of peacekeepers deployed by any country in a single operation since 2000? | SELECT MAX(personnel) FROM peacekeeping_personnel WHERE deployment_date >= '2000-01-01' GROUP BY operation_name ORDER BY MAX(personnel) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teams (TeamID INT, TeamName VARCHAR(100), Goals INT); INSERT INTO Teams (TeamID, TeamName, Goals) VALUES (1, 'Barcelona', 12), (2, 'Real Madrid', 15), (3, 'Bayern Munich', 18); | What is the average number of goals scored by each team in the UEFA Champions League? | SELECT TeamName, AVG(Goals) as AvgGoals FROM Teams GROUP BY TeamName; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, office_location VARCHAR(255), billing_rate DECIMAL(5,2)); INSERT INTO attorneys (attorney_id, office_location, billing_rate) VALUES (1, 'Los Angeles', 300), (2, 'New York', 450), (3, 'Los Angeles', 350); | What is the average billing rate for attorneys in the New York office? | SELECT AVG(billing_rate) FROM attorneys WHERE office_location = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE alternative_sentencing (id INT PRIMARY KEY, state VARCHAR(255), program_name VARCHAR(255), program_type VARCHAR(255)); INSERT INTO alternative_sentencing (id, state, program_name, program_type) VALUES (1, 'Texas', 'Community Service', 'Alternative Sentencing'), (2, 'Texas', 'Probation', 'Alternative Senten... | What is the total number of alternative sentencing programs offered in the state of Texas? | SELECT COUNT(*) FROM alternative_sentencing WHERE state = 'Texas' AND program_type = 'Alternative Sentencing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtifactsDates (ArtifactID INT, Date DATE); INSERT INTO ArtifactsDates (ArtifactID, Date) VALUES (1, '1955-01-01'), (2, '1960-01-01'), (3, '1970-01-01'), (4, '1980-01-01'), (5, '1990-01-01'); | Which artifact types are present at excavation sites dated between 1950 and 1990? | SELECT ArtifactType FROM Artifacts a JOIN ArtifactsDates d ON a.ArtifactID = d.ArtifactID WHERE d.Date BETWEEN '1950-01-01' AND '1990-01-01' GROUP BY ArtifactType; | gretelai_synthetic_text_to_sql |
CREATE TABLE bills (id INT, subscriber_id INT, amount DECIMAL(10,2), billing_period DATE, type VARCHAR(10), region VARCHAR(10)); INSERT INTO bills (id, subscriber_id, amount, billing_period, type, region) VALUES (1, 1, 50.00, '2022-01-01', 'postpaid', 'North East'), (2, 2, 60.00, '2022-01-01', 'postpaid', 'North East')... | What is the average monthly bill for postpaid mobile customers in the 'North East' region? | SELECT AVG(bills.amount) AS avg_monthly_bill FROM bills WHERE bills.type = 'postpaid' AND bills.region = 'North East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(255), city VARCHAR(255), country VARCHAR(255)); | Delete all records in the 'suppliers' table with a 'country' of 'China' and a 'supplier_name' starting with 'Lee' | DELETE FROM suppliers WHERE country = 'China' AND supplier_name LIKE 'Lee%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_count (id INTEGER, name VARCHAR(255), species VARCHAR(255), ocean VARCHAR(255)); | How many marine species are there in the 'Southern Ocean'? | SELECT COUNT(*) FROM marine_species_count WHERE ocean = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media (user_id INT, post_id INT, post_date DATE); | What is the average number of posts per day for the 'social_media' table, assuming the 'post_date' column is of type DATE? | SELECT AVG(COUNT(*)) FROM social_media GROUP BY post_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE Forest_Management_4 (ID INT, Region VARCHAR(50), Practice VARCHAR(50), Cost FLOAT); INSERT INTO Forest_Management_4 (ID, Region, Practice, Cost) VALUES (1, 'Region1', 'Practice1', 1000), (2, 'Region1', 'Practice2', 1200), (3, 'Region2', 'Practice3', 1500); | What is the average cost of forest management practices in 'Region1'? | SELECT AVG(Cost) FROM Forest_Management_4 WHERE Region = 'Region1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AccessibilityImprovements (SchoolName VARCHAR(255), Year INT, Budget DECIMAL(10,2)); INSERT INTO AccessibilityImprovements (SchoolName, Year, Budget) VALUES ('SchoolA', 2020, 50000.00), ('SchoolB', 2020, 75000.00), ('SchoolC', 2019, 60000.00); | What is the breakdown of the budget allocated for accessibility improvements in each school? | SELECT SchoolName, SUM(Budget) as TotalBudget FROM AccessibilityImprovements WHERE SchoolName IN (SELECT SchoolName FROM Schools WHERE Type = 'School') GROUP BY SchoolName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (ID INT, Name TEXT, CargoWeight INT, DockedAt DATETIME); INSERT INTO Vessels (ID, Name, CargoWeight, DockedAt) VALUES (1, 'Vessel1', 5000, '2022-01-01 10:00:00'), (2, 'Vessel2', 6000, '2022-01-05 14:30:00'); CREATE TABLE Ports (ID INT, Name TEXT); INSERT INTO Ports (ID, Name) VALUES (1, 'Oakland'),... | What is the maximum cargo weight handled by the vessels that docked in the port of San Francisco in the last year? | SELECT MAX(CargoWeight) FROM Vessels WHERE DockedAt >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND Ports.Name = 'San_Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (id INT, name VARCHAR(50), country VARCHAR(50), prize_money_won DECIMAL(10, 2)); INSERT INTO teams (id, name, country, prize_money_won) VALUES (1, 'Team1', 'South Korea', 70000.00), (2, 'Team2', 'USA', 35000.00), (3, 'Team3', 'South Korea', 80000.00); | What is the total prize money won by teams from South Korea in esports events? | SELECT SUM(prize_money_won) FROM teams WHERE country = 'South Korea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name TEXT, region TEXT, avg_depth FLOAT); INSERT INTO marine_protected_areas (id, name, region, avg_depth) VALUES (1, 'MPA 1', 'Pacific', 2500), (2, 'MPA 2', 'Pacific', 2800), (3, 'MPA 3', 'Pacific', 1800); | What is the average depth of all marine protected areas in the Pacific region, excluding areas with an average depth of more than 3000 meters? | SELECT AVG(avg_depth) FROM marine_protected_areas WHERE region = 'Pacific' AND avg_depth < 3000; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name TEXT, country TEXT, dissolved_oxygen FLOAT); INSERT INTO fish_farms (id, name, country, dissolved_oxygen) VALUES (1, 'Farm G', 'Chile', 6.5); INSERT INTO fish_farms (id, name, country, dissolved_oxygen) VALUES (2, 'Farm H', 'Chile', 7.1); INSERT INTO fish_farms (id, name, country, ... | What is the average dissolved oxygen level for all fish farms in Chile? | SELECT AVG(dissolved_oxygen) FROM fish_farms WHERE country = 'Chile'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_charging_stations (id INT, station_name VARCHAR(50), state VARCHAR(50), location VARCHAR(50)); INSERT INTO ev_charging_stations (id, station_name, state, location) VALUES (1, 'New York City EV Charging', 'New York', 'Manhattan'); | List all electric vehicle charging stations in the state of New York, along with their locations. | SELECT station_name, location FROM ev_charging_stations WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (aircraft_id INT, name VARCHAR(50), status VARCHAR(20), flight_hours INT); INSERT INTO aircraft (aircraft_id, name, status, flight_hours) VALUES (1, 'B747', 'active', 15000), (2, 'A320', 'active', 12000); | Calculate average flight hours of aircraft | SELECT AVG(flight_hours) AS avg_flight_hours FROM aircraft; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Diversity VARCHAR(20), Department VARCHAR(30)); INSERT INTO Employees (EmployeeID, Diversity, Department) VALUES (8, 'Neurodivergent', 'IT'), (9, 'Neurotypical', 'IT'); | What is the count of employees who identify as neurodivergent in the IT department? | SELECT COUNT(*) FROM Employees WHERE Diversity = 'Neurodivergent'; | gretelai_synthetic_text_to_sql |
CREATE TABLE InvestigativeProjects (ProjectID INT, Region VARCHAR(50), CompletionStatus VARCHAR(50)); INSERT INTO InvestigativeProjects (ProjectID, Region, CompletionStatus) VALUES (1, 'Northeast', 'Completed'), (2, 'Southeast', 'In Progress'), (3, 'Midwest', 'Completed'); | How many investigative journalism projects have been completed in each region, in total and by their completion status? | SELECT Region, COUNT(*) as TotalProjects, SUM(CASE WHEN CompletionStatus = 'Completed' THEN 1 ELSE 0 END) as CompletedProjects, SUM(CASE WHEN CompletionStatus = 'In Progress' THEN 1 ELSE 0 END) as InProgressProjects FROM InvestigativeProjects GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE SolarPlant (country VARCHAR(50), installed_capacity FLOAT); | What is the total installed capacity of solar power plants in GW, grouped by country? | SELECT country, SUM(installed_capacity) FROM SolarPlant GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name TEXT, products TEXT); INSERT INTO suppliers (id, name, products) VALUES (1, 'Supplier X', 'organic cotton, recycled polyester'), (2, 'Supplier Y', 'conventional cotton, linen'), (3, 'Supplier Z', 'recycled polyester, hemp'); | List all suppliers that provide both organic cotton and recycled polyester. | SELECT name FROM suppliers WHERE products LIKE '%organic cotton%' AND products LIKE '%recycled polyester%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_pricing_CA (state VARCHAR(255), year INT, revenue FLOAT); INSERT INTO carbon_pricing_CA (state, year, revenue) VALUES ('California', 2022, 12.5); | What is the total carbon pricing revenue for California in 2022? | SELECT revenue FROM carbon_pricing_CA WHERE state = 'California' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (material_id INT, name VARCHAR(255), type VARCHAR(255), recycled_content DECIMAL(5,2));CREATE TABLE products (product_id INT, name VARCHAR(255), material_id INT, quantity INT);INSERT INTO materials (material_id, name, type, recycled_content) VALUES (1, 'Recycled Cotton', 'Recycled', 1.00), (2, 'O... | What is the total quantity of recycled materials used in European products in Q3 2021? | SELECT SUM(products.quantity) as total_quantity FROM materials JOIN products ON materials.material_id = products.material_id WHERE materials.type = 'Recycled' AND QUARTER(products.dates) = 3 AND YEAR(products.dates) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (Name VARCHAR(50), Population INT, MilitarySpending NUMERIC(18,2)); INSERT INTO Country (Name, Population, MilitarySpending) VALUES ('China', 1430000000, 250000), ('India', 1366000000, 66000), ('United States', 331000000, 770000), ('Indonesia', 273000000, 8000), ('Pakistan', 225000000, 11000); | What is the total military spending for countries with a population over 100 million? | SELECT Name, MilitarySpending FROM Country WHERE Population > 100000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE productivity (project_id INT, mineral TEXT, quantity INT, extraction_hours INT); INSERT INTO productivity (project_id, mineral, quantity, extraction_hours) VALUES (1, 'gold', 1200, 200), (2, 'copper', 1500, 300); | What is the average quantity (in kg) of copper extracted per hour for all mining projects in Africa? | SELECT AVG(quantity/extraction_hours) FROM productivity WHERE mineral = 'copper' AND EXISTS (SELECT 1 FROM projects WHERE projects.id = productivity.project_id AND projects.continent = 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceRadar (id INT, country VARCHAR(50), year INT, satellites INT); INSERT INTO SpaceRadar (id, country, year, satellites) VALUES (1, 'USA', 2000, 10), (2, 'China', 2005, 8), (3, 'Russia', 1995, 12); | What is the total number of satellites launched by each country in the SpaceRadar table? | SELECT country, SUM(satellites) AS total_satellites FROM SpaceRadar GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_applications (app_id INT, app_name TEXT, safety_score DECIMAL(3,2), developer_id INT, developer_country TEXT); INSERT INTO creative_ai_applications (app_id, app_name, safety_score, developer_id, developer_country) VALUES (1, 'AI Painter', 8.5, 1001, 'USA'), (2, 'AI Music Composer', 9.1, 1002, '... | What is the average safety score of creative AI applications developed by women in the US? | SELECT AVG(safety_score) FROM creative_ai_applications caa JOIN developers d ON caa.developer_id = d.developer_id WHERE d.developer_gender = 'Female' AND d.developer_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (id INT, donor VARCHAR(50), funds DECIMAL(10,2), year INT); INSERT INTO humanitarian_assistance (id, donor, funds, year) VALUES (1, 'European Union', 20000000.00, 2019); INSERT INTO humanitarian_assistance (id, donor, funds, year) VALUES (2, 'USA', 15000000.00, 2019); INSERT INTO hu... | What is the total humanitarian assistance provided by the European Union in 2019? | SELECT SUM(funds) as total_humanitarian_assistance FROM humanitarian_assistance WHERE donor = 'European Union' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (PolicyID INT, RiskAssessmentScore INT, City VARCHAR(20)); INSERT INTO Policyholders (PolicyID, RiskAssessmentScore, City) VALUES (1, 200, 'CityA'), (2, 300, 'CityA'), (3, 200, 'CityB'); | List all unique risk assessment scores used for policyholders in 'CityA'. | SELECT DISTINCT RiskAssessmentScore FROM Policyholders WHERE City = 'CityA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (id INT, name VARCHAR(255), continent VARCHAR(255)); INSERT INTO HeritageSites (id, name, continent) VALUES (1, 'Taj Mahal', 'Asia'), (2, 'Christ the Redeemer', 'South America'), (3, 'Angkor Wat', 'Asia'); CREATE TABLE Budget (id INT, heritage_site VARCHAR(255), budget FLOAT); INSERT INTO Bud... | Which heritage sites have the highest community engagement budgets? | SELECT HeritageSites.name, Budget.budget FROM HeritageSites INNER JOIN Budget ON HeritageSites.name = Budget.heritage_site ORDER BY Budget.budget DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Systems (Id INT, Threat VARCHAR(255), Timestamp DATETIME); INSERT INTO Systems (Id, Threat, Timestamp) VALUES (1, 'Ransomware', '2022-01-01 10:00:00'), (2, 'Spyware', '2022-01-02 12:00:00'), (3, 'Ransomware', '2022-01-03 14:00:00'); | Calculate the percentage of systems impacted by each threat type in the last 30 days. | SELECT Threat, COUNT(DISTINCT Id) as SystemCount, 100.0 * COUNT(DISTINCT Id) / (SELECT COUNT(DISTINCT Id) FROM Systems WHERE Timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY)) as Percentage FROM Systems WHERE Timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY) GROUP BY Threat; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (approval_id INT, drug_name TEXT, disease_area TEXT, approval_date DATE); INSERT INTO drug_approval (approval_id, drug_name, disease_area, approval_date) VALUES (1, 'DrugG', 'Cardiovascular', '2015-01-01'), (2, 'DrugH', 'Oncology', '2018-01-01'); | Minimum drug approval time for Cardiovascular drugs | SELECT MIN(DATEDIFF('2022-01-01', approval_date)) FROM drug_approval WHERE disease_area = 'Cardiovascular'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileSuppliers (SupplierID INT, SupplierName TEXT, Material TEXT); INSERT INTO TextileSuppliers (SupplierID, SupplierName, Material) VALUES (1, 'GreenFields', 'Organic Cotton'), (2, 'NaturalFibers', 'Hemp'), (3, 'EcoWeaves', 'Organic Cotton'), (4, 'SustainableHarvest', 'Bamboo'), (5, 'PureTextiles', 'Org... | List all the textile suppliers that provide both organic cotton and hemp? | SELECT DISTINCT SupplierName FROM TextileSuppliers WHERE Material IN ('Organic Cotton', 'Hemp') GROUP BY SupplierName HAVING COUNT(DISTINCT Material) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabrics (id INT PRIMARY KEY, material VARCHAR(255), country VARCHAR(255), quantity INT); INSERT INTO fabrics (id, material, country, quantity) VALUES (1, 'cotton', 'Bangladesh', 500), (2, 'silk', 'China', 300), (3, 'wool', 'Australia', 700); | Insert a new record in the fabrics table for material 'hemp', country 'Canada' and quantity 400 | INSERT INTO fabrics (material, country, quantity) VALUES ('hemp', 'Canada', 400); | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Aircrafts_2 (id INT, country VARCHAR(50), type VARCHAR(50), maintenance_cost FLOAT); | What is the minimum maintenance cost for military aircrafts in South America? | SELECT MIN(maintenance_cost) FROM Military_Aircrafts_2 WHERE country = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftProductionCost ( id INT, model VARCHAR(255), year INT, quantity INT, unit_cost DECIMAL(5,2)); INSERT INTO AircraftProductionCost (id, model, year, quantity, unit_cost) VALUES (1, 'F-15', 2019, 100, 120.50), (2, 'F-16', 2020, 200, 145.20), (3, 'F-35', 2021, 300, 189.90); | What is the total production cost for each aircraft model by year? | SELECT model, year, SUM(quantity * unit_cost) AS total_cost FROM AircraftProductionCost GROUP BY model, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (region VARCHAR(255), initiative_status VARCHAR(255)); INSERT INTO climate_finance VALUES ('Africa', 'successful'); | List all climate finance initiatives in Africa that were successful. | SELECT * FROM climate_finance WHERE region = 'Africa' AND initiative_status = 'successful'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory(item_id INT, item_name VARCHAR(50), is_locally_sourced BOOLEAN, price DECIMAL(5,2)); INSERT INTO Inventory VALUES(1,'Apples',TRUE,0.99),(2,'Bananas',FALSE,1.49),(3,'Carrots',TRUE,1.25); | Find the maximum price of locally sourced items in the inventory. | SELECT MAX(price) FROM Inventory WHERE is_locally_sourced = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_customers (customer_id INT, data_usage FLOAT); INSERT INTO mobile_customers (customer_id, data_usage) VALUES (1, 3.5), (2, 4.2), (3, 1.9), (4, 1.7), (5, 1.8); | Find the total number of mobile customers who have a data usage less than 2 GB. | SELECT COUNT(*) FROM mobile_customers WHERE data_usage < 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (ocean TEXT, trench TEXT, max_depth INTEGER);INSERT INTO marine_trenches (ocean, trench, max_depth) VALUES ('Pacific', 'Mariana Trench', 10994), ('Indian', 'Java Trench', 7725); | What is the maximum depth of the deepest marine trench in each ocean? | SELECT ocean, MAX(max_depth) FROM marine_trenches GROUP BY ocean; | gretelai_synthetic_text_to_sql |
CREATE TABLE il_projects (project VARCHAR(20), completion_time FLOAT); INSERT INTO il_projects (project, completion_time) VALUES ('Residential', 12.5), ('Commercial', 18.2), ('Industrial', 21.7); | What is the average time to complete a construction project in Illinois? | SELECT AVG(completion_time) FROM il_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, client_name TEXT, country TEXT, financial_capability_score FLOAT); INSERT INTO clients (client_id, client_name, country, financial_capability_score) VALUES (1, 'Maria Hernandez', 'Costa Rica', 7), (2, 'Pedro Alvarez', 'Guatemala', 8), (3, 'Carlos Rodriguez', 'Panama', 6), (4, 'Ana G... | Find the average financial capability score for clients in each country in Central America. | SELECT country, AVG(financial_capability_score) FROM clients WHERE country IN ('Costa Rica', 'Guatemala', 'Panama', 'Nicaragua') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_policing (id INT, city VARCHAR(50), start_year INT, end_year INT, programs INT); INSERT INTO community_policing (id, city, start_year, end_year, programs) VALUES (1, 'Houston', 2018, 2020, 5); INSERT INTO community_policing (id, city, start_year, end_year, programs) VALUES (2, 'Houston', 2019, 20... | What is the maximum number of community policing programs implemented in the city of Houston between 2018 and 2020? | SELECT MAX(programs) FROM community_policing WHERE city = 'Houston' AND start_year <= 2020 AND end_year >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(50)); CREATE TABLE transactions (transaction_id INT, customer_id INT, amount DECIMAL(10,2), transaction_date DATE); | Identify customers who haven't made any transactions in the last month. | SELECT c.customer_id, c.name, c.region FROM customers c LEFT JOIN transactions t ON c.customer_id = t.customer_id AND t.transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) WHERE t.transaction_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Art (id INT, title VARCHAR(255), artist_id INT, gallery_id INT, value INT); CREATE TABLE Gallery (id INT, name VARCHAR(255)); | Identify galleries with the highest and lowest average value of artworks on display. | SELECT Gallery.name, AVG(Art.value) AS avg_value FROM Gallery JOIN Art ON Gallery.id = Art.gallery_id GROUP BY Gallery.name ORDER BY avg_value DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE RuralPopulation (region TEXT, year INTEGER, clean_water_access BOOLEAN); INSERT INTO RuralPopulation (region, year, clean_water_access) VALUES ('Sub-Saharan Africa', 2021, TRUE), ('Sub-Saharan Africa', 2021, FALSE), ('Sub-Saharan Africa', 2021, TRUE), ('Sub-Saharan Africa', 2021, TRUE), ('Sub-Saharan Afric... | What is the percentage of total rural population in Sub-Saharan Africa that has access to clean water in 2021? | SELECT (COUNT(*) FILTER (WHERE clean_water_access = TRUE) * 100.0 / COUNT(*)) AS percentage FROM RuralPopulation WHERE region = 'Sub-Saharan Africa' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE basketball_games (id INT, home_team VARCHAR(50), away_team VARCHAR(50), date DATE, points_home INT, points_away INT); INSERT INTO basketball_games (id, home_team, away_team, date, points_home, points_away) VALUES (1, 'Los Angeles Lakers', 'Golden State Warriors', '2022-02-01', 110, 100); INSERT INTO basket... | What is the minimum number of points scored by a player in a basketball game in the 'basketball_games' table? | SELECT MIN(points_home), MIN(points_away) FROM basketball_games; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (MetricID INT, Score INT, Region VARCHAR(15)); INSERT INTO HealthEquityMetrics (MetricID, Score, Region) VALUES (1, 85, 'Northeast'), (2, 92, 'Midwest'), (3, 78, 'South'), (4, 88, 'West'); | Update the health equity metric scores for the South region to 80. | UPDATE HealthEquityMetrics SET Score = 80 WHERE Region = 'South'; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, name VARCHAR(50), budget INT, open_data BOOLEAN); INSERT INTO departments (id, name, budget, open_data) VALUES (1, 'Education', 15000000, true), (2, 'Transportation', 20000000, false); | What is the maximum budget of transportation departments that have not yet adopted open data policies? | SELECT MAX(budget) as max_budget FROM departments WHERE name = 'Transportation' AND open_data = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, state VARCHAR(20)); CREATE TABLE workout_data (id INT, user_id INT, type VARCHAR(20), duration INT, date DATE); | List the top 3 most popular workout types in Texas by total duration in minutes. | SELECT type, SUM(duration) as total_duration FROM workout_data w JOIN users u ON w.user_id = u.id WHERE u.state = 'Texas' GROUP BY type ORDER BY total_duration DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Museums (name VARCHAR(255), state VARCHAR(255), num_art_pieces INT); | Find the total number of art pieces owned by museums in California and Texas. | SELECT SUM(num_art_pieces) FROM Museums WHERE state IN ('California', 'Texas'); | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers(supplier_id INT, name TEXT, location TEXT);CREATE TABLE menu_items(item_id INT, name TEXT, type TEXT, price DECIMAL, supplier_id INT); INSERT INTO suppliers VALUES (1, 'GreenVeggies', 'California'); INSERT INTO menu_items VALUES (1, 'Veggie Burger', 'Vegetarian', 7.50, 1); | What is the total inventory value of vegetarian items? | SELECT SUM(menu_items.price) FROM menu_items JOIN suppliers ON menu_items.supplier_id = suppliers.supplier_id WHERE menu_items.type = 'Vegetarian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE garments (garment_id INTEGER, garment_type TEXT, garment_color TEXT, price INTEGER, quantity INTEGER); INSERT INTO garments (garment_id, garment_type, garment_color, price, quantity) VALUES (1, 't-shirt', 'red', 20, 100), (2, 'jeans', 'blue', 50, 75), (3, 'hoodie', 'black', 30, 120), (4, 'skirt', 'green', ... | Find the average price and quantity of garments in the 'garments' table, for each garment type, and display the results in descending order based on the average price. | SELECT garment_type, AVG(price) AS avg_price, AVG(quantity) AS avg_quantity FROM garments GROUP BY garment_type ORDER BY avg_price DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_investments (id INT, region VARCHAR(255), sustainable BOOLEAN); INSERT INTO sustainable_investments (id, region, sustainable) VALUES (1, 'Americas', TRUE), (2, 'Europe', FALSE), (3, 'Americas', TRUE); | What is the percentage of sustainable investments in the Americas? | SELECT region, COUNT(*) * 100.0 / SUM(COUNT(*)) OVER () FROM sustainable_investments WHERE region = 'Americas' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (city VARCHAR(20), year INT, total_waste INT); INSERT INTO waste_generation (city, year, total_waste) VALUES ('Seattle', 2019, 120000), ('Seattle', 2021, 135000); | What is the total waste generated in the city of Seattle in 2020? | SELECT SUM(total_waste) FROM waste_generation WHERE city = 'Seattle' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, player_name VARCHAR(100), position VARCHAR(50), team VARCHAR(50), games_played INT, at_bats INT, hits INT, home_runs INT, rbi INT); INSERT INTO players (player_id, player_name, position, team, games_played, at_bats, hits, home_runs, rbi) VALUES (1, 'John Doe', 'Outfield', 'Red Sox',... | Find the player with the highest number of home runs in each season, for every player. | SELECT player_name, season, MAX(home_runs) as max_homeruns FROM (SELECT player_name, DATE_PART('year', game_date) as season, home_runs FROM games JOIN players ON games.player_id = players.player_id) subquery GROUP BY player_name, season; | gretelai_synthetic_text_to_sql |
CREATE TABLE billing (attorney_id INT, client_id INT, hours FLOAT, rate FLOAT); INSERT INTO billing (attorney_id, client_id, hours, rate) VALUES (1, 101, 10, 300), (2, 102, 8, 350), (3, 103, 12, 250); | What is the average billing rate for attorneys in the 'billing' table? | SELECT AVG(rate) FROM billing; | gretelai_synthetic_text_to_sql |
CREATE TABLE subway_vehicles (id INT, type VARCHAR(10), last_service DATE); INSERT INTO subway_vehicles (id, type, last_service) VALUES (1, 'Car', '2022-06-01'), (2, 'Bus', '2022-06-15'), (3, 'Train', '2022-07-01'); | How many vehicles have been serviced in the NYC subway system in the last 30 days? | SELECT COUNT(*) FROM subway_vehicles WHERE last_service >= DATEADD(day, -30, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contractors (id INT, contractor_id VARCHAR(50), contractor_name VARCHAR(100), industry VARCHAR(50)); CREATE TABLE defense_contractor_contracts (id INT, contract_id VARCHAR(50), contractor_id VARCHAR(50), contract_amount DECIMAL(10,2)); | What are the total defense contract amounts awarded to the top 10 defense contractors? | SELECT c.contractor_name, SUM(dc.contract_amount) AS total_contracts FROM defense_contractor_contracts dc INNER JOIN defense_contractors c ON dc.contractor_id = c.contractor_id WHERE c.industry = 'Defense' GROUP BY c.contractor_name ORDER BY total_contracts DESC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE AdvocacyGroups (AdvocacyGroupID INT, AdvocacyGroupName VARCHAR(50)); CREATE TABLE AdvocatesData (AdvocateID INT, AdvocacyGroupID INT, RegionID INT, Date DATE); | Insert new records for 3 labor rights advocates who joined AdvocacyGroupB in the year 2022, with their respective advocate IDs, regions, and join dates. | INSERT INTO AdvocatesData (AdvocateID, AdvocacyGroupID, RegionID, Date) VALUES (1001, (SELECT AdvocacyGroupID FROM AdvocacyGroups WHERE AdvocacyGroupName = 'AdvocacyGroupB'), 1, '2022-01-01'), (1002, (SELECT AdvocacyGroupID FROM AdvocacyGroups WHERE AdvocacyGroupName = 'AdvocacyGroupB'), 2, '2022-01-02'), (1003, (SELEC... | gretelai_synthetic_text_to_sql |
CREATE TABLE education_programs (id INT, name VARCHAR(50), focus VARCHAR(30)); CREATE VIEW marine_programs AS SELECT * FROM education_programs WHERE focus LIKE '%marine%'; | Which education programs are focused on protecting marine animals? | SELECT name FROM marine_programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE india_cosmetics (product_id INT, product_name VARCHAR(50), consumer_rating FLOAT); INSERT INTO india_cosmetics (product_id, product_name, consumer_rating) VALUES (2001, 'Lipstick X', 4.7), (2002, 'Foundation Y', 4.3), (2003, 'Mascara Z', 4.5), (2004, 'Eye Liner W', 3.9), (2005, 'Blush V', 4.1); | What is the consumer rating for the top 3 cosmetic products in India? | SELECT product_name, consumer_rating FROM india_cosmetics WHERE product_id IN (SELECT product_id FROM india_cosmetics ORDER BY consumer_rating DESC LIMIT 3); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, cultural_diversity INT, last_two_years BOOLEAN); INSERT INTO community_health_workers (worker_id, cultural_diversity, last_two_years) VALUES (1, 50, TRUE), (2, 75, TRUE), (3, 25, FALSE); | Which community health workers have served the most culturally diverse communities in the last two years? | SELECT c.worker_id, c.cultural_diversity FROM community_health_workers c WHERE c.last_two_years = TRUE ORDER BY c.cultural_diversity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (id INT, site_name VARCHAR(50), location VARCHAR(50), num_artifacts INT); INSERT INTO excavation_sites (id, site_name, location, num_artifacts) VALUES (1, 'Site A', 'USA', 30), (2, 'Site B', 'Mexico', 45), (3, 'Site C', 'Canada', 25), (4, 'Site D', 'Brazil', 60), (5, 'Site E', 'Argentina',... | List all excavation sites located in 'South America' and the number of artifacts associated with each site. | SELECT site_name, num_artifacts FROM excavation_sites WHERE location IN ('Brazil', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.experiments (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(100)); INSERT INTO genetics.experiments (id, name, location) VALUES (1, 'ExpA', 'Berlin'), (2, 'ExpB', 'Munich'), (3, 'ExpC', 'Hamburg'), (4, 'ExpD', 'Frankfurt'), (5, 'ExpE', 'B... | List all unique genetic research experiments conducted in Germany. | SELECT DISTINCT name FROM genetics.experiments WHERE location = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_innovation (id INT, project_name VARCHAR(50), budget FLOAT); INSERT INTO rural_innovation (id, project_name, budget) VALUES (1, 'Precision Agriculture', 500000.00), (2, 'Organic Farming', 350000.00); | What is the total budget for agricultural innovation projects in the 'rural_innovation' table? | SELECT SUM(budget) FROM rural_innovation WHERE project_name LIKE 'agricultural%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, transaction_date DATE, transaction_category VARCHAR(255), transaction_value DECIMAL(10,2)); INSERT INTO transactions (transaction_id, transaction_date, transaction_category, transaction_value) VALUES (1, '2022-01-02', 'Food', 75.00), (2, '2022-01-05', 'Electronics', 350.00... | What is the average transaction value for the month of January 2022? | SELECT AVG(transaction_value) as avg_transaction_value FROM transactions WHERE transaction_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS vessel_safety (id INT PRIMARY KEY, vessel_name VARCHAR(255), safety_inspection_date DATE); | Create a table named 'vessel_safety' | CREATE TABLE vessel_safety (id INT PRIMARY KEY, vessel_name VARCHAR(255), safety_inspection_date DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (ID INT, HeartRate INT, Activity VARCHAR(20)); INSERT INTO Members (ID, HeartRate, Activity) VALUES (1, 110, 'Cycling'); | How many members have a heart rate over 100 during cycling? | SELECT COUNT(*) FROM Members WHERE HeartRate > 100 AND Activity = 'Cycling'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(50), location VARCHAR(50), capacity INT, primary_fuel VARCHAR(10)); INSERT INTO projects VALUES (1, 'Solar Farm A', 'California', 5000, 'Solar'), (2, 'Wind Farm B', 'Texas', 6000, 'Wind'), (3, 'Hydro Plant C', 'Washington', 7000, 'Hydro'); | How can I find the total installed capacity of renewable energy projects? | SELECT SUM(capacity) FROM projects WHERE primary_fuel IN ('Solar', 'Wind', 'Hydro'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (id INT, program TEXT, budget FLOAT, start_date DATE, end_date DATE); INSERT INTO Programs (id, program, budget, start_date, end_date) VALUES (1, 'Education', 5000, '2022-04-01', '2022-06-30'), (2, 'Health', 7000, '2022-01-01', '2022-12-31'); | What is the total budget for all programs that start in the second quarter? | SELECT SUM(budget) FROM Programs WHERE EXTRACT(QUARTER FROM start_date) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE albums (id INT, title TEXT, release_year INT, revenue INT); INSERT INTO albums (id, title, release_year, revenue) VALUES (1, 'Album 1', 2019, 5000000), (2, 'Album 2', 2020, 7000000), (3, 'Album 3', 2018, 6000000), (4, 'Album 4', 2020, 8000000); | What is the total revenue generated by music albums released in the year 2020? | SELECT SUM(albums.revenue) FROM albums WHERE albums.release_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE city (id INT, name VARCHAR(255), population INT, sustainable_projects INT); INSERT INTO city (id, name, population, sustainable_projects) VALUES (1, 'San Francisco', 884363, 450); INSERT INTO city (id, name, population, sustainable_projects) VALUES (2, 'Los Angeles', 4000000, 650); INSERT INTO city (id, na... | How many sustainable projects are there in each city? | SELECT name, SUM(sustainable_projects) as total_sustainable_projects FROM city GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE berlin_renewable_energy (project_id INT, project_name VARCHAR(255), city VARCHAR(255), type VARCHAR(255), capacity FLOAT); INSERT INTO berlin_renewable_energy (project_id, project_name, city, type, capacity) VALUES (1, 'Berlin Solar Farm', 'Berlin', 'Solar', 50.0); INSERT INTO berlin_renewable_energy (proj... | What is the total capacity of renewable energy projects in the city of Berlin? | SELECT SUM(capacity) FROM berlin_renewable_energy WHERE city = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE arctic_stations (id INT, name TEXT, location TEXT, temperature DECIMAL(5,2)); INSERT INTO arctic_stations (id, name, location, temperature) VALUES (1, 'Station A', 'Greenland', 2.3), (2, 'Station B', 'Canada', -5.2); | What is the average temperature per year for each Arctic research station? | SELECT name, AVG(temperature) as avg_temp, YEAR(time) as year FROM arctic_weather JOIN arctic_stations ON arctic_weather.station_id = arctic_stations.id GROUP BY name, YEAR(time) | gretelai_synthetic_text_to_sql |
CREATE TABLE concentrate_strain_sales (dispensary_id INT, sale_date DATE, strain_id INT, quantity INT); INSERT INTO concentrate_strain_sales (dispensary_id, sale_date, strain_id, quantity) VALUES (1, '2022-04-01', 4, 25), (1, '2022-04-15', 5, 15), (1, '2022-05-05', 6, 10), (2, '2022-04-03', 4, 30), (2, '2022-04-30', 6,... | How many times did each strain of cannabis concentrate sell at each dispensary in Q2 2022? | SELECT s.name, d.name, SUM(css.quantity) as total_sales FROM concentrate_strain_sales css JOIN strains s ON css.strain_id = s.id JOIN dispensaries d ON css.dispensary_id = d.id WHERE css.sale_date BETWEEN '2022-04-01' AND '2022-06-30' GROUP BY s.name, d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE flights (origin VARCHAR(255), destination VARCHAR(255), co2_emissions INT); INSERT INTO flights (origin, destination, co2_emissions) VALUES ('Canada', 'China', 30000), ('Canada', 'Japan', 35000); | Total CO2 emissions for flights from Canada to Asia in 2022 | SELECT SUM(co2_emissions) FROM flights WHERE origin = 'Canada' AND destination IN ('China', 'Japan') AND YEAR(flight_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE artifacts_count (site_id INT, artifact_count INT); INSERT INTO artifacts_count (site_id, artifact_count) VALUES (1, 20), (2, 15), (3, 12); | How many artifacts were found at each excavation site? | SELECT site_id, COUNT(*) OVER (PARTITION BY site_id) AS artifact_count FROM artifacts; | gretelai_synthetic_text_to_sql |
CREATE TABLE exploration_missions (mission_name VARCHAR(255), location VARCHAR(255), acidity FLOAT); INSERT INTO exploration_missions (mission_name, location, acidity) VALUES ('Mission1', 'Location1', 6.5), ('Mission2', 'Location2', 7.2); | What is the maximum ocean acidity level for each exploration mission? | SELECT mission_name, MAX(acidity) as max_acidity FROM exploration_missions GROUP BY mission_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtHeritage (id INT, name VARCHAR(50), type VARCHAR(50), year INT, country VARCHAR(50)); INSERT INTO ArtHeritage (id, name, type, year, country) VALUES (1, 'Pottery', 'Art', 2005, 'Mexico'); INSERT INTO ArtHeritage (id, name, type, year, country) VALUES (2, 'Woven Baskets', 'Art', 1950, 'USA'); | What is the oldest art piece in the 'ArtHeritage' table? | SELECT name, type, year, country FROM (SELECT name, type, year, country, MIN(year) OVER () as min_year FROM ArtHeritage) t WHERE year = min_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (farmer_id INT, name TEXT, location TEXT, crops TEXT); INSERT INTO farmers (farmer_id, name, location, crops) VALUES (1, 'James Johnson', 'Villageville', 'Corn, Wheat'), (2, 'Emily Brown', 'Farmland', 'Soybean, Rice'); | What are the names and locations of farmers who have diversified their crops in the 'rural_development' database? | SELECT name, location FROM farmers WHERE LENGTH(REGEXP_SPLIT_TO_TABLE(crops, ', ')) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_missions (spacecraft_id INT, mission_id INT, mission_duration INT); INSERT INTO spacecraft_missions (spacecraft_id, mission_id, mission_duration) VALUES (1, 1, 300), (2, 2, 500), (3, 3, 600); CREATE TABLE space_missions (mission_id INT, name TEXT, destination TEXT); INSERT INTO space_missions (m... | What is the maximum duration (in days) of missions to Jupiter and which spacecraft was used for each? | SELECT s.name AS spacecraft_name, sm.mission_duration FROM spacecraft_missions sm JOIN space_missions m ON sm.mission_id = m.mission_id JOIN spacecrafts s ON sm.spacecraft_id = s.spacecraft_id WHERE m.destination = 'Jupiter' ORDER BY sm.mission_duration DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (country VARCHAR(50), budget INT); INSERT INTO military_innovation (country, budget) VALUES ('China', 5000000), ('Japan', 3000000), ('India', 4000000); | What is the average budget allocated for military innovation by countries in the Asia-Pacific region? | SELECT AVG(budget) FROM military_innovation WHERE country IN ('China', 'Japan', 'India', 'Australia', 'South Korea'); | 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.