Dataset Viewer
Auto-converted to Parquet Duplicate
id
int64
3.55k
29.2k
domain
stringclasses
100 values
sql_prompt
stringlengths
25
281
sql_context
stringlengths
11
1.11k
sql
stringlengths
22
633
5,097
forestry
What is the total volume of timber sold by each salesperson, sorted by salesperson?
CREATE TABLE salesperson (salesperson_id INT, name TEXT, region TEXT); INSERT INTO salesperson (salesperson_id, name, region) VALUES (1, 'John Doe', 'North'), (2, 'Jane Smith', 'South'); CREATE TABLE timber_sales (sales_id INT, salesperson_id INT, volume REAL, sale_date DATE); INSERT INTO timber_sales (sales_id, salesp...
SELECT salesperson_id, name, SUM(volume) as total_volume FROM timber_sales JOIN salesperson ON timber_sales.salesperson_id = salesperson.salesperson_id GROUP BY salesperson_id, name ORDER BY total_volume DESC;
5,098
defense industry
List all the unique equipment types and their corresponding total maintenance frequency from the equipment_maintenance table.
CREATE TABLE equipment_maintenance (equipment_type VARCHAR(255), maintenance_frequency INT);
SELECT equipment_type, SUM(maintenance_frequency) AS total_maintenance_frequency FROM equipment_maintenance GROUP BY equipment_type;
5,099
marine biology
How many marine species are found in the Southern Ocean?
CREATE TABLE marine_species (name VARCHAR(50), common_name VARCHAR(50), location VARCHAR(50));
SELECT COUNT(*) FROM marine_species WHERE location = 'Southern Ocean';
5,100
financial services
What is the total trade value and average price for each trader and stock in the trade_history table?
CREATE TABLE trade_history (id INT, trader_id INT, stock VARCHAR(255), price DECIMAL(5,2), quantity INT, trade_time TIMESTAMP);
SELECT trader_id, stock, SUM(price * quantity) as total_trade_value, AVG(price) as avg_price FROM trade_history GROUP BY trader_id, stock;
5,101
energy
Find the energy efficiency upgrades with the highest cost and their types.
CREATE TABLE upgrades (id INT, cost FLOAT, type TEXT); INSERT INTO upgrades (id, cost, type) VALUES (1, 500, 'Insulation'), (2, 1000, 'HVAC'), (3, 1500, 'Lighting');
SELECT type, cost FROM (SELECT type, cost, ROW_NUMBER() OVER (ORDER BY cost DESC) as rn FROM upgrades) sub WHERE rn = 1;
5,102
defense operations
What is the total spending on humanitarian assistance by the European Union in the last 3 years?
CREATE SCHEMA if not exists defense; CREATE TABLE if not exists eu_humanitarian_assistance (id INT PRIMARY KEY, year INT, spending INT); INSERT INTO defense.eu_humanitarian_assistance (id, year, spending) VALUES (1, 2019, 1500), (2, 2020, 1800), (3, 2021, 2100);
SELECT SUM(spending) FROM defense.eu_humanitarian_assistance WHERE year BETWEEN 2019 AND 2021;
5,103
aquaculture
What is the average water temperature for each fish species in February?
CREATE TABLE SpeciesWaterTemp (SpeciesID int, Date date, WaterTemp float); INSERT INTO SpeciesWaterTemp (SpeciesID, Date, WaterTemp) VALUES (1, '2022-02-01', 12.8), (1, '2022-02-02', 13.1), (2, '2022-02-01', 14.3), (2, '2022-02-02', 14.7);
SELECT SpeciesName, AVG(WaterTemp) as AvgTemp FROM SpeciesWaterTemp INNER JOIN FishSpecies ON SpeciesWaterTemp.SpeciesID = FishSpecies.SpeciesID WHERE MONTH(Date) = 2 GROUP BY SpeciesName;
5,104
nonprofit operations
Delete a program's outcome data
CREATE TABLE Program_Outcomes (id INT, program_id INT, outcome_type VARCHAR, value INT, outcome_date DATE); INSERT INTO Program_Outcomes (id, program_id, outcome_type, value, outcome_date) VALUES (1, 1001, 'participants', 50, '2021-01-01'), (2, 1002, 'hours_donated', 1000, '2021-01-01');
DELETE FROM Program_Outcomes WHERE program_id = 1002;
5,105
public transportation
Find the total fare collected from passengers on 'Green Line' buses
CREATE TABLE bus_routes (route_name VARCHAR(50), fare FLOAT); INSERT INTO bus_routes (route_name, fare) VALUES ('Green Line', 1.50), ('Red Line', 2.00), ('Blue Line', 1.75);
SELECT SUM(fare) FROM bus_routes WHERE route_name = 'Green Line';
5,106
real estate
What is the average property size in inclusive housing areas?
CREATE TABLE Inclusive_Housing (Property_ID INT, Inclusive VARCHAR(10), Property_Size INT); INSERT INTO Inclusive_Housing (Property_ID, Inclusive, Property_Size) VALUES (1, 'Yes', 900), (2, 'No', 1100), (3, 'Yes', 800), (4, 'No', 1200);
SELECT AVG(Property_Size) FROM Inclusive_Housing WHERE Inclusive = 'Yes';
5,107
rural health
What is the average income of farmers in each district in India?
CREATE TABLE farmers_india (id INT, name VARCHAR(255), district_id INT, age INT, income INT); INSERT INTO farmers_india (id, name, district_id, age, income) VALUES (1, 'Farmer A', 1, 45, 50000); CREATE TABLE districts_india (id INT, name VARCHAR(255), state VARCHAR(255)); INSERT INTO districts_india (id, name, state) V...
SELECT d.name, AVG(f.income) FROM farmers_india f JOIN districts_india d ON f.district_id = d.id GROUP BY d.name;
5,108
marine biology
What is the average sea surface temperature in the Pacific Ocean per year?
CREATE TABLE Ocean(id INT, region VARCHAR(20), temperature DECIMAL(5,2)); INSERT INTO Ocean(id, region, temperature) VALUES (1, 'Pacific', 20.5), (2, 'Atlantic', 18.3), (3, 'Indian', 23.2);
SELECT AVG(temperature) FROM (SELECT temperature FROM Ocean WHERE region = 'Pacific' GROUP BY temperature, YEAR(STR_TO_DATE(region, '%Y'))) AS PacificAverage;
5,109
sustainable infrastructure
Update the end date of carbon offset initiative 'Initiative 1' in Australia to '2025-12-31'.
CREATE TABLE carbon_offsets (initiative_id INT, initiative_name VARCHAR(255), country VARCHAR(255), start_date DATE, end_date DATE);
UPDATE carbon_offsets SET end_date = '2025-12-31' WHERE initiative_name = 'Initiative 1' AND country = 'Australia';
5,110
beauty industry
Which regions have the highest and lowest sustainability metrics for products?
CREATE TABLE sustainability_metrics (product_id INT, carbon_footprint INT, water_usage INT, waste_generation INT, region VARCHAR(50)); INSERT INTO sustainability_metrics (product_id, carbon_footprint, water_usage, waste_generation, region) VALUES (1, 10, 50, 20, 'Northeast'), (2, 15, 60, 30, 'Southwest'), (3, 8, 40, 15...
SELECT region, MAX(sustainability_metrics.carbon_footprint) as max_carbon_footprint, MAX(sustainability_metrics.water_usage) as max_water_usage, MAX(sustainability_metrics.waste_generation) as max_waste_generation FROM sustainability_metrics JOIN products ON sustainability_metrics.product_id = products.product_id GROUP...
5,111
automotive
Remove the 'vehicle_safety_testing' table and its records
CREATE TABLE vehicle_safety_testing (id INT PRIMARY KEY, vehicle_model VARCHAR(255), test_score FLOAT);
DROP TABLE vehicle_safety_testing;
5,112
marine biology
Show the conservation status of marine mammals and birds by year.
CREATE TABLE mammals (id INT, name VARCHAR(255), conservation_status VARCHAR(255), year INT); CREATE TABLE birds (id INT, name VARCHAR(255), conservation_status VARCHAR(255), year INT); CREATE VIEW combined AS SELECT 'Mammals' AS animal_group, * FROM mammals UNION ALL SELECT 'Birds', * FROM birds;
SELECT animal_group, conservation_status, year, COUNT(*) FROM combined GROUP BY animal_group, conservation_status, year;
5,113
defense security
What are the names and types of military bases located in 'California'?
CREATE TABLE Armed_Forces (base_id INT, base_name VARCHAR(50), base_location VARCHAR(50), base_type VARCHAR(50)); INSERT INTO Armed_Forces (base_id, base_name, base_location, base_type) VALUES (1, 'Fort Bragg', 'North Carolina', 'Army'); INSERT INTO Armed_Forces (base_id, base_name, base_location, base_type) VALUES (2,...
SELECT base_name, base_type FROM Armed_Forces WHERE base_location = 'California';
5,114
arts operations and management
What is the total value of artworks for each artist in the 'artists_valuation' table?
CREATE TABLE artist (id INT, name VARCHAR(50)); INSERT INTO artist (id, name) VALUES (1, 'Picasso'), (2, 'Warhol'), (3, 'Basquiat'); CREATE TABLE artists_valuation (artist_id INT, valuation INT); INSERT INTO artists_valuation (artist_id, valuation) VALUES (1, 10000000), (1, 12000000), (2, 8000000), (2, 9000000), (3, 11...
SELECT a.name, SUM(av.valuation) AS total_valuation FROM artist a JOIN artists_valuation av ON a.id = av.artist_id GROUP BY a.id, a.name;
5,115
biotechnology
List startups that received funding for biosensor development
CREATE TABLE startups (id INT, name VARCHAR(50), domain VARCHAR(50), location VARCHAR(50)); INSERT INTO startups (id, name, domain, location) VALUES (1, 'SensBiotech', 'Biosensors', 'CA'); INSERT INTO startups (id, name, domain, location) VALUES (2, 'BioSignal', 'Bioinformatics', 'NY'); CREATE TABLE funding (id INT, st...
SELECT s.name FROM startups s JOIN funding f ON s.id = f.startup_id WHERE s.domain = 'Biosensors' AND f.purpose = 'Biosensor Development';
5,116
defense operations
What is the total amount of humanitarian assistance provided by non-governmental organizations (NGOs) to countries in Africa in the last 5 years?
CREATE TABLE HumanitarianAssistance (Country VARCHAR(50), Organization VARCHAR(50), Amount INT, Year INT); INSERT INTO HumanitarianAssistance (Country, Organization, Amount, Year) VALUES ('Kenya', 'Doctors Without Borders', 2000000, 2018), ('Nigeria', 'International Rescue Committee', 3000000, 2019), ('South Africa', '...
SELECT SUM(Amount) AS TotalAssistance, Country FROM HumanitarianAssistance WHERE Organization NOT IN ('Government', 'Military') AND Year BETWEEN 2016 AND 2020 GROUP BY Country;
5,117
automotive
What is the total number of autonomous driving research papers published by country in the past year?
CREATE TABLE ResearchPapers (ID INT, Title VARCHAR(100), PublishedDate DATE, Author VARCHAR(50), Country VARCHAR(50)); INSERT INTO ResearchPapers (ID, Title, PublishedDate, Author, Country) VALUES (1, 'AD Research 1', '2022-01-15', 'A. Smith', 'USA'), (2, 'AD Research 2', '2022-03-20', 'B. Johnson', 'Canada'), (3, 'AD ...
SELECT Country, COUNT(*) as Total_Papers FROM ResearchPapers WHERE PublishedDate >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND Author LIKE '%autonomous%' GROUP BY Country;
5,118
cybersecurity
What are the unique combinations of security incident types and their corresponding statuses in the incident_responses table, excluding any records with 'In Progress' status?
CREATE TABLE incident_responses (incident VARCHAR(50), status VARCHAR(15)); INSERT INTO incident_responses (incident, status) VALUES ('Incident 1', 'Resolved'), ('Incident 2', 'In Progress'), ('Incident 3', 'Resolved'), ('Incident 4', 'In Progress'), ('Incident 5', 'Assessed');
SELECT incident, status FROM incident_responses WHERE status != 'In Progress' GROUP BY incident, status;
5,119
biotechnology
What is the maximum number of genetic research projects in Japan per year?
CREATE SCHEMA if not exists genetic;CREATE TABLE if not exists genetic.projects (id INT PRIMARY KEY, name VARCHAR(100), start_date DATE);INSERT INTO genetic.projects (id, name, start_date) VALUES (1, 'ProjectX', '2018-01-01'), (2, 'ProjectY', '2020-05-15'), (3, 'ProjectZ', '2017-08-08'), (4, 'ProjectW', '2021-03-03'), ...
SELECT YEAR(start_date) AS year, MAX(COUNT(*)) AS projects_count FROM genetic.projects GROUP BY year;
5,120
construction
How many construction projects were completed each month in 2020 and 2021?
CREATE TABLE project_timeline (id INT, project VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO project_timeline (id, project, start_date, end_date) VALUES (1, 'Office Building', '2019-12-20', '2021-04-30'), (2, 'Residential Apartments', '2021-03-01', '2022-08-01'), (3, 'School', '2020-06-15', '2021-10-15'), (...
SELECT YEAR(start_date) AS year, MONTH(start_date) AS month, COUNT(*) AS projects FROM project_timeline WHERE end_date IS NOT NULL GROUP BY year, month;
5,121
construction
What is the average labor cost per worker per week in the 'LaborStatistics' table?
CREATE TABLE LaborStatistics (workerID INT, laborDate DATE, hourlyRate DECIMAL(10,2), hoursWorked DECIMAL(10,2));
SELECT AVG(hourlyRate * hoursWorked * 5) AS AverageLaborCost FROM LaborStatistics;
5,122
agriculture
List all food justice organizations in Africa, along with the number of projects they have implemented.
CREATE TABLE food_justice_orgs (org_id INT, org_name TEXT, country TEXT, num_projects INT); INSERT INTO food_justice_orgs (org_id, org_name, country, num_projects) VALUES (1, 'Org A', 'Kenya', 10), (2, 'Org B', 'Nigeria', 7), (3, 'Org C', 'South Africa', 15);
SELECT org_name, num_projects FROM food_justice_orgs WHERE country = 'Africa';
5,123
wildlife conservation
Retrieve the names and species of all animals that weigh more than 500 kg
CREATE TABLE animals (id INT, name VARCHAR(20), species VARCHAR(20), weight DECIMAL(5, 2)); INSERT INTO animals (id, name, species, weight) VALUES (1, 'Elephant', 'African', 6000), (2, 'Lion', 'African', 400), (3, 'Hippo', 'African', 3000), (4, 'Tiger', 'Asian', 300), (5, 'Crane', 'African', 100), (6, 'Rhinoceros', 'Af...
SELECT name, species FROM animals WHERE weight > 500;
5,124
hospitality technology
Identify hotels with the highest virtual tour engagement in the APAC region in Q1 2022
CREATE TABLE virtual_tour_stats (hotel_id INT, hotel_name TEXT, region TEXT, q1_2022_views INT); INSERT INTO virtual_tour_stats (hotel_id, hotel_name, region, q1_2022_views) VALUES (10, 'Hotel X', 'APAC', 500), (11, 'Hotel Y', 'APAC', 650);
SELECT hotel_name, q1_2022_views FROM virtual_tour_stats WHERE region = 'APAC' ORDER BY q1_2022_views DESC LIMIT 5;
5,125
cybersecurity
What are the common cybersecurity policies across all departments, according to our Policy Analysis database?
CREATE TABLE PolicyAnalysis (id INT, policy VARCHAR(100), department VARCHAR(50)); INSERT INTO PolicyAnalysis (id, policy, department) VALUES (1, 'Data Access Policy', 'Sales'), (2, 'Password Policy', 'Marketing');
SELECT policy FROM PolicyAnalysis GROUP BY policy HAVING COUNT(DISTINCT department) = (SELECT COUNT(DISTINCT department) FROM PolicyAnalysis);
5,126
venture capital
How many companies were founded by women in the San Francisco Bay Area?
CREATE TABLE companies (id INT, name TEXT, city TEXT, state TEXT, founder_gender TEXT); INSERT INTO companies (id, name, city, state, founder_gender) VALUES (1, 'Acme Inc', 'San Francisco', 'CA', 'female');
SELECT COUNT(*) FROM companies WHERE city='San Francisco' AND state='CA' AND founder_gender='female';
5,127
finance
What was the total value of socially responsible loans issued to women in H2 2021?
CREATE TABLE socially_responsible_loans (id INT, value DECIMAL(10, 2), client_gender VARCHAR(10), date DATE);
SELECT SUM(value) FROM socially_responsible_loans WHERE client_gender = 'female' AND date BETWEEN '2021-07-01' AND '2021-12-31';
5,128
space
What is the maximum distance of all satellites from the Earth's surface, organized by country of origin?
CREATE TABLE satellites (id INT, name VARCHAR(255), country_of_origin VARCHAR(255), avg_distance FLOAT);
SELECT country_of_origin, MAX(avg_distance) FROM satellites GROUP BY country_of_origin;
5,129
telecommunications
What is the total data usage for mobile customers in the city of Toronto for the year 2022?
CREATE TABLE mobile_usage (subscriber_id INT, data_usage FLOAT, city VARCHAR(20), year INT); INSERT INTO mobile_usage (subscriber_id, data_usage, city, year) VALUES (1, 3.5, 'Toronto', 2022), (2, 4.2, 'New York', 2022), (3, 3.8, 'Toronto', 2022);
SELECT SUM(data_usage) FROM mobile_usage WHERE city = 'Toronto' AND year = 2022;
5,130
maritime
What is the maximum cargo weight for VesselC?
CREATE TABLE vessels (id INT, name TEXT, max_cargo_weight INT); INSERT INTO vessels (id, name, max_cargo_weight) VALUES (3, 'VesselC', 50000);
SELECT max_cargo_weight FROM vessels WHERE name = 'VesselC';
5,131
healthcare
What is the minimum cultural competency score by worker?
CREATE TABLE worker_scores (worker_id INT, score INT); INSERT INTO worker_scores (worker_id, score) VALUES (1, 95), (2, 88), (3, 72);
SELECT worker_id, MIN(score) FROM worker_scores;
5,132
cybersecurity
What is the total number of security incidents that have occurred in each region in the past year?
CREATE TABLE incident_region(id INT, region VARCHAR(50), incidents INT, incident_date DATE);
SELECT region, SUM(incidents) as total_incidents FROM incident_region WHERE incident_date > DATE(NOW()) - INTERVAL 365 DATE GROUP BY region;
5,133
defense operations
Show all records in the defense_diplomacy table where the participant_country is 'China' or 'India'
CREATE TABLE defense_diplomacy (diplomacy_id INT, event_name VARCHAR(50), participant_country VARCHAR(50), event_date DATE, event_description TEXT);
SELECT * FROM defense_diplomacy WHERE participant_country IN ('China', 'India');
5,134
defense security
What was the total number of military personnel in the United States in 2018, 2019, and 2020?
CREATE TABLE us_military_personnel (id INT, year INT, personnel INT); INSERT INTO us_military_personnel (id, year, personnel) VALUES (1, 2018, 2100000), (2, 2019, 2150000), (3, 2020, 2180000);
SELECT SUM(personnel) FROM us_military_personnel WHERE year IN (2018, 2019, 2020);
5,135
justice
What is the name and age of the youngest inmate in the prison table?
CREATE TABLE prison (id INT, name TEXT, security_level TEXT, age INT); INSERT INTO prison (id, name, security_level, age) VALUES (1, 'John Doe', 'low_security', 25); INSERT INTO prison (id, name, security_level, age) VALUES (2, 'Jane Smith', 'medium_security', 35);
SELECT name, age FROM prison ORDER BY age LIMIT 1;
5,136
tourism
What is the average hotel star rating for hotels in Japan and South Korea?
CREATE TABLE hotel_ratings (country VARCHAR(50), stars FLOAT); INSERT INTO hotel_ratings (country, stars) VALUES ('Japan', 4.2), ('South Korea', 4.5);
SELECT AVG(stars) FROM hotel_ratings WHERE country IN ('Japan', 'South Korea');
5,137
media
What is the total word count for articles in each language per week?
CREATE TABLE Articles (id INT, language TEXT, publish_date DATE, word_count INT); INSERT INTO Articles (id, language, publish_date, word_count) VALUES (1, 'Language 1', '2023-01-01', 500);
SELECT language, DATE_TRUNC('week', publish_date) as week, SUM(word_count) as total_word_count FROM Articles GROUP BY language, week ORDER BY week;
5,138
public health
What is the average age of patients who received a flu shot in California, grouped by county?
CREATE TABLE vaccinations (patient_id INT, county VARCHAR(20), vaccine VARCHAR(20)); INSERT INTO vaccinations (patient_id, county, vaccine) VALUES (1, 'Los Angeles', 'Flu'), (2, 'San Francisco', 'Flu'), (3, 'San Diego', 'Flu'); CREATE TABLE patients (patient_id INT, age INT); INSERT INTO patients (patient_id, age) VALU...
SELECT v.county, AVG(p.age) as avg_age FROM vaccinations v INNER JOIN patients p ON v.patient_id = p.patient_id WHERE vaccine = 'Flu' AND county = 'California' GROUP BY v.county;
5,139
automotive
What was the highest horsepower vehicle at the 2021 Geneva Motor Show?
CREATE TABLE geneva_motor_show (year INT, make VARCHAR(50), model VARCHAR(50), horsepower INT); INSERT INTO geneva_motor_show (year, make, model, horsepower) VALUES (2021, 'Koenigsegg', 'Jesko', 1600), (2021, 'Bugatti', 'Chiron Super Sport', 1578), (2021, 'Rimac', 'Nevera', 1914), (2021, 'Pagani', 'Huayra BC', 800);
SELECT make, model, MAX(horsepower) FROM geneva_motor_show WHERE year = 2021;
5,140
rural development
What is the number of economic diversification initiatives in tourism and their total budget for the last 3 years?
CREATE TABLE economic_diversification (id INT, initiative_name TEXT, budget INT, category TEXT, start_year INT); INSERT INTO economic_diversification (id, initiative_name, budget, category, start_year) VALUES (1, 'Cultural Festival', 30000, 'Tourism', 2019), (2, 'Eco-Lodge Development', 50000, 'Tourism', 2020), (3, 'Ag...
SELECT category, start_year, COUNT(*), SUM(budget) FROM economic_diversification WHERE start_year >= 2019 GROUP BY category, start_year;
5,141
automotive
Which electric vehicle models have a safety rating above 4.5?
CREATE TABLE VehicleModels (Model VARCHAR(255), Manufacturer VARCHAR(255), SafetyRating FLOAT); INSERT INTO VehicleModels (Model, Manufacturer, SafetyRating) VALUES ('Model S', 'Tesla', 5.1), ('Model 3', 'Tesla', 4.9), ('Prius', 'Toyota', 4.6), ('Civic', 'Honda', 4.4);
SELECT Model FROM VehicleModels WHERE SafetyRating > 4.5;
5,142
sports entertainment
How many athletes have participated in wellbeing programs in each sport in the last year, and which sport had the most participants?
CREATE TABLE wellbeing_programs (athlete_id INT, sport VARCHAR(50), program_date DATE); INSERT INTO wellbeing_programs (athlete_id, sport, program_date) VALUES (1, 'Soccer', '2022-01-01'), (2, 'Basketball', '2022-01-02'), (3, 'Football', '2022-01-03'), (4, 'Soccer', '2022-01-04'), (5, 'Baseball', '2022-01-05');
SELECT sport, COUNT(DISTINCT athlete_id) AS participants FROM wellbeing_programs WHERE program_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY sport ORDER BY participants DESC;
5,143
space
What is the total number of space missions led by women?
CREATE TABLE space_missions (id INT, name VARCHAR(255), leader VARCHAR(255), year INT); INSERT INTO space_missions (id, name, leader, year) VALUES (1, 'Mars Rover', 'Dr. Jessica Watkins', 2022); INSERT INTO space_missions (id, name, leader, year) VALUES (2, 'ISS Expedition', 'Anousheh Ansari', 2023);
SELECT COUNT(*) FROM space_missions WHERE leader IN (SELECT name FROM astronauts WHERE gender = 'Female');
5,144
public safety
What is the average response time for fires in Boston?
CREATE TABLE boston_emergency_response (id INT, incident_type TEXT, response_time INT); INSERT INTO boston_emergency_response (id, incident_type, response_time) VALUES (1, 'Fire', 120), (2, 'Medical', 150), (3, 'Police', 180);
SELECT AVG(response_time) FROM boston_emergency_response WHERE incident_type = 'Fire';
5,145
retail
What is the percentage of products that are made from recycled materials?
CREATE TABLE products(product_id INT, is_recycled BOOLEAN);
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM products)) as percentage FROM products WHERE is_recycled = TRUE;
5,146
real estate
List property co-owners in New York City who have not implemented accessibility features.
CREATE TABLE CoOwners (CoOwnerID int, PropertyID int, City varchar(20)); CREATE TABLE Properties (PropertyID int, Accessibility varchar(5)); INSERT INTO CoOwners (CoOwnerID, PropertyID, City) VALUES (1, 1, 'New York City'); INSERT INTO Properties (PropertyID, Accessibility) VALUES (1, 'No'); INSERT INTO CoOwners (CoOwn...
SELECT CoOwners.CoOwnerID, Properties.City FROM CoOwners INNER JOIN Properties ON CoOwners.PropertyID = Properties.PropertyID WHERE Properties.City = 'New York City' AND Properties.Accessibility = 'No';
5,147
ethical fashion
What is the total revenue generated by brands that have a circular business model, in the year 2020?
CREATE TABLE BrandRevenue (brand VARCHAR(255), revenue DECIMAL(10,2), year INT, circular_model BOOLEAN);
SELECT SUM(revenue) FROM BrandRevenue WHERE circular_model = TRUE AND year = 2020;
5,148
automotive
Which autonomous vehicles have the highest safety ratings in the 'auto_show' table?
CREATE TABLE auto_show (id INT, vehicle_name VARCHAR(50), safety_rating INT);
SELECT vehicle_name, safety_rating FROM (SELECT vehicle_name, safety_rating, RANK() OVER (ORDER BY safety_rating DESC) as safety_rank FROM auto_show WHERE vehicle_name LIKE '%Autonomous%') AS auton_ranks WHERE safety_rank = 1;
5,149
restaurant operations
What is the average food safety inspection score for restaurants located in 'Westwood'?
CREATE TABLE Restaurants (RestaurantID int, RestaurantName varchar(255), Region varchar(255)); CREATE TABLE Inspections (InspectionID int, RestaurantID int, InspectionScore int, InspectionDate date);
SELECT AVG(I.InspectionScore) as AvgInspectionScore FROM Restaurants R INNER JOIN Inspections I ON R.RestaurantID = I.RestaurantID WHERE R.Region = 'Westwood';
5,150
public health
How many hospitals are there in each state in the United States?
CREATE TABLE Hospitals (HospitalID INT, HospitalName VARCHAR(255), State VARCHAR(255)); INSERT INTO Hospitals (HospitalID, HospitalName, State) VALUES (1, 'Alaska General Hospital', 'Alaska'), (2, 'Bama Healthcare', 'Alabama'), (3, 'California Care', 'California'), (4, 'Delaware Hospital', 'Delaware'), (5, 'Florida Med...
SELECT State, COUNT(*) FROM Hospitals GROUP BY State;
5,151
wildlife conservation
What are the names and habitats of all animals that are part of an education program in the 'Americas' region?
CREATE TABLE AnimalEducation (id INT, animal_id INT, program_id INT); INSERT INTO AnimalEducation (id, animal_id, program_id) VALUES (1, 1, 1), (2, 2, 1), (3, 3, 2);
SELECT a.name, h.name FROM Animals a INNER JOIN AnimalEducation ae ON a.id = ae.animal_id INNER JOIN EducationPrograms e ON ae.program_id = e.id INNER JOIN Coordinators c ON e.coordinator_id = c.id INNER JOIN Habitat h ON a.habitat_id = h.id WHERE c.region = 'Americas';
5,152
defense contractors
List defense projects that started in 2019 and their associated risks, if any.
CREATE TABLE DefenseProjects (id INT, project_name VARCHAR(50), start_date DATE, risk_level INT); INSERT INTO DefenseProjects (id, project_name, start_date, risk_level) VALUES (1, 'Project G', '2019-01-01', 3), (2, 'Project H', '2018-06-15', 5), (3, 'Project I', '2019-12-31', NULL);
SELECT project_name, risk_level FROM DefenseProjects WHERE start_date >= '2019-01-01' AND start_date <= '2019-12-31' AND risk_level IS NOT NULL;
5,153
waste management
What is the total waste generation in the textile category for each country in 2021?'
CREATE TABLE textile_waste (country VARCHAR(50), year INT, amount INT); INSERT INTO textile_waste (country, year, amount) VALUES ('Bangladesh', 2021, 50000), ('Vietnam', 2021, 40000), ('India', 2021, 30000);
SELECT country, SUM(amount) as total_textile_waste FROM textile_waste WHERE year = 2021 GROUP BY country;
5,154
defense industry
How many military equipment maintenance requests were there in January 2020?
CREATE TABLE maintenance_requests (request_id INT, date DATE, type VARCHAR(255)); INSERT INTO maintenance_requests (request_id, date, type) VALUES (1, '2020-01-01', 'equipment'); INSERT INTO maintenance_requests (request_id, date, type) VALUES (2, '2020-01-15', 'facility');
SELECT COUNT(*) FROM maintenance_requests WHERE date BETWEEN '2020-01-01' AND '2020-01-31' AND type = 'equipment';
5,155
chemicals
List all the suppliers and their contact information who have not supplied any raw materials in the last 6 months.
CREATE TABLE Suppliers (supplier_id INT, supplier_name VARCHAR(20), contact_name VARCHAR(20), contact_phone VARCHAR(15), last_supply DATE);
SELECT Suppliers.* FROM Suppliers LEFT JOIN (SELECT supplier_id FROM Raw_Materials WHERE supply_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY supplier_id) AS RM ON Suppliers.supplier_id = RM.supplier_id WHERE RM.supplier_id IS NULL;
5,156
philanthropy
What is the total donation amount by region?
CREATE TABLE Donors (DonorID int, DonorName varchar(100), Region varchar(50), Country varchar(50), DonationDate date, AmountDonated decimal(10,2)); INSERT INTO Donors (DonorID, DonorName, Region, Country, DonationDate, AmountDonated) VALUES (1, 'John Doe', 'North America', 'USA', '2022-01-01', 500.00), (2, 'Jane Smith'...
SELECT Region, SUM(AmountDonated) as TotalDonated FROM Donors GROUP BY Region;
5,157
space
Display the names of all satellites launched before 2010
CREATE TABLE satellites (id INT, name TEXT, country TEXT, launch_date DATE); INSERT INTO satellites (id, name, country, launch_date) VALUES (1, 'Sentinel-1A', 'France', '2012-04-03'); INSERT INTO satellites (id, name, country, launch_date) VALUES (2, 'Sentinel-1B', 'France', '2014-04-22'); INSERT INTO satellites (id, n...
SELECT name FROM satellites WHERE launch_date < '2010-01-01';
5,158
hospitality technology
Count the number of unique users who engaged with virtual tours in 'January'?
CREATE TABLE user_activity (user_id INT, activity_date DATE); INSERT INTO user_activity (user_id, activity_date) VALUES (1, '2023-01-01'), (2, '2023-01-05'), (3, '2023-01-07'), (4, '2023-01-10'), (5, '2023-01-12');
SELECT COUNT(DISTINCT user_id) FROM user_activity WHERE EXTRACT(MONTH FROM activity_date) = 1;
5,159
gaming technology
What is the average age of players who use VR in France?
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (1, 25, 'Male', 'France'); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (2, 30, 'Female', 'France'); CREATE TABLE VRUsers (PlayerID INT, VRDevice VARCHAR(20))...
SELECT AVG(Age) FROM Players JOIN VRUsers ON Players.PlayerID = VRUsers.PlayerID WHERE Country = 'France';
5,160
wildlife conservation
Calculate the total population of animals in North American conservation programs
CREATE TABLE conservation_programs (id INT, program_name VARCHAR(255), location VARCHAR(255)); CREATE TABLE animal_populations (id INT, program_id INT, animal_type VARCHAR(255), population INT); INSERT INTO conservation_programs (id, program_name, location) VALUES (1, 'Yellowstone National Park', 'USA'), (2, 'Banff Nat...
SELECT SUM(animal_populations.population) FROM conservation_programs INNER JOIN animal_populations ON conservation_programs.id = animal_populations.program_id WHERE conservation_programs.location = 'USA' OR conservation_programs.location = 'Canada';
5,161
forestry
How many tree species in the temperate rainforest have a DBH greater than 50 cm?
CREATE TABLE biomes (biome_id INT PRIMARY KEY, name VARCHAR(50), area_km2 FLOAT); INSERT INTO biomes (biome_id, name, area_km2) VALUES (1, 'Tropical Rainforest', 15000000.0), (2, 'Temperate Rainforest', 250000.0), (3, 'Boreal Forest', 12000000.0); CREATE TABLE trees (tree_id INT PRIMARY KEY, species VARCHAR(50), biome_...
SELECT COUNT(DISTINCT species) FROM trees JOIN biomes ON trees.biome_id = biomes.biome_id WHERE trees.dbh > 50.0 AND biomes.name = 'Temperate Rainforest';
5,162
ethical fashion
What is the total quantity of cotton sourced from the United States by brands that have committed to fair labor practices?
CREATE TABLE cotton_source (brand VARCHAR(255), country VARCHAR(255), quantity INT); INSERT INTO cotton_source (brand, country, quantity) VALUES ('BrandA', 'USA', 1500), ('BrandB', 'USA', 2000), ('BrandC', 'China', 1000);
SELECT SUM(quantity) FROM cotton_source WHERE country = 'USA' AND brand IN (SELECT brand FROM fair_labor WHERE commitment = 'yes');
5,163
media
Find the title and genre of the top 3 movies with the highest ratings from studios based in Italy, ordered by ratings in descending order.
CREATE TABLE movies (title VARCHAR(255), genre VARCHAR(255), studio VARCHAR(255), rating FLOAT); INSERT INTO movies (title, genre, studio, rating) VALUES ('Movie19', 'Action', 'Italy Studio1', 8.5), ('Movie20', 'Drama', 'Italy Studio2', 9.0);
SELECT title, genre FROM (SELECT title, genre, studio, rating, ROW_NUMBER() OVER (PARTITION BY studio ORDER BY rating DESC) as rank FROM movies WHERE studio LIKE '%Italy%') subquery WHERE rank <= 3 ORDER BY rating DESC;
5,164
oceanography
List the top 3 marine species with the highest population growth rate.
CREATE TABLE marine_species (id INT, name VARCHAR(255), population_size INT, growth_rate DECIMAL(4,2)); INSERT INTO marine_species (id, name, population_size, growth_rate) VALUES (1, 'Clownfish', 10000, 0.05), (2, 'Sea Turtle', 5000, 0.10), (3, 'Dolphin', 20000, 0.02);
SELECT name, growth_rate FROM (SELECT name, growth_rate, ROW_NUMBER() OVER (ORDER BY growth_rate DESC) rn FROM marine_species) t WHERE rn <= 3;
5,165
sustainable infrastructure
What is the minimum energy production of wind turbines installed in China after 2016?
CREATE TABLE wind_turbines (id INT, installation_year INT, energy_production FLOAT, country VARCHAR(50)); INSERT INTO wind_turbines (id, installation_year, energy_production, country) VALUES (1, 2005, 2.8, 'China'), (2, 2008, 3.5, 'India'), (3, 2012, 4.2, 'Germany'), (4, 2015, 4.5, 'China'), (5, 2016, 4.7, 'China'), (6...
SELECT MIN(energy_production) FROM wind_turbines WHERE installation_year > 2016 AND country = 'China';
5,166
government policy
Insert a new record into the "Legislation" table with the ID of 4, a description of "Climate Change Act", and a status of "Draft"
CREATE TABLE Legislation (ID INT, Description TEXT, Status VARCHAR(255));
INSERT INTO Legislation (ID, Description, Status) VALUES (4, 'Climate Change Act', 'Draft');
5,167
philanthropy
What is the total donation amount from donors aged 40 and above?
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL(10,2), Age INT);
SELECT SUM(DonationAmount) FROM Donors WHERE Age >= 40;
5,168
food industry
How many times has there been a recall of organic chicken products in the US in the last 2 years?
CREATE TABLE recalls(id INT, product VARCHAR(30), reason VARCHAR(30), state VARCHAR(20), date DATE); INSERT INTO recalls(id, product, reason, state, date) VALUES (1, 'Organic Chicken Breast', 'contamination', 'California', '2021-01-01'); INSERT INTO recalls(id, product, reason, state, date) VALUES (2, 'Organic Chicken ...
SELECT COUNT(*) FROM recalls WHERE product LIKE 'Organic Chicken%' AND date BETWEEN '2020-01-01' AND '2022-12-31';
5,169
defense security
What is the total number of military personnel involved in cybersecurity operations in Asia?
CREATE TABLE MilitaryCyberOps (Id INT, Region VARCHAR(50), Personnel INT, Year INT); INSERT INTO MilitaryCyberOps (Id, Region, Personnel, Year) VALUES (1, 'Asia', 200, 2021); INSERT INTO MilitaryCyberOps (Id, Region, Personnel, Year) VALUES (2, 'Europe', 300, 2021);
SELECT SUM(Personnel) FROM MilitaryCyberOps WHERE Region = 'Asia';
5,170
mining operations
Display total resources extracted and the respective extraction dates for 'gold' and 'silver' resources from the 'resource_extraction' table.
CREATE TABLE resource_extraction (resource_type VARCHAR(50), extraction_date DATE, quantity INT); INSERT INTO resource_extraction (resource_type, extraction_date, quantity) VALUES ('gold', '2022-01-01', 100), ('silver', '2022-01-05', 200);
SELECT resource_type, SUM(quantity) as total_quantity, extraction_date FROM resource_extraction WHERE resource_type IN ('gold', 'silver') GROUP BY resource_type, extraction_date;
5,171
civil engineering
What is the name, height, and number of stories for all buildings in the city of New York with more than 50 floors?
CREATE TABLE Buildings (id INT, name VARCHAR(100), height FLOAT, num_stories INT, city VARCHAR(50)); INSERT INTO Buildings (id, name, height, num_stories, city) VALUES (1, 'Empire State Building', 381, 102, 'New York');
SELECT name, height, num_stories FROM Buildings WHERE city = 'New York' AND num_stories > 50;
5,172
manufacturing
Count the number of factories in the "renewable energy" sector that have more than 50 employees.
CREATE TABLE factories (id INT, sector TEXT, employee_count INT); INSERT INTO factories (id, sector, employee_count) VALUES (1, 'renewable energy', 60), (2, 'renewable energy', 40), (3, 'oil', 70), (4, 'coal', 80), (5, 'renewable energy', 30);
SELECT COUNT(*) FROM factories WHERE sector = 'renewable energy' HAVING employee_count > 50;
5,173
sports entertainment
How many sports_events took place in '2019' with a ticket sales count greater than 50000?
CREATE TABLE sports_events (event_id INT, year INT, tickets_sold INT); INSERT INTO sports_events (event_id, year, tickets_sold) VALUES (1, 2017, 60000), (2, 2018, 80000), (3, 2017, 55000), (4, 2019, 52000);
SELECT COUNT(*) FROM sports_events WHERE year = 2019 AND tickets_sold > 50000;
5,174
startups
Show the total funding amount for companies with female founders
CREATE TABLE companies (company_id INT, company_name VARCHAR(255), founding_year INT, founder_gender VARCHAR(10));CREATE TABLE funding_rounds (funding_round_id INT, company_id INT, funding_amount INT);
SELECT SUM(fr.funding_amount) FROM companies c INNER JOIN funding_rounds fr ON c.company_id = fr.company_id WHERE c.founder_gender = 'Female';
5,175
automotive
What are the vehicle safety testing organizations that operate in the UK and France?
CREATE TABLE SafetyOrgs (name VARCHAR(20), country VARCHAR(10)); INSERT INTO SafetyOrgs (name, country) VALUES ('Euro NCAP', 'UK'); INSERT INTO SafetyOrgs (name, country) VALUES ('ADAC', 'Germany'); INSERT INTO SafetyOrgs (name, country) VALUES ('UTAC', 'France');
SELECT name FROM SafetyOrgs WHERE country IN ('UK', 'France');
5,176
defense operations
Delete all humanitarian assistance missions conducted by Kenya in 2018.
CREATE TABLE humanitarian_assistance (mission_id INT, country_id INT, year INT, FOREIGN KEY (country_id) REFERENCES country(id));
DELETE FROM humanitarian_assistance WHERE country_id = (SELECT id FROM country WHERE name = 'Kenya') AND year = 2018;
5,177
real estate
Count the number of wheelchair-accessible properties in New York with a listing price above $800,000.
CREATE TABLE properties (id INT, city VARCHAR(20), listing_price INT, wheelchair_accessible BOOLEAN); INSERT INTO properties (id, city, listing_price, wheelchair_accessible) VALUES (1, 'New York', 900000, true); INSERT INTO properties (id, city, listing_price, wheelchair_accessible) VALUES (2, 'New York', 700000, false...
SELECT COUNT(*) FROM properties WHERE city = 'New York' AND listing_price > 800000 AND wheelchair_accessible = true;
5,178
food industry
What is the minimum serving size of gluten-free meals available in convenience stores?
CREATE TABLE MealTypes (meal_id INT, meal_name VARCHAR(255), meal_type VARCHAR(255), serving_size INT, store_type VARCHAR(255)); INSERT INTO MealTypes (meal_id, meal_name, meal_type, serving_size, store_type) VALUES (1, 'Chicken Salad', 'Gluten-free', 250, 'Convenience Store'), (2, 'Beef Stew', 'Vegetarian', 300, 'Conv...
SELECT MIN(serving_size) FROM MealTypes WHERE meal_type = 'Gluten-free' AND store_type = 'Convenience Store';
5,179
construction
Which sustainable practices were used in the 'Structural Engineering' department that cost over $10,000?
CREATE TABLE SustainablePractices (PracticeID INT, PracticeName VARCHAR(50), Description VARCHAR(255), Department VARCHAR(50), Cost DECIMAL(10,2)); INSERT INTO SustainablePractices (PracticeID, PracticeName, Description, Department, Cost) VALUES (5, 'Green Roof', 'Installing a green roof to reduce energy consumption an...
SELECT SustainablePractices.PracticeName FROM SustainablePractices WHERE SustainablePractices.Department = 'Structural Engineering' AND SustainablePractices.Cost > 10000.00;
5,180
government services
Add a new policy impact record to the "PolicyImpact" table
CREATE TABLE PolicyImpact (ID INT, Policy TEXT, Impact TEXT, StartDate DATE, EndDate DATE);
INSERT INTO PolicyImpact (ID, Policy, Impact, StartDate, EndDate) VALUES (3001, 'Body Cameras for Police Officers', 'Reduction in use-of-force incidents by 25%', '2021-01-01', '2022-12-31');
5,181
public transportation
What was the average fare collected on weekdays in February 2021 for the 'Red Line'?
CREATE SCHEMA trans schemas.trans; CREATE TABLE red_line (route_id INT, fare FLOAT, date DATE); INSERT INTO red_line (route_id, fare, date) VALUES (102, 3.00, '2021-02-01'), (102, 3.00, '2021-02-02'), (102, 3.00, '2021-02-03'), (102, 3.00, '2021-02-04'), (102, 3.00, '2021-02-05'), (102, 3.00, '2021-02-06'), (102, 3.00,...
SELECT AVG(fare) FROM red_line WHERE route_id = 102 AND EXTRACT(DAY FROM date) BETWEEN 2 AND 6 AND EXTRACT(MONTH FROM date) = 2;
5,182
entertainment industry
Get the average production budget for Action and Drama movies released between 2000 and 2010.
CREATE TABLE movies (id INT, title VARCHAR(100), genre VARCHAR(50), release_year INT, production_budget INT); INSERT INTO movies (id, title, genre, release_year, production_budget) VALUES (1, 'MovieA', 'Action', 2005, 15000000); INSERT INTO movies (id, title, genre, release_year, production_budget) VALUES (2, 'MovieB',...
SELECT AVG(production_budget) FROM movies WHERE genre IN ('Action', 'Drama') AND release_year BETWEEN 2000 AND 2010;
5,183
chemicals
What is the maximum production capacity of any tank in the Eastern region?
CREATE TABLE Production (tank VARCHAR(20), capacity INT, location VARCHAR(20)); INSERT INTO Production (tank, capacity, location) VALUES ('Tank3', 100000, 'Eastern'), ('Tank4', 150000, 'Western');
SELECT MAX(capacity) FROM Production WHERE location = 'Eastern';
5,184
oil and gas
List all the fields, including the ones without production, with their corresponding production rate
CREATE TABLE fields_production (field_id INT, production_rate FLOAT); INSERT INTO fields_production (field_id, production_rate) VALUES (1, 1000.0), (2, 2000.0), (3, NULL);
SELECT f.field_id, f.field_name, fp.production_rate FROM fields f LEFT JOIN fields_production fp ON f.field_id = fp.field_id;
5,185
restaurant operations
Identify the menu items that were 86'ed (ran out) before 5pm on a specific day for the 'Gourmet Greens' restaurant.
CREATE TABLE menu_items (id INT, restaurant_id INT, name VARCHAR(50), available INT, available_time TIME); INSERT INTO menu_items (id, restaurant_id, name, available, available_time) VALUES (1, 3, 'Kale Salad', 10, '12:00:00'), (2, 3, 'Beet Burger', 15, '12:00:00'), (3, 3, 'Carrot Fries', 20, '12:00:00'), (4, 3, 'Quino...
SELECT name FROM menu_items WHERE restaurant_id = 3 AND available_time < '17:00:00' GROUP BY name HAVING SUM(available) = 0;
5,186
rare earth elements
Which REEs were produced in Australia in 2020?
CREATE TABLE production (country VARCHAR(255), REE VARCHAR(255), amount INT, year INT); INSERT INTO production (country, REE, amount, year) VALUES ('Australia', 'Neodymium', 100, 2020); INSERT INTO production (country, REE, amount, year) VALUES ('Australia', 'Praseodymium', 150, 2020);
SELECT DISTINCT REE FROM production WHERE country = 'Australia' AND year = 2020;
5,187
healthcare
Show cultural competency training records for community health workers
CREATE TABLE CulturalCompetencyTraining (TrainingID INT PRIMARY KEY, MHW_ID INT, TrainingName TEXT, TrainingDate DATE); INSERT INTO CulturalCompetencyTraining (TrainingID, MHW_ID, TrainingName, TrainingDate) VALUES (1, 123, 'Cultural Competency 101', '2021-06-15');
SELECT CulturalCompetencyTraining.TrainingID, CulturalCompetencyTraining.MHW_ID, CulturalCompetencyTraining.TrainingName, CulturalCompetencyTraining.TrainingDate, CommunityHealthWorker.Name FROM CulturalCompetencyTraining INNER JOIN CommunityHealthWorker ON CulturalCompetencyTraining.MHW_ID = CommunityHealthWorker.Work...
5,188
defense industry
Calculate the percentage of defense contracts awarded to companies in California
CREATE TABLE contract_states (company_name TEXT, contract_id INT, state TEXT); INSERT INTO contract_states (company_name, contract_id, state) VALUES ('Lockheed Martin', 1, 'California'), ('Boeing', 2, 'Washington'), ('Raytheon', 3, 'Massachusetts'), ('Northrop Grumman', 4, 'California'), ('General Dynamics', 5, 'Florid...
SELECT state, (COUNT(*)::FLOAT / (SELECT COUNT(*) FROM contract_states)) * 100 AS percentage FROM contract_states GROUP BY state;
5,189
transportation
Find the average speed of electric vehicles in New York and London?
CREATE TABLE vehicle_speed (id INT, type VARCHAR(20), city VARCHAR(20), speed INT); INSERT INTO vehicle_speed (id, type, city, speed) VALUES (1, 'electric', 'New York', 50), (2, 'electric', 'London', 60), (3, 'gasoline', 'New York', 40);
SELECT AVG(speed) FROM vehicle_speed WHERE type = 'electric' AND city IN ('New York', 'London');
5,190
fine arts
What are the top 10 artists with the highest number of artworks?
CREATE TABLE Artists (id INT, name TEXT); CREATE TABLE Artworks (id INT, artist_id INT, name TEXT);
SELECT a.name, COUNT(*) as artworks_count FROM Artists a JOIN Artworks aw ON a.id = aw.artist_id GROUP BY a.name ORDER BY artworks_count DESC LIMIT 10;
5,191
water resources
What is the total water consumption by industrial customers in Texas and Oklahoma?
CREATE TABLE industrial_customers (customer_id INT, location VARCHAR(255), water_consumption FLOAT); INSERT INTO industrial_customers (customer_id, location, water_consumption) VALUES (1, 'Dallas', 2000), (2, 'Houston', 2500), (3, 'Tulsa', 1800), (4, 'Oklahoma_City', 2200);
SELECT SUM(water_consumption) FROM industrial_customers WHERE location IN ('Texas', 'Oklahoma');
5,192
disability services
List the programs and their budgets for mobility accommodations.
CREATE TABLE Programs (Program VARCHAR(20), Budget INT, Type VARCHAR(20)); INSERT INTO Programs (Program, Budget, Type) VALUES ('Wheelchair Ramp', 30000, 'Mobility'); INSERT INTO Programs (Program, Budget, Type) VALUES ('Prosthetic Services', 40000, 'Mobility');
SELECT Program, Budget FROM Programs WHERE Type = 'Mobility';
5,193
space exploration
List the space missions that have had astronauts from both the US and Canada.
CREATE TABLE SpaceMissions (mission_name VARCHAR(30), astronaut_nationality VARCHAR(20)); INSERT INTO SpaceMissions (mission_name, astronaut_nationality) VALUES ('Mission1', 'US'); INSERT INTO SpaceMissions (mission_name, astronaut_nationality) VALUES ('Mission1', 'Canada');
SELECT mission_name FROM SpaceMissions WHERE astronaut_nationality IN ('US', 'Canada') GROUP BY mission_name HAVING COUNT(DISTINCT astronaut_nationality) = 2;
5,194
oceans
What is the average depth of all marine protected areas in the world?
CREATE TABLE marine_protected_areas (name VARCHAR(255), location VARCHAR(255), avg_depth FLOAT); INSERT INTO marine_protected_areas (name, location, avg_depth) VALUES ('MPA 1', 'Pacific Ocean', 123.4), ('MPA 2', 'Atlantic Ocean', 567.8);
SELECT AVG(avg_depth) FROM marine_protected_areas;
5,195
oil and gas
Calculate the total production in the Southern region by oil and gas type
CREATE TABLE production (well_id INT, type VARCHAR(10), region VARCHAR(50), quantity INT); INSERT INTO production (well_id, type, region, quantity) VALUES (1, 'Oil', 'Northern', 1000), (2, 'Gas', 'Southern', 2000), (3, 'Oil', 'Southern', 3000);
SELECT type, SUM(quantity) as total_production FROM production WHERE region = 'Southern' GROUP BY type;
5,196
energy
How many electric vehicles are there in China and Japan?
CREATE TABLE electric_vehicles (country VARCHAR(50), num_vehicles INT); INSERT INTO electric_vehicles (country, num_vehicles) VALUES ('China', 1140000), ('Japan', 850000);
SELECT SUM(num_vehicles) FROM electric_vehicles WHERE country IN ('China', 'Japan');
End of preview. Expand in Data Studio

Synthetic Text-to-SQL — Tangle SFT demo subset

A small, fixed subset of gretelai/synthetic_text_to_sql (Apache-2.0), prepared for an end-to-end supervised fine-tuning showcase running as a Tangle pipeline.

  • train.jsonl — first 5,000 rows of the source train split.
  • eval.jsonl — first 500 rows of the source test split.
  • train.tiny.jsonl / eval.tiny.jsonl — 16 / 8 rows, for a fast CPU wiring dry-run.

Each row keeps five fields from the source: id, domain, sql_prompt (the natural-language question), sql_context (the CREATE TABLE + INSERT DDL the query runs against), and sql (the gold query). The task: given sql_prompt + sql_context, generate sql.

All credit to Gretel.ai for the original dataset. This is an unmodified verbatim subset (column projection only), redistributed under the same Apache-2.0 license.

Downloads last month
47