context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE regional_sales (region TEXT, sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO regional_sales (region, sale_date, revenue) VALUES ('North', '2022-01-01', 500.00), ('South', '2022-01-03', 300.00), ('East', '2022-02-14', 800.00), ('West', '2022-03-01', 600.00); | What is the total revenue for each region in the last quarter? | SELECT region, SUM(revenue) FROM regional_sales WHERE sale_date BETWEEN DATE_SUB(NOW(), INTERVAL 3 MONTH) AND NOW() GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (id INT, project_name TEXT, country TEXT, technology TEXT, installed_capacity FLOAT); INSERT INTO renewable_energy_projects (id, project_name, country, technology, installed_capacity) VALUES (1, 'Project A', 'country1', 'solar', 200.0), (2, 'Project B', 'country2', 'wind', 150.0),... | What is the minimum installed capacity of solar projects in 'country2'? | SELECT MIN(installed_capacity) FROM renewable_energy_projects WHERE country = 'country2' AND technology = 'solar'; | gretelai_synthetic_text_to_sql |
CREATE TABLE western_region (region VARCHAR(20), account_type VARCHAR(30), account_balance DECIMAL(10,2)); INSERT INTO western_region (region, account_type, account_balance) VALUES ('Western', 'Financial Wellbeing', 9000.00), ('Western', 'Financial Wellbeing', 10000.00), ('Western', 'Financial Stability', 8000.00); | What is the maximum account balance for financial wellbeing accounts in the Western region? | SELECT MAX(account_balance) FROM western_region WHERE account_type = 'Financial Wellbeing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ad_campaigns (id INT, start_date TIMESTAMP, end_date TIMESTAMP, target_age INT, ad_spend DECIMAL(10,2)); | Find the total ad spend for campaigns targeting users aged 18-24 in the past month. | SELECT SUM(ad_spend) FROM ad_campaigns WHERE target_age BETWEEN 18 AND 24 AND start_date BETWEEN DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH) AND CURRENT_TIMESTAMP(); | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_driving_research (id INT, make VARCHAR(50), model VARCHAR(50), autonomy_level INT); | Delete all rows with an autonomy_level less than 1 from the autonomous_driving_research table. | DELETE FROM autonomous_driving_research WHERE autonomy_level < 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE donation_timeline (id INT, donor_id INT, donation_date DATE); | How many unique donors have there been in each of the last 3 months? | SELECT DATE_FORMAT(donation_date, '%Y-%m') as donation_month, COUNT(DISTINCT donor_id) as unique_donors FROM donation_timeline WHERE donation_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH) GROUP BY donation_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species_name VARCHAR(50), habitat_depth FLOAT); INSERT INTO marine_species (id, species_name, habitat_depth) VALUES (1, 'Dolphin', 50.0, (2, 'Shark', 300.0)); | What is the average depth of marine species habitats in the Pacific Ocean? | SELECT AVG(habitat_depth) FROM marine_species WHERE ocean = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Humanitarian_Assistance (Mission_ID INT, Mission_Name VARCHAR(50), Location VARCHAR(50), Start_Date DATE, End_Date DATE); INSERT INTO Humanitarian_Assistance (Mission_ID, Mission_Name, Location, Start_Date, End_Date) VALUES (1, 'Operation Restore Hope', 'Somalia', '1992-01-01', '1993-12-31'); | How many humanitarian assistance missions were conducted in Africa? | SELECT COUNT(*) as Total_Missions FROM Humanitarian_Assistance WHERE Location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (sale_id INT PRIMARY KEY, ticket_price DECIMAL(5,2), sale_date DATE); | Remove any duplicate ticket sales records from the 'ticket_sales' table | DELETE FROM ticket_sales WHERE sale_id IN (SELECT sale_id FROM ticket_sales GROUP BY sale_id HAVING COUNT(*) > 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE CityG_Satis (ID INT, Year INT, Satisfaction VARCHAR(10)); INSERT INTO CityG_Satis (ID, Year, Satisfaction) VALUES (1, 2021, 'Satisfied'), (2, 2021, 'Neutral'); CREATE TABLE CityH_Satis (ID INT, Year INT, Satisfaction VARCHAR(10)); INSERT INTO CityH_Satis (ID, Year, Satisfaction) VALUES (1, 2021, 'Satisfied... | What is the percentage of citizens who are satisfied with the public transportation service in 'CityG' and 'CityH' in 2021? | SELECT 100.0 * COUNT(CASE WHEN CityG_Satis.Satisfaction = 'Satisfied' OR CityH_Satis.Satisfaction = 'Satisfied' THEN 1 END) / COUNT(*) FROM CityG_Satis, CityH_Satis WHERE CityG_Satis.Year = 2021 AND CityH_Satis.Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (incident_id INT, incident_date DATE, user_id INT);CREATE TABLE users (user_id INT, user_name VARCHAR(255), department VARCHAR(255), department_size INT); | What is the total number of security incidents in the last year that involved a user from a department that has more than 100 users? | SELECT COUNT(*) FROM security_incidents si JOIN users u ON si.user_id = u.user_id WHERE incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND u.department_size > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(50)); CREATE TABLE oil_production (company_id INT, date DATE, oil_production FLOAT); CREATE TABLE gas_production (company_id INT, date DATE, gas_production FLOAT); | Show the total oil and gas production for each company in the third quarter of 2021 | SELECT c.name, SUM(op.oil_production) + SUM(gp.gas_production) FROM company c JOIN oil_production op ON c.id = op.company_id JOIN gas_production gp ON c.id = gp.company_id WHERE op.date BETWEEN '2021-07-01' AND '2021-09-30' AND gp.date BETWEEN '2021-07-01' AND '2021-09-30' GROUP BY c.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE InterpretationServices (service_id INT, hours_per_week INT, accommodation_type VARCHAR(255)); | What is the maximum number of hours of speech-to-text interpretation provided in a week? | SELECT MAX(hours_per_week) FROM InterpretationServices WHERE accommodation_type = 'Speech-to-Text'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (name VARCHAR(255), region VARCHAR(255)); CREATE TABLE southern_ocean (name VARCHAR(255), region_type VARCHAR(255)); INSERT INTO marine_species (name, region) VALUES ('SPECIES1', 'Southern Ocean'), ('SPECIES2', 'Arctic Ocean'); INSERT INTO southern_ocean (name, region_type) VALUES ('SPE... | Which marine species are found in the Southern Ocean? | SELECT marine_species.name FROM marine_species INNER JOIN southern_ocean ON marine_species.name = southern_ocean.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name VARCHAR(50), location VARCHAR(50), focus VARCHAR(50)); INSERT INTO organizations (id, name, location, focus) VALUES (1, 'TechForAll', 'Africa', 'Technology Accessibility'), (2, 'SocialGoodAI', 'Global', 'Ethical AI'), (3, 'DigitalDivideInitiative', 'Asia', 'Digital Divide'); | How many organizations are working on technology accessibility in Africa? | SELECT COUNT(*) FROM organizations WHERE location = 'Africa' AND focus = 'Technology Accessibility'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Port (port_id INT PRIMARY KEY, port_name VARCHAR(255)); INSERT INTO Port (port_id, port_name) VALUES (1, 'Sydney'); CREATE TABLE Vessel (vessel_id INT PRIMARY KEY, vessel_name VARCHAR(255)); CREATE TABLE Vessel_Movement (vessel_id INT, movement_date DATE, port_id INT, PRIMARY KEY (vessel_id, movement_date)... | How many vessels visited Sydney in June 2022? | SELECT COUNT(DISTINCT V.vessel_id) FROM Vessel V JOIN Vessel_Movement VM ON V.vessel_id = VM.vessel_id WHERE VM.movement_date = '2022-06-01' AND VM.port_id = (SELECT port_id FROM Port WHERE port_name = 'Sydney'); | gretelai_synthetic_text_to_sql |
CREATE TABLE workouts (member_id INT, workout_date DATE, workout_type VARCHAR(50), duration INT, calories_burned INT); | Update the workout type for ID 102 to 'Pilates' | UPDATE workouts SET workout_type = 'Pilates' WHERE member_id = 102; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_projects (id INT, region VARCHAR(255), budget DECIMAL(10, 2)); INSERT INTO ai_projects (id, region, budget) VALUES (1, 'North America', 500000.00), (2, 'Southeast Asia', 350000.00), (3, 'South America', 400000.00); | What is the average budget for AI projects in Southeast Asia? | SELECT AVG(budget) FROM ai_projects WHERE region = 'Southeast Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (country VARCHAR(50), initiative VARCHAR(50), funding DECIMAL(10,2)); INSERT INTO climate_communication (country, initiative, funding) VALUES ('Canada', 'Climate Change Documentary', 1000000), ('Mexico', 'Climate Communication Symposium', 2000000); | Which countries have climate communication initiatives that received funding higher than the average funding amount? | SELECT country, initiative, funding FROM climate_communication WHERE funding > (SELECT AVG(funding) FROM climate_communication); | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (id INT PRIMARY KEY, model VARCHAR(50), engine VARCHAR(50)); INSERT INTO aircraft (id, model, engine) VALUES (101, '747', 'CFM56'), (102, 'A320', 'IAE V2500'), (103, 'A350', 'Rolls-Royce Trent XWB'), (104, '787', 'GE GEnx'), (105, '737', 'CFM56'); | Update the model of aircraft with ID 102 to 'A321' | UPDATE aircraft SET model = 'A321' WHERE id = 102; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_biomass (year INT, region VARCHAR(255), species VARCHAR(255), biomass FLOAT); INSERT INTO fish_biomass (year, region, species, biomass) VALUES (2020, 'Atlantic Ocean', 'Cod', 1500), (2020, 'Atlantic Ocean', 'Haddock', 1000), (2021, 'Atlantic Ocean', 'Cod', 1600); | What is the total biomass of fish species in the 'Atlantic Ocean' for each year? | SELECT year, region, SUM(biomass) AS total_biomass FROM fish_biomass WHERE region = 'Atlantic Ocean' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_patents (country VARCHAR(50), year INT, patent_count INT); | Military technology patents by the US vs. Russia in 2020 | SELECT country, patent_count FROM tech_patents WHERE year = 2020 AND country IN ('United States', 'Russia') ORDER BY patent_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, Name VARCHAR(50), Manufacturer VARCHAR(50), Mass FLOAT);CREATE TABLE SpaceMissions (MissionID INT, SpacecraftID INT, Name VARCHAR(50), LaunchDate DATE); INSERT INTO Spacecraft (SpacecraftID, Name, Manufacturer, Mass) VALUES (1, 'Voyager 1', 'NASA', 770), (2, 'Voyager 2', 'NASA... | What was the combined mass of spacecraft involved in space missions before 2010? | SELECT SUM(s.Mass) FROM Spacecraft s INNER JOIN SpaceMissions sm ON s.SpacecraftID = sm.SpacecraftID WHERE sm.LaunchDate < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE IoTData (id INT, field VARCHAR(255), device_type VARCHAR(255), deployment_date DATE); | List the total number of IoT devices deployed in each field in the 'PrecisionFarm' farm as of the end of 2021. | SELECT field, COUNT(DISTINCT device_type) FROM IoTData WHERE field IN ('PrecisionFarm1', 'PrecisionFarm2', 'PrecisionFarm3') AND YEAR(deployment_date) = 2021 AND MONTH(deployment_date) = 12 GROUP BY field; | gretelai_synthetic_text_to_sql |
CREATE TABLE TraditionalArtEvents (ID INT, Art VARCHAR(50), Year INT, Events INT); INSERT INTO TraditionalArtEvents (ID, Art, Year, Events) VALUES (1, 'Kabuki', 2022, 50); INSERT INTO TraditionalArtEvents (ID, Art, Year, Events) VALUES (2, 'Flamenco', 2022, 60); | What is the difference in the number of events for each traditional art between the current year and the previous year? | SELECT Art, Events AS CurrentYearEvents, LEAD(Events) OVER (PARTITION BY Art ORDER BY Year) AS PreviousYearEvents, CurrentYearEvents - PreviousYearEvents AS Difference FROM TraditionalArtEvents; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, country VARCHAR(255), certification VARCHAR(255)); INSERT INTO factories (factory_id, country, certification) VALUES (1, 'India', 'fair trade'), (2, 'Bangladesh', 'not fair trade'), (3, 'India', 'fair trade'), (4, 'Nepal', 'fair trade'); | Which country has the least number of fair trade certified factories? | SELECT country, COUNT(*) as factory_count FROM factories WHERE certification = 'fair trade' GROUP BY country ORDER BY factory_count ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE InfrastructureProjects (id INT, name VARCHAR(100), region VARCHAR(50), project_type VARCHAR(50), completion_date DATE); INSERT INTO InfrastructureProjects (id, name, region, project_type, completion_date) VALUES (1, 'Boston Bridge', 'Northeast', 'bridge', '2005-01-01'); | How many bridges were built in the Northeast region before 2010? | SELECT COUNT(*) FROM InfrastructureProjects WHERE region = 'Northeast' AND project_type = 'bridge' AND completion_date < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EcoManufacturing (id INT, trend VARCHAR(20), fabric VARCHAR(20), quantity INT); INSERT INTO EcoManufacturing (id, trend, fabric, quantity) VALUES (1, 'minimalism', 'organic cotton', 500), (2, 'vintage', 'recycled polyester', 700); | What is the total quantity of eco-friendly textiles used in manufacturing for each trend? | SELECT trend, SUM(quantity) FROM EcoManufacturing WHERE fabric LIKE '%eco%' GROUP BY trend; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (id INT, name VARCHAR(255)); CREATE TABLE police_responses (id INT, district_id INT, response_time INT); INSERT INTO districts (id, name) VALUES (1, 'South'); INSERT INTO police_responses (id, district_id, response_time) VALUES (1, 1, 7); | What is the minimum response time for police assistance in the 'South' district? | SELECT MIN(response_time) FROM police_responses WHERE district_id = (SELECT id FROM districts WHERE name = 'South'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, product_id INT, material VARCHAR(50), sale_date DATE, quantity INT); | What are the total sales of sustainable material products per month? | SELECT MONTH(sale_date) AS sale_month, SUM(quantity) AS total_sales FROM sales WHERE material IN ('organic_cotton', 'recycled_polyester', 'tencel') GROUP BY sale_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT, location VARCHAR(255), capacity INT); INSERT INTO warehouse (id, location, capacity) VALUES (1, 'warehouse1', 5000), (2, 'warehouse2', 7000), (3, 'warehouse3', 6000); CREATE TABLE movements (id INT, source_id INT, destination_id INT, quantity INT, moved_date DATE); INSERT INTO movements ... | How many pallets were moved between 'warehouse1' and 'warehouse3' in July 2021? | SELECT SUM(quantity) FROM movements WHERE source_id = 1 AND destination_id = 3 AND moved_date BETWEEN '2021-07-01' AND '2021-07-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE staff (id INT PRIMARY KEY, name VARCHAR(255), role VARCHAR(255), department VARCHAR(255)); INSERT INTO staff (id, name, role, department) VALUES (1, 'Alice', 'Communication Lead', 'climate_mitigation'), (2, 'Bob', 'Project Manager', 'climate_adaptation'), (3, 'Charlie', 'Finance Analyst', 'climate_finance'... | Who is the communication lead for 'climate_mitigation'? | SELECT name FROM staff WHERE role = 'Communication Lead' AND department = 'climate_mitigation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm (id INT, name VARCHAR(50), country VARCHAR(50)); | Find the number of aquaculture farms in each country, sorted by the number of farms in descending order. | SELECT f.country, COUNT(f.id) FROM Farm f GROUP BY f.country ORDER BY COUNT(f.id) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hotels (id INT, name TEXT, country TEXT, rating FLOAT, eco_friendly BOOLEAN); INSERT INTO Hotels (id, name, country, rating, eco_friendly) VALUES (1, 'Eco Hotel', 'Germany', 4.6, true), (2, 'Green Lodge', 'Germany', 4.3, true), (3, 'Classic Hotel', 'Germany', 4.8, false); | What is the highest-rated eco-friendly hotel in Germany? | SELECT name, rating FROM Hotels WHERE country = 'Germany' AND eco_friendly = true ORDER BY rating DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE addresses (address VARCHAR(42), country VARCHAR(2)); INSERT INTO addresses (address, country) VALUES ('0x123', 'IN'), ('0x456', 'US'), ('0x789', 'IN'); CREATE TABLE erc20_tokens (token_name VARCHAR(10), address VARCHAR(42), total_supply BIGINT); INSERT INTO erc20_tokens (token_name, address, total_supply) ... | What is the total supply of ERC20 tokens issued by addresses located in India? | SELECT SUM(total_supply) FROM erc20_tokens t JOIN addresses a ON t.address = a.address WHERE a.country = 'IN'; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_name VARCHAR(30), reach INT, conversions INT); INSERT INTO campaigns (campaign_name, reach, conversions) VALUES ('Mental Health Awareness Campaign', 12000, 1800); INSERT INTO campaigns (campaign_name, reach, conversions) VALUES ('Suicide Prevention Campaign', 8500, 1300); INSERT INTO ca... | What is the success rate of the 'Depression Screening Campaign'? | SELECT (CONVERT(FLOAT, conversions) / reach) * 100.0 FROM campaigns WHERE campaign_name = 'Depression Screening Campaign'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_founding (id INT, company_name VARCHAR(100), founding_date DATE); | Add a new record into the "company_founding" table for 'Delta Inc.' with the founding date 2018-05-15 | INSERT INTO company_founding (id, company_name, founding_date) VALUES (4, 'Delta Inc.', '2018-05-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Temperature_Data (year INT, temperature FLOAT); CREATE TABLE Climate_Trends (year INT, temperature FLOAT); | Find the average temperature increase for each year in the 'Temperature_Data' table and the 'Climate_Trends' table, then sum the results. | SELECT AVG(temperature) FROM Temperature_Data GROUP BY year UNION ALL SELECT AVG(temperature) FROM Climate_Trends GROUP BY year | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (operation_id INT, operation_name VARCHAR(50), resource_type VARCHAR(50), depletion_date DATE, quantity INT); INSERT INTO mining_operations (operation_id, operation_name, resource_type, depletion_date, quantity) VALUES (1, 'Operation A', 'Coal', '2022-01-01', 100), (2, 'Operation B', 'Iro... | What is the total quantity of each resource type depleted in the current year? | SELECT resource_type, SUM(quantity) AS total_depleted FROM mining_operations WHERE depletion_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY resource_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Citizen_Feedback (id INT, city_id INT, service VARCHAR(50), rating INT, date_created DATETIME); INSERT INTO Citizen_Feedback (id, city_id, service, rating, date_created) VALUES (9, 1, 'Road Maintenance', 4, '2022-01-15 12:00:00'), (10, 1, 'Waste Management', 3, '2022-02-20 14:30:00'), (11, 1, 'Road Mainten... | Which services in city 1 have the highest average rating in the last month? | SELECT CF.service, AVG(CF.rating) as avg_rating FROM Citizen_Feedback CF INNER JOIN City C ON CF.city_id = C.id WHERE C.name = 'City1' AND CF.date_created >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH) GROUP BY CF.service ORDER BY avg_rating DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor_data (id INT, crop_type VARCHAR(255), temperature INT, humidity INT, measurement_date DATE); INSERT INTO sensor_data (id, crop_type, temperature, humidity, measurement_date) VALUES (1, 'Corn', 22, 55, '2021-07-01'); INSERT INTO sensor_data (id, crop_type, temperature, humidity, measurement_date) VAL... | Delete all records of crop type 'Sorghum' with temperature readings below 20. | DELETE FROM sensor_data WHERE crop_type = 'Sorghum' AND temperature < 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE moma_exhibitions (artist_name TEXT, exhibition_year INTEGER); INSERT INTO moma_exhibitions (artist_name, exhibition_year) VALUES ('Pablo Picasso', 1939), ('Vincent Van Gogh', 1935), ('Francis Bacon', 1975); | List all artists who have exhibited at the MoMA and the year(s) of their exhibition(s). | SELECT artist_name, exhibition_year FROM moma_exhibitions; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthBudget (Year INT, Service VARCHAR(255), Budget FLOAT); INSERT INTO HealthBudget (Year, Service, Budget) VALUES (2018, 'Healthcare', 120000), (2019, 'Healthcare', 150000), (2020, 'Healthcare', NULL), (2021, 'Healthcare', 180000); | What is the total budget allocated for healthcare services in the year 2020? | SELECT SUM(Budget) FROM HealthBudget WHERE Year = 2020 AND Service = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HistoricalSites (SiteID INT, SiteName VARCHAR(255), Country VARCHAR(255), PreservationStatus VARCHAR(255)); INSERT INTO HistoricalSites (SiteID, SiteName, Country, PreservationStatus) VALUES (1, 'Colosseum', 'Italy', 'Good'), (2, 'Leaning Tower', 'Italy', 'Fair'); CREATE TABLE VisitorCounts (SiteID INT, Ye... | List all historical sites with their preservation status and number of annual visitors from Italy. | SELECT HistoricalSites.SiteName, HistoricalSites.PreservationStatus, SUM(VisitorCounts.VisitorCount) FROM HistoricalSites INNER JOIN VisitorCounts ON HistoricalSites.SiteID = VisitorCounts.SiteID WHERE HistoricalSites.Country = 'Italy' GROUP BY HistoricalSites.SiteName, HistoricalSites.PreservationStatus; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT PRIMARY KEY, name VARCHAR(50), population INT); | Update the population of the Arctic Fox by 150. | WITH updated_population AS (UPDATE species SET population = population + 150 WHERE name = 'Arctic Fox') SELECT * FROM species WHERE name = 'Arctic Fox'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (country VARCHAR(50), year INT, continent VARCHAR(50), waste_generation FLOAT); INSERT INTO waste_generation (country, year, continent, waste_generation) VALUES ('USA', 2019, 'North America', 7000), ('Canada', 2019, 'North America', 6000), ('Mexico', 2019, 'North America', 5000); | What is the total waste generation in grams for each North American country in 2019? | SELECT country, SUM(waste_generation) FROM waste_generation WHERE year = 2019 AND continent = 'North America' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE co_ownership (property_id INT, co_owner_name TEXT, share FLOAT); INSERT INTO co_ownership VALUES (1, 'Alice', 0.5), (1, 'Bob', 0.5), (2, 'Carol', 1.0) | List property_ids, co-owners' names, and their shares in the co_ownership table. | SELECT property_id, co_owner_name, share FROM co_ownership; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (chw_id INT, state VARCHAR(2), name VARCHAR(50), certification_date DATE); | Add new community health worker record for Hawaii | INSERT INTO community_health_workers (chw_id, state, name, certification_date) VALUES (321, 'HI', 'Keoni Kanahele', '2023-02-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue (item_name TEXT, revenue INTEGER); INSERT INTO revenue (item_name, revenue) VALUES ('Burger', 500), ('Pizza', 700), ('Pasta', 600), ('Salad', 400); | What is the total revenue for 'Pasta' and 'Salad' items? | SELECT SUM(revenue) FROM revenue WHERE item_name IN ('Pasta', 'Salad'); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, industry TEXT, founders_gender TEXT, funding FLOAT); | What is the average funding received by companies founded by women in the agriculture sector? | SELECT AVG(funding) FROM companies WHERE founders_gender = 'female' AND industry = 'agriculture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (initiative_id INT, initiative_name VARCHAR(50), country VARCHAR(20), open_pedagogy BOOLEAN); INSERT INTO initiatives (initiative_id, initiative_name, country, open_pedagogy) VALUES (1, 'Open Education Resources', 'USA', TRUE), (2, 'Massive Open Online Courses', 'Canada', TRUE), (3, 'Flipped Cl... | What is the distribution of open pedagogy initiatives by country? | SELECT country, COUNT(*) as num_initiatives FROM initiatives WHERE open_pedagogy = TRUE GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (ExhibitionID INT, ExhibitionName VARCHAR(255), Category VARCHAR(255), TicketPrice DECIMAL(5,2)); INSERT INTO Exhibitions (ExhibitionID, ExhibitionName, Category, TicketPrice) VALUES (1, 'Egyptian Treasures', 'Ancient Civilizations', 25.99), (2, 'Roman Antiquities', 'Ancient Civilizations', 29.... | What is the sum of ticket prices for all exhibitions in the "Ancient Civilizations" category? | SELECT SUM(TicketPrice) FROM Exhibitions WHERE Category = 'Ancient Civilizations'; | gretelai_synthetic_text_to_sql |
CREATE TABLE actors (id INT, name VARCHAR(255), movies INT); INSERT INTO actors (id, name, movies) VALUES (1, 'ActorA', 10), (2, 'ActorB', 5), (3, 'ActorC', 15), (4, 'ActorD', 3), (5, 'ActorE', 20); | Who are the top 5 actors by the number of movies they have acted in? | SELECT name, movies FROM actors ORDER BY movies DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (id INT, country VARCHAR(20), finance_type VARCHAR(20), amount INT, finance_year INT); INSERT INTO climate_finance (id, country, finance_type, amount, finance_year) VALUES (1, 'Brazil', 'International Aid', 1000000, 2022), (2, 'India', 'International Aid', 1200000, 2022), (3, 'Indonesia', '... | Which countries received the most climate finance in the form of international aid in 2022? | SELECT country, SUM(amount) FROM climate_finance WHERE finance_type = 'International Aid' AND finance_year = 2022 GROUP BY country ORDER BY SUM(amount) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'Mediterranean Sea'); CREATE TABLE vessel_movements (id INT, vessel_id INT, departure_port_id INT, arrival_port_id INT, speed DECIMAL(5,2), date DATE, region_id INT); INSERT INTO vessel_movements (id, vessel_id, departure_port_i... | What was the maximum speed recorded for a vessel in the Mediterranean Sea? | SELECT MAX(speed) FROM vessel_movements WHERE region_id = (SELECT id FROM regions WHERE name = 'Mediterranean Sea'); | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (id INT, genre VARCHAR(255)); INSERT INTO genres (id, genre) VALUES (1, 'Pop'); CREATE TABLE sales (id INT, genre_id INT, revenue DECIMAL(10,2), sale_date DATE); | What is the total revenue for the 'Pop' genre in the first half of 2020? | SELECT SUM(sales.revenue) FROM sales JOIN genres ON sales.genre_id = genres.id WHERE genres.genre = 'Pop' AND sale_date BETWEEN '2020-01-01' AND '2020-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (program_id INT, program_name VARCHAR(255), location VARCHAR(255)); INSERT INTO carbon_offset_programs (program_id, program_name, location) VALUES (1, 'Tree Planting Program 1', 'Asia'), (2, 'Energy Efficiency Program 1', 'North America'), (3, 'Tree Planting Program 2', 'Europe'), (4... | What is the number of carbon offset programs implemented in 'South America'? | SELECT COUNT(*) FROM carbon_offset_programs WHERE location = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_id INT, drug_name TEXT, sales_region TEXT, revenue FLOAT); INSERT INTO drugs (drug_id, drug_name, sales_region, revenue) VALUES (1001, 'DrugA', 'EU', 5000000), (1002, 'DrugB', 'EU', 6000000), (1003, 'DrugC', 'US', 7000000), (1004, 'DrugD', 'EU', 4000000); | What are the top 3 drugs by sales revenue in the EU region for 2020? | SELECT drug_name, MAX(revenue) AS max_revenue FROM drugs WHERE sales_region = 'EU' GROUP BY drug_name LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Lanthanum_Sales (id INT PRIMARY KEY, year INT, country VARCHAR(20), quantity INT, price PER_KG); INSERT INTO Lanthanum_Sales (id, year, country, quantity, price) VALUES (1, 2017, 'Japan', 1200, 10), (2, 2018, 'Japan', 1300, 11), (3, 2019, 'Japan', 1400, 12), (4, 2017, 'China', 1600, 9), (5, 2018, 'China', ... | What is the total revenue generated from selling Lanthanum in Japan from 2017 to 2019? | SELECT SUM(quantity * price) FROM Lanthanum_Sales WHERE country = 'Japan' AND year BETWEEN 2017 AND 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE feedback (citizen_id INT, service_id INT, rating INT); INSERT INTO feedback (citizen_id, service_id, rating) VALUES (1, 123, 5), (2, 123, 4), (3, 123, 5), (4, 123, 3), (5, 123, 5), (6, 123, 1); | Calculate the percentage of citizens who rated service 123 a 5 | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM feedback WHERE service_id = 123)) as percentage FROM feedback WHERE service_id = 123 AND rating = 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_readership (id INT, topic VARCHAR(50), country VARCHAR(50), readership INT); INSERT INTO news_readership (id, topic, country, readership) VALUES (1, 'Politics', 'India', 5000); INSERT INTO news_readership (id, topic, country, readership) VALUES (2, 'Sports', 'India', 3000); | Who are the top 5 most read news topics in India? | SELECT topic, SUM(readership) FROM news_readership WHERE country = 'India' GROUP BY topic ORDER BY SUM(readership) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_name VARCHAR(50), donation_amount DECIMAL(10, 2), donation_date DATE, country VARCHAR(50)); INSERT INTO donations (id, donor_name, donation_amount, donation_date, country) VALUES (1, 'John Doe', 50.00, '2021-01-01', 'USA'); INSERT INTO donations (id, donor_name, donation_amount, do... | What is the average donation amount per country? | SELECT country, AVG(donation_amount) as avg_donation FROM donations GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(255), type VARCHAR(255), price DECIMAL(5,2)); INSERT INTO menus (menu_id, menu_name, type, price) VALUES (1, 'Quinoa Salad', 'Vegetarian', 12.99), (2, 'Margherita Pizza', 'Non-Vegetarian', 9.99), (3, 'Falafel Wrap', 'Vegetarian', 8.99), (4, 'Steak Sandwich', 'Non-Veget... | What is the minimum price of non-vegetarian menu items? | SELECT MIN(price) FROM menus WHERE type = 'Non-Vegetarian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PatientOutcomes (PatientID INT, Condition VARCHAR(50), Therapy VARCHAR(50), Outcome VARCHAR(10)); | What percentage of patients with PTSD have had a positive outcome after CBT therapy? | SELECT 100.0 * SUM(CASE WHEN Outcome = 'positive' THEN 1 ELSE 0 END) / COUNT(*) FROM PatientOutcomes WHERE Condition = 'PTSD' AND Therapy = 'CBT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE gym_memberships(member_id INT, start_date DATE); INSERT INTO gym_memberships(member_id, start_date) VALUES (1, '2022-01-01'); INSERT INTO gym_memberships(member_id, start_date) VALUES (2, '2022-02-01'); INSERT INTO gym_memberships(member_id, start_date) VALUES (3, '2021-12-15'); INSERT INTO gym_memberships... | How many members have a gym membership starting in January? | SELECT COUNT(member_id) FROM gym_memberships WHERE MONTH(start_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensor;CREATE TABLE if not exists biosensor.sensors(id INT, name TEXT, disease_category TEXT);INSERT INTO biosensor.sensors (id, name, disease_category) VALUES (1, 'BiosensorA', 'Infectious Diseases'), (2, 'BiosensorB', 'Cancer'), (3, 'BiosensorC', 'Neurological Disorders'), (4, 'Biosenso... | List the biosensors developed for infectious diseases. | SELECT * FROM biosensor.sensors WHERE disease_category = 'Infectious Diseases'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (metric_id INT, organization VARCHAR(100), metric_value FLOAT, report_date DATE); | Determine the number of threat intelligence metrics reported by each organization in the past year | SELECT organization, COUNT(*) AS num_metrics FROM threat_intelligence WHERE report_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_participation_programs (program_id INT, budget INT, state VARCHAR(20), year INT); INSERT INTO public_participation_programs (program_id, budget, state, year) VALUES (1, 100000, 'New York', 2020), (2, 200000, 'California', 2019), (3, 150000, 'New York', 2020), (4, 50000, 'California', 2020), (5, 2500... | What is the total budget allocated for public participation programs in the state of New York for the year 2020? | SELECT SUM(budget) FROM public_participation_programs WHERE state = 'New York' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT, name VARCHAR(50), habitat_type VARCHAR(50)); CREATE TABLE conservation_status (id INT, species_id INT, status VARCHAR(50), score FLOAT); | List all marine species and their average conservation status score, if available. | SELECT species.name, AVG(score) AS avg_score FROM species LEFT JOIN conservation_status ON species.id = conservation_status.species_id GROUP BY species.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (author_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50)); | Add a new author, 'Ali Al-Ahmad', to the 'authors' table | INSERT INTO authors (first_name, last_name) VALUES ('Ali', 'Al-Ahmad'); | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (id INT, title VARCHAR(100), publication_date DATE, topic VARCHAR(50), publication_country VARCHAR(50)); INSERT INTO news_articles (id, title, publication_date, topic, publication_country) VALUES (1, 'Climate Change: A Growing Crisis', '2022-02-12', 'Climate Change', 'United States'); CREATE ... | What is the total number of articles published about climate change and the minimum age of readers who prefer political news in the United States? | SELECT COUNT(*) FROM news_articles WHERE topic = 'Climate Change' AND publication_country = 'United States' UNION SELECT MIN(age) FROM readers WHERE country = 'United States' AND news_preference = 'Politics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists diplomacy (id INT, event_name VARCHAR(100), country VARCHAR(50), partner_country VARCHAR(50), date DATE); INSERT INTO diplomacy (id, event_name, country, partner_country, date) VALUES (1, 'Military Aid', 'USA', 'Afghanistan', '2001-09-11'); INSERT INTO diplomacy (id, event_name, country, part... | Who is the partner country of the most recent defense agreement of Japan? | SELECT event_name, country, partner_country, date, RANK() OVER(PARTITION BY country ORDER BY date DESC) as recent_rank FROM diplomacy WHERE event_name = 'Defense Agreement' AND country = 'Japan' ORDER BY date DESC FETCH FIRST 1 ROW ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists countries (country_id INT, country VARCHAR(255)); INSERT INTO countries (country_id, country) VALUES (1, 'France'), (2, 'Germany'), (3, 'Italy'); CREATE TABLE if not exists athletes (athlete_id INT, country_id INT, medals INT, sport VARCHAR(255)); INSERT INTO athletes (athlete_id, country_id,... | Which athlete has won the most medals in swimming events in France? | SELECT athlete_id, SUM(medals) FROM athletes WHERE country_id = 1 AND sport = 'Swimming' GROUP BY athlete_id ORDER BY SUM(medals) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (ID INT PRIMARY KEY, Name TEXT, Email TEXT); | Delete the record for the donor with ID 4 | DELETE FROM Donors WHERE ID = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE unfair_outcomes (id INT PRIMARY KEY, algorithm_name VARCHAR(50), outcome VARCHAR(20), bias_type VARCHAR(20), description TEXT); | Delete records in the 'unfair_outcomes' table where the 'outcome' is 'unfavorable' and the 'bias_type' is 'gender' | DELETE FROM unfair_outcomes WHERE outcome = 'unfavorable' AND bias_type = 'gender'; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name TEXT, location TEXT, budget INT); CREATE TABLE donations (id INT, donor_id INT, program_id INT, amount DECIMAL); CREATE TABLE donors (id INT, name TEXT, email TEXT); | Show the total budget for each program, the number of donors who have contributed to the program, and the total amount donated, along with program details. | SELECT programs.name as program_name, COUNT(DISTINCT donors.id) as num_donors, SUM(donations.amount) as total_donation, programs.budget as budget FROM programs INNER JOIN donations ON programs.id = donations.program_id INNER JOIN donors ON donations.donor_id = donors.id GROUP BY programs.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (id INT, name VARCHAR(50), category VARCHAR(50), cost DECIMAL(10,2)); | What is the total cost of ingredients for each menu item? | SELECT name, SUM(cost) as total_cost FROM menu_items GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShow (Id INT, VehicleType VARCHAR(50), Event VARCHAR(100), Horsepower FLOAT); INSERT INTO AutoShow (Id, VehicleType, Event, Horsepower) VALUES (1, 'Electric', '2022 Detroit Auto Show', 350), (2, 'Hybrid', '2022 Detroit Auto Show', 250), (3, 'Gasoline', '2022 Detroit Auto Show', 200), (4, 'Electric', '2... | What is the average horsepower of electric vehicles in the 2022 Detroit Auto Show? | SELECT AVG(Horsepower) FROM AutoShow WHERE VehicleType = 'Electric' AND Event LIKE '%2022 Detroit Auto Show%' | gretelai_synthetic_text_to_sql |
use rural_health; CREATE TABLE facilities (id int, name text, type text, state text); INSERT INTO facilities (id, name, type, state) VALUES (1, 'Rural Hospital A', 'Hospital', 'Alabama'); INSERT INTO facilities (id, name, type, state) VALUES (2, 'Urgent Care B', 'Urgent Care', 'Alabama'); INSERT INTO facilities (id, na... | What is the total number of healthcare facilities in each state? | SELECT state, COUNT(*) as total FROM rural_health.facilities GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_routes (route_id INT, city VARCHAR(50), num_trips INT); INSERT INTO bus_routes (route_id, city, num_trips) VALUES (1, 'Tokyo', 1000), (2, 'Tokyo', 1500), (3, 'Tokyo', 2000); CREATE TABLE train_lines (line_id INT, city VARCHAR(50), num_trips INT); INSERT INTO train_lines (line_id, city, num_trips) VALUE... | What is the total number of public transportation trips taken in Tokyo? | SELECT (SELECT SUM(num_trips) FROM bus_routes WHERE city = 'Tokyo') + (SELECT SUM(num_trips) FROM train_lines WHERE city = 'Tokyo'); | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganicWasteData (country VARCHAR(50), population INT, organic_waste_kg FLOAT); INSERT INTO OrganicWasteData (country, population, organic_waste_kg) VALUES ('Japan', 126317000, 13.4); | What is the average organic waste generation per capita in Japan? | SELECT AVG(organic_waste_kg/population) FROM OrganicWasteData WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (school_id INT, program_name VARCHAR(50), program_type VARCHAR(20)); | List all the unique mental health programs offered by schools in the 'programs' table, sorted alphabetically. | SELECT DISTINCT program_name FROM programs WHERE program_type = 'mental_health' ORDER BY program_name ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher (id INT, name TEXT); INSERT INTO teacher (id, name) VALUES (1, 'John Doe'), (2, 'Jane Smith'); CREATE TABLE course (id INT, name TEXT, teacher_id INT); INSERT INTO course (id, name, teacher_id) VALUES (1, 'Python for Teachers', 1), (2, 'Data Science for Teachers', 1), (3, 'Math for Teachers', 2), (... | How many professional development courses have been completed by each teacher? | SELECT c.teacher_id, COUNT(DISTINCT c.id) AS courses_completed FROM course c GROUP BY c.teacher_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, category VARCHAR(20), quantity INT); INSERT INTO products (product_id, category, quantity) VALUES (1, 'furniture', 25), (2, 'furniture', 50), (3, 'furniture', 75); | Find the maximum quantity of products in the 'furniture' category | SELECT MAX(quantity) FROM products WHERE category = 'furniture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product (product_id INT, name VARCHAR(255), quantity INT, material VARCHAR(255)); INSERT INTO product (product_id, name, quantity, material) VALUES (1, 'Organic Cotton T-Shirt', 30, 'organic cotton'); | What is the total quantity of 'organic cotton' products in the inventory? | SELECT SUM(quantity) FROM product WHERE material = 'organic cotton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_supply_chain (product_id INT, supplier_id INT, recycling_program BOOLEAN); CREATE VIEW recycling_rates_by_country AS SELECT country, AVG(recycling_program) as avg_recycling_rate FROM circular_supply_chain cs JOIN product_transparency pt ON cs.product_id = pt.product_id JOIN supplier_ethics se ON c... | Create a view to show the average recycling rate by country | CREATE VIEW recycling_rates_by_country AS SELECT country, AVG(recycling_program) as avg_recycling_rate FROM circular_supply_chain cs JOIN product_transparency pt ON cs.product_id = pt.product_id JOIN supplier_ethics se ON cs.supplier_id = se.supplier_id GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE xai_datasets (id INT, name VARCHAR(255), description VARCHAR(255)); INSERT INTO xai_datasets (id, name, description) VALUES (1, 'Credit Approval', 'Credit approval dataset for customers with sensitive features'); | Add a new explainable AI dataset 'German Credit' | INSERT INTO xai_datasets (id, name, description) VALUES (2, 'German Credit', 'Credit dataset for individuals with sensitive features'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Movies (movie_id INT, title VARCHAR(255), release_date DATE, genre VARCHAR(255), rating DECIMAL(3,2), user_country VARCHAR(50)); INSERT INTO Movies (movie_id, title, release_date, genre, rating, user_country) VALUES (1, 'Movie1', '2020-01-01', 'Action', 8.5, 'USA'), (2, 'Movie2', '2019-05-15', 'Drama', 7.2... | What is the average movie rating by users from the United States? | SELECT AVG(rating) FROM Movies WHERE user_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, sector VARCHAR(20), amount DECIMAL(10,2)); INSERT INTO investments (id, sector, amount) VALUES (1, 'education', 15000.00), (2, 'healthcare', 20000.00), (3, 'education', 22000.00); | What is the sum of investments made in the healthcare sector? | SELECT SUM(amount) FROM investments WHERE sector = 'healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Permits (PermitID int, Region varchar(20), Date date); INSERT INTO Permits (PermitID, Region, Date) VALUES (1, 'Western', '2022-01-01'), (2, 'Central', '2022-02-01'), (3, 'Western', '2022-03-01'); | Show the building permit data for the last 6 months, for the Western region, and rank the permits by their permit numbers in descending order. | SELECT PermitID, Region, Date, ROW_NUMBER() OVER (PARTITION BY Region ORDER BY Date DESC) as rn FROM Permits WHERE Region = 'Western' AND Date >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecrafts (spacecraft_id INT, name TEXT, observations_jupiter INT); INSERT INTO spacecrafts (spacecraft_id, name, observations_jupiter) VALUES (1, 'Galileo', 1546), (2, 'Juno', 2000), (3, 'Pioneer 10', 20), (4, 'Cassini', 100); CREATE TABLE spacecraft_missions (spacecraft_id INT, mission_id INT); INSERT ... | Calculate the total number of scientific observations conducted by spacecraft on Jupiter. | SELECT SUM(observations_jupiter) FROM spacecrafts sc JOIN spacecraft_missions sm ON sc.spacecraft_id = sm.spacecraft_id JOIN space_missions s ON sm.mission_id = s.mission_id WHERE s.destination = 'Jupiter'; | gretelai_synthetic_text_to_sql |
CREATE TABLE soccer_players (player_id INT, name VARCHAR(50), team VARCHAR(50), goals INT, tournament VARCHAR(50)); INSERT INTO soccer_players (player_id, name, team, goals, tournament) VALUES (1, 'Lionel Messi', 'Argentina', 5, 'FIFA World Cup'); | Which soccer players have scored the most goals in the 2022 FIFA World Cup, sorted by team? | SELECT team, name, SUM(goals) as total_goals FROM soccer_players WHERE tournament = 'FIFA World Cup' AND YEAR(start_date) = 2022 GROUP BY team, name ORDER BY total_goals DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Animals (name VARCHAR(50), species VARCHAR(50), location VARCHAR(50)); INSERT INTO Animals (name, species, location) VALUES ('Moose 1', 'Moose', 'Canadian Wildlife Reserve'), ('Moose 2', 'Moose', 'Canadian Wildlife Reserve'), ('Grizzly Bear 1', 'Grizzly Bear', 'Canadian Wildlife Reserve'); CREATE TABLE Res... | List the names and species of all animals in the Canadian Wildlife Reserve. | SELECT name, species FROM Animals INNER JOIN Reserves ON TRUE WHERE Animals.location = Reserves.location AND Reserves.name = 'Canadian Wildlife Reserve'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultivators (id INT, name TEXT, state TEXT); INSERT INTO cultivators (id, name, state) VALUES (1, 'Cultivator C', 'Oregon'); INSERT INTO cultivators (id, name, state) VALUES (2, 'Cultivator D', 'Oregon'); CREATE TABLE strains (cultivator_id INT, name TEXT, year INT, potency INT, sales INT); INSERT INTO str... | What are the total sales and average potency for each strain produced by cultivators in Oregon in 2019? | SELECT s.name as strain_name, c.state as cultivator_state, SUM(s.sales) as total_sales, AVG(s.potency) as average_potency FROM strains s INNER JOIN cultivators c ON s.cultivator_id = c.id WHERE c.state = 'Oregon' AND s.year = 2019 GROUP BY s.name, c.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT PRIMARY KEY, name VARCHAR(50), age INT, gender VARCHAR(10), location VARCHAR(50), profession VARCHAR(50)); INSERT INTO farmers (id, name, age, gender, location, profession) VALUES (1, 'John Doe', 35, 'Male', 'USA', 'Farmer'), (2, 'Jane Smith', 40, 'Female', 'Canada', 'Farmer'); | Delete the record with id 1 from the 'farmers' table | DELETE FROM farmers WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, founder_gender TEXT, funding_amount INT); INSERT INTO companies (id, name, founder_gender, funding_amount) VALUES (1, 'Acme Inc', 'Female', 5000000); | What is the average funding amount per round for female founders? | SELECT AVG(funding_amount) FROM companies WHERE founder_gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(50), manufacturer VARCHAR(50), mass FLOAT); INSERT INTO Spacecraft (id, name, manufacturer, mass) VALUES (1, 'Voyager 1', 'SpaceCorp', 770.0), (2, 'Voyager 2', 'SpaceCorp', 770.0), (3, 'Galileo', 'NASA', 2223.0), (4, 'Cassini', 'NASA', 5650.0), (5, 'InSight', 'JPL', 358.0),... | What is the total mass of spacecraft that were manufactured by SpaceCorp? | SELECT SUM(Spacecraft.mass) FROM Spacecraft WHERE Spacecraft.manufacturer = 'SpaceCorp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammals (name TEXT, ocean TEXT); | How many marine mammals are found in the Arctic Ocean? | SELECT COUNT(*) FROM marine_mammals WHERE ocean = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_reviews (hotel_id INT, hotel_name TEXT, city TEXT, occupancy_rate DECIMAL, review_count INT); INSERT INTO hotel_reviews (hotel_id, hotel_name, city, occupancy_rate, review_count) VALUES (101, 'Hotel Roma', 'Rome', 0.75, 120), (102, 'Eternal City Inn', 'Rome', 0.85, 200), (103, 'Villa Bella', 'Paris',... | What is the average occupancy rate of hotels in the city of 'Rome' with more than 100 reviews? | SELECT AVG(occupancy_rate) as avg_occupancy_rate FROM hotel_reviews WHERE city = 'Rome' AND review_count > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_escooters (scooter_id INT, trip_duration INT, start_speed INT, end_speed INT, trip_date DATE); INSERT INTO shared_escooters (scooter_id, trip_duration, start_speed, end_speed, trip_date) VALUES (1, 1200, 5, 15, '2022-01-01'), (2, 900, 10, 20, '2022-01-02'); CREATE TABLE city_coordinates (city VARCHA... | What is the average speed of shared e-scooters in New York? | SELECT AVG(end_speed - start_speed) as avg_speed FROM shared_escooters, city_coordinates WHERE city_coordinates.city = 'New York'; | 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.