context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE victim_services (id INT, case_number INT, victim_name VARCHAR(255), service_type VARCHAR(255)); INSERT INTO victim_services (id, case_number, victim_name, service_type) VALUES (1, 1234, 'John Doe', 'Counseling'); | What is the name of the victim and type of service for case number 1234? | SELECT victim_name, service_type FROM victim_services WHERE case_number = 1234; | gretelai_synthetic_text_to_sql |
CREATE TABLE US_Sales (id INT, vehicle_type TEXT, quantity INT, year INT); INSERT INTO US_Sales (id, vehicle_type, quantity, year) VALUES (1, 'Electric', 900, 2020); | What is the total number of electric vehicles sold in the US in 2020? | SELECT SUM(quantity) FROM US_Sales WHERE vehicle_type = 'Electric' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ferries (ferry_id INT, region VARCHAR(20), fare DECIMAL(5,2)); INSERT INTO Ferries (ferry_id, region, fare) VALUES (701, 'Lakeside', 5.00), (702, 'Lakeside', 7.50), (703, 'Lakeside', 10.00); | What is the maximum fare for ferries in the 'Lakeside' region? | SELECT MAX(fare) FROM Ferries WHERE region = 'Lakeside'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health (student_id INT, course_name TEXT, score INT); INSERT INTO mental_health (student_id, course_name, score) VALUES (456, 'Advanced Calculus', 80); | What is the average mental health score for students in 'Advanced Calculus'? | SELECT AVG(score) FROM mental_health WHERE course_name = 'Advanced Calculus'; | gretelai_synthetic_text_to_sql |
CREATE TABLE personnel (id INT PRIMARY KEY, name VARCHAR(50), region VARCHAR(50), role VARCHAR(50)); INSERT INTO personnel (id, name, region, role) VALUES (1, 'John Doe', 'North America', 'officer'), (2, 'Jane Smith', 'Europe', 'general'), (3, 'Alice Johnson', 'Asia', 'soldier'); | Delete records in the 'personnel' table where the 'region' is 'North America' and the 'role' is 'officer' | DELETE FROM personnel WHERE region = 'North America' AND role = 'officer'; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (program_id INT, program_name VARCHAR(50), program_type VARCHAR(50)); CREATE TABLE funding (funding_id INT, program_id INT, amount INT, funding_date DATE); INSERT INTO programs (program_id, program_name, program_type) VALUES (1, 'Art Education', 'Education'), (2, 'Symphony Orchestra', 'Music'); IN... | What is the sum of funding received by education programs in 2020? | SELECT SUM(funding.amount) FROM funding JOIN programs ON funding.program_id = programs.program_id WHERE programs.program_type = 'Education' AND YEAR(funding.funding_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name TEXT); CREATE TABLE cargo(id INT, vessel_id INT, cargo_weight INT, transport_date DATE); INSERT INTO vessels VALUES (1, 'VesselA'), (2, 'VesselB'), (3, 'VesselC'), (4, 'VesselD'); INSERT INTO cargo VALUES (1, 4, 5000, '2021-02-15'), (2, 4, 7000, '2021-03-20'); | What is the total cargo weight transported by VesselD in 2021? | SELECT SUM(cargo_weight) FROM cargo WHERE vessel_id = 4 AND YEAR(transport_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE IncidentSeverity (id INT, incident_date DATE, incident_severity VARCHAR(255)); | What is the percentage of high-severity security incidents in the last month? | SELECT (COUNT(*) FILTER (WHERE incident_severity = 'high')) * 100.0 / COUNT(*) as high_severity_percentage FROM IncidentSeverity WHERE incident_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE assists (team VARCHAR(50), season INT, assists INT); INSERT INTO assists (team, season, assists) VALUES ('Barcelona', 2021, 50), ('Barcelona', 2022, 60), ('Real Madrid', 2021, 45), ('Real Madrid', 2022, 55); | What are the total assists made by soccer teams in the current season? | SELECT team, SUM(assists) AS total_assists FROM assists WHERE season = YEAR(GETDATE()) GROUP BY team | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtGalleries (GalleryID INT, Country VARCHAR(50)); INSERT INTO ArtGalleries (GalleryID, Country) VALUES (1, 'Italy'), (2, 'France'), (3, 'Spain'), (4, 'Germany'), (5, 'USA'), (6, 'Mexico'), (7, 'Brazil'), (8, 'Australia'), (9, 'China'), (10, 'Japan'); | Generate a list of the top three countries with the most art galleries, and their respective gallery counts. | SELECT Country, COUNT(*) AS GalleryCount FROM ArtGalleries GROUP BY Country ORDER BY GalleryCount DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
create table vulnerabilities (id int, industry varchar(255), severity int); insert into vulnerabilities values (1, 'financial services', 7); insert into vulnerabilities values (2, 'financial services', 5); insert into vulnerabilities values (3, 'healthcare', 8); | What is the average severity score of vulnerabilities for the financial services industry? | SELECT AVG(severity) FROM vulnerabilities WHERE industry = 'financial services'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryFoodIntake (CountryName VARCHAR(50), Continent VARCHAR(50), Year INT, CaloriesPerPerson INT); INSERT INTO CountryFoodIntake (CountryName, Continent, Year, CaloriesPerPerson) VALUES ('United States', 'North America', 2021, 3800), ('Mexico', 'North America', 2021, 3400), ('Italy', 'Europe', 2021, 3200... | What is the average calorie intake per person for each continent in 2021? | SELECT Continent, AVG(CaloriesPerPerson) FROM CountryFoodIntake WHERE Year = 2021 GROUP BY Continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact_investments (id INT, country VARCHAR(255), amount FLOAT, strategy_id INT); INSERT INTO impact_investments (id, country, amount, strategy_id) VALUES (1, 'Colombia', 1000000, 2), (2, 'Colombia', 1500000, 3); | How many impact investments were made in Colombia? | SELECT COUNT(*) FROM impact_investments WHERE country = 'Colombia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Community_Health_Workers (ID INT, Name TEXT, Location TEXT, Experience INT); INSERT INTO Community_Health_Workers (ID, Name, Location, Experience) VALUES (1, 'John Doe', 'Urban', 5); INSERT INTO Community_Health_Workers (ID, Name, Location, Experience) VALUES (2, 'Jane Smith', 'Rural', 7); | What is the total number of community health workers in urban and rural areas, respectively? | SELECT Location, COUNT(*) FROM Community_Health_Workers GROUP BY Location; | gretelai_synthetic_text_to_sql |
CREATE TABLE doctor_visit (patient_id INT, visit_year INT, number_of_visits INT); INSERT INTO doctor_visit (patient_id, visit_year, number_of_visits) VALUES (1, 2022, 2); | What is the minimum number of doctor visits for patients with heart disease in urban Alabama? | SELECT MIN(number_of_visits) FROM doctor_visit WHERE patient_id = 1 AND visit_year = 2022 AND disease = 'Heart Disease' AND location = 'urban Alabama'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BaseballPlayers (PlayerID INT, Name VARCHAR(50), Country VARCHAR(50)); CREATE TABLE BaseballPlayerStats (PlayerID INT, GameID INT, HomeRuns INT); | What is the average number of home runs hit by players in the BaseballPlayers and BaseballPlayerStats tables, for players from countries with more than 10 players in the database? | SELECT AVG(HomeRuns) FROM BaseballPlayerStats INNER JOIN BaseballPlayers ON BaseballPlayerStats.PlayerID = BaseballPlayers.PlayerID GROUP BY Country HAVING COUNT(*) > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE MediaContent (MediaId INT, MediaType VARCHAR(50), Title VARCHAR(50), Genre VARCHAR(50), Rating DECIMAL(5,2)); INSERT INTO MediaContent (MediaId, MediaType, Title, Genre, Rating) VALUES (1, 'Movie', 'MovieA', 'Action', 8.5), (2, 'TVShow', 'ShowA', 'Drama', 7.8), (3, 'Movie', 'MovieB', 'Comedy', 9.2); | How many movies and TV shows are available for each genre, and what is the average rating? | SELECT MediaType, Genre, COUNT(*) AS ContentCount, AVG(Rating) AS Avg_Rating FROM MediaContent GROUP BY MediaType, Genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE GarmentInventory (garment_id INT, size INT, quantity INT); INSERT INTO GarmentInventory VALUES (1, 14, 200), (2, 16, 150), (3, 12, 300); | What is the total number of size 14 and size 16 garments in stock? | SELECT SUM(quantity) FROM GarmentInventory WHERE size IN (14, 16); | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, type VARCHAR(10), status VARCHAR(10)); INSERT INTO vulnerabilities (id, type, status) VALUES (1, 'Application', 'Resolved'), (2, 'Network', 'Unresolved'), (3, 'Operating System', 'Resolved'), (4, 'Database', 'Resolved'), (5, 'Application', 'Resolved'), (6, 'Network', 'Resolved'); | Calculate the percentage of resolved vulnerabilities by type | SELECT type, 100.0 * SUM(CASE WHEN status = 'Resolved' THEN 1 ELSE 0 END) / COUNT(*) as resolved_percentage FROM vulnerabilities GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE offices (office_id INT, city TEXT); CREATE TABLE attorneys (attorney_id INT, office_id INT, name TEXT); CREATE TABLE cases (case_id INT, attorney_id INT, billing_amount INT); | How many cases were handled by attorneys from the 'New York' office? | SELECT COUNT(DISTINCT cases.case_id) FROM cases INNER JOIN attorneys ON cases.attorney_id = attorneys.attorney_id INNER JOIN offices ON attorneys.office_id = offices.office_id WHERE offices.city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_project_values(project_id INT, value FLOAT, project_type VARCHAR(20), country VARCHAR(10)); | Minimum investment value for green projects in Southeast Asia | SELECT MIN(value) FROM green_project_values WHERE project_type = 'green' AND country LIKE 'Southeast%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_workers (id INT, gender VARCHAR(10), years_of_experience INT, salary DECIMAL(10,2)); INSERT INTO textile_workers (id, gender, years_of_experience, salary) VALUES (1, 'Female', 6, 45000.00), (2, 'Male', 3, 50000.00), (3, 'Female', 8, 55000.00), (4, 'Male', 2, 48000.00), (5, 'Female', 10, 60000.00); | What is the average salary of workers in the textile industry who are female and have more than 5 years of experience? | SELECT AVG(salary) FROM textile_workers WHERE gender = 'Female' AND years_of_experience > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Luxury_Sedans (id INT, name VARCHAR(255), horsepower INT, release_year INT, country VARCHAR(50)); INSERT INTO Luxury_Sedans (id, name, horsepower, release_year, country) VALUES (1, 'Lexus LS', 290, 2006, 'Japan'); INSERT INTO Luxury_Sedans (id, name, horsepower, release_year, country) VALUES (2, 'Acura RL'... | What is the average horsepower of luxury sedans released in Japan since 2000? | SELECT AVG(horsepower) FROM Luxury_Sedans WHERE country = 'Japan' AND release_year >= 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE esg_investments (id INT, country VARCHAR(255), amount FLOAT); INSERT INTO esg_investments (id, country, amount) VALUES (1, 'Canada', 6000000), (2, 'Mexico', 7000000); | Delete the record with id 1 in the table 'esg_investments'. | DELETE FROM esg_investments WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Clothing (id INT, material VARCHAR(255), price DECIMAL(5,2)); INSERT INTO Clothing (id, material, price) VALUES (1, 'cotton', 25.99), (2, 'silk', 150.00), (3, 'wool', 79.99), (4, 'polyester', 19.99); | What is the average price of sustainable clothing items, grouped by material? | SELECT material, AVG(price) FROM Clothing WHERE sustainable = 'yes' GROUP BY material; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name TEXT, ingredients TEXT); | Find the total number of ingredients used in all menu items. | SELECT SUM(LENGTH(ingredients) - LENGTH(REPLACE(ingredients, ',', '')) + 1) FROM dishes; | gretelai_synthetic_text_to_sql |
CREATE TABLE concert_attendance (id INT, attendee_age INT, concert_location VARCHAR(50)); INSERT INTO concert_attendance (id, attendee_age, concert_location) VALUES (1, 35, 'Paris'), (2, 40, 'Paris'), (3, 30, 'Berlin'), (4, 45, 'Berlin'), (5, 32, 'London'), (6, 42, 'London'); | What is the concert_location with the highest average attendee_age? | SELECT concert_location, AVG(attendee_age) AS avg_age FROM concert_attendance GROUP BY concert_location ORDER BY avg_age DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_libraries (name VARCHAR(255), state VARCHAR(255), built_year INT); INSERT INTO public_libraries (name, state, built_year) VALUES ('Los Angeles Public Library', 'CA', 1995); INSERT INTO public_libraries (name, state, built_year) VALUES ('San Francisco Public Library', 'CA', 1998); | What is the total number of public libraries in the state of California that were built before the year 2000? | SELECT COUNT(*) FROM public_libraries WHERE state = 'CA' AND built_year < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Midwest_Materials (location VARCHAR(20), material VARCHAR(30), cost FLOAT, order_date DATE); INSERT INTO Midwest_Materials VALUES ('WI', 'Concrete', 1500, '2022-01-05'), ('IL', 'Cement', 800, '2022-02-10'), ('MI', 'Insulation', 600, '2022-03-15'); | What is the total cost of construction materials in the Midwest, ordered by material? | SELECT material, SUM(cost) OVER (PARTITION BY material ORDER BY material) as total_cost FROM Midwest_Materials; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendance (attendance_id INT, museum_name VARCHAR(50), date DATE, visitors INT); INSERT INTO attendance (attendance_id, museum_name, date, visitors) VALUES (1, 'Metropolitan Museum of Art', '2021-09-11', 5000); INSERT INTO attendance (attendance_id, museum_name, date, visitors) VALUES (2, 'Metropolitan Mu... | What was the minimum museum attendance on Saturdays? | SELECT MIN(visitors) FROM attendance WHERE EXTRACT(DAYOFWEEK FROM date) = 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists water_treatment_plants (id INT PRIMARY KEY, location VARCHAR(50), treatment_capacity FLOAT, capacity_change FLOAT, change_date DATE); | Which water treatment plants have experienced the greatest increase in treatment capacity? | SELECT location, treatment_capacity, MAX(capacity_change) OVER (PARTITION BY location ORDER BY change_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as max_capacity_change FROM water_treatment_plants; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (id INT, habitat_name VARCHAR(50), threat_level VARCHAR(10), area_protected INT); | Insert a new record into the 'habitat_preservation' table for the 'Amazon Rainforest' with a 'threat_level' of 'high' | INSERT INTO habitat_preservation (id, habitat_name, threat_level, area_protected) VALUES (1, 'Amazon Rainforest', 'high', NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE HydroPowerPlants ( PlantID INT, Name VARCHAR(255), Country VARCHAR(255), EnergyStorageCapacity FLOAT ); | What is the average energy storage capacity in MWh for Hydro Power Plants in Spain? | SELECT AVG(EnergyStorageCapacity) FROM HydroPowerPlants WHERE Country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft_flights (id INT, model VARCHAR(50), flight_hours DECIMAL(5,2), year INT); INSERT INTO aircraft_flights (id, model, flight_hours, year) VALUES (1, 'Boeing 737', 3500.5, 2019), (2, 'Airbus A320', 3200.2, 2019), (3, 'Boeing 787', 3800.8, 2018); | What is the total flight time for each aircraft model by year? | SELECT model, year, SUM(flight_hours) as total_flight_time FROM aircraft_flights GROUP BY model, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, name TEXT, country TEXT, revenue FLOAT); INSERT INTO hotels (id, name, country, revenue) VALUES (1, 'Sustainable Seattle Hotel', 'USA', 75000); | Update the revenue of the 'Sustainable Seattle Hotel' by 10% | UPDATE hotels SET revenue = revenue * 1.10 WHERE name = 'Sustainable Seattle Hotel'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget(Year INT, Department VARCHAR(20), Region VARCHAR(20), Amount INT); INSERT INTO Budget(Year, Department, Region, Amount) VALUES (2022, 'Education', 'North', 5000000), (2022, 'Education', 'South', 6000000), (2022, 'Education', 'East', 4000000), (2022, 'Education', 'West', 7000000); | What is the total budget allocated for education in the year 2022 across all regions? | SELECT SUM(Amount) FROM Budget WHERE Department = 'Education' AND Year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarterly_production (id INT, country VARCHAR(255), mineral VARCHAR(255), year INT, quarter INT, quantity INT); INSERT INTO quarterly_production (id, country, mineral, year, quarter, quantity) VALUES (1, 'Indonesia', 'Nickel', 2022, 1, 500), (2, 'Indonesia', 'Tin', 2022, 1, 200), (3, 'Indonesia', 'Nickel',... | What is the total quantity of minerals extracted in each quarter by Indonesia? | SELECT country, mineral, EXTRACT(QUARTER FROM DATE(year, 3, 1)) as quarter, SUM(quantity) as total_quantity_extracted FROM quarterly_production WHERE country = 'Indonesia' GROUP BY country, mineral, quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, condition TEXT, state TEXT);INSERT INTO patients (id, name, condition, state) VALUES (1, 'John Smith', 'Depression', 'Texas');INSERT INTO patients (id, name, condition, state) VALUES (2, 'Jane Smith', 'Anxiety', 'Texas'); | What is the most common mental health condition among patients in Texas? | SELECT patients.condition, COUNT(patients.condition) FROM patients WHERE patients.state = 'Texas' GROUP BY patients.condition ORDER BY COUNT(patients.condition) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name VARCHAR(50), gender VARCHAR(50), location VARCHAR(50)); INSERT INTO farmers (id, name, gender, location) VALUES (1, 'John Doe', 'Male', 'Springfield'); INSERT INTO farmers (id, name, gender, location) VALUES (2, 'Jane Doe', 'Female', 'Springfield'); INSERT INTO farmers (id, name, gend... | What is the total number of female and male farmers in the 'farmers' table? | SELECT SUM(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS total_males, SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) AS total_females FROM farmers; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_date DATE, menu_category VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO sales (sale_date, menu_category, revenue) VALUES ('2023-03-01', 'Appetizers', 200.00), ('2023-03-01', 'Entrees', 450.00), ('2023-03-01', 'Desserts', 250.00), ('2023-03-02', 'Appetizers', 250.00), ('2023-03-02', 'Entrees',... | What is the total revenue for each menu category, broken down by day? | SELECT sale_date, menu_category, SUM(revenue) FROM sales GROUP BY sale_date, menu_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_map (project VARCHAR(50), depth FLOAT); INSERT INTO ocean_map VALUES ('Project 1', 123.4), ('Project 1', 234.5), ('Project 2', 345.6); | What is the average depth of the ocean floor for each mapping project, along with the project name? | SELECT project, AVG(depth) as avg_depth FROM ocean_map GROUP BY project; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_actors (threat_actor_id INT, threat_actor_name VARCHAR(255)); CREATE TABLE malware (malware_id INT, malware_name VARCHAR(255), threat_actor_id INT); | List all threat actors and their corresponding malware types. | SELECT ta.threat_actor_name, m.malware_name FROM threat_actors ta JOIN malware m ON ta.threat_actor_id = m.threat_actor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military (id INT, name VARCHAR(100), branch VARCHAR(50), country VARCHAR(50)); INSERT INTO Military (id, name, branch, country) VALUES (1, 'John Smith', 'Army', 'USA'), (2, 'Jane Doe', 'Navy', 'USA'), (3, 'Pierre Dupont', 'Air Force', 'Canada'), (4, 'Agnes MacDonald', 'Army', 'Canada'); | What is the total number of military personnel, by branch of service, for the US and Canada? | SELECT country, branch, COUNT(*) AS total FROM Military WHERE country IN ('USA', 'Canada') GROUP BY country, branch; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_consumption (building_id INT, building_type VARCHAR(20), country VARCHAR(20), consumption FLOAT, consumption_date DATETIME); INSERT INTO energy_consumption (building_id, building_type, country, consumption, consumption_date) VALUES (1, 'Residential', 'India', 500.0, '2021-01-01'), (2, 'Commercial', ... | What is the daily energy consumption for residential and commercial buildings in India and China for the first week of January 2021? | SELECT building_type, country, DATE(consumption_date) as consumption_date, AVG(consumption) as avg_daily_consumption FROM energy_consumption WHERE country IN ('India', 'China') AND building_type IN ('Residential', 'Commercial') AND consumption_date >= '2021-01-01' AND consumption_date < '2021-01-08' GROUP BY building_t... | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT, crop_type VARCHAR(255), state VARCHAR(255)); INSERT INTO crops (id, crop_type, state) VALUES (1, 'corn', 'Iowa'), (2, 'soybean', 'Illinois'), (3, 'wheat', 'Kansas'), (4, 'rice', 'Louisiana'), (5, 'barley', 'Montana'); CREATE TABLE farmers (id INT, name VARCHAR(255), state VARCHAR(255)); INSE... | Find the number of farmers in each state that grow a specific crop type. | SELECT c.crop_type, f.state, COUNT(f.id) FROM crops c JOIN farmers f ON c.state = f.state GROUP BY c.crop_type, f.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE divisions (did INT, division_name VARCHAR(255)); CREATE TABLE officers (oid INT, did INT, officer_type VARCHAR(255), is_active BOOLEAN); | What is the total number of police officers in each division, including reserve officers? | SELECT d.division_name, COUNT(o.oid) FROM divisions d LEFT JOIN officers o ON d.did = o.did AND o.is_active = TRUE AND o.officer_type IN ('active', 'reserve') GROUP BY d.division_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_batch (batch_id INT, chemical_code VARCHAR(10)); INSERT INTO production_batch (batch_id, chemical_code) VALUES (1001, 'A123'), (1002, 'B456'), (1003, 'C789'), (1004, 'A123'); | Count the number of unique chemical codes in the production_batch table | SELECT COUNT(DISTINCT chemical_code) FROM production_batch; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_infrastructure (id INT, name VARCHAR(50), country VARCHAR(50), resilience_score FLOAT); INSERT INTO country_infrastructure VALUES (1, 'Dam', 'Australia', 90), (2, 'Bridge', 'Canada', 75), (3, 'Road', 'Germany', 85); | What is the average resilience score for each country? | SELECT country, AVG(resilience_score) FROM country_infrastructure GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory(item_id INT, item_name VARCHAR(50), is_gluten_free BOOLEAN, price DECIMAL(5,2)); INSERT INTO Inventory VALUES(1,'Apples',TRUE,0.99),(2,'Bananas',TRUE,1.49),(3,'Bread',FALSE,3.50); | Count the number of gluten-free items in the inventory that have a price over 5. | SELECT COUNT(*) FROM Inventory WHERE is_gluten_free = TRUE AND price > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_reports (id INT, report_name TEXT, category TEXT, region TEXT); INSERT INTO threat_reports (id, report_name, category, region) VALUES (1, 'Report A', 'Cyber Warfare', 'Asia-Pacific'), (2, 'Report B', 'Cyber Warfare', 'Europe'); | List all threat intelligence reports related to 'Cyber Warfare' in the 'Asia-Pacific' region. | SELECT report_name FROM threat_reports WHERE category = 'Cyber Warfare' AND region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE libraries (id INT, name TEXT, province TEXT, type TEXT, budget FLOAT); INSERT INTO libraries (id, name, province, type, budget) VALUES (1, 'Library A', 'Province A', 'public', 150000), (2, 'Library B', 'Province A', 'private', 100000), (3, 'Library C', 'Province B', 'public', 200000); | What is the minimum budget allocated for public libraries in each province? | SELECT province, MIN(budget) FROM libraries WHERE type = 'public' GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerPlaytime (PlayerID int, PlayerName varchar(50), Game varchar(50), Playtime decimal(10,2)); | What is the total playtime for each player in the "Adventure" genre? | SELECT PlayerName, SUM(Playtime) OVER(PARTITION BY PlayerID) as TotalPlaytime FROM PlayerPlaytime WHERE Game = 'Adventure'; | gretelai_synthetic_text_to_sql |
CREATE TABLE debris (debris_id INT, orbit_type VARCHAR(255), size FLOAT); INSERT INTO debris (debris_id, orbit_type, size) VALUES (1, 'LEO', 0.1); INSERT INTO debris (debris_id, orbit_type, size) VALUES (2, 'GEO', 0.5); | How many debris objects are there in LEO and GEO orbits? | SELECT SUM(size) FROM debris WHERE orbit_type IN ('LEO', 'GEO'); | gretelai_synthetic_text_to_sql |
CREATE TABLE salinity_data (farm_id INT, location VARCHAR(20), salinity FLOAT); INSERT INTO salinity_data (farm_id, location, salinity) VALUES (1, 'Red sea', 42.5), (2, 'Persian gulf', 41.2), (3, 'Red sea', 43.1), (4, 'Persian gulf', 40.8); | What is the average water salinity in the farms located in the Red sea and the Persian gulf? | SELECT AVG(salinity) FROM salinity_data WHERE location IN ('Red sea', 'Persian gulf'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donor_id INT, donation_amount DECIMAL(10,2), donation_date DATE, cause VARCHAR(255)); INSERT INTO donations (donor_id, donation_amount, donation_date, cause) VALUES (1, 500, '2022-01-05', 'Education'), (2, 300, '2022-03-15', 'Education'), (3, 700, '2022-01-10', 'Health'); | What was the total amount donated by individual donors to the 'Education' cause in Q1 2022? | SELECT SUM(donation_amount) FROM donations WHERE donation_date BETWEEN '2022-01-01' AND '2022-03-31' AND cause = 'Education' AND donor_id NOT IN (SELECT donor_id FROM organizations); | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainablePractices (PracticeID INT, PracticeName VARCHAR(50), Description VARCHAR(255), Department VARCHAR(50)); INSERT INTO SustainablePractices (PracticeID, PracticeName, Description, Department) VALUES (2, 'Wind Turbines', 'Using wind turbines to generate electricity for the construction site.', 'Civi... | How many employees were involved in sustainable practices in the 'Civil Engineering' department? | SELECT COUNT(DISTINCT EmployeesSustainablePractices.EmployeeID) FROM EmployeesSustainablePractices INNER JOIN SustainablePractices ON EmployeesSustainablePractices.PracticeID = SustainablePractices.PracticeID WHERE SustainablePractices.Department = 'Civil Engineering'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID INT, ProductID INT, QuantitySold INT, Country VARCHAR(50), SaleDate DATE); INSERT INTO Sales (SaleID, ProductID, QuantitySold, Country, SaleDate) VALUES (1, 1, 50, 'USA', '2022-07-21'), (2, 2, 30, 'Canada', '2022-08-03'), (3, 1, 70, 'Mexico', '2022-07-15'); CREATE TABLE Products (ProductID IN... | Which countries have the highest and lowest 'Tops' sales in the 'Summer 2022' season? | SELECT Country, ProductType, SUM(QuantitySold) as TotalQuantitySold FROM Sales S JOIN Products P ON S.ProductID = P.ProductID WHERE P.ProductType = 'Top' AND SaleDate BETWEEN '2022-06-01' AND '2022-09-30' GROUP BY Country ORDER BY TotalQuantitySold DESC, Country ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsEvents (EventID INT, Country VARCHAR(50), VRAdoption INT); INSERT INTO EsportsEvents (EventID, Country, VRAdoption) VALUES (1, 'USA', 500), (2, 'Canada', 300), (3, 'Mexico', 400), (4, 'Germany', 600), (5, 'France', 700); | Which countries have the highest number of VR headset adoptions in esports? | SELECT Country, MAX(VRAdoption) FROM EsportsEvents GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (Product varchar(50), StoreID int); INSERT INTO Products (Product, StoreID) VALUES ('Bananas', 1), ('Carrots', 1), ('Avocados', 2), ('Lemons', 2), ('Strawberries', 3), ('Oranges', 3); CREATE TABLE Sales (Product varchar(50), StoreID int, QuantitySold int); INSERT INTO Sales (Product, StoreID, Quan... | What is the maximum quantity of any food product sold in a single store? | SELECT Product, MAX(QuantitySold) as MaxQuantitySold FROM Sales GROUP BY Product; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_sales (sales_id INT PRIMARY KEY, garment_id INT, store_id INT, quantity INT, price DECIMAL(5,2), date DATE); CREATE TABLE stores (store_id INT PRIMARY KEY, store_name TEXT, store_city TEXT, store_country TEXT); INSERT INTO stores (store_id, store_name, store_city, store_country) VALUES (1, 'Flagshi... | What is the total quantity of garments sold per store? | SELECT s.store_name, SUM(gs.quantity) as total_sold FROM garment_sales gs JOIN stores s ON gs.store_id = s.store_id GROUP BY s.store_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_vehicles (vehicle_id INT, make VARCHAR(50), model VARCHAR(50), mpg DECIMAL(5,2)); | Insert a new record for the 'Tesla Model Y' with an MPG of 125 in the 'green_vehicles' table. | INSERT INTO green_vehicles (vehicle_id, make, model, mpg) VALUES (NULL, 'Tesla', 'Model Y', 125); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_housing (id INT, address VARCHAR(255), city VARCHAR(255), state VARCHAR(255), square_footage INT, sustainable_features VARCHAR(255)); INSERT INTO sustainable_housing (id, address, city, state, square_footage, sustainable_features) VALUES (1, '123 Maple St', 'San Francisco', 'CA', 1200, 'solar p... | How many properties are there in the 'sustainable_housing' table for each state? | SELECT state, COUNT(*) FROM sustainable_housing GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (CaseID INT, OpenDate DATE); INSERT INTO Cases (CaseID, OpenDate) VALUES (1, '2022-01-03'), (2, '2022-01-05'), (3, '2022-01-07'), (4, '2022-01-09'), (5, '2022-01-11'), (6, '2022-01-13'), (7, '2022-01-15'), (8, '2022-01-16'); | What is the number of cases opened per day of the week? | SELECT TO_CHAR(OpenDate, 'Day') AS DayOfWeek, COUNT(*) AS CasesOpened FROM Cases GROUP BY DayOfWeek ORDER BY TO_CHAR(OpenDate, 'IYYY')::INT, TO_CHAR(OpenDate, 'IMonth')::INT, TO_CHAR(OpenDate, 'IDay')::INT; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_professional_development (teacher_id INT, course_id INT, date DATE); INSERT INTO teacher_professional_development (teacher_id, course_id, date) VALUES (1, 1, '2022-12-01'), (2, 2, '2022-12-02'), (3, 3, '2022-12-03'); | What is the total number of professional development courses completed by teachers in 'Winter 2022'? | SELECT COUNT(DISTINCT course_id) FROM teacher_professional_development WHERE date = '2022-12-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_urbanism_florida (id INT, price FLOAT); INSERT INTO sustainable_urbanism_florida (id, price) VALUES (1, 800000), (2, 900000), (3, 700000); | Determine the minimum property price for sustainable urbanism properties in Florida. | SELECT MIN(price) FROM sustainable_urbanism_florida; | gretelai_synthetic_text_to_sql |
CREATE TABLE investor (id INT, name VARCHAR(50), type VARCHAR(50), total_investments INT, total_assets FLOAT); CREATE TABLE investment (id INT, investor_id INT, company_id INT, round VARCHAR(50), invested_amount FLOAT, investment_date DATE); CREATE TABLE company (id INT, name VARCHAR(50), founding_year INT, industry VA... | Who are the female founders that have received funding from Indian venture capital firms in the last 5 years? | SELECT c.name, i.name FROM company c INNER JOIN investment inv ON c.id = inv.company_id INNER JOIN investor i ON inv.investor_id = i.id WHERE c.gender = 'Female' AND i.type = 'Venture Capital' AND investment_date >= DATEADD(year, -5, GETDATE()) AND inv.investor_id IN (SELECT id FROM investor WHERE location = 'India'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (vehicle_id INT, vehicle_type TEXT); CREATE TABLE maintenance (maintenance_id INT, vehicle_id INT, maintenance_date DATE, maintenance_type TEXT); | What is the total number of maintenance tasks performed on each vehicle type? | SELECT v.vehicle_type, COUNT(m.maintenance_id) as total_maintenance_tasks FROM vehicles v INNER JOIN maintenance m ON v.vehicle_id = m.vehicle_id GROUP BY v.vehicle_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees(id INT, name VARCHAR(255), title VARCHAR(255), age INT); INSERT INTO employees(id, name, title, age) VALUES ('1', 'Jane Smith', 'Mining Engineer', '50'); | What is the total number of employees with the title 'Engineer' in the 'employees' table? | SELECT COUNT(*) FROM employees WHERE title LIKE '%Engineer%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, name VARCHAR(50), age INT, team VARCHAR(20)); INSERT INTO athletes (athlete_id, name, age, team) VALUES (1, 'John Doe', 25, 'Basketball'); INSERT INTO athletes (athlete_id, name, age, team) VALUES (2, 'Jane Smith', 30, 'Soccer'); INSERT INTO athletes (athlete_id, name, age, team) ... | What is the average age of athletes in the 'Basketball' team in the 'athletes' table? | SELECT AVG(age) FROM athletes WHERE team = 'Basketball'; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (assistance_id INT, assistance_name TEXT, assistance_description TEXT, region TEXT, amount DECIMAL(10,2), date DATE); INSERT INTO humanitarian_assistance (assistance_id, assistance_name, assistance_description, region, amount, date) VALUES (1, 'Food Aid', 'Food for drought-affected ... | What is the total amount of humanitarian assistance provided to each region in the last fiscal year? | SELECT humanitarian_assistance.region, SUM(humanitarian_assistance.amount) FROM humanitarian_assistance WHERE humanitarian_assistance.date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 YEAR) AND LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 YEAR)) GROUP BY humanitarian_assistance.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE american_social_good (budget INT); INSERT INTO american_social_good (budget) VALUES (40000), (50000), (60000); | What is the minimum budget allocated to technology for social good initiatives in America? | SELECT MIN(budget) FROM american_social_good; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlasticWaste (Country VARCHAR(50), RecyclingRate DECIMAL(5,2)); INSERT INTO PlasticWaste (Country, RecyclingRate) VALUES ('European Union', 0.25), ('United States', 0.10), ('Japan', 0.20), ('China', 0.15); | Compare the recycling rates of plastic waste in the European Union and in the United States. | SELECT Country, RecyclingRate FROM PlasticWaste WHERE Country IN ('European Union', 'United States') ORDER BY RecyclingRate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE households (zip_code INT, state VARCHAR(20), water_consumption FLOAT); INSERT INTO households (zip_code, state, water_consumption) VALUES (90001, 'California', 150.0), (90002, 'California', 200.0), (90003, 'California', 180.0); | What is the average water consumption per household in the state of California, broken down by zip code? | SELECT zip_code, AVG(water_consumption) FROM households WHERE state = 'California' GROUP BY zip_code; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_amount INT, organization_id INT); CREATE TABLE organizations (id INT, name TEXT, country TEXT, focus TEXT); INSERT INTO donations (id, donation_amount, organization_id) VALUES (1, 5000, 1), (2, 10000, 2), (3, 7000, 3); INSERT INTO organizations (id, name, country, focus) VALUES ... | What is the average donation amount for organizations with a focus on education in the UK? | SELECT AVG(donations.donation_amount) FROM donations INNER JOIN organizations ON donations.organization_id = organizations.id WHERE organizations.country = 'UK' AND organizations.focus = 'education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellite_deployment ( id INT, name VARCHAR(255), launch_date DATE ); | What are the names and launch dates of satellites deployed in the last 5 years? | SELECT name, launch_date FROM satellite_deployment WHERE launch_date >= DATE(NOW()) - INTERVAL 5 YEAR; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnvironmentalBudget (Year INTEGER, Budget INTEGER); INSERT INTO EnvironmentalBudget (Year, Budget) VALUES (2018, 8000000), (2019, 9000000), (2020, 10000000); | What is the total budget allocated for environmental protection in 2018, 2019, and 2020? | SELECT SUM(Budget) FROM EnvironmentalBudget WHERE Year IN (2018, 2019, 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_menu (menu_id INT, dish_name TEXT, serving_size REAL, calories INT); | What is the average calorie count for dishes in the sustainable_menu table? | SELECT AVG(calories) FROM sustainable_menu; | gretelai_synthetic_text_to_sql |
CREATE TABLE recipes (id INT, name TEXT, cuisine TEXT, vegan BOOLEAN, cook_time INT); INSERT INTO recipes (id, name, cuisine, vegan, cook_time) VALUES (1, 'Chana Masala', 'Indian', true, 45), (2, 'Pasta Primavera', 'Italian', false, 30), (3, 'Veggie Fried Rice', 'Chinese', true, 25); | What is the minimum cooking time for vegan dishes? | SELECT MIN(cook_time) FROM recipes WHERE vegan = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE GamePlay (PlayerID INT, GameID INT); INSERT INTO GamePlay (PlayerID, GameID) VALUES (1, 1); CREATE TABLE Games (GameID INT, Name VARCHAR(50), Genre VARCHAR(20), ReleaseDate DATETIME, Publisher VARCHAR(50)); INSERT INTO Games (GameID, Name, Genre, ReleaseDate, Publisher) VALUES (3, 'Call of Duty: Warzone',... | Which games have the word 'War' in their names and how many players have played them? | SELECT g.Name, COUNT(DISTINCT gp.PlayerID) FROM Games g INNER JOIN GamePlay gp ON g.GameID = gp.GameID WHERE g.Name LIKE '%War%' GROUP BY g.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(255), location VARCHAR(255), city VARCHAR(255), country VARCHAR(255)); INSERT INTO wells (well_id, well_name, location, city, country) VALUES (1, 'Well A', 'Aberdeen', 'UK'), (2, 'Well B', 'Stavanger', 'Norway'), (3, 'Well C', 'New Orleans', 'USA'), (4, 'Well D', 'Ho C... | List the number of wells in each city, for cities in the USA. | SELECT city, COUNT(*) AS num_wells FROM wells WHERE country = 'USA' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development(id INT, location VARCHAR(255), food_aid FLOAT); INSERT INTO community_development(id, location, food_aid) VALUES (1, 'Haiti', 500.0), (2, 'Mexico', 300.0); | What is the minimum amount of food aid distributed in 'community_development' table for 'Haiti'? | SELECT MIN(food_aid) FROM community_development WHERE location = 'Haiti'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SUVSafetyTesting (id INT, rating INT, release_year INT); INSERT INTO SUVSafetyTesting (id, rating, release_year) VALUES (1, 3, 2018), (2, 4, 2017), (3, 5, 2016), (4, 4, 2015), (5, 5, 2014), (6, 4, 2013), (7, 3, 2012); | What is the minimum safety rating of SUVs released before 2019? | SELECT MIN(rating) FROM SUVSafetyTesting WHERE release_year < 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE atlanta_prop(id INT, type VARCHAR(20), cert VARCHAR(20)); INSERT INTO atlanta_prop VALUES (1, 'commercial', 'green'); CREATE TABLE austin_prop(id INT, type VARCHAR(20), cert VARCHAR(20)); INSERT INTO austin_prop VALUES (1, 'residential', 'green'); CREATE TABLE denver_prop(id INT, type VARCHAR(20), cert VAR... | What is the total number of green-certified properties in Atlanta, Austin, and Denver? | SELECT COUNT(*) FROM atlanta_prop WHERE cert = 'green' UNION ALL SELECT COUNT(*) FROM austin_prop WHERE cert = 'green' UNION ALL SELECT COUNT(*) FROM denver_prop WHERE cert = 'green'; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts (id INT, art_name VARCHAR(100), origin_country VARCHAR(50)); INSERT INTO traditional_arts (id, art_name, origin_country) VALUES (1, 'Kabuki', 'Japan'), (2, 'Pansori', 'Korea'), (3, 'Taiko', 'Japan'); | Identify overlapping traditional arts between Japan and Korea. | SELECT art_name FROM traditional_arts WHERE origin_country IN ('Japan', 'Korea') GROUP BY art_name HAVING COUNT(DISTINCT origin_country) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites(SiteID INT, SiteName VARCHAR(100), Country VARCHAR(50), RestorationDate DATE, RestorationCost DECIMAL(10,2), RestorerID INT); CREATE TABLE Restorers(RestorerID INT, RestorerName VARCHAR(100), Skills VARCHAR(100)); | List all heritage sites in Africa that have been restored in the last 5 years, along with the restoration cost and restorer information. | SELECT HeritageSites.SiteName, HeritageSites.RestorationDate, HeritageSites.RestorationCost, Restorers.RestorerName FROM HeritageSites INNER JOIN Restorers ON HeritageSites.RestorerID = Restorers.RestorerID WHERE HeritageSites.RestorationDate >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (satellite_id INT, name VARCHAR(255), launch_country VARCHAR(255), launch_date DATE, altitude INT); | What is the average altitude of satellites launched by NASA? | SELECT AVG(altitude) as avg_altitude FROM satellites WHERE launch_country = 'United States' AND agency = 'NASA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DEX (transaction_id INT, transaction_date DATE, digital_asset VARCHAR(20), transaction_volume DECIMAL(10, 2)); INSERT INTO DEX (transaction_id, transaction_date, digital_asset, transaction_volume) VALUES (1, '2022-01-01', 'ETH', 5000.00), (2, '2022-01-01', 'BTC', 3000.00), (3, '2022-01-02', 'ETH', 6000.00)... | Find the daily total transaction volume for each digital asset in the 'DEX' trading platform, ordered by date and total volume in descending order. | SELECT transaction_date, digital_asset, SUM(transaction_volume) as total_volume FROM DEX GROUP BY transaction_date, digital_asset ORDER BY transaction_date, total_volume DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_continent(volunteer_id INT, volunteer_name TEXT, continent TEXT); INSERT INTO volunteer_continent(volunteer_id, volunteer_name, continent) VALUES (1, 'John Doe', 'North America'), (2, 'Jane Smith', 'North America'), (3, 'Alice Johnson', 'Africa'); | How many volunteers have there been in total from each continent? | SELECT continent, COUNT(*) FROM volunteer_continent GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, EmployeeName VARCHAR(50), Department VARCHAR(50), Salary INT); INSERT INTO Employees (EmployeeID, EmployeeName, Department, Salary) VALUES (1, 'John Doe', 'Ethical AI Data Scientist', 80000); INSERT INTO Employees (EmployeeID, EmployeeName, Department, Salary) VALUES (2, 'Jane Sm... | What is the average salary of data scientists working on ethical AI projects? | SELECT AVG(Salary) FROM Employees WHERE Department = 'Ethical AI Data Scientist'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HomeInsurance (PolicyID INT, Name VARCHAR(50), Coverage DECIMAL(5,2)); INSERT INTO HomeInsurance VALUES (1, 'John Smith', 1500.00), (2, 'Jane Doe', 2000.00); CREATE TABLE AutoInsurance (PolicyID INT, Name VARCHAR(50), Coverage DECIMAL(5,2)); INSERT INTO AutoInsurance VALUES (1, 'John Smith', 800.00), (2, '... | Which policyholders have both home and auto insurance? | SELECT h.Name FROM HomeInsurance h INNER JOIN AutoInsurance a ON h.PolicyID = a.PolicyID; | gretelai_synthetic_text_to_sql |
CREATE TABLE Paintings (PaintingID INT, Title VARCHAR(50), ArtistID INT, YearCreated INT); INSERT INTO Paintings (PaintingID, Title, ArtistID, YearCreated) VALUES (1, 'Starry Night', 1, 1889); INSERT INTO Paintings (PaintingID, Title, ArtistID, YearCreated) VALUES (2, 'Guernica', 2, 1937); | Update the painting 'The Starry Night' to be created in 1888. | UPDATE Paintings SET YearCreated = 1888 WHERE Title = 'The Starry Night'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftManufacturing (id INT, company VARCHAR(255), cost INT);INSERT INTO SpacecraftManufacturing (id, company, cost) VALUES (1, 'SpaceTech Inc.', 5000000); | What was the total cost of spacecraft manufactured by SpaceTech Inc.? | SELECT SUM(cost) FROM SpacecraftManufacturing WHERE company = 'SpaceTech Inc.'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists VehicleSafetyRating (Id int, Vehicle varchar(100), Country varchar(50), SafetyRating float); INSERT INTO VehicleSafetyRating (Id, Vehicle, Country, SafetyRating) VALUES (1, 'Tesla Model 3', 'USA', 5.3), (2, 'Tesla Model S', 'USA', 5.4), (3, 'Nissan Leaf', 'Japan', 4.8), (4, 'BMW i3', 'Germany... | Find the vehicle with the highest safety rating in each country. | SELECT Country, Vehicle, SafetyRating FROM (SELECT Country, Vehicle, SafetyRating, DENSE_RANK() OVER (PARTITION BY Country ORDER BY SafetyRating DESC) AS Rank FROM VehicleSafetyRating) AS Subquery WHERE Rank = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (author_id INT, first_name VARCHAR(255), last_name VARCHAR(255), email VARCHAR(255)); | Update the name of the author with id 15 to "Maria Rodriguez" in the "authors" table | UPDATE authors SET first_name = 'Maria', last_name = 'Rodriguez' WHERE author_id = 15; | gretelai_synthetic_text_to_sql |
CREATE TABLE case_outcomes (case_id INT, case_type_id INT, case_status VARCHAR(20)); CREATE TABLE case_types (case_type_id INT, case_type VARCHAR(20)); | What is the success rate of cases for each case type ('case_types' table) in the 'case_outcomes' table? | SELECT ct.case_type, (SUM(CASE WHEN co.case_status = 'Success' THEN 1 ELSE 0 END) / COUNT(*)) * 100.0 AS success_rate FROM case_outcomes co JOIN case_types ct ON co.case_type_id = ct.case_type_id GROUP BY ct.case_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_building_certifications (id INT, certification_number INT, certification_date DATE, region VARCHAR(50)); | Identify the number of green building certifications issued in 'North America' each year | SELECT EXTRACT(YEAR FROM certification_date) AS year, COUNT(*) AS certifications FROM green_building_certifications WHERE region = 'North America' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE illegal_fishing_activities (id INT, vessel_name VARCHAR(50), region VARCHAR(50), date DATE); INSERT INTO illegal_fishing_activities (id, vessel_name, region, date) VALUES ('Queen of the Ocean', 'Indian Ocean', '2022-02-03'); INSERT INTO illegal_fishing_activities (id, vessel_name, region, date) VALUES ('Se... | List all the unique vessels that have been involved in illegal fishing activities in the Indian Ocean in the past year. | SELECT DISTINCT vessel_name FROM illegal_fishing_activities WHERE region = 'Indian Ocean' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (id INT, artist_name VARCHAR(255), country VARCHAR(255), tickets_sold INT, ticket_price FLOAT); INSERT INTO Concerts (id, artist_name, country, tickets_sold, ticket_price) VALUES (1, 'Taylor Swift', 'USA', 10000, 50), (2, 'BTS', 'South Korea', 15000, 70), (3, 'Ed Sheeran', 'UK', 12000, 40); | What is the total revenue from concert tickets for each artist in the Concerts table? | SELECT artist_name, SUM(tickets_sold * ticket_price) as total_revenue FROM Concerts GROUP BY artist_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_id INT, ingredient_name VARCHAR(50)); CREATE TABLE vegan_cruelty_free_products (product_id INT, ingredient_id INT); | List the top 5 ingredients that are most frequently used in cosmetic products that are both cruelty-free and vegan, in descending order. | SELECT i.ingredient_name, COUNT(vcfp.product_id) as vegan_cruelty_free_product_count FROM ingredients i JOIN vegan_cruelty_free_products vcfp ON i.ingredient_id = vcfp.ingredient_id GROUP BY i.ingredient_name ORDER BY vegan_cruelty_free_product_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_appointments (id INT, gender VARCHAR(50), appointment_date DATE); INSERT INTO mental_health_appointments (id, gender, appointment_date) VALUES (1, 'Female', '2022-01-01'), (2, 'Male', '2022-01-02'), (3, 'Female', '2022-02-03'); | What is the total number of mental health appointments by month for each gender? | SELECT gender, DATE_FORMAT(appointment_date, '%Y-%m') AS month, COUNT(*) FROM mental_health_appointments GROUP BY gender, month; | 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.