context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE iss_spacecraft (spacecraft_name VARCHAR(255), max_astronauts INT); INSERT INTO iss_spacecraft (spacecraft_name, max_astronauts) VALUES ('Space Shuttle', 8); INSERT INTO iss_spacecraft (spacecraft_name, max_astronauts) VALUES ('Soyuz', 3); | What is the maximum number of astronauts carried by each spacecraft to the International Space Station? | SELECT spacecraft_name, MAX(max_astronauts) FROM iss_spacecraft; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_bikes (bike_id INT, city VARCHAR(20), is_electric BOOLEAN); INSERT INTO shared_bikes (bike_id, city, is_electric) VALUES (1, 'New York', true), (2, 'Chicago', true), (3, 'Los Angeles', false); | Delete all records of traditional shared bikes in Los Angeles from the shared_bikes table. | DELETE FROM shared_bikes WHERE city = 'Los Angeles' AND is_electric = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, name VARCHAR(50), ethnicity VARCHAR(20)); INSERT INTO community_health_workers (worker_id, name, ethnicity) VALUES (1, 'Ana Garcia', 'Hispanic'), (2, 'Juan Hernandez', 'Hispanic'), (3, 'Mark Johnson', 'Non-Hispanic'); | Who are the community health workers serving the Hispanic population? | SELECT * FROM community_health_workers WHERE ethnicity = 'Hispanic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name text, location text); INSERT INTO marine_protected_areas (name, location) VALUES ('Galapagos Islands', 'Pacific Ocean'), ('Great Barrier Reef', 'Atlantic Ocean'); | How many marine protected areas are there in the Atlantic Ocean? | SELECT COUNT(*) FROM marine_protected_areas WHERE location = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_amount DECIMAL, donation_date DATE); INSERT INTO donations (id, donation_amount, donation_date) VALUES (1, 100.00, '2022-01-01'), (2, 200.00, '2022-05-05'); | What is the total donation amount by week for the last year? | SELECT DATE_FORMAT(donation_date, '%Y-%u') as donation_week, SUM(donation_amount) as total_donations FROM donations WHERE donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY donation_week ORDER BY donation_week; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, artist TEXT, category TEXT); INSERT INTO artworks (id, artist, category) VALUES (1, 'Van Gogh', 'Painting'), (2, 'Van Gogh', 'Drawing'), (3, 'Monet', 'Painting'), (4, 'Monet', 'Painting'); | Update the category of artwork with ID 3 to 'Drawing' | UPDATE artworks SET category = 'Drawing' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments(id INT, mode VARCHAR(50), source VARCHAR(50), destination VARCHAR(50), delivery_time DATE); INSERT INTO Shipments(id, mode, source, destination, delivery_time) VALUES (1, 'air', 'China', 'United Kingdom', '2022-02-01'); | List the names and delivery times of all shipments that were sent by air from China to the United Kingdom. | SELECT Shipments.mode, Shipments.source, Shipments.destination, Shipments.delivery_time FROM Shipments WHERE Shipments.mode = 'air' AND Shipments.source = 'China' AND Shipments.destination = 'United Kingdom'; | gretelai_synthetic_text_to_sql |
CREATE TABLE author (author_id INT, author_name VARCHAR(50), gender VARCHAR(10)); INSERT INTO author (author_id, author_name, gender) VALUES (1, 'Alice Johnson', 'Female'), (2, 'Bob Smith', 'Male'), (3, 'Carla Garcia', 'Female'); CREATE TABLE book (book_id INT, author_id INT, book_name VARCHAR(50)); INSERT INTO book (b... | Who are the top 5 most prolific female authors? | SELECT author_name, COUNT(*) as num_books FROM book JOIN author ON book.author_id = author.author_id WHERE gender = 'Female' GROUP BY author_name ORDER BY num_books DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, attorney_id INT, category VARCHAR(50), billing_amount INT); INSERT INTO cases (case_id, attorney_id, category, billing_amount) VALUES (1, 1, 'Personal Injury', 5000), (2, 2, 'Civil Litigation', 7000), (3, 3, 'Personal Injury', 6000), (4, 3, 'Civil Litigation', 8000); | How many cases were handled by attorney 'Carlos García'? | SELECT SUM(billing_amount) FROM cases WHERE attorney_id = (SELECT attorney_id FROM attorneys WHERE name = 'Carlos García'); | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_foods (id INT, food VARCHAR(50), country VARCHAR(50)); | Insert new records into the traditional_foods table with the following data: (1, 'Potato', 'Peru'), (2, 'Ramen', 'Japan'), (3, 'Tacos', 'Mexico'). | INSERT INTO traditional_foods (id, food, country) VALUES (1, 'Potato', 'Peru'), (2, 'Ramen', 'Japan'), (3, 'Tacos', 'Mexico'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Renewable_Energy_Projects (id INT, project_name VARCHAR(50), country VARCHAR(50)); INSERT INTO Renewable_Energy_Projects (id, project_name, country) VALUES (1, 'Solar Plant', 'USA'), (2, 'Wind Farm', 'Canada'), (3, 'Hydroelectric Dam', 'Mexico'); | Update the name of renewable energy projects with 'Plant' in the name to 'Renewable Energy Plant'. | UPDATE Renewable_Energy_Projects SET project_name = 'Renewable Energy Plant' WHERE project_name LIKE '%Plant%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hospitals (HospitalID INT, HospitalName VARCHAR(50), State VARCHAR(20), NumberOfBeds INT); INSERT INTO Hospitals (HospitalID, HospitalName, State, NumberOfBeds) VALUES (1, 'Rural General Hospital', 'California', 75); INSERT INTO Hospitals (HospitalID, HospitalName, State, NumberOfBeds) VALUES (2, 'Mountain... | Find the top 3 states with the highest number of hospitals. | SELECT State, COUNT(*) AS NumberOfHospitals FROM Hospitals GROUP BY State ORDER BY NumberOfHospitals DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE certifications (id INT, accommodation_id INT, continent TEXT); INSERT INTO certifications (id, accommodation_id, continent) VALUES (1, 1, 'Americas'), (2, 2, 'Europe'); CREATE TABLE accommodations (id INT, name TEXT, continent TEXT); INSERT INTO accommodations (id, name, continent) VALUES (1, 'Eco Lodge', ... | What is the total number of certified eco-friendly accommodations in each continent? | SELECT c.continent, COUNT(*) FROM certifications c JOIN accommodations a ON c.accommodation_id = a.id GROUP BY c.continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (SiteID INT, SiteName VARCHAR(100), Location VARCHAR(100), Visits INT); | Insert a new record for the heritage site 'Taj Mahal' into the HeritageSites table. | INSERT INTO HeritageSites (SiteID, SiteName, Location, Visits) VALUES (2, 'Taj Mahal', 'India', 8000000); | gretelai_synthetic_text_to_sql |
CREATE TABLE DentalCare (patientID INT, age INT, state VARCHAR(20)); INSERT INTO DentalCare (patientID, age, state) VALUES (1, 45, 'Alabama'), (2, 32, 'Alabama'), (3, 50, 'Alabama'); | What is the average age of patients who received dental care in 2021 in the state of Alabama? | SELECT AVG(age) FROM DentalCare WHERE state = 'Alabama' AND YEAR(datetime) = 2021 AND type_of_care = 'dental'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessel (vessel_id INT, name VARCHAR(255), type VARCHAR(255), max_speed DECIMAL(5,2)); CREATE TABLE Inspection (inspection_id INT, vessel_id INT, inspection_time TIMESTAMP); INSERT INTO Vessel (vessel_id, name, type, max_speed) VALUES (1, 'Test Vessel 1', 'Cargo', 20.5), (2, 'Test Vessel 2', 'Tanker', 15.2)... | How many vessels have a type of 'Cargo' and have been inspected in the last month? | SELECT COUNT(*) FROM Vessel v INNER JOIN Inspection i ON v.vessel_id = i.vessel_id WHERE v.type = 'Cargo' AND i.inspection_time >= NOW() - INTERVAL '1 month'; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_loans (loan_id INT, customer_name TEXT, customer_zip INT, account_balance DECIMAL); CREATE TABLE socially_responsible_lending (lending_id INT, loan_id INT); | List the names, ZIP codes, and average account balances for customers who have a socially responsible loan? | SELECT srl.customer_name, srl.customer_zip, AVG(srl.account_balance) FROM socially_responsible_loans srl JOIN socially_responsible_lending srlg ON srl.loan_id = srlg.loan_id GROUP BY srl.customer_name, srl.customer_zip; | gretelai_synthetic_text_to_sql |
CREATE TABLE Startups (id INT, name VARCHAR(100), exit_event BOOLEAN); CREATE TABLE Founders (id INT, startup_id INT, race VARCHAR(50)); INSERT INTO Startups (id, name, exit_event) VALUES (1, 'Heal', FALSE), (2, 'VirtuSense', TRUE), (3, 'Clinico', FALSE); INSERT INTO Founders (id, startup_id, race) VALUES (1, 1, 'Afric... | List the names of startups that have not yet had an exit event and were founded by underrepresented racial/ethnic groups. | SELECT s.name FROM Startups s JOIN Founders f ON s.id = f.startup_id WHERE s.exit_event = FALSE AND f.race IN ('African American', 'Hispanic', 'Native American', 'Pacific Islander', 'South Asian', 'Other'); | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS carbon_footprint (id INT PRIMARY KEY, name TEXT, region TEXT, carbon_footprint FLOAT); INSERT INTO carbon_footprint (id, name, region, carbon_footprint) VALUES (1, 'EcoResort', 'Asia', 12.5), (2, 'GreenParadise', 'Asia', 11.3), (3, 'SustainableCity', 'Europe', 10.9); | Find the destination with the lowest carbon footprint in Asia. | SELECT name FROM carbon_footprint WHERE region = 'Asia' ORDER BY carbon_footprint ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, client_name VARCHAR(100), country VARCHAR(50)); INSERT INTO clients (client_id, client_name, country) VALUES (1, 'John Doe', 'Spain'); INSERT INTO clients (client_id, client_name, country) VALUES (2, 'Jane Doe', 'France'); CREATE TABLE transactions (transaction_id INT, client_id INT... | What is the total amount of transactions per client for clients from Spain? | SELECT c.client_name, SUM(t.amount) FROM clients c JOIN transactions t ON c.client_id = t.client_id WHERE c.country = 'Spain' GROUP BY c.client_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (projectID INT, projectType VARCHAR(50), totalCost DECIMAL(10,2), sqft DECIMAL(10,2));CREATE TABLE BuildingPermits (permitID INT, projectID INT, permitDate DATE);CREATE TABLE GreenBuildings (projectID INT, sustainableMaterial VARCHAR(50), sustainableMaterialCost DECIMAL(10,2)); | What is the total construction cost and the number of permits issued for each project type per month in the 'Projects', 'BuildingPermits', and 'GreenBuildings' tables? | SELECT P.projectType, DATE_FORMAT(permitDate, '%Y-%m') AS Month, SUM(P.totalCost)/SUM(P.sqft) AS CostPerSqft, COUNT(B.permitID) AS PermitsIssued FROM Projects P INNER JOIN BuildingPermits B ON P.projectID = B.projectID LEFT JOIN GreenBuildings GB ON P.projectID = GB.projectID GROUP BY P.projectType, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (id INT, date DATE, meals INT); | What is the total number of meals served in the last month, broken down by day of the week? | SELECT DATE_FORMAT(date, '%W') as day_of_week, SUM(meals) as total_meals FROM orders WHERE date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE GROUP BY day_of_week; | gretelai_synthetic_text_to_sql |
CREATE TABLE activities (id INT, volunteer_id INT, activity_date DATE); INSERT INTO activities (id, volunteer_id, activity_date) VALUES (1, 1, '2020-01-01'), (2, 1, '2019-12-31'), (3, 2, '2021-06-01'), (4, 2, '2020-12-31'); | Delete all records from the 'activities' table that are over 2 years old. | DELETE FROM activities WHERE activity_date < (CURRENT_DATE - INTERVAL '2 years'); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, is_recycled BOOLEAN, price DECIMAL(5,2)); INSERT INTO products (product_id, is_recycled, price) VALUES (1, true, 75.99), (2, false, 60.00), (3, true, 85.00); | What is the maximum price of a product made with recycled materials? | SELECT MAX(price) FROM products WHERE is_recycled = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE restorative_justice_participants (id INT, age INT, gender TEXT, program_date DATE); | How many individuals have participated in restorative justice programs in the past year, grouped by their age and gender? | SELECT age, gender, COUNT(*) FROM restorative_justice_participants WHERE program_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY age, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_codes (country TEXT, code TEXT); INSERT INTO country_codes (country, code) VALUES ('Norway', 'NO'), ('Canada', 'CA'); CREATE TABLE fish_harvest (id INT, name TEXT, type TEXT, location TEXT, harvest_quantity INT, country TEXT); INSERT INTO fish_harvest (id, name, type, location, harvest_quantity, co... | How many fish were harvested from marine fish farms in each country in the last month? | SELECT country, COUNT(*) FROM fish_harvest JOIN country_codes ON fish_harvest.country = country_codes.code GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (id INT, location TEXT, attendees INT, tour_date DATE); INSERT INTO virtual_tours (id, location, attendees, tour_date) VALUES (1, 'Tokyo', 25, '2022-01-01'), (2, 'Seoul', 30, '2022-02-10'); | Find the maximum number of attendees in virtual tours across Asian countries, in the last 6 months. | SELECT MAX(attendees) FROM virtual_tours WHERE location LIKE '%Asia%' AND tour_date >= DATE_SUB(NOW(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (year INT, location VARCHAR(50), temperature FLOAT); | What is the average temperature change in the Arctic per year since 1990? | SELECT AVG(temperature_change) FROM (SELECT (temperature - LAG(temperature) OVER (ORDER BY year)) AS temperature_change FROM weather_data WHERE year >= 1990) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Name VARCHAR(20), Country VARCHAR(20), VRPlatform VARCHAR(10)); INSERT INTO Players (PlayerID, Name, Country, VRPlatform) VALUES (1, 'Hiroshi', 'Japan', 'PlayStation VR'); | Update the names of players who are from 'Japan' and use PlayStation VR to 'PSVR Japanese Players'. | UPDATE Players SET Name = 'PSVR Japanese Players' WHERE Country = 'Japan' AND VRPlatform = 'PlayStation VR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Bridges (BridgeID INT, Name TEXT, Length FLOAT, Region TEXT, Country TEXT); INSERT INTO Bridges (BridgeID, Name, Length, Region, Country) VALUES (1, 'Bridge1', 500.5, 'Andalusia', 'Spain'); INSERT INTO Bridges (BridgeID, Name, Length, Region, Country) VALUES (2, 'Bridge2', 600.6, 'Andalusia', 'Spain'); INS... | How many bridges are there in the region of Andalusia, Spain? | SELECT COUNT(*) FROM Bridges WHERE Region = 'Andalusia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conditions (id INT, name VARCHAR(255)); INSERT INTO conditions (id, name) VALUES (1, 'Anxiety'), (2, 'Depression'), (3, 'Bipolar Disorder'); CREATE TABLE treatments (id INT, community_center_id INT, patient_id INT, condition_id INT, type VARCHAR(255)); INSERT INTO treatments (id, community_center_id, patie... | List the conditions treated in Community Center A that required medication for more than 30% of the patients. | SELECT c.name, AVG(t.type = 'medication') as medication_percentage FROM treatments t JOIN conditions c ON t.condition_id = c.id WHERE t.community_center_id = 1 GROUP BY c.name HAVING AVG(t.type = 'medication') > 0.3; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_practices (practice_id INT, building_type VARCHAR(20), state VARCHAR(20), description TEXT); INSERT INTO sustainable_practices (practice_id, building_type, state, description) VALUES (1, 'Residential', 'WA', 'Use of recycled materials'); | List all sustainable building practices in the state of Washington | SELECT * FROM sustainable_practices WHERE state = 'WA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customer_Freight_Costs (id INT, freight_date DATETIME, freight_country VARCHAR(50), customer_id INT, freight_cost DECIMAL(10, 2)); INSERT INTO Customer_Freight_Costs (id, freight_date, freight_country, customer_id, freight_cost) VALUES (1, '2022-01-01', 'South Africa', 1, 500.00), (2, '2022-01-02', 'Egypt'... | Identify the top 3 customers with the highest total freight costs in Africa. | SELECT customer_id, SUM(freight_cost) AS total_cost FROM Customer_Freight_Costs WHERE freight_country IN ('South Africa', 'Egypt', 'Nigeria', 'Algeria', 'Morocco') GROUP BY customer_id ORDER BY total_cost DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels(Id INT, Name VARCHAR(255), AverageSpeed DECIMAL(5,2)); INSERT INTO Vessels VALUES (1, 'VesselA', 15.5), (2, 'VesselB', 18.3), (3, 'OceanWanderer', 20.2); | What is the maximum speed in knots for the vessel 'OceanWanderer'? | SELECT MAX(v.AverageSpeed) FROM Vessels v WHERE v.Name = 'OceanWanderer'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ingredients (ingredient_id INT, ingredient_name TEXT, dish_id INT, cost FLOAT); INSERT INTO Ingredients (ingredient_id, ingredient_name, dish_id, cost) VALUES (1, 'Veggie Patty', 2, 2.5); | What is the total cost of ingredients for the 'Veggie Burger' for the month of April 2022? | SELECT SUM(cost) FROM Ingredients WHERE dish_id IN (SELECT dish_id FROM Dishes WHERE dish_name = 'Veggie Burger') AND ingredient_name NOT IN ('Lettuce', 'Tomato', 'Bun'); | gretelai_synthetic_text_to_sql |
CREATE TABLE disasters (id INT, type TEXT, location TEXT, year INT); INSERT INTO disasters (id, type, location, year) VALUES (1, 'Flood', 'South America', 2020), (2, 'Earthquake', 'Asia', 2019), (3, 'Tornado', 'North America', 2020), (4, 'Disaster Response', 'Middle East', 2018), (5, 'Disaster Response', 'Middle East',... | What is the average number of disaster response incidents in the Middle East? | SELECT AVG(total_disasters) FROM (SELECT location, COUNT(*) AS total_disasters FROM disasters WHERE type = 'Disaster Response' AND location = 'Middle East' GROUP BY location, year) AS disaster_counts GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Retro_Racers (player_id INT, player_name VARCHAR(50), score INT, join_date DATE); INSERT INTO Retro_Racers (player_id, player_name, score, join_date) VALUES (1, 'Anna Nguyen', 100, '2020-05-05'), (2, 'Ben Park', 120, '2021-01-01'), (3, 'Clara Lee', 90, '2019-12-31'); | What is the sum of the scores for players who joined before 2021 in the game 'Retro Racers'? | SELECT SUM(score) FROM Retro_Racers WHERE join_date < '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings(id INT, building_name VARCHAR(50), building_type VARCHAR(50));CREATE TABLE energy_efficiency(building_id INT, rating INT); | Show the average energy efficiency rating for each building type in the buildings and energy_efficiency tables. | SELECT b.building_type, AVG(e.rating) AS avg_rating FROM buildings b INNER JOIN energy_efficiency e ON b.id = e.building_id GROUP BY b.building_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarters (id INT, name VARCHAR(255)); INSERT INTO quarters (id, name) VALUES (1, 'Q1'), (2, 'Q2'), (3, 'Q3'), (4, 'Q4'); CREATE TABLE regions (id INT, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'Northeast'), (2, 'Southeast'), (3, 'Midwest'), (4, 'West'); CREATE TABLE games (id INT, regio... | How many fans attended basketball games in the Southeast in Q1 2022? | SELECT SUM(g.attendees) as total_attendees FROM games g JOIN regions r ON g.region_id = r.id JOIN quarters q ON g.quarter_id = q.id WHERE g.sport_id = 1 AND r.name = 'Southeast' AND q.name = 'Q1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, organization TEXT, region TEXT, incident_date DATE, response_time INT); INSERT INTO security_incidents (id, organization, region, incident_date, response_time) VALUES (1, 'Non-profit A', 'Asia', '2022-06-20', 150); INSERT INTO security_incidents (id, organization, region, incide... | What is the average response time to security incidents for non-profit organizations in Q2 2022, grouped by region? | SELECT region, AVG(response_time) FROM security_incidents WHERE organization LIKE '%Non-profit%' AND incident_date >= '2022-04-01' AND incident_date < '2022-07-01' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_expeditions (year INT, region VARCHAR(255), number_of_expeditions INT);INSERT INTO deep_sea_expeditions (year, region, number_of_expeditions) VALUES (2015, 'Mediterranean Sea', 3), (2016, 'Mediterranean Sea', 4), (2017, 'Mediterranean Sea', 5), (2018, 'Mediterranean Sea', 6), (2019, 'Mediterranean... | How many deep-sea expeditions were conducted in the Mediterranean Sea between 2015 and 2020? | SELECT number_of_expeditions FROM deep_sea_expeditions WHERE region = 'Mediterranean Sea' AND year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stores (StoreID INT, StoreName VARCHAR(50));CREATE TABLE Menu (MenuID INT, MenuItem VARCHAR(50), Price DECIMAL(5,2));CREATE TABLE Sales (SaleID INT, StoreID INT, MenuID INT, QuantitySold INT, SaleDate DATE); | Find the daily revenue for each store, ranked by revenue in descending order. | SELECT StoreName, SaleDate, SUM(Price * QuantitySold) AS DailyRevenue, RANK() OVER (PARTITION BY SaleDate ORDER BY SUM(Price * QuantitySold) DESC) AS RevenueRank FROM Sales JOIN Menu ON Sales.MenuID = Menu.MenuID JOIN Stores ON Sales.StoreID = Stores.StoreID GROUP BY StoreName, SaleDate ORDER BY SaleDate, RevenueRank; | gretelai_synthetic_text_to_sql |
CREATE TABLE datasets (dataset_name TEXT, year INTEGER, domain TEXT); INSERT INTO datasets (dataset_name, year, domain) VALUES ('Dataset X', 2016, 'AI Safety'), ('Dataset Y', 2017, 'Algorithmic Fairness'), ('Dataset Z', 2015, 'Explainable AI'); | List all the datasets used in AI safety research since 2015 | SELECT dataset_name FROM datasets WHERE domain = 'AI Safety' AND year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sellers (SellerID INT, SellerName TEXT, Region TEXT); INSERT INTO Sellers (SellerID, SellerName, Region) VALUES (1, 'John Doe', 'Midwest'), (2, 'Jane Smith', 'Northeast'); CREATE TABLE Sales (SaleID INT, SellerID INT, Quantity INT); INSERT INTO Sales (SaleID, SellerID, Quantity) VALUES (1, 1, 6000), (2, 1,... | What is the average quantity of fish sold by each seller in the Midwest region, only considering those sellers who have sold more than 5000 units? | SELECT SellerName, AVG(Quantity) FROM Sellers INNER JOIN Sales ON Sellers.SellerID = Sales.SellerID WHERE Sellers.Region = 'Midwest' GROUP BY SellerName HAVING SUM(Quantity) > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_lifelong_learning (student_id INT, subject VARCHAR(255), lifelong_learning_score INT); | What is the maximum lifelong learning score for each subject, grouped by student? | SELECT s.student_id, s.subject, MAX(s.lifelong_learning_score) as max_score FROM student_lifelong_learning s GROUP BY s.student_id, s.subject; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hope_Wildlife_Sanctuary (Animal_ID INT, Animal_Name VARCHAR(50), Species VARCHAR(50), Age INT); INSERT INTO Hope_Wildlife_Sanctuary VALUES (1, 'Bambi', 'Deer', 3); INSERT INTO Hope_Wildlife_Sanctuary VALUES (2, 'Fiona', 'Turtle', 10); CREATE TABLE Paws_and_Claws_Rescue (Animal_ID INT, Animal_Name VARCHAR(5... | What is the total number of animals in 'Hope Wildlife Sanctuary' and 'Paws and Claws Rescue'? | SELECT SUM(Number_of_Animals) FROM (SELECT COUNT(*) AS Number_of_Animals FROM Hope_Wildlife_Sanctuary UNION ALL SELECT COUNT(*) AS Number_of_Animals FROM Paws_and_Claws_Rescue) AS Total_Animals | gretelai_synthetic_text_to_sql |
CREATE SCHEMA CityData; CREATE TABLE CityBudget (Service varchar(255), Year int, Budget int); INSERT INTO CityBudget (Service, Year, Budget) VALUES ('Education', 2023, 500000), ('Healthcare', 2023, 700000), ('Transportation', 2023, 90000), ('Transportation', 2023, 120000); | Delete the records with a budget lower than 100000 for the 'Transportation' service in the 'CityData' schema's 'CityBudget' table for the year 2023. | DELETE FROM CityData.CityBudget WHERE Service = 'Transportation' AND Year = 2023 AND Budget < 100000; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions_reduction (project_id INT, project_name VARCHAR(255), co2_reduction FLOAT, reduction_year INT, province VARCHAR(255)); | Show the annual CO2 emissions reduction achieved by renewable energy projects in the province of Ontario, Canada | SELECT reduction_year, SUM(co2_reduction) as annual_reduction FROM co2_emissions_reduction WHERE province = 'Ontario' GROUP BY reduction_year; | gretelai_synthetic_text_to_sql |
Player_Demographics | Add a new row to the 'Player_Demographics' table | INSERT INTO Player_Demographics (Player_ID, Age, Gender, Location) VALUES (6, 25, 'Female', 'Australia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Threat_Intel (metric_id INT, country TEXT, metric_value INT, metric_date DATE); INSERT INTO Threat_Intel (metric_id, country, metric_value, metric_date) VALUES (1, 'USA', 85, '2022-01-01'), (2, 'Russia', 75, '2022-01-01'); | Which countries have the highest threat intelligence metrics in the last 6 months? | SELECT country, AVG(metric_value) as avg_metric FROM Threat_Intel WHERE metric_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY country ORDER BY avg_metric DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation_trips_seoul (trip_id INT, transportation_id INT, city VARCHAR(50), date DATE); | What is the total number of trips taken on public transportation in Seoul, South Korea? | CREATE TABLE public_transportation_trips_seoul (trip_id INT, transportation_id INT, city VARCHAR(50), date DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_subscribers (subscriber_id INT, technology VARCHAR(255)); INSERT INTO broadband_subscribers (subscriber_id, technology) VALUES (1, 'Fiber'), (2, 'Cable'), (3, 'DSL'), (4, 'Fiber'), (5, 'Cable'), (6, 'Satellite'); | Show the percentage of broadband subscribers by technology type, ordered from the highest to the lowest. | SELECT technology, 100.0 * COUNT(*) OVER (PARTITION BY technology) / SUM(COUNT(*)) OVER () as pct_subscribers FROM broadband_subscribers GROUP BY technology ORDER BY pct_subscribers DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_consumption (id INT, state VARCHAR(255), usage_category VARCHAR(255), consumption_cubic_meters INT, year INT); INSERT INTO water_consumption (id, state, usage_category, consumption_cubic_meters, year) VALUES (1, 'California', 'agriculture', 3000000, 2019), (2, 'California', 'municipal', 2000000, 2019... | What is the total water consumption (in cubic meters) for agriculture purposes in the state of California in 2019? | SELECT SUM(consumption_cubic_meters) FROM water_consumption WHERE state = 'California' AND usage_category = 'agriculture' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends (year INT, ree_price FLOAT); INSERT INTO market_trends (year, ree_price) VALUES (2019, 25.5), (2020, 30.2), (2021, 35.1), (2022, 40.5), (2023, 45.6), (2024, 50.4); | Identify REE market trends by year and price. | SELECT market_trends.year, market_trends.ree_price, production.total_production FROM market_trends INNER JOIN (SELECT company_id, year, SUM(ree_production) as total_production FROM production GROUP BY company_id, year) as production ON market_trends.year = production.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE advertising_stats(ad_id INT, category TEXT, ad_spend DECIMAL(10,2)); | What is the maximum ad spend for ads with the category 'clean_transportation' in the 'advertising_stats' table? | SELECT MAX(ad_spend) FROM advertising_stats WHERE category = 'clean_transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_centers_us (name TEXT, location TEXT, patients_served INT); INSERT INTO healthcare_centers_us (name, location, patients_served) VALUES ('HC A', 'Rural Alabama', 250), ('HC B', 'Rural Alaska', 150), ('HC C', 'Rural California', 225); | List the names of rural healthcare centers in the US that serve more than 200 patients. | SELECT name FROM healthcare_centers_us WHERE location LIKE 'Rural%' AND patients_served > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue(company VARCHAR(50), product VARCHAR(50), revenue DECIMAL(10,2)); | What is the total revenue generated by each company from ethical fashion products? | SELECT company, SUM(revenue) FROM revenue WHERE product IN ('ethical_fashion') GROUP BY company; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, environmental_impact_score FLOAT); INSERT INTO products (product_id, environmental_impact_score) VALUES (1, 5.2), (2, 6.1), (3, 4.9); | Which product has the highest average environmental impact score? | SELECT product_id, MAX(environmental_impact_score) OVER () AS max_score FROM products; | gretelai_synthetic_text_to_sql |
CREATE TABLE regulatory_frameworks (country TEXT, asset TEXT, status TEXT); INSERT INTO regulatory_frameworks (country, asset, status) VALUES ('Japan', 'Ripple', 'Under Review'); | What is the regulatory status of Ripple in Japan? | SELECT status FROM regulatory_frameworks WHERE country = 'Japan' AND asset = 'Ripple'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (id INT, region VARCHAR(255), event VARCHAR(255)); | How many defense diplomacy events were conducted in each region? | SELECT region, COUNT(event) FROM defense_diplomacy GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, company_name TEXT, certification TEXT, region TEXT); INSERT INTO green_buildings (id, company_name, certification, region) VALUES (1, 'EcoBuild Pte Ltd', 'LEED', 'Asia-Pacific'), (2, 'GreenTech India', 'IGBC', 'Asia-Pacific'); | What are the green building certifications held by companies based in the Asia-Pacific region? | SELECT DISTINCT certification FROM green_buildings WHERE region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (id INT, project_id INT, country VARCHAR(50), project VARCHAR(50), budget DECIMAL(10,2), start_date DATE, end_date DATE); INSERT INTO infrastructure_projects (id, project_id, country, project, budget, start_date, end_date) VALUES (1, 8001, 'Bangladesh', 'Electric Grid Expansion', 60... | Insert a new rural infrastructure project in Bangladesh that started on 2022-01-15 with a budget of 60000.00 USD. | INSERT INTO infrastructure_projects (project_id, country, project, budget, start_date, end_date) VALUES (8002, 'Bangladesh', 'Solar Powered Irrigation', 70000.00, '2022-07-01', '2024-06-30'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerName TEXT, Country TEXT, CoinsEarned INT); INSERT INTO Players (PlayerID, PlayerName, Country, CoinsEarned) VALUES (1, 'John Doe', 'USA', 500), (2, 'Jane Smith', 'Canada', 600); | What is the average coins earned per game by players from the United States? | SELECT AVG(CoinsEarned) FROM Players WHERE Country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (id INT, start_date DATE, labor_cost FLOAT); INSERT INTO Projects (id, start_date, labor_cost) VALUES (1, '2020-01-05', 12000.0), (2, '2019-12-30', 15000.0), (3, '2021-02-01', 13000.0); | What is the total cost of labor for projects that started after January 1, 2020? | SELECT SUM(labor_cost) FROM Projects WHERE start_date > '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations_4 (id INT, name TEXT, region TEXT, cost FLOAT); INSERT INTO accommodations_4 (id, name, region, cost) VALUES (1, 'Wheelchair Ramp', 'Asia', 120000.00), (2, 'Sign Language Interpreter', 'Asia', 60000.00); | Delete records of accommodations that cost more than $80000 in the Asian region. | DELETE FROM accommodations_4 WHERE cost > 80000 AND region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, severity FLOAT, region VARCHAR(50)); INSERT INTO vulnerabilities (id, severity, region) VALUES (1, 7.5, 'North America'); | What is the total severity of vulnerabilities found in the North American region? | SELECT SUM(severity) FROM vulnerabilities WHERE region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE grad_students (id INT, name TEXT, gpa DECIMAL(3,2), research_grant_received DATE); INSERT INTO grad_students (id, name, gpa, research_grant_received) VALUES (1, 'Kai', 3.9, NULL); INSERT INTO grad_students (id, name, gpa, research_grant_received) VALUES (2, 'Lena', 3.7, '2020-08-01'); | What is the maximum GPA of graduate students who have not received a research grant in the last year? | SELECT MAX(gpa) FROM grad_students WHERE research_grant_received IS NULL OR research_grant_received < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (id INT PRIMARY KEY, location VARCHAR(255), capacity INT, date DATE); | Update the capacity of 'Ontario' to 500000 in landfill_capacity table | UPDATE landfill_capacity SET capacity = 500000 WHERE location = 'Ontario'; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (region VARCHAR(50), year INT, capacity_m3 FLOAT); INSERT INTO landfill_capacity (region, year, capacity_m3) VALUES ('Africa', 2020, 5000000), ('Africa', 2021, 6000000); | Update the landfill capacity of 'Africa' in 2021 to 7000000 m3 | UPDATE landfill_capacity SET capacity_m3 = 7000000 WHERE region = 'Africa' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Continent TEXT); INSERT INTO Donors (DonorID, DonorName, Continent) VALUES (1, 'John Doe', 'North America'), (2, 'Jane Smith', 'Africa'); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount INT); INSERT INTO Donations (DonationID, DonorID, DonationAmount... | What is the maximum donation amount made by a donor from Africa? | SELECT MAX(DonationAmount) FROM Donations JOIN Donors ON Donations.DonorID = Donors.DonorID WHERE Donors.Continent = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales(equipment_id INT, manufacturer VARCHAR(255), purchaser VARCHAR(255), sale_date DATE, quantity INT);INSERT INTO Military_Equipment_Sales(equipment_id, manufacturer, purchaser, sale_date, quantity) VALUES (1, 'Raytheon', 'Germany', '2019-04-01', 20), (2, 'Raytheon', 'France', '2019-0... | What is the maximum quantity of military equipment sold in a single transaction by Raytheon to European countries in Q2 2019? | SELECT MAX(quantity) FROM Military_Equipment_Sales WHERE manufacturer = 'Raytheon' AND purchaser LIKE 'Europe%' AND sale_date BETWEEN '2019-04-01' AND '2019-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Species (id INT, name VARCHAR(50), population INT, region VARCHAR(50)); INSERT INTO Species (id, name, population, region) VALUES (1, 'Polar Bear', 25000, 'Arctic'); INSERT INTO Species (id, name, population, region) VALUES (2, 'Arctic Fox', 5000, 'Arctic'); | What is the maximum population for each species in the Arctic region? | SELECT region, MAX(population) FROM Species WHERE region = 'Arctic' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (id INT, region VARCHAR(255), crop_type VARCHAR(255), area INT); | List the total area (in hectares) of each crop type under cultivation by farmers in the 'Southern' region for the year 2022. | SELECT region, crop_type, SUM(area / 10000.0) FROM Farmers WHERE region = 'Southern' AND YEAR(timestamp) = 2022 GROUP BY region, crop_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE oceans (name TEXT, depth FLOAT, surface_area FLOAT); INSERT INTO oceans (name, depth, surface_area) VALUES ('Pacific Ocean', 4000, 165200000); INSERT INTO oceans (name, depth, surface_area) VALUES ('Atlantic Ocean', 3500, 82300000); INSERT INTO oceans (name, depth, surface_area) VALUES ('Indian Ocean', 350... | What is the surface area of the Pacific Ocean? | SELECT surface_area FROM oceans WHERE name = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tours (tour_id INT, name VARCHAR(255), country VARCHAR(255), booked_date DATE, cultural_heritage BOOLEAN); INSERT INTO tours (tour_id, name, country, booked_date, cultural_heritage) VALUES (1, 'Roman Colosseum Tour', 'Italy', '2022-04-15', true), (2, 'Venice Canals Tour', 'Italy', '2022-05-20', false), (3,... | What is the total number of cultural heritage tours booked in Italy in Q2 2022? | SELECT COUNT(*) FROM tours WHERE country = 'Italy' AND YEAR(booked_date) = 2022 AND QUARTER(booked_date) = 2 AND cultural_heritage = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, organization_name TEXT, sector TEXT, country TEXT, grant_amount DECIMAL(10,2)); INSERT INTO community_development (id, organization_name, sector, country, grant_amount) VALUES (1, 'Youth Empowerment Fund', 'Community Development', 'South Africa', 30000.00), (2, 'Rural Women D... | What is the total grant money received by organizations in the community development sector in South Africa? | SELECT SUM(grant_amount) FROM community_development WHERE country = 'South Africa' AND sector = 'Community Development'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(10), SexualOrientation VARCHAR(20)); INSERT INTO Employees (EmployeeID, Gender, SexualOrientation) VALUES (1, 'Female', 'Heterosexual'), (2, 'Male', 'Gay'), (3, 'Non-binary', 'Queer'), (4, 'Male', 'Bisexual'), (5, 'Female', 'Heterosexual'); | What is the percentage of employees who identify as LGBTQ+ in the company? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Employees WHERE SexualOrientation IS NOT NULL)) FROM Employees WHERE SexualOrientation LIKE '%LGBTQ%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContinentVisitors (id INT, continent VARCHAR(50), year INT, visitors INT); INSERT INTO ContinentVisitors (id, continent, year, visitors) VALUES (1, 'Africa', 2018, 45000000); INSERT INTO ContinentVisitors (id, continent, year, visitors) VALUES (2, 'Africa', 2019, 47000000); INSERT INTO ContinentVisitors (i... | What is the average number of visitors for each continent in 2019? | SELECT continent, AVG(visitors) as avg_visitors FROM ContinentVisitors WHERE year = 2019 GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_personnel (id INT, name VARCHAR(50), gender VARCHAR(50), branch VARCHAR(50), rank VARCHAR(50), experience INT); INSERT INTO military_personnel (id, name, gender, branch, rank, experience) VALUES (1, 'John Doe', 'Male', 'army', 'Captain', 10); INSERT INTO military_personnel (id, name, gender, branc... | What is the highest rank held by a female military personnel in the 'army' branch? | SELECT MAX(rank) FROM military_personnel WHERE gender = 'Female' AND branch = 'army'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure (id INT, name VARCHAR(100), type VARCHAR(50), location VARCHAR(100), state VARCHAR(50)); INSERT INTO Infrastructure (id, name, type, location, state) VALUES (7, 'Texas Central High-Speed Railway', 'Railway', 'Houston', 'Texas'); | Get the number of railways in Texas | SELECT COUNT(*) FROM Infrastructure WHERE type = 'Railway' AND state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, country TEXT); CREATE TABLE donations (id INT, donor_id INT, donation_amount FLOAT, organization_id INT); CREATE TABLE organizations (id INT, name TEXT, cause_area TEXT); | What is the total donation amount for each cause area, for donors from India and China, in descending order? | SELECT o.cause_area, SUM(donations.donation_amount) as total_donations FROM donations INNER JOIN organizations o ON donations.organization_id = o.id INNER JOIN donors d ON donations.donor_id = d.id WHERE d.country IN ('India', 'China') GROUP BY o.cause_area ORDER BY total_donations DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE CitizenFeedback (Year INT, Topic VARCHAR(20), Feedback VARCHAR(10)); INSERT INTO CitizenFeedback (Year, Topic, Feedback) VALUES (2021, 'Public Safety', 'Positive'), (2021, 'Public Safety', 'Negative'), (2021, 'Public Safety', 'Neutral'), (2021, 'Healthcare', 'Positive'), (2021, 'Healthcare', 'Negative'); | What is the percentage of citizen feedback related to public safety in 2021? | SELECT (COUNT(CASE WHEN Topic = 'Public Safety' AND Feedback IN ('Positive', 'Negative', 'Neutral') THEN 1 END) * 100.0 / COUNT(*)) as Pct_Public_Safety_Feedback FROM CitizenFeedback WHERE Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryEquipmentSales (EquipmentID INT, Manufacturer VARCHAR(50), DestinationRegion VARCHAR(50), SaleDate DATE, Quantity INT, UnitPrice FLOAT); INSERT INTO MilitaryEquipmentSales (EquipmentID, Manufacturer, DestinationRegion, SaleDate, Quantity, UnitPrice) VALUES (1, 'Raytheon', 'Asia', '2019-01-10', 5, 2... | What was the total revenue for Raytheon's military equipment sales to Asia in Q1 2019? | SELECT SUM(Quantity * UnitPrice) FROM MilitaryEquipmentSales WHERE Manufacturer = 'Raytheon' AND DestinationRegion = 'Asia' AND SaleDate >= '2019-01-01' AND SaleDate < '2019-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, registration_date DATE, country VARCHAR(255)); INSERT INTO users (user_id, registration_date, country) VALUES (1, '2022-01-01', 'USA'), (2, '2022-01-02', 'Canada'), (3, '2022-01-03', 'Mexico'); | What is the number of users registered in each country in the current month? | SELECT u.country, COUNT(DISTINCT u.user_id) FROM users u WHERE MONTH(u.registration_date) = MONTH(GETDATE()) AND YEAR(u.registration_date) = YEAR(GETDATE()) GROUP BY u.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Underrepresented BOOLEAN); INSERT INTO Players (PlayerID, Underrepresented) VALUES (1, TRUE), (2, FALSE), (3, TRUE), (4, TRUE); | How many players are from underrepresented communities? | SELECT COUNT(*) FROM Players WHERE Underrepresented = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(100), profile_picture VARCHAR(50)); INSERT INTO users (id, name, profile_picture) VALUES (1, 'Aarav', 'old_profile_pic.jpg'), (2, 'Benita', 'profile_pic_2.png'), (3, 'Chanho', 'profile_pic_3.jpg'); | Update the profile picture of user with id 3 to 'new_profile_pic.jpg' | UPDATE users SET profile_picture = 'new_profile_pic.jpg' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE ad_campaigns (id INT, name VARCHAR(255), target_country VARCHAR(255)); INSERT INTO ad_campaigns (id, name, target_country) VALUES (1, 'AI for All', 'Brazil'), (2, 'Data Science', 'USA'); | Show all ad campaigns that target users in Brazil. | SELECT * FROM ad_campaigns WHERE target_country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, socioeconomic_status VARCHAR(50), therapy_completed BOOLEAN, medication_completed BOOLEAN, therapy_outcome INT, medication_outcome INT); | What are the patient outcomes for those who received therapy and medication, separated by socioeconomic status? | SELECT socioeconomic_status, SUM(CASE WHEN therapy_outcome > 0 THEN 1 ELSE 0 END) AS improved_therapy, SUM(CASE WHEN medication_outcome > 0 THEN 1 ELSE 0 END) AS improved_medication FROM patients WHERE therapy_completed = TRUE AND medication_completed = TRUE GROUP BY socioeconomic_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE WorkoutTypes (Id INT PRIMARY KEY, WorkoutType VARCHAR(50)); | Update the workout type "Spinning" to "Cycling" in the "WorkoutTypes" table | UPDATE WorkoutTypes SET WorkoutType = 'Cycling' WHERE WorkoutType = 'Spinning'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_models (id INT, name VARCHAR(255), type VARCHAR(255), method VARCHAR(255)); INSERT INTO safety_models (id, name, type, method) VALUES (1, 'Criticality Safety', 'Safety AI', 'Sensitivity Analysis'); | Update the safety AI model 'Criticality Safety' with a new method | UPDATE safety_models SET method = 'Consequence Analysis' WHERE name = 'Criticality Safety'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (crop_type VARCHAR(20), temperature FLOAT, record_date DATE); INSERT INTO WeatherData (crop_type, temperature, record_date) VALUES ('Corn', 22.5, '2022-01-01'); INSERT INTO WeatherData (crop_type, temperature, record_date) VALUES ('Corn', 25.3, '2022-01-02'); | What is the average temperature recorded for crop 'Corn'? | SELECT AVG(temperature) FROM WeatherData WHERE crop_type = 'Corn'; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_divide_initiatives (region VARCHAR(20), budget DECIMAL(10,2)); INSERT INTO digital_divide_initiatives (region, budget) VALUES ('Oceania', 250000.00), ('Africa', 300000.00), ('South America', 320000.00); | What is the average budget for digital divide initiatives in Oceania? | SELECT AVG(budget) as avg_budget FROM digital_divide_initiatives WHERE region = 'Oceania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE LaborAdvocacy (id INT, org_name VARCHAR, location VARCHAR, budget FLOAT); | What is the average budget for labor advocacy organizations in Michigan that have a budget? | SELECT AVG(budget) as avg_budget FROM LaborAdvocacy WHERE location = 'Michigan' AND budget IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing (manufacturing_id INT, manufacturer VARCHAR(50), CO2_emissions DECIMAL(10,2), manufacture_date DATE); | What is the total CO2 emissions for each garment manufacturer in 2021? | SELECT manufacturer, SUM(CO2_emissions) as total_emissions FROM manufacturing WHERE manufacture_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE IncidentReports (id INT, incident_name VARCHAR(50), severity VARCHAR(10), incident_type VARCHAR(50)); INSERT INTO IncidentReports (id, incident_name, severity, incident_type) VALUES (1, 'Incident1', 'High', 'Malware'), (2, 'Incident2', 'Medium', 'Phishing'), (3, 'Incident3', 'Low', 'Unpatched Software'), (... | What are the top 3 most common incident types in the 'IncidentReports' table? | SELECT incident_type, COUNT(*) as frequency FROM IncidentReports GROUP BY incident_type ORDER BY frequency DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Name TEXT, Domain TEXT, HourlyRate DECIMAL); INSERT INTO Attorneys VALUES (1, 'Singh', 'Legal Services', 300), (2, 'Lee', 'Criminal Law', 250), (3, 'Flores', 'Legal Services', 280), (4, 'Gomez', 'Intellectual Property', 350); | What is the average billing rate for attorneys in the legal services domain? | SELECT AVG(Attorneys.HourlyRate) FROM Attorneys WHERE Attorneys.Domain = 'Legal Services'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft_Manufacturing(name VARCHAR(50), mass FLOAT, country VARCHAR(50)); | identify the heaviest spacecraft manufactured by each country | SELECT country, MAX(mass) FROM Spacecraft_Manufacturing GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT PRIMARY KEY, name VARCHAR(100), age INT, state VARCHAR(2), income FLOAT); | Delete records from donors table where state is 'CA' | DELETE FROM donors WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE underwriting (id INT, group VARCHAR(10), name VARCHAR(20), claim_amount DECIMAL(10,2)); INSERT INTO underwriting (id, group, name, claim_amount) VALUES (1, 'High Risk', 'John Doe', 5000.00), (2, 'Medium Risk', 'Sophia Gonzalez', 6000.00), (3, 'Medium Risk', 'Javier Rodriguez', 7000.00), (4, 'Low Risk', 'Em... | List the top 2 policyholders with the highest claim amounts in the 'Medium Risk' underwriting group. | SELECT name, claim_amount FROM (SELECT name, claim_amount, ROW_NUMBER() OVER (PARTITION BY group ORDER BY claim_amount DESC) rn FROM underwriting WHERE group = 'Medium Risk') sub WHERE rn <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE CaseTypes (id INT, case_type VARCHAR(50), billing_amount DECIMAL(10,2)); | What is the total billing amount for cases in the "family" department? | SELECT case_type, SUM(billing_amount) FROM CaseTypes WHERE case_type = 'family' GROUP BY case_type; | 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.