context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE player_daily_playtime (player_id INT, play_date DATE, playtime INT); INSERT INTO player_daily_playtime (player_id, play_date, playtime) VALUES (1, '2021-01-01', 100), (1, '2021-01-02', 200), (1, '2021-01-03', 300), (2, '2021-01-01', 400), (2, '2021-01-02', 500), (2, '2021-01-03', 600); | What is the average playtime per day for each player? | SELECT player_id, AVG(playtime) FROM player_daily_playtime GROUP BY player_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, team_id INT, age INT); INSERT INTO athletes VALUES (1, 1, 25), (2, 1, 26), (3, 2, 27), (4, 2, 28), (5, 3, 29); | What is the average age of the athletes in each team? | SELECT te.team_name, AVG(a.age) as avg_age FROM athletes a JOIN teams te ON a.team_id = te.team_id GROUP BY te.team_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, equipment_type VARCHAR(50), maintenance_cost FLOAT, date DATE); | Find the average maintenance cost of military equipment for each type in the last 6 months. | SELECT equipment_type, AVG(maintenance_cost) FROM military_equipment WHERE date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) GROUP BY equipment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (Astronaut_ID INT, Name VARCHAR(50), Gender VARCHAR(10), Age INT, Agency VARCHAR(50)); INSERT INTO Astronauts (Astronaut_ID, Name, Gender, Age, Agency) VALUES (3, 'Soichi Noguchi', 'Male', 54, 'JAXA'), (4, 'Akihiko Hoshide', 'Male', 51, 'JAXA'); CREATE TABLE Missions (Mission_ID INT, Mission_Nam... | What are the total mission durations for astronauts from JAXA who have been on multiple missions? | SELECT a.Name, DATEDIFF(day, MIN(m.Start_Date), MAX(m.End_Date)) * 1.0 / 30 AS Total_Mission_Duration_Months FROM Astronauts a INNER JOIN Missions m ON a.Name = m.Astronaut_Name WHERE a.Agency = 'JAXA' GROUP BY a.Name HAVING COUNT(m.Mission_ID) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE agri_innovation_projects(id INT, project TEXT, location TEXT, budget INT, year INT); INSERT INTO agri_innovation_projects (id, project, location, budget, year) VALUES (1, 'Smart Farming Project', 'Oceania', 3000000, 2020); | What is the total budget for agricultural innovation projects in 'Oceania' in '2020'? | SELECT SUM(budget) FROM agri_innovation_projects WHERE location = 'Oceania' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_usage (usage_id INT, customer_id INT, usage_date DATE, usage_amount FLOAT); INSERT INTO daily_usage (usage_id, customer_id, usage_date, usage_amount) VALUES (1, 1, '2022-01-01', 50), (2, 1, '2022-01-02', 55), (3, 1, '2022-01-03', 60); | What is the average daily water usage for a specific residential customer in a given month? | SELECT AVG(usage_amount) FROM daily_usage WHERE customer_id = 1 AND usage_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, incident_id INT, department VARCHAR(255), containment_time INT); INSERT INTO vulnerabilities (id, incident_id, department, containment_time) VALUES (1, 444, 'finance', 120), (2, 555, 'finance', 150), (3, 666, 'finance', 180), (4, 777, 'finance', 210); | What is the median time to contain a vulnerability for the finance department? | SELECT AVG(containment_time) FROM (SELECT containment_time FROM vulnerabilities WHERE department = 'finance' ORDER BY containment_time LIMIT 2) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID int, Name varchar(50), Age int); INSERT INTO Customers (CustomerID, Name, Age) VALUES (1, 'John Smith', 35), (2, 'Jane Doe', 42); CREATE TABLE Transactions (TransactionID int, CustomerID int, Amount decimal(10,2)); INSERT INTO Transactions (TransactionID, CustomerID, Amount) VALUES (1... | Find the transaction with the highest amount and its customer's name? | SELECT Contexts.Name as CustomerName, Transactions.Amount as HighestAmount FROM Contexts JOIN Transactions ON Contexts.CustomerID = Transactions.CustomerID WHERE Transactions.Amount = (SELECT MAX(Amount) FROM Transactions) ORDER BY HighestAmount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_forest_management (id INT, continent VARCHAR(255), country VARCHAR(255), region VARCHAR(255), area FLOAT); INSERT INTO sustainable_forest_management (id, continent, country, region, area) VALUES (1, 'Africa', 'Kenya', 'East Africa', 12345.12), (2, 'Asia', 'India', 'South Asia', 23456.12), (3, '... | What is the total area of sustainable forest management, in square kilometers, for each continent? | SELECT continent, SUM(area) FROM sustainable_forest_management GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (year INT, region VARCHAR(50), material VARCHAR(50), volume FLOAT); INSERT INTO WasteGeneration (year, region, material, volume) VALUES (2020, 'North America', 'Electronic', 12000), (2020, 'Europe', 'Electronic', 15000), (2020, 'Asia', 'Electronic', 20000), (2020, 'South America', 'Electron... | What is the total volume of electronic waste generated in 2020, categorized by region for North America, Europe, and Africa? | SELECT region, SUM(volume) FROM WasteGeneration WHERE year = 2020 AND material = 'Electronic' GROUP BY region HAVING region IN ('North America', 'Europe', 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse_stats (id INT, warehouse VARCHAR(20), total_pallets INT); INSERT INTO warehouse_stats (id, warehouse, total_pallets) VALUES (1, 'Atlanta', 2500), (2, 'Los Angeles', 3000), (3, 'Houston', 2000); | What is the total number of pallets handled in the Los Angeles warehouse? | SELECT SUM(total_pallets) FROM warehouse_stats WHERE warehouse = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryVehicles (Country VARCHAR(50), NumberOfVehicles INT); INSERT INTO MilitaryVehicles (Country, NumberOfVehicles) VALUES ('Australia', 1000), ('New Zealand', 500), ('Papua New Guinea', 250), ('Fiji', 150), ('Solomon Islands', 100); | What is the total number of military vehicles in Oceania? | SELECT SUM(NumberOfVehicles) FROM MilitaryVehicles WHERE Country IN ('Australia', 'New Zealand', 'Papua New Guinea', 'Fiji', 'Solomon Islands'); | gretelai_synthetic_text_to_sql |
CREATE TABLE allocations (id INT, organization VARCHAR(50), budget DECIMAL(10,2)); INSERT INTO allocations (id, organization, budget) VALUES (1, 'EthicalAI', 750000.00), (2, 'NoBudget', NULL); | List the organizations that have not allocated any budget for ethical AI. | SELECT organization FROM allocations WHERE budget IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (id INT, project_name VARCHAR(50), location VARCHAR(50), total_cost INT); INSERT INTO infrastructure_projects (id, project_name, location, total_cost) VALUES (1, 'Road Widening', 'City A', 500000), (2, 'Coastal Protection', 'City B', 700000), (3, 'Wastewater Treatment', 'City A', 80... | What is the 'total_cost' for all 'infrastructure_projects' in 'City B'? | SELECT SUM(total_cost) FROM infrastructure_projects WHERE location = 'City B'; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (country VARCHAR(50), capacity INT); INSERT INTO landfill_capacity (country, capacity) VALUES ('Japan', 10000), ('Canada', 15000), ('Brazil', 20000), ('India', 8000), ('Australia', 14000); | Update landfill_capacity table, setting the capacity to 12000 where the country is 'Canada' | UPDATE landfill_capacity SET capacity = 12000 WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mines (MineID INT, Name TEXT, Location TEXT, TotalWorkers INT); INSERT INTO Mines (MineID, Name, Location, TotalWorkers) VALUES (1, 'Golden Mine', 'California', 250), (2, 'Silver Ridge', 'Nevada', 300); | What is the total number of workers in each mine? | SELECT Name, SUM(TotalWorkers) FROM Mines GROUP BY Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, total_donated DECIMAL); | Find the average donation per donor for donors who have donated more than $5000 | SELECT AVG(total_donated) FROM donors WHERE total_donated > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE MarineLife (id INT PRIMARY KEY, species VARCHAR(255), population INT, country VARCHAR(255)); | Retrieve the total population of marine species per country in the 'MarineLife' table | SELECT country, SUM(population) FROM MarineLife GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Schools (SchoolID INT, SchoolName TEXT, SchoolCountry TEXT); CREATE TABLE Classes (ClassID INT, SchoolID INT, ClassStudents INT); INSERT INTO Schools (SchoolID, SchoolName, SchoolCountry) VALUES (1, 'Kabul School', 'Afghanistan'), (2, 'Herat School', 'Afghanistan'); INSERT INTO Classes (ClassID, SchoolID, ... | How many children are there in each school in Afghanistan? | SELECT Schools.SchoolName, SUM(Classes.ClassStudents) FROM Schools INNER JOIN Classes ON Schools.SchoolID = Classes.SchoolID GROUP BY Schools.SchoolName; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_systems (system_id INT, system_name VARCHAR(50)); INSERT INTO ai_systems (system_id, system_name) VALUES (1, 'AISystem1'), (2, 'AISystem2'), (3, 'AISystem3'), (4, 'AISystem4'); CREATE TABLE fairness_reports (report_id INT, system_id INT, issue_count INT); INSERT INTO fairness_reports (report_id, system_... | How many algorithmic fairness issues have been reported for each AI system, ordered by the number of issues in descending order? | SELECT a.system_name, SUM(fr.issue_count) as total_issues FROM ai_systems a JOIN fairness_reports fr ON a.system_id = fr.system_id GROUP BY a.system_name ORDER BY total_issues DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (name TEXT, launch_date DATE, company TEXT, cost INTEGER); INSERT INTO Satellites (name, launch_date, company, cost) VALUES ('Starlink-1', '2019-05-24', 'SpaceX', 100000000); INSERT INTO Satellites (name, launch_date, company, cost) VALUES ('Starlink-2', '2019-11-11', 'SpaceX', 150000000); | What is the minimum cost of a satellite launched by SpaceX? | SELECT MIN(cost) FROM Satellites WHERE company = 'SpaceX'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists higher_ed;CREATE TABLE if not exists higher_ed.students(id INT, name VARCHAR(255), department VARCHAR(255), gpa DECIMAL(3,2)); | How many graduate students in the Physics department have a GPA of at least 3.5? | SELECT COUNT(*) FROM higher_ed.students WHERE department = 'Physics' AND gpa >= 3.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_vehicles (make VARCHAR(50), model VARCHAR(50), year INT, range INT); | List all electric vehicles in the 'green_vehicles' table that have a range of over 300 miles. | SELECT * FROM green_vehicles WHERE make IN ('Tesla', 'Rivian') AND range > 300; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, FirstName varchar(50), LastName varchar(50), Gender varchar(50), Ethnicity varchar(50), TrainingProgramCompletion bit); INSERT INTO Employees (EmployeeID, FirstName, LastName, Gender, Ethnicity, TrainingProgramCompletion) VALUES (1, 'John', 'Doe', 'Male', 'Asian', 1), (2, 'Jane',... | What is the distribution of training program completion rates by gender and ethnicity? | SELECT Employees.Gender, Employees.Ethnicity, COUNT(Employees.EmployeeID) as Count_of_Employees, COUNT(CASE WHEN Employees.TrainingProgramCompletion = 1 THEN 1 ELSE NULL END) as Completed_Training FROM Employees GROUP BY Employees.Gender, Employees.Ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE consumer_awareness (id INT PRIMARY KEY, country VARCHAR(50), awareness DECIMAL(3,2)); INSERT INTO consumer_awareness (id, country, awareness) VALUES (1, 'Germany', 0.85), (2, 'Italy', 0.70), (3, 'France', 0.80); | Find countries with high consumer awareness | SELECT country FROM consumer_awareness WHERE awareness >= 0.8; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dolphins (id INT, species VARCHAR(20), location VARCHAR(30), population INT); INSERT INTO Dolphins (id, species, location, population) VALUES (1, 'Bottlenose Dolphin', 'Pacific Ocean', 4000); INSERT INTO Dolphins (id, species, location, population) VALUES (2, 'Oracle Dolphin', 'Atlantic Ocean', 3500); | What is the total population of dolphins in the Pacific and Atlantic Oceans? | SELECT location, SUM(population) as total_population FROM Dolphins WHERE location IN ('Pacific Ocean', 'Atlantic Ocean') GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mining_Company (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO Mining_Company (id, name, location) VALUES (1, 'CompanyA', 'USA'), (2, 'CompanyB', 'Canada'); CREATE TABLE Mining_Operation (id INT, company_id INT, mine_name VARCHAR(50), resource VARCHAR(10), quantity INT); INSERT INTO Mining_Op... | What is the total quantity of gold mined by each mining company? | SELECT m.name, SUM(quantity) as total_gold_quantity FROM Mining_Operation o JOIN Mining_Company m ON o.company_id = m.id WHERE o.resource = 'Gold' GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, attorney_name VARCHAR(255), billing_amount FLOAT, case_date DATE); INSERT INTO cases (case_id, attorney_name, billing_amount, case_date) VALUES (1, 'Smith', 5000, '2020-01-01'), (2, 'Jones', 3000, '2020-05-15'), (3, 'Garcia', 3500, '2021-07-20'), (4, 'Smith', 4000, '2020-12-31'), (5, 'B... | What is the average billing amount for cases handled by attorney Garcia in the last year? | SELECT AVG(billing_amount) FROM cases WHERE attorney_name = 'Garcia' AND case_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, date DATE, category VARCHAR(20), source_ip VARCHAR(15), target_ip VARCHAR(15)); CREATE TABLE threat_actors (id INT, date DATE, type VARCHAR(20), location VARCHAR(30)); INSERT INTO incidents (id, date, category, source_ip, target_ip) VALUES (1, '2021-01-01', 'malware', '192.168.1.100', '8... | Which threat actors have been active in Europe in the last 30 days, and what is the number of incidents they have been involved in? | SELECT threat_actors.type, COUNT(*) as incident_count FROM threat_actors JOIN incidents ON threat_actors.date = incidents.date WHERE threat_actors.location = 'Europe' AND incidents.date >= (CURRENT_DATE - INTERVAL '30' DAY) GROUP BY threat_actors.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensary_sales (id INT, dispensary_name VARCHAR(255), state VARCHAR(255), sales_amount DECIMAL(10, 2), sale_date DATE); | What was the total revenue for the state of California in the year 2021? | SELECT SUM(sales_amount) FROM dispensary_sales WHERE state = 'California' AND sale_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_professionals (professional_id INT, name TEXT, specialty TEXT, rural BOOLEAN, state_code TEXT); INSERT INTO healthcare_professionals (professional_id, name, specialty, rural, state_code) VALUES (1, 'Dr. Smith', 'Cardiology', TRUE, 'CA'), (2, 'Dr. Johnson', 'Pediatrics', TRUE, 'TX'); | What is the number of rural healthcare professionals and their respective specialties, ordered by state and then by specialty? | SELECT healthcare_professionals.state_code, healthcare_professionals.specialty, COUNT(healthcare_professionals.professional_id) as count FROM healthcare_professionals WHERE healthcare_professionals.rural = TRUE GROUP BY healthcare_professionals.state_code, healthcare_professionals.specialty ORDER BY healthcare_professi... | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (id INT PRIMARY KEY, name TEXT); CREATE TABLE songs (id INT PRIMARY KEY, title TEXT, genre_id INT, year INT, artist TEXT, streams INT); INSERT INTO genres (id, name) VALUES (1, 'Pop'), (2, 'Rock'), (3, 'Jazz'), (4, 'Hip Hop'), (5, 'Country'); | Show the total number of streams for each genre in 2021. | SELECT g.name, SUM(s.streams) as total_streams FROM songs s JOIN genres g ON s.genre_id = g.id WHERE s.year = 2021 GROUP BY g.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE RainfallData (date DATE, city VARCHAR(20), rainfall FLOAT); | What is the maximum number of consecutive days without rain in the city of Cape Town in the year 2020? | SELECT DATEDIFF(date, LAG(date) OVER (PARTITION BY city ORDER BY date)) + 1 AS consecutive_days_no_rain FROM RainfallData WHERE city = 'Cape Town' AND rainfall = 0 ORDER BY consecutive_days_no_rain DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE site (site_id INT, site_name VARCHAR(50)); CREATE TABLE reactor (reactor_id INT, site_id INT, temperature DECIMAL(5,2)); INSERT INTO site (site_id, site_name) VALUES (1, 'Site A'), (2, 'Site B'); INSERT INTO reactor (reactor_id, site_id, temperature) VALUES (1, 1, 80), (2, 1, 85), (3, 2, 70), (4, 2, 72); | What is the average reactor temperature per site, ordered by the highest average temperature? | SELECT AVG(temperature) AS avg_temperature, site_id FROM reactor GROUP BY site_id ORDER BY avg_temperature DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(50), department VARCHAR(50), research_grant_amount DECIMAL(10,2)); INSERT INTO graduate_students (id, name, department, research_grant_amount) VALUES (1, 'Alice', 'Computer Science', 15000.00), (2, 'Bob', 'Computer Science', 20000.00); | What is the total research grant amount awarded to graduate students from the 'Computer Science' department? | SELECT SUM(research_grant_amount) FROM graduate_students WHERE department = 'Computer Science'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ariane5Launches (id INT, launch_date DATE, launch_result VARCHAR(10)); | What is the total number of successful launches for the Ariane 5 rocket? | SELECT COUNT(*) FROM Ariane5Launches WHERE launch_result = 'Success'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_categories(id INT, category VARCHAR(255)); INSERT INTO menu_categories (id, category) VALUES (1, 'Sandwiches'), (2, 'Salads'), (3, 'Entrees'); CREATE TABLE menu_item_sales(id INT, menu_item_id INT, category_id INT, sales FLOAT); INSERT INTO menu_item_sales (id, menu_item_id, category_id, sales) VALUES... | Find the most popular menu item by sales in each category. | SELECT category_id, menu_item_id, MAX(sales) FROM menu_item_sales GROUP BY category_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Project_Team (id INT, project VARCHAR(30), researcher VARCHAR(30)); CREATE TABLE Researchers (id INT, project VARCHAR(30), researcher VARCHAR(30)); | Determine the number of researchers working on each project in the 'Project_Team' table and the 'Researchers' table, then remove duplicates. | SELECT project, COUNT(DISTINCT researcher) FROM Project_Team GROUP BY project UNION SELECT project, COUNT(DISTINCT researcher) FROM Researchers GROUP BY project | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_providers (id INT, census_tract VARCHAR(15), provider_type VARCHAR(20)); INSERT INTO mental_health_providers (id, census_tract, provider_type) VALUES (1, '9900100150', 'Psychiatrist'); CREATE TABLE census_tracts (census_tract VARCHAR(15), state VARCHAR(2), pop_density INT); INSERT INTO census... | List the number of mental health providers in each census tract, for tracts with a population density greater than 3,000 people per square mile. | SELECT m.census_tract, COUNT(m.id) FROM mental_health_providers m JOIN census_tracts c ON m.census_tract = c.census_tract WHERE c.pop_density > 3000 GROUP BY m.census_tract; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (program_id INT, program_name VARCHAR(255)); INSERT INTO Programs (program_id, program_name) VALUES (1, 'Jazz Ensemble'), (2, 'Theater Workshop'); CREATE TABLE Funding (funding_id INT, program_id INT, funder_name VARCHAR(255)); INSERT INTO Funding (funding_id, program_id, funder_name) VALUES (1, 1... | How many times has the 'Jazz Ensemble' program received funding from the 'National Endowment for the Arts'? | SELECT COUNT(f.funding_id) AS funding_count FROM Funding f JOIN Programs p ON f.program_id = p.program_id WHERE p.program_name = 'Jazz Ensemble' AND f.funder_name = 'National Endowment for the Arts'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Machine_Production_Daily (Machine_ID INT, Production_Date DATE, Production_Rate INT); INSERT INTO Machine_Production_Daily (Machine_ID, Production_Date, Production_Rate) VALUES (1, '2022-01-01', 50), (1, '2022-01-02', 55), (1, '2022-01-03', 60), (2, '2022-01-01', 60), (2, '2022-01-03', 65), (2, '2022-01-04... | Calculate the moving average of production rate for each machine over the last three days. | SELECT Machine_ID, Production_Date, AVG(Production_Rate) OVER (PARTITION BY Machine_ID ORDER BY Production_Date RANGE BETWEEN INTERVAL '2' DAY PRECEDING AND CURRENT ROW) as Moving_Average FROM Machine_Production_Daily; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers (id INT, name VARCHAR(20), department VARCHAR(20), salary FLOAT); INSERT INTO workers (id, name, department, salary) VALUES (1, 'Alice', 'textiles', 50000), (2, 'Bob', 'textiles', 55000), (3, 'Charlie', 'metallurgy', 60000), (4, 'Dave', 'metallurgy', 45000); | Get the names and salaries of workers earning more than the average salary | SELECT name, salary FROM workers WHERE salary > (SELECT AVG(salary) FROM workers); | gretelai_synthetic_text_to_sql |
CREATE TABLE employee (id INT, name TEXT, gender TEXT, ethnicity TEXT, department TEXT, hire_date DATE); | What is the total number of employees from underrepresented communities working in the mining industry? | SELECT COUNT(employee.id) as total_employees FROM employee WHERE employee.department IN ('Mining') AND employee.ethnicity IN ('African American', 'Hispanic', 'Native American', 'Asian Pacific Islander'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Matches (MatchID INT, TeamName VARCHAR(50), Wins INT); INSERT INTO Matches (MatchID, TeamName, Wins) VALUES (1, 'Australia', 450), (2, 'India', 400), (3, 'England', 425); | Who are the top 3 cricket teams with the highest win percentage? | SELECT TeamName, (SUM(Wins) * 100.0 / (SELECT COUNT(*) FROM Matches)) AS WinPercentage FROM Matches GROUP BY TeamName ORDER BY WinPercentage DESC LIMIT 3 | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(255), location VARCHAR(255), company VARCHAR(255), production_figures DECIMAL(10,2), date DATE); INSERT INTO wells (well_id, well_name, location, company, production_figures, date) VALUES (1, 'Well A', 'North Sea', 'Company A', 12000.50, '2021-01-01'), (2, 'Well B', 'N... | What are the total production figures for each company, broken down by quarter, for the year 2021? | SELECT company, EXTRACT(QUARTER FROM date) AS quarter, SUM(production_figures) AS total_production FROM wells WHERE EXTRACT(YEAR FROM date) = 2021 GROUP BY company, quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, name VARCHAR(50), weight FLOAT); | What is the total weight of all space debris in orbit? | SELECT SUM(weight) FROM space_debris; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (id INT, name VARCHAR(50)); INSERT INTO Cities (id, name) VALUES (1, 'CityA'), (2, 'CityB'); CREATE TABLE GreenBuildings (id INT, city_id INT, certification VARCHAR(50)); INSERT INTO GreenBuildings (id, city_id, certification) VALUES (1, 1, 'LEED'), (2, 1, 'BREEAM'), (3, 2, 'LEED'); | List all Green Building certifications awarded per city. | SELECT Cities.name, GreenBuildings.certification FROM Cities INNER JOIN GreenBuildings ON Cities.id = GreenBuildings.city_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE salaries (id INT, employee_id INT, salary INT, salary_date DATE, department VARCHAR(255)); INSERT INTO salaries (id, employee_id, salary, salary_date, department) VALUES (1, 801, 55000, '2021-07-01', 'Sales'); INSERT INTO salaries (id, employee_id, salary, salary_date, department) VALUES (2, 802, 65000, '2... | Show the average salary for each department for the second half of 2021 | SELECT department, AVG(salary) FROM salaries WHERE salary_date BETWEEN '2021-07-01' AND '2021-12-31' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (id INT PRIMARY KEY, tx_hash VARCHAR(255), smart_contract_id INT, timestamp TIMESTAMP); INSERT INTO transactions (id, tx_hash, smart_contract_id, timestamp) VALUES (1, 'tx1', 1, '2022-12-31 10:00:00'), (2, 'tx2', 2, '2022-12-30 11:00:00'); | Provide the asset name and transaction hash for all transactions that occurred on 2022-12-31. | SELECT t.tx_hash, s.asset_name FROM transactions t INNER JOIN smart_contracts s ON t.smart_contract_id = s.id WHERE t.timestamp = '2022-12-31 00:00:00'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_forests (id INT, name VARCHAR(50), hectares DECIMAL(5,2)); INSERT INTO public_forests (id, name, hectares) VALUES (1, 'Forest 1', 1500.00), (2, 'Forest 2', 2000.00); CREATE TABLE timber_harvest (id INT, forest_id INT, year INT, volume DECIMAL(10,2)); INSERT INTO timber_harvest (id, forest_id, year, ... | What is the total volume of timber harvested from public forests in 2020? | SELECT SUM(th.volume) FROM public_forests pf INNER JOIN timber_harvest th ON pf.id = th.forest_id WHERE pf.hectares > 1000 AND th.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethereum_erc20 (token_id INT, total_supply DECIMAL); | What is the total supply of ERC-20 tokens on the Ethereum network? | SELECT SUM(total_supply) FROM ethereum_erc20; | gretelai_synthetic_text_to_sql |
CREATE TABLE user (user_id INT, username VARCHAR(20), posts INT); INSERT INTO user (user_id, username, posts) VALUES (1, 'user1', 10), (2, 'user2', 20), (3, 'user3', 30); | What is the average number of posts per user in the social_media database? | SELECT AVG(posts) FROM user; | gretelai_synthetic_text_to_sql |
CREATE TABLE LOW_PRODUCTION AS SELECT * FROM GAS_WELLS WHERE PRODUCTION_QTY < 100; | Delete all records with production quantities less than 100 in the 'LOW_PRODUCTION' table. | DELETE FROM LOW_PRODUCTION; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, name VARCHAR(50), mass FLOAT, orbit VARCHAR(50));INSERT INTO space_debris (id, name, mass, orbit) VALUES (1, 'Debris 1', 150.3, 'LEO'); | What is the total mass of space debris orbiting Earth? | SELECT SUM(mass) FROM space_debris WHERE orbit = 'LEO'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_friendly_homes (id INT, size FLOAT, location VARCHAR(255)); INSERT INTO eco_friendly_homes (id, size, location) VALUES (1, 1200.0, 'San Francisco'), (2, 1800.0, 'New York'), (3, 900.0, 'Los Angeles'); | What is the average property size in eco_friendly_homes table? | SELECT AVG(size) FROM eco_friendly_homes; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturers (id INT, name TEXT); CREATE TABLE RecycledPolyesterUsage (manufacturer_id INT, quantity INT); INSERT INTO Manufacturers (id, name) VALUES (1, 'Manufacturer X'), (2, 'Manufacturer Y'), (3, 'Manufacturer Z'); INSERT INTO RecycledPolyesterUsage (manufacturer_id, quantity) VALUES (1, 5000), (1, 6... | What is the total quantity of recycled polyester used by each manufacturer? | SELECT m.name, SUM(rpu.quantity) FROM Manufacturers m JOIN RecycledPolyesterUsage rpu ON m.id = rpu.manufacturer_id GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, city VARCHAR(20), carbon_offset FLOAT); INSERT INTO green_buildings (id, city, carbon_offset) VALUES (1, 'New York', 30.5), (2, 'Los Angeles', 25.3), (3, 'New York', 32.1), (4, 'Chicago', 28.9); | What is the average carbon offset for green buildings in 'New York'? | SELECT AVG(carbon_offset) FROM green_buildings WHERE city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE events_attendance (event_id INT, visitors INT); INSERT INTO events_attendance VALUES (1, 60); | List the events that had more than 50 visitors. | SELECT e.name FROM events e JOIN events_attendance ea ON e.id = ea.event_id GROUP BY e.name HAVING COUNT(ea.visitors) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, name TEXT, country TEXT, is_eco_friendly BOOLEAN, daily_revenue INT); INSERT INTO hotels (id, name, country, is_eco_friendly, daily_revenue) VALUES (1, 'Barcelona Eco Hotel', 'Spain', true, 300), (2, 'Madrid Hotel', 'Spain', false, 250), (3, 'Ibiza Green Hotel', 'Spain', true, 400); | What is the average revenue per night for hotels in Spain? | SELECT AVG(daily_revenue) FROM hotels WHERE country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, quarter INT, annual_production INT); INSERT INTO mines (id, name, location, quarter, annual_production) VALUES (1, 'Mine A', 'Country X', 1, 375), (2, 'Mine B', 'Country Y', 1, 500), (3, 'Mine C', 'Country Z', 1, 437); | How many tons of REE were produced by each mine in Q1 2018? | SELECT name, SUM(annual_production) as total_production FROM mines WHERE YEAR(timestamp) = 2018 AND quarter = 1 GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, name TEXT, city TEXT, rating FLOAT, ai_adoption BOOLEAN); INSERT INTO hotels (id, name, city, rating, ai_adoption) VALUES (1, 'The Plaza', 'New York City', 4.5, true), (2, 'The Bowery Hotel', 'New York City', 4.7, false); | What is the average rating of hotels in New York City that have adopted hospitality AI? | SELECT AVG(rating) FROM hotels WHERE city = 'New York City' AND ai_adoption = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftMissions (MissionID INT, SpacecraftID INT, LaunchDate DATE, Destination VARCHAR(50)); | What is the earliest launch date of a spacecraft that visited Uranus? | SELECT MIN(LaunchDate) FROM SpacecraftMissions WHERE Destination = 'Uranus'; | gretelai_synthetic_text_to_sql |
CREATE TABLE residential (customer_id INT, water_usage FLOAT, usage_date DATE); INSERT INTO residential (customer_id, water_usage, usage_date) VALUES (1, 150.5, '2022-07-01'), (2, 0, '2022-07-02'), (3, 800.4, '2022-07-03'); | Find the minimum water_usage in the residential table for the month of July 2022, excluding any customers with a water_usage of 0. | SELECT MIN(water_usage) FROM residential WHERE usage_date BETWEEN '2022-07-01' AND '2022-07-31' AND water_usage > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmTemp (FarmID int, Date date, WaterTemp float); INSERT INTO FarmTemp (FarmID, Date, WaterTemp) VALUES (1, '2022-01-01', 10.5), (1, '2022-01-02', 11.2), (2, '2022-01-01', 12.1), (2, '2022-01-02', 12.6); | What is the maximum water temperature recorded for each farm? | SELECT FarmID, MAX(WaterTemp) as MaxTemp FROM FarmTemp GROUP BY FarmID; | gretelai_synthetic_text_to_sql |
CREATE TABLE nonprofits (id INT, name TEXT, state TEXT, program TEXT, donation_amount FLOAT); INSERT INTO nonprofits (id, name, state, program, donation_amount) VALUES (1, 'Nonprofit A', 'California', 'Education', 25000.00), (2, 'Nonprofit B', 'California', 'Health', 50000.00), (3, 'Nonprofit C', 'California', 'Environ... | Identify the top 3 nonprofits with the highest total donation amounts, regardless of their location or programs offered, and list their names and corresponding total donation amounts. | SELECT name, SUM(donation_amount) as total_donation FROM nonprofits GROUP BY name ORDER BY total_donation DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_biz (business_id INT, business_name TEXT, country TEXT, sustainability_practice BOOLEAN); INSERT INTO local_biz (business_id, business_name, country, sustainability_practice) VALUES (1, 'Paris Patisserie', 'France', TRUE); INSERT INTO local_biz (business_id, business_name, country, sustainability_pra... | What is the total number of local businesses in France that have implemented sustainable tourism practices? | SELECT COUNT(*) FROM local_biz WHERE country = 'France' AND sustainability_practice = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (site_id INT, site_name VARCHAR(255)); INSERT INTO mining_sites (site_id, site_name) VALUES (1, 'Site A'), (2, 'Site B'); CREATE TABLE mining_activities (activity_id INT, site_id INT, activity_date DATE); INSERT INTO mining_activities (activity_id, site_id, activity_date) VALUES (1, 1, '2022-0... | Find the mining sites where mining activities were recorded on a specific date | SELECT s.site_name FROM mining_sites s INNER JOIN mining_activities a ON s.site_id = a.site_id WHERE a.activity_date = '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (project_id INT, project_name VARCHAR(50), budget INT, region VARCHAR(50)); CREATE TABLE beneficiaries (beneficiary_id INT, project_id INT, number_of_beneficiaries INT); INSERT INTO infrastructure_projects (project_id, project_name, budget, region) VALUES (1, 'Road Construction', 50... | List all rural infrastructure projects in the 'rural_development' database, along with their corresponding budgets, and the total number of beneficiaries they have reached. | SELECT infrastructure_projects.project_name, infrastructure_projects.budget, SUM(beneficiaries.number_of_beneficiaries) FROM infrastructure_projects INNER JOIN beneficiaries ON infrastructure_projects.project_id = beneficiaries.project_id GROUP BY infrastructure_projects.project_name, infrastructure_projects.budget; | gretelai_synthetic_text_to_sql |
CREATE TABLE bikes (id INT PRIMARY KEY, availability INT, date DATE); CREATE VIEW last_days AS SELECT MAX(date) FROM bikes GROUP BY EXTRACT(YEAR_MONTH FROM date); | How many shared bikes were available in New York on the last day of each month? | SELECT COUNT(*) FROM bikes b JOIN last_days l ON b.date = l.MAX(date) WHERE b.availability > 0 AND EXTRACT(MONTH FROM b.date) = EXTRACT(MONTH FROM l.MAX(date)); | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (name VARCHAR(255), location VARCHAR(255), capacity FLOAT, monthly_production FLOAT); INSERT INTO wind_farms VALUES ('Farm A', 'USA', 100, 2000), ('Farm B', 'Canada', 150, 3000), ('Farm C', 'Germany', 200, 4000); | What is the average monthly energy production for each wind farm in gigawatt-hours? | SELECT name, AVG(monthly_production) OVER (PARTITION BY name) AS avg_monthly_production FROM wind_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping (id INT, country VARCHAR(50), operation VARCHAR(50), start_date DATE, end_date DATE, cost INT); INSERT INTO peacekeeping (id, country, operation, start_date, end_date, cost) VALUES (1, 'Rwanda', 'UNAMIR', '1993-10-22', '1996-03-08', 1234567), (2, 'Burundi', 'ONUB', '2004-06-01', '2007-12-01', ... | What is the total cost of peacekeeping operations for African countries since 2010? | SELECT SUM(cost) as total_cost FROM peacekeeping WHERE country LIKE 'Africa%' AND start_date >= '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(255)); INSERT INTO users (id, country) VALUES (1, 'USA'), (2, 'Canada'); CREATE TABLE posts (id INT, user_id INT, content TEXT); INSERT INTO posts (id, user_id, content) VALUES (1, 1, 'Hello'), (2, 1, 'World'), (3, 2, 'AI'); | What is the average number of posts per user in the United States? | SELECT AVG(posts.user_id) FROM posts JOIN users ON posts.user_id = users.id WHERE users.country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (id INT, model VARCHAR(255), manufacturer_id INT); INSERT INTO aircraft (id, model, manufacturer_id) VALUES (1, 'B737', 1), (2, 'A320', 2), (3, 'B787', 1); CREATE TABLE manufacturer (id INT, name VARCHAR(255)); INSERT INTO manufacturer (id, name) VALUES (1, 'Boeing'), (2, 'Airbus'); CREATE TABLE a... | List all aircraft models and their manufacturers with accidents since 2015. | SELECT a.model, m.name, COUNT(a.id) as accidents FROM aircraft a INNER JOIN manufacturer m ON a.manufacturer_id = m.id INNER JOIN accident ac ON a.id = ac.aircraft_id WHERE YEAR(ac.accident_date) >= 2015 GROUP BY a.model, m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE GraduateStudents(Id INT, Name VARCHAR(100), Program VARCHAR(50), GrantsReceived INT, Ethnicity VARCHAR(50)); INSERT INTO GraduateStudents(Id, Name, Program, GrantsReceived, Ethnicity) VALUES (1, 'Aaliyah', 'Engineering', 3, 'Latinx'), (2, 'Benjamin', 'Engineering', 2, 'Hispanic'); | What is the average number of research grants received by graduate students in the Engineering program who identify as Latinx or Hispanic? | SELECT AVG(GrantsReceived) FROM GraduateStudents WHERE Program = 'Engineering' AND Ethnicity IN ('Latinx', 'Hispanic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO mining_operations (id, name, location) VALUES (1, 'Mining Operation 1', 'Pará, Brazil'), (2, 'Mining Operation 2', 'Amazonas, Brazil'); | List all mining operations in the state of Pará, Brazil? | SELECT * FROM mining_operations WHERE location LIKE '%Pará, Brazil%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_applications (app_id INT, app_name TEXT, app_region TEXT, app_type TEXT); INSERT INTO creative_ai_applications (app_id, app_name, app_region, app_type) VALUES (1, 'AI Art Generation', 'North America', 'Image'), (2, 'AI Music Composition', 'Europe', 'Audio'), (3, 'AI Poetry Writing', 'Asia', 'Te... | What is the distribution of creative AI applications by region and application type? | SELECT app_region, app_type, COUNT(*) as num_applications FROM creative_ai_applications GROUP BY app_region, app_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (employee_id INT, name TEXT, race TEXT, gender TEXT); INSERT INTO employees (employee_id, name, race, gender) VALUES (1, 'Alice', 'Asian', 'Female'), (2, 'Bob', 'White', 'Male'), (3, 'Charlie', 'Black', 'Non-binary'), (4, 'Dave', 'White', 'Male'), (5, 'Eve', 'Latinx', 'Female'); | What is the racial and gender diversity of the company? | SELECT race, gender, COUNT(*) AS num_employees FROM employees GROUP BY race, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (id INT, project_name VARCHAR(50), location VARCHAR(50), size_acres DECIMAL(10,2), budget_USD DECIMAL(10,2), start_date DATE, end_date DATE); | Delete record with id 1 from 'habitat_preservation' | WITH cte AS (DELETE FROM habitat_preservation WHERE id = 1) SELECT * FROM cte; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment (veteran_id INT, name VARCHAR(50), job_start_date DATE); | Delete records in the veteran_employment table where the 'name' is 'Sarah Lee' and 'job_start_date' is older than 2020-01-01 | DELETE FROM veteran_employment WHERE name = 'Sarah Lee' AND job_start_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT PRIMARY KEY, species VARCHAR(255), population INT, region VARCHAR(255)); | Find animal species with a population greater than 1000 in a specific region | SELECT species FROM animal_population WHERE population > 1000 AND region = 'African Savannah'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_villages (id INT, name VARCHAR(100), population INT, healthcare_distance DECIMAL(5, 2)); | What is the minimum distance to the nearest healthcare facility for each village in the 'rural_villages' table, excluding villages with a population of less than 500? | SELECT name, MIN(healthcare_distance) FROM rural_villages WHERE population >= 500 GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE machines (id INT, model VARCHAR(50), year INT, status VARCHAR(50), maintenance_start_date DATE); INSERT INTO machines (id, model, year, status, maintenance_start_date) VALUES (1, 'CNC Mill', 2015, 'Operational', '2021-02-01'); INSERT INTO machines (id, model, year, status, maintenance_start_date) VALUES (2... | Delete records of machines that have been under maintenance for over a year. | DELETE FROM machines WHERE status = 'Under Maintenance' AND maintenance_start_date <= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA Europe; CREATE TABLE MilitaryVehicles (id INT, name VARCHAR(255), type VARCHAR(255), quantity INT); INSERT INTO MilitaryVehicles (id, name, type, quantity) VALUES (1, 'Tank', 'Main Battle Tank', 100); INSERT INTO MilitaryVehicles (id, name, type, quantity) VALUES (2, 'APC', 'Armored Personnel Carrier', 20... | What is the total number of military vehicles in the 'Europe' schema? | SELECT SUM(quantity) FROM Europe.MilitaryVehicles; | gretelai_synthetic_text_to_sql |
CREATE TABLE Program (ID INT, Name VARCHAR(255)); INSERT INTO Program (ID, Name) VALUES (1, 'Education'), (2, 'Health'), (3, 'Environment'); CREATE TABLE Volunteer (ID INT, Name VARCHAR(255), ProgramID INT); INSERT INTO Volunteer (ID, Name, ProgramID) VALUES (1, 'John Doe', 1), (2, 'Jane Smith', 2), (3, 'Alice Johnson'... | What is the total number of volunteers for each program in the 'NonprofitDB' database? | SELECT v.ProgramID, COUNT(*) as TotalVolunteers FROM Volunteer v GROUP BY v.ProgramID; | gretelai_synthetic_text_to_sql |
CREATE TABLE client_scores (id INT, client_id INT, financial_wellbeing_score INT); INSERT INTO client_scores (id, client_id, financial_wellbeing_score) VALUES (1, 1, 75), (2, 2, 60), (3, 3, 80); | What is the average financial wellbeing score for clients? | SELECT AVG(financial_wellbeing_score) FROM client_scores; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech_branches (branch VARCHAR(255), tech_name VARCHAR(255), year_introduced INT, current_version INT); | Analyze the military technology used by different branches of the military, the year it was first introduced, and the latest version of the technology. | SELECT branch, tech_name, MAX(year_introduced) as first_introduced, MAX(current_version) as latest_version FROM military_tech_branches GROUP BY branch, tech_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name TEXT, type TEXT, price DECIMAL); INSERT INTO menus (menu_id, menu_name, type, price) VALUES (1, 'Quinoa Salad', 'Vegetarian', 12.99), (2, 'Chicken Caesar Wrap', 'Gluten-free', 10.99), (3, 'Vegan Burger', 'Vegan', 14.99), (4, 'Falafel Wrap', 'Vegan;Gluten-free', 9.99); | What is the maximum price of a vegan menu item? | SELECT MAX(price) FROM menus WHERE type = 'Vegan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest (id INT, name VARCHAR(255), area_ha INT, avg_carbon_ton FLOAT); INSERT INTO forest (id, name, area_ha, avg_carbon_ton) VALUES (1, 'Forest1', 10000, 2.3), (2, 'Forest2', 12000, 2.5), (3, 'Forest3', 15000, 2.8); | What is the average carbon sequestration of all forests in metric tons? | SELECT AVG(avg_carbon_ton) FROM forest; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (id INT, make VARCHAR(255), model VARCHAR(255), type VARCHAR(255), top_speed INT); INSERT INTO vehicles (id, make, model, type, top_speed) VALUES (1, 'Tesla', 'Model S', 'Electric', 250); | What is the average speed of electric vehicles in the "vehicles" table? | SELECT AVG(top_speed) FROM vehicles WHERE type = 'Electric'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (medium VARCHAR(20), age INT); INSERT INTO Artists (medium, age) VALUES ('Painting', 25), ('Painting', 45), ('Sculpture', 30), ('Sculpture', 50); | What is the minimum and maximum age of artists in the painting and sculpture media? | SELECT MIN(age), MAX(age) FROM Artists WHERE medium IN ('Painting', 'Sculpture'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hydrothermal_vents (vent_name TEXT, location TEXT, depth FLOAT); INSERT INTO hydrothermal_vents (vent_name, location, depth) VALUES ('Chimney 1', 'Atlantic Ocean', 2100.0), ('Vent A', 'Pacific Ocean', 2700.0), ('Vent B', 'Indian Ocean', 3200.0); | List the names and locations of all deep-sea hydrothermal vents. | SELECT vent_name, location FROM hydrothermal_vents; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (shipment_id INT, shipping_method TEXT, weight FLOAT); INSERT INTO shipments (shipment_id, shipping_method, weight) VALUES (1, 'ground', 10.5), (2, 'air', 15.3), (3, 'ocean', 8.2); | What is the total weight (in kg) of packages shipped via each shipping method, in the last month? | SELECT shipping_method, SUM(weight) as total_weight FROM shipments WHERE shipped_date BETWEEN DATEADD(day, -30, GETDATE()) AND GETDATE() GROUP BY shipping_method; | gretelai_synthetic_text_to_sql |
CREATE TABLE MusicConcertsWorldwide (title VARCHAR(255), city VARCHAR(255), continent VARCHAR(255), revenue FLOAT, concert_date DATE); INSERT INTO MusicConcertsWorldwide (title, city, continent, revenue, concert_date) VALUES ('ConcertA', 'NYC', 'North America', 100000, '2022-01-01'), ('ConcertB', 'LA', 'North America',... | What was the total revenue for music concerts, by city and continent? | SELECT continent, city, SUM(revenue) FROM MusicConcertsWorldwide GROUP BY continent, city; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (event_id INT, event_name VARCHAR(50), location VARCHAR(50), date DATE, ticket_price DECIMAL(5,2), num_tickets INT); | Which events have more than 10,000 fans attending in the 'concerts' table? | SELECT event_name FROM concerts WHERE num_tickets > 10000 GROUP BY event_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, age INT, gender VARCHAR(10), city VARCHAR(20)); INSERT INTO fans VALUES (1, 25, 'Male', 'Toronto'); INSERT INTO fans VALUES (2, 35, 'Female', 'Vancouver'); CREATE TABLE games (game_id INT, team VARCHAR(20), location VARCHAR(20)); INSERT INTO games VALUES (1, 'Maple Leafs', 'Toronto'); INS... | Find the number of fans who have attended ice hockey games in both Toronto and Vancouver. | SELECT COUNT(DISTINCT fans.fan_id) FROM fans WHERE fans.city IN ('Toronto', 'Vancouver') GROUP BY fans.city HAVING COUNT(DISTINCT fans.city) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_disputes (id INT, union_name VARCHAR(50), dispute_date DATE, dispute_reason VARCHAR(50)); INSERT INTO labor_disputes (id, union_name, dispute_date, dispute_reason) VALUES (1, 'United Steelworkers', '2019-12-01', 'Wages'), (2, 'Teamsters', '2020-06-15', 'Benefits'), (3, 'Service Employees Internationa... | Delete records from "labor_disputes" table where the "dispute_date" is before '2020-01-01' | DELETE FROM labor_disputes WHERE dispute_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ConstructionProjects (id INT, city VARCHAR(50), country VARCHAR(50), cost FLOAT); | What is the minimum construction cost of any project in the city of Bangkok, Thailand? | SELECT MIN(cost) FROM ConstructionProjects WHERE city = 'Bangkok'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (id INT, name VARCHAR(255)); INSERT INTO clients (id, name) VALUES (1, 'John Doe'), (2, 'Jane Smith'), (3, 'Alice Johnson'); CREATE TABLE investments (id INT, client_id INT, fund_type VARCHAR(255), amount DECIMAL(10, 2)); INSERT INTO investments (id, client_id, fund_type, amount) VALUES (1, 1, 'Sha... | What is the average investment in Shariah-compliant funds per client? | SELECT AVG(amount / NULLIF(cnt, 0)) FROM (SELECT client_id, COUNT(*) AS cnt, SUM(amount) AS amount FROM investments WHERE fund_type = 'Shariah-compliant' GROUP BY client_id) t; | gretelai_synthetic_text_to_sql |
CREATE TABLE shrimp_farms (id INT, name TEXT, region TEXT, salinity FLOAT); INSERT INTO shrimp_farms (id, name, region, salinity) VALUES (1, 'Farm K', 'Gulf of Mexico', 30.1); INSERT INTO shrimp_farms (id, name, region, salinity) VALUES (2, 'Farm L', 'Gulf of Mexico', 32.5); INSERT INTO shrimp_farms (id, name, region, ... | What is the minimum water salinity level for all shrimp farms in the Gulf of Mexico? | SELECT MIN(salinity) FROM shrimp_farms WHERE region = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_sizes (id INT, customer_id INT, waist DECIMAL(3,1), hip DECIMAL(3,1), country VARCHAR(50)); | How many customers in Japan have a waist size of 60 or larger? | SELECT COUNT(*) FROM customer_sizes WHERE country = 'Japan' AND waist >= 60; | 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.