context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Students (student_id INT, department VARCHAR(255)); CREATE TABLE Accommodations (accommodation_id INT, student_id INT, accommodation_type VARCHAR(255)); | What is the maximum number of accommodations provided to a single student? | SELECT MAX(accommodation_count) as max_accommodations FROM ( SELECT student_id, COUNT(accommodation_id) as accommodation_count FROM Accommodations GROUP BY student_id ) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE TheaterPerformances (performanceID INT, attendeeCount INT, performanceDate DATE); INSERT INTO TheaterPerformances (performanceID, attendeeCount, performanceDate) VALUES (1, 120, '2022-03-01'), (2, 80, '2022-02-15'), (3, 150, '2022-01-10'); | What is the maximum number of attendees for any theater performance in the last month? | SELECT MAX(attendeeCount) FROM TheaterPerformances WHERE performanceDate >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Incidents (IncidentID INT, Date DATE, Type VARCHAR(20), Description TEXT, Department VARCHAR(20)); INSERT INTO Incidents (IncidentID, Date, Type, Description, Department) VALUES (1, '2021-05-01', 'Electrical', 'Power distribution failure', 'Avionics'); | Find incidents related to electrical issues in the Avionics department. | SELECT * FROM Incidents WHERE Department = 'Avionics' AND Type = 'Electrical' | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, country TEXT, ethical_practice_score INT); INSERT INTO countries (country_id, country, ethical_practice_score) VALUES (1, 'Italy', 85); INSERT INTO countries (country_id, country, ethical_practice_score) VALUES (2, 'France', 90); INSERT INTO countries (country_id, country, ethica... | Which countries have the most ethical labor practices? | SELECT country, MAX(ethical_practice_score) FROM countries GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (1, 25, 'Male', 'USA'), (2, 30, 'Female', 'Canada'), (3, 22, 'Male', 'Mexico'); CREATE TABLE GamePlay (PlayerID INT, Playtime INT, GamePrice DECIMAL(5, 2)); INSERT INTO Game... | What is the minimum playtime for players who have played games with a price greater than 50, by gender? | SELECT Gender, MIN(Playtime) FROM Players INNER JOIN GamePlay ON Players.PlayerID = GamePlay.PlayerID WHERE GamePrice > 50 GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (contract_id INT, dapp_id INT, contract_name VARCHAR(50), region VARCHAR(50)); CREATE TABLE regulatory_actions (action_id INT, contract_id INT, action_date DATE); | List all smart contracts associated with decentralized applications that have been involved in regulatory actions in the Arctic region. | SELECT s.contract_name FROM smart_contracts s INNER JOIN regulatory_actions r ON s.contract_id = r.contract_id WHERE s.region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterUsage (Id INT PRIMARY KEY, City VARCHAR(255), Usage FLOAT, Date DATE); INSERT INTO WaterUsage (Id, City, Usage, Date) VALUES (1, 'Dallas', 1200, '2022-01-15'); INSERT INTO WaterUsage (Id, City, Usage, Date) VALUES (2, 'Houston', 1500, '2022-01-15'); INSERT INTO WaterUsage (Id, City, Usage, Date) VALUE... | What is the total water usage for cities in Texas on January 15, 2022? | SELECT City, SUM(Usage) FROM WaterUsage WHERE Date = '2022-01-15' AND City IN ('Dallas', 'Houston', 'Austin') GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather ( id INT PRIMARY KEY, location VARCHAR(255), temperature DECIMAL(5,2), measurement_date DATE ); INSERT INTO weather (id, location, temperature, measurement_date) VALUES (1, 'Arctic Ocean', 2.1, '2010-06-01'), (2, 'Arctic Ocean', 3.5, '2010-07-01'), (3, 'Arctic Ocean', 4.2, '2010-08-01'); | What is the average water temperature in the Arctic Ocean for the months of June, July, and August since 2010? | SELECT AVG(temperature) FROM weather WHERE location = 'Arctic Ocean' AND EXTRACT(MONTH FROM measurement_date) IN (6, 7, 8) AND EXTRACT(YEAR FROM measurement_date) >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE ota_bookings (id INT, hotel_id INT, country TEXT, booking_date DATE); INSERT INTO ota_bookings (id, hotel_id, country, booking_date) VALUES (1, 1, 'France', '2021-01-02'), (2, 2, 'Germany', '2021-01-05'), (3, 3, 'Italy', '2021-01-07'), (4, 4, 'Spain', '2022-01-01'), (5, 5, 'France', '2022-01-03'); | What is the total number of OTA bookings in 'Europe' in the last year? | SELECT COUNT(*) FROM ota_bookings WHERE country LIKE 'Europe%' AND booking_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE country_emission_targets (country_name VARCHAR(50), year INT, co2_emission_target DECIMAL(10,2)); | What is the CO2 emission reduction target for each country in 2023? | SELECT country_name, co2_emission_target AS co2_emission_reduction_target_2023 FROM country_emission_targets WHERE year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (country VARCHAR(255), year INT, co2_emission FLOAT); INSERT INTO emissions (country, year, co2_emission) VALUES ('USA', 2020, 5135.32), ('China', 2020, 10098.24), ('India', 2020, 2649.54), ('Russia', 2020, 2496.84), ('Japan', 2020, 1180.52); | What is the average CO2 emission of the top 5 countries in 2020? | SELECT AVG(co2_emission) FROM (SELECT co2_emission FROM emissions WHERE country IN ('USA', 'China', 'India', 'Russia', 'Japan') AND year = 2020 ORDER BY co2_emission DESC LIMIT 5) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShow (id INT, name VARCHAR(255), location VARCHAR(255), country VARCHAR(255), num_vehicles INT); INSERT INTO AutoShow (id, name, location, country, num_vehicles) VALUES (1, 'New York Auto Show', 'New York', 'USA', 1000); | Which auto show has the most vehicles on display? | SELECT name, location, MAX(num_vehicles) FROM AutoShow; | gretelai_synthetic_text_to_sql |
CREATE TABLE facility_metrics (facility TEXT, product_innovation INT); INSERT INTO facility_metrics (facility, product_innovation) VALUES ('Facility1', 75), ('Facility2', 30), ('Facility3', 60); | What are the names of all facilities that have a product innovation metric greater than 50? | SELECT facility FROM facility_metrics WHERE product_innovation > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE RuralHealthFacility11 (id INT, name TEXT, diagnosis TEXT); INSERT INTO RuralHealthFacility11 (id, name, diagnosis) VALUES (1, 'Jamal Brown', 'Asthma'), (2, 'Kimberly Davis', 'Diabetes'); | What is the total number of patients with 'Asthma' or 'Diabetes' in 'RuralHealthFacility11'? | SELECT COUNT(*) FROM RuralHealthFacility11 WHERE diagnosis IN ('Asthma', 'Diabetes'); | gretelai_synthetic_text_to_sql |
CREATE TABLE supply_chain (supplier_name TEXT, safety_score INTEGER); INSERT INTO supply_chain (supplier_name, safety_score) VALUES ('Farm Fresh', 92), ('Green Grocers', 88), ('Local Produce', 95); | Which local_supplier has the highest safety score in the supply_chain table? | SELECT supplier_name, MAX(safety_score) FROM supply_chain; | gretelai_synthetic_text_to_sql |
CREATE TABLE sports (id INT PRIMARY KEY, sport_name VARCHAR(100)); | List all sports types | SELECT sport_name FROM sports; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name VARCHAR(50), region VARCHAR(50), revenue FLOAT); INSERT INTO customers (id, name, region, revenue) VALUES (1, 'John Smith', 'Southeast', 5000), (2, 'Jane Doe', 'Northeast', 7000), (3, 'Bob Johnson', 'Southeast', 6000), (4, 'Alex Brown', 'West', 4000); | What is the total revenue of customers with a name starting with 'J'? | SELECT SUM(revenue) FROM customers WHERE name LIKE 'J%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mesopotamia (artifact_id INT, weight FLOAT, type VARCHAR(255)); | What is the total weight of ceramic artifacts from 'mesopotamia'? | SELECT SUM(weight) FROM mesopotamia WHERE type = 'ceramic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, city VARCHAR(20), visitors INT, exhibition_date DATE); INSERT INTO Exhibitions (id, city, visitors, exhibition_date) VALUES (1, 'Tokyo', 50, '2021-07-01'), (2, 'Tokyo', 60, '2021-07-05'); | What is the most visited exhibition in Tokyo? | SELECT city, MAX(visitors) as max_visitors FROM Exhibitions WHERE city = 'Tokyo' GROUP BY city | gretelai_synthetic_text_to_sql |
CREATE TABLE Cargo (CargoID INT, Name VARCHAR(255), Quantity INT, PortID INT); INSERT INTO Cargo (CargoID, Name, Quantity, PortID) VALUES (2, 'Copper', 6000, 2); | What is the name and quantity of all cargo having a quantity greater than 5000 that is located in a port in Greece? | SELECT Cargo.Name, Cargo.Quantity FROM Cargo INNER JOIN Port ON Cargo.PortID = Port.PortID WHERE Port.Country = 'Greece' AND Cargo.Quantity > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Bike_Sharing (City VARCHAR(50), System_Name VARCHAR(50), Trips INT); INSERT INTO Bike_Sharing (City, System_Name, Trips) VALUES ('Barcelona', 'Bicing', 2000000); INSERT INTO Bike_Sharing (City, System_Name, Trips) VALUES ('Chicago', 'Divvy', 3600000); INSERT INTO Bike_Sharing (City, System_Name, Trips) VAL... | Which city has the highest bike-sharing ridership in millions? | SELECT City, MAX(Trips/1000000) FROM Bike_Sharing GROUP BY City; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseProjects (id INT PRIMARY KEY, project VARCHAR(50), start_date DATE); INSERT INTO DefenseProjects (id, project, start_date) VALUES (1, 'Project B', '2023-01-01'); | Which defense projects have a start date on or after January 1, 2023? | SELECT project FROM DefenseProjects WHERE start_date >= '2023-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (PolicyID INT, Team VARCHAR(20), State VARCHAR(20)); INSERT INTO Policies VALUES (1, 'Team A', 'California'), (2, 'Team B', 'California'), (3, 'Team A', 'Texas'), (4, 'Team C', 'New York'), (5, 'Team A', 'California'); | Which Underwriting team has the most policies in California and Texas? | SELECT Team, COUNT(*) FROM Policies WHERE State IN ('California', 'Texas') GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE RestaurantRevenue(restaurant_id INT, revenue DECIMAL(10,2), revenue_date DATE); | Find the top 3 restaurants with the highest revenue for February 2022. | SELECT restaurant_id, SUM(revenue) FROM RestaurantRevenue WHERE revenue_date BETWEEN '2022-02-01' AND '2022-02-28' GROUP BY restaurant_id ORDER BY SUM(revenue) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE feed_type (feed_id INT, farm_location VARCHAR(255), feed_type VARCHAR(255)); INSERT INTO feed_type (feed_id, farm_location, feed_type) VALUES (1, 'India', 'Pellets'), (2, 'India', 'Flakes'), (3, 'Indonesia', 'Pellets'), (4, 'Indonesia', 'Gel'), (5, 'Malaysia', 'Flakes'), (6, 'Malaysia', 'Gel'); | Identify the distinct types of aquatic feed used in fish farms in India, Indonesia, and Malaysia. | SELECT DISTINCT feed_type FROM feed_type WHERE farm_location IN ('India', 'Indonesia', 'Malaysia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_by_region (id INT, region VARCHAR(50), sale_date DATE, sales DECIMAL(10,2)); CREATE VIEW region_sales AS SELECT region, EXTRACT(MONTH FROM sale_date) as sale_month, SUM(sales) as total_sales FROM sales_by_region GROUP BY region, sale_month; | What is the revenue for each region by month? | SELECT r.region, rs.sale_month, SUM(rs.total_sales) as total_sales FROM regions r JOIN region_sales rs ON r.name = rs.region GROUP BY r.region, rs.sale_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer (customer_id INT, first_name VARCHAR(50), last_name VARCHAR(50), state VARCHAR(50)); INSERT INTO customer (customer_id, first_name, last_name, state) VALUES (1, 'John', 'Doe', 'NY'), (2, 'Jane', 'Smith', 'NJ'); CREATE TABLE transactions (transaction_id INT, customer_id INT, transaction_date DATE, ... | What are the transaction dates and types for all customers from New York? | SELECT transaction_date, transaction_type FROM transactions INNER JOIN customer ON transactions.customer_id = customer.customer_id WHERE customer.state = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_attendees (program_id INT, attendee_id INT); INSERT INTO program_attendees (program_id, attendee_id) VALUES (1, 1), (2, 3), (3, 4), (5, 6); | List all programs without any attendees | SELECT p.name FROM programs p WHERE p.id NOT IN (SELECT program_id FROM program_attendees); | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, gender VARCHAR(10)); CREATE TABLE workouts (workout_id INT, member_id INT, date DATE); INSERT INTO members VALUES (1,'Female'),(2,'Male'),(3,'Female'); INSERT INTO workouts VALUES (1,1,'2022-01-01'),(2,1,'2022-01-02'),(3,2,'2022-01-03'),(4,3,'2022-01-04'),(5,3,'2022-01-05'); | What is the total number of workouts performed by male members? | SELECT COUNT(*) FROM workouts JOIN members ON workouts.member_id = members.member_id WHERE members.gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE geological_survey (mine_id INT, country TEXT, x_coordinate INT, y_coordinate INT, geological_feature TEXT); INSERT INTO geological_survey (mine_id, country, x_coordinate, y_coordinate, geological_feature) VALUES (1, 'Canada', 10, 20, 'Granite'), (1, 'Canada', 12, 22, 'Quartz'), (2, 'Mexico', 15, 25, 'Shale... | List the geological survey information for each mine, including the mine name, coordinates, and geological features, and group the results by country. | SELECT m.mine_name, gs.country, gs.x_coordinate, gs.y_coordinate, gs.geological_feature FROM geological_survey gs JOIN mines m ON gs.mine_id = m.mine_id GROUP BY gs.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE instructors (id INT, name VARCHAR(50), country VARCHAR(50), expertise VARCHAR(50)); INSERT INTO instructors (id, name, country, expertise) VALUES (1, 'John Doe', 'Canada', 'AI'), (2, 'Jane Smith', 'USA', 'Data Science'), (3, 'Alice Johnson', 'UK', 'Machine Learning'); | Delete all records from the 'instructors' table where 'expertise' is 'Machine Learning' | DELETE FROM instructors WHERE expertise = 'Machine Learning'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_virtual_tours (hotel_id INT, city VARCHAR(50), rating FLOAT); INSERT INTO hotel_virtual_tours (hotel_id, city, rating) VALUES (1, 'Tokyo', 4.6), (2, 'Tokyo', 4.4), (3, 'Tokyo', 4.2); | What percentage of hotel virtual tours in Tokyo have a rating above 4.5? | SELECT city, PERCENTAGE() OVER (PARTITION BY city) as rating_percentage FROM hotel_virtual_tours WHERE rating > 4.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE geothermal_plants (id INT, name VARCHAR(50), location VARCHAR(50), energy_efficiency_rating FLOAT); INSERT INTO geothermal_plants (id, name, location, energy_efficiency_rating) VALUES (1, 'Geothermal Plant 1', 'Country A', 0.75); INSERT INTO geothermal_plants (id, name, location, energy_efficiency_rating) ... | What is the maximum energy efficiency rating for geothermal power plants in the energy_efficiency schema? | SELECT MAX(energy_efficiency_rating) FROM energy_efficiency.geothermal_plants; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, program_name VARCHAR(20), volunteer_hours INT, volunteer_date DATE); INSERT INTO Volunteers (id, program_name, volunteer_hours, volunteer_date) VALUES (1, 'program_x', 5, '2022-04-01'); INSERT INTO Volunteers (id, program_name, volunteer_hours, volunteer_date) VALUES (2, 'program_y', 3,... | What is the maximum number of volunteer hours for 'program_x' in '2023'? | SELECT MAX(volunteer_hours) FROM Volunteers WHERE program_name = 'program_x' AND YEAR(volunteer_date) = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE billing (attorney_id INT, client_id INT, hours FLOAT, rate FLOAT); INSERT INTO billing (attorney_id, client_id, hours, rate) VALUES (1, 101, 10, 300), (2, 102, 8, 350), (3, 103, 12, 250); | Find the attorney with the lowest billing rate in the 'billing' table? | SELECT attorney_id, MIN(rate) FROM billing; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, school_id INT, mental_health_score INT); | What is the minimum mental health score per school that has more than 50 students? | SELECT school_id, MIN(mental_health_score) as min_score FROM students GROUP BY school_id HAVING COUNT(student_id) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, age INT, has_insurance BOOLEAN, has_diabetes BOOLEAN); INSERT INTO patients (id, age, has_insurance, has_diabetes) VALUES (1, 55, false, true), (2, 45, true, false); CREATE TABLE locations (id INT, region VARCHAR, is_rural BOOLEAN); INSERT INTO locations (id, region, is_rural) VALUES (1, ... | Find the number of patients without health insurance in each rural region. | SELECT locations.region, COUNT(patients.id) FROM patients INNER JOIN locations ON patients.id = locations.id WHERE locations.is_rural = true AND patients.has_insurance = false GROUP BY locations.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_grants (id INT, department VARCHAR(255), amount FLOAT); INSERT INTO research_grants (id, department, amount) VALUES (1, 'Computer Science', 100000), (2, 'Computer Science', 200000), (3, 'Statistics', 150000), (4, 'Philosophy', 250000); | What is the average number of research grants awarded per department in the 'research_grants' table, excluding departments with less than 2 grants? | SELECT AVG(grant_count) FROM (SELECT department, COUNT(*) AS grant_count FROM research_grants GROUP BY department HAVING COUNT(*) >= 2) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE SatelliteOrbits (SatelliteID INT, OrbitType VARCHAR(50), OrbitHeight INT); INSERT INTO SatelliteOrbits (SatelliteID, OrbitType, OrbitHeight) VALUES (101, 'LEO', 500), (201, 'MEO', 8000), (301, 'GEO', 36000), (401, 'LEO', 600), (501, 'MEO', 10000); | What is the minimum, maximum, and average orbit height for each orbit type, based on the SatelliteOrbits table? | SELECT OrbitType, MIN(OrbitHeight) AS MinHeight, MAX(OrbitHeight) AS MaxHeight, AVG(OrbitHeight) AS AvgHeight FROM SatelliteOrbits GROUP BY OrbitType; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, city VARCHAR(20), num_sites INT); INSERT INTO heritage_sites (id, city, num_sites) VALUES (1, 'Buenos Aires', 3), (2, 'Rio de Janeiro', 4), (3, 'Sydney', 2), (4, 'Buenos Aires', 5), (5, 'Rio de Janeiro', 3); | How many heritage sites are in 'Buenos Aires' and 'Rio de Janeiro'? | SELECT city, SUM(num_sites) FROM heritage_sites GROUP BY city HAVING city IN ('Buenos Aires', 'Rio de Janeiro'); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founding_year INT, founder_race TEXT); INSERT INTO startups (id, name, founding_year, founder_race) VALUES (1, 'Delta Tech', 2020, 'African American'); INSERT INTO startups (id, name, founding_year, founder_race) VALUES (2, 'Epsilon LLC', 2018, 'Asian'); | How many startups were founded in 2020 by underrepresented racial or ethnic groups? | SELECT COUNT(*) FROM startups WHERE founding_year = 2020 AND founder_race IN ('African American', 'Hispanic', 'Native American', 'Pacific Islander'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Scores_India (id INT, country VARCHAR(50), score INT); INSERT INTO Scores_India (id, country, score) VALUES (1, 'India', 70), (2, 'India', 75); CREATE TABLE Accommodations_India (id INT, country VARCHAR(50), type VARCHAR(50)); INSERT INTO Accommodations_India (id, country, type) VALUES (1, 'India', 'Eco-Fr... | What is the total number of eco-friendly accommodations in India and their average sustainability scores? | SELECT AVG(Scores_India.score) FROM Scores_India INNER JOIN Accommodations_India ON Scores_India.country = Accommodations_India.country WHERE Accommodations_India.type = 'Eco-Friendly' AND Scores_India.country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseContracts (contract_id INT, state VARCHAR(255), year INT, value FLOAT); INSERT INTO DefenseContracts (contract_id, state, year, value) VALUES (1, 'Texas', 2019, 1500000), (2, 'Texas', 2018, 800000), (3, 'Florida', 2019, 1200000); | List all defense contracts signed in Texas in 2019 with a value greater than 1000000. | SELECT * FROM DefenseContracts WHERE state = 'Texas' AND year = 2019 AND value > 1000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (id INT, project_name VARCHAR(50), sector VARCHAR(50), start_date DATE, end_date DATE, budget FLOAT); INSERT INTO rural_infrastructure (id, project_name, sector, start_date, end_date, budget) VALUES (1, 'Precision Farming Initiative', 'Agriculture', '2017-04-01', '2020-12-31', 500000); | What are the names of all rural infrastructure projects that started before '2018'? | SELECT project_name FROM rural_infrastructure WHERE start_date < '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_efforts (effort_id INT, effort_name VARCHAR(50), location VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO conservation_efforts (effort_id, effort_name, location, start_date, end_date) VALUES (2, 'Mediterranean Protection', 'Mediterranean Sea', '2010-01-01', '2030-12-31'); | Identify conservation efforts in the Mediterranean Sea. | SELECT * FROM conservation_efforts WHERE location = 'Mediterranean Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(50), material VARCHAR(50)); INSERT INTO suppliers (supplier_id, supplier_name, material) VALUES (1, 'Supplier E', 'recycled metal'), (2, 'Supplier F', 'organic wool'), (3, 'Supplier G', 'organic wool'), (4, 'Supplier H', 'recycled plastic'); | List all suppliers that provide recycled metal and organic wool materials. | SELECT supplier_name FROM suppliers WHERE material IN ('recycled metal', 'organic wool') GROUP BY supplier_name HAVING COUNT(DISTINCT material) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Traffic_Violations (ID INT, Gender VARCHAR(10), Violation VARCHAR(20)); INSERT INTO Traffic_Violations (ID, Gender, Violation) VALUES (1, 'Male', 'Traffic Violation'), (2, 'Female', 'Misdemeanor'); | What is the total number of traffic violations and misdemeanors committed by gender? | SELECT Gender, COUNT(*) FROM Traffic_Violations GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmA (country VARCHAR(20), species VARCHAR(20), biomass FLOAT); INSERT INTO FarmA (country, species, biomass) VALUES ('Norway', 'Salmon', 450000); INSERT INTO FarmA (country, species, biomass) VALUES ('Norway', 'Trout', 120000); INSERT INTO FarmA (country, species, biomass) VALUES ('Scotland', 'Salmon', 3... | What is the total biomass of salmon and trout farmed in Norway and Scotland? | SELECT SUM(biomass) FROM FarmA WHERE (country='Norway' AND species IN ('Salmon', 'Trout')) UNION ALL SELECT SUM(biomass) FROM FarmA WHERE country='Scotland' AND species IN ('Salmon', 'Trout'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, name TEXT, program_category TEXT); | Delete a volunteer | DELETE FROM Volunteers WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE onshore_wells (well_id INT, location VARCHAR(255), drill_date DATE); INSERT INTO onshore_wells (well_id, location, drill_date) VALUES (1, 'Texas', '2011-01-01'); INSERT INTO onshore_wells (well_id, location, drill_date) VALUES (2, 'Oklahoma', '2009-01-01'); | List all onshore wells in Texas that were drilled after 2010. | SELECT * FROM onshore_wells WHERE location = 'Texas' AND drill_date > '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (city VARCHAR(20), year INT, total_waste_gen FLOAT); INSERT INTO waste_generation (city, year, total_waste_gen) VALUES ('Denver', 2022, 300000), ('Austin', 2022, 290000), ('Dallas', 2022, 280000); | Which city generated the least waste in the year 2022? | SELECT city, MIN(total_waste_gen) FROM waste_generation GROUP BY year HAVING year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_age_groups (id INT, age_group VARCHAR(50), volunteer_date DATE, volunteer_hours FLOAT); INSERT INTO volunteer_age_groups (id, age_group, volunteer_date, volunteer_hours) VALUES (1, '18-24', '2022-01-01', 5.0), (2, '25-34', '2022-02-14', 8.0), (3, '35-44', '2022-03-25', 10.0); | What was the total number of volunteers by age group in Q1 2022? | SELECT age_group, COUNT(*) FROM volunteer_age_groups WHERE YEAR(volunteer_date) = 2022 AND MONTH(volunteer_date) BETWEEN 1 AND 3 GROUP BY age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE audience_demographics (article_id INT, audience_age INT, gender VARCHAR(20), location VARCHAR(100)); | Update the 'gender' column to 'Not Specified' for all records in the 'audience_demographics' table where 'gender' is null | UPDATE audience_demographics SET gender = 'Not Specified' WHERE gender IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (property_id INT, price FLOAT, neighborhood VARCHAR(255)); INSERT INTO properties (property_id, price, neighborhood) VALUES (1, 500000, 'Eco Village'); INSERT INTO properties (property_id, price, neighborhood) VALUES (2, 600000, 'Green Meadows'); | What is the average property price in eco-friendly neighborhoods? | SELECT AVG(price) FROM properties JOIN neighborhoods ON properties.neighborhood = neighborhoods.name WHERE neighborhoods.eco_friendly = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_materials (project_id INT, material_name TEXT, cost FLOAT); INSERT INTO green_materials (project_id, material_name, cost) VALUES (1, 'solar panels', 15000.0), (1, 'smart glass', 25000.0), (2, 'wind turbines', 30000.0), (2, 'geothermal systems', 40000.0); | What is the average cost of green building materials for projects in the 'smart_cities' schema? | SELECT AVG(cost) FROM green_materials WHERE project_id IN (SELECT project_id FROM projects WHERE schema_name = 'smart_cities') AND material_name = 'green building materials'; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_metrics (member_id INT, weight_loss_pounds FLOAT, last_checked DATE); INSERT INTO health_metrics (member_id, weight_loss_pounds, last_checked) VALUES (1, 3, '2021-01-15'), (2, 7, '2022-03-28'); | What is the total weight loss in pounds for members who have lost weight since they joined? | SELECT SUM(weight_loss_pounds) FROM health_metrics JOIN members ON health_metrics.member_id = members.member_id WHERE health_metrics.weight_loss_pounds > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (movie_id INT, movie_title VARCHAR(100), release_year INT, country VARCHAR(50), director_id INT); CREATE TABLE directors (director_id INT, director_name VARCHAR(50), director_gender VARCHAR(10)); INSERT INTO movies (movie_id, movie_title, release_year, country, director_id) VALUES (1, 'Gladiator', 2... | What is the percentage of movies directed by women in each country? | SELECT country, ROUND(100.0 * COUNT(CASE WHEN d.director_gender = 'Female' THEN 1 END) / COUNT(*), 2) as percentage_female_directors FROM movies m INNER JOIN directors d ON m.director_id = d.director_id GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (Code TEXT, Name TEXT, Continent TEXT); INSERT INTO Country (Code, Name, Continent) VALUES ('CN', 'China', 'Asia'), ('AU', 'Australia', 'Australia'), ('US', 'United States', 'North America'), ('IN', 'India', 'Asia'); CREATE TABLE ProductionCountry (Year INT, Country TEXT, Element TEXT, Quantity INT... | Identify the top 2 countries with the highest total production of Dysprosium in 2021 and their respective production amounts. | SELECT Country, SUM(Quantity) FROM ProductionCountry WHERE Element = 'Dysprosium' AND Year = 2021 GROUP BY Country ORDER BY SUM(Quantity) DESC FETCH FIRST 2 ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(50), birthdate DATE);CREATE TABLE artworks (id INT, title VARCHAR(50), artist_id INT, creation_date DATE); INSERT INTO artists (id, name, birthdate) VALUES (1, 'Artemisia Gentileschi', '1593-07-08'); INSERT INTO artworks (id, title, artist_id, creation_date) VALUES (1, 'Judith... | How many artworks were created by female artists from the 17th century? | SELECT COUNT(a.id) FROM artists a INNER JOIN artworks ar ON a.id = ar.artist_id WHERE a.birthdate <= '1600-12-31' AND a.gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE haircare_sales (product_id INT, product_name VARCHAR(255), sale_price DECIMAL(10,2), is_cruelty_free BOOLEAN, country VARCHAR(255)); CREATE TABLE products (product_id INT, product_name VARCHAR(255), category VARCHAR(255)); INSERT INTO haircare_sales (product_id, product_name, sale_price, is_cruelty_free, c... | What percentage of cruelty-free haircare products are sold in the UK? | SELECT (COUNT(haircare_sales.product_id) * 100.0 / (SELECT COUNT(*) FROM haircare_sales WHERE country = 'UK')) AS percentage FROM haircare_sales INNER JOIN products ON haircare_sales.product_id = products.product_id WHERE haircare_sales.is_cruelty_free = true AND products.category = 'Haircare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE officers (officer_id INT, first_name VARCHAR(20), last_name VARCHAR(20)); INSERT INTO officers (officer_id, first_name, last_name) VALUES (1, 'John', 'Smith'), (2, 'Jane', 'Doe'), (3, 'Mike', 'Johnson'); | Update the 'officers' table: change the first_name to 'Officer' for records with last_name 'Smith' | UPDATE officers SET first_name = 'Officer' WHERE last_name = 'Smith'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GrantTypes (GrantID int, GrantType varchar(20), GrantAmount decimal(10,2)); INSERT INTO GrantTypes (GrantID, GrantType, GrantAmount) VALUES (1, 'Operational', 20000.00), (2, 'Programmatic', 30000.00), (3, 'Operational', 15000.00); | What is the distribution of grants by type? | SELECT GrantType, COUNT(GrantID) AS GrantCount FROM GrantTypes GROUP BY GrantType; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_hours (hour_id INT, volunteer_id INT, hour_date DATE, hours FLOAT); INSERT INTO volunteer_hours (hour_id, volunteer_id, hour_date, hours) VALUES (1, 1, '2021-01-01', 5.00), (2, 2, '2021-02-01', 10.00); | What is the total number of hours volunteered by volunteers from the 'healthcare' sector in the year 2021? | SELECT SUM(hours) FROM volunteer_hours INNER JOIN volunteers ON volunteer_hours.volunteer_id = volunteers.volunteer_id WHERE volunteers.sector = 'healthcare' AND YEAR(hour_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Innovation (project VARCHAR(255), budget INT, sponsor VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO Innovation (project, budget, sponsor, start_date, end_date) VALUES ('Stealth Technology', 20000000, 'NATO', '2018-01-01', '2022-12-31'); | What is the total budget allocated for military innovation projects by NATO in the last 5 years? | SELECT SUM(budget) FROM Innovation WHERE sponsor = 'NATO' AND start_date >= DATE(NOW()) - INTERVAL 5 YEAR; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalHeritageSites (name VARCHAR(50), location VARCHAR(20), year INT); | What is the total number of cultural heritage sites in Spain that were built before the year 1800? | SELECT COUNT(*) FROM CulturalHeritageSites WHERE location = 'Spain' AND year < 1800; | gretelai_synthetic_text_to_sql |
CREATE TABLE transit_fleet (fleet_id INT, manufacturer TEXT, vehicle_type TEXT); INSERT INTO transit_fleet (fleet_id, manufacturer, vehicle_type) VALUES (1, 'Manufacturer A', 'Bus'), (2, 'Manufacturer B', 'Bus'); | List the number of buses in the fleet by manufacturer | SELECT manufacturer, COUNT(*) FROM transit_fleet WHERE vehicle_type = 'Bus' GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE Music_Artists (id INT, name VARCHAR(100), genre VARCHAR(50), country VARCHAR(50)); INSERT INTO Music_Artists (id, name, genre, country) VALUES (1, 'BTS', 'K-Pop', 'South Korea'); INSERT INTO Music_Artists (id, name, genre, country) VALUES (2, 'Blackpink', 'K-Pop', 'South Korea'); | Delete all records from the 'Music_Artists' table with a genre of 'K-Pop'. | DELETE FROM Music_Artists WHERE genre = 'K-Pop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest (id INT, name TEXT, region TEXT, avg_carbon_tonnes FLOAT); | What is the average carbon sequestration in metric tons for the forests in the temperate region? | SELECT AVG(avg_carbon_tonnes) FROM forest WHERE region = 'temperate'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bike_trips (id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, trip_city VARCHAR(50), trip_user_age INT); | Find the number of bike-share trips in May 2022 for users over 65 in Madrid | SELECT EXTRACT(MONTH FROM trip_start_time) AS month, COUNT(*) AS num_trips | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, content TEXT, post_date DATE); INSERT INTO posts (id, user_id, content, post_date) VALUES (1, 1, 'Hello World', '2021-12-31'), (2, 1, 'I love data', '2022-01-01'); | Delete all posts with the word 'Python' in the content made before 2022-01-01 | DELETE FROM posts WHERE content LIKE '%Python%' AND post_date < '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, mining_type VARCHAR(255), country VARCHAR(255), co2_emissions FLOAT, operation_date DATE); INSERT INTO mining_operations (id, mining_type, country, co2_emissions, operation_date) VALUES (1, 'open pit', 'Canada', 500, '2021-01-01'), (2, 'underground', 'Canada', 700, '2021-02-01'),... | What is the average CO2 emissions per day for mining operations in Canada, for the past year, partitioned by the mining type? | SELECT mining_type, AVG(co2_emissions / DATEDIFF(day, operation_date, GETDATE())) as avg_co2_emissions_per_day FROM mining_operations WHERE country = 'Canada' AND operation_date >= DATEADD(year, -1, GETDATE()) GROUP BY mining_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolarBears(region VARCHAR(255), population_size FLOAT); | What is the total number of polar bears in each Arctic region? | SELECT region, SUM(population_size) FROM PolarBears GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (well_id INT, date DATE, quantity FLOAT, state VARCHAR(2)); INSERT INTO production (well_id, date, quantity, state) VALUES (1, '2021-01-01', 100.0, 'PA'), (1, '2021-01-02', 120.0, 'PA'), (2, '2021-01-01', 150.0, 'OK'); | Get the daily production for the past week for wells in the Marcellus Shale | SELECT well_id, date, quantity FROM production p JOIN wells w ON p.well_id = w.id WHERE w.state = 'PA' AND p.date >= DATEADD(day, -7, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, name VARCHAR(100), location VARCHAR(50), carbon_offset FLOAT, region VARCHAR(10)); INSERT INTO green_buildings (id, name, location, carbon_offset, region) VALUES (1, 'Green Building A', 'Sydney', 500.3, 'Oceania'); INSERT INTO green_buildings (id, name, location, carbon_offset, reg... | Show green building projects in 'Oceania' and their carbon offsets | SELECT name, carbon_offset FROM green_buildings WHERE region = 'Oceania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_attendance (fan_id INT, game_date DATE); | Find the number of unique fans who attended games in the last 30 days | SELECT COUNT(DISTINCT fan_id) FROM fan_attendance WHERE game_date >= CURDATE() - INTERVAL 30 DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidification (region TEXT, level FLOAT); INSERT INTO ocean_acidification (region, level) VALUES ('Arctic Ocean', 7.9), ('Atlantic Ocean', 8.1), ('Indian Ocean', 8.0), ('Pacific Ocean', 8.2); | Which regions have the highest and lowest ocean acidification levels? | SELECT region, level FROM (SELECT region, level, RANK() OVER (ORDER BY level DESC) AS rank FROM ocean_acidification) AS ranked_ocean_acidification WHERE rank = 1 OR rank = (SELECT COUNT(*) FROM ocean_acidification) | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (id INT, name VARCHAR(50), agency VARCHAR(50), status VARCHAR(10)); INSERT INTO SpaceMissions (id, name, agency, status) VALUES (1, 'Ares 1', 'NASA', 'failed'), (2, 'Artemis 1', 'ISA', 'success'), (3, 'Apollo 11', 'NASA', 'success'); | How many space missions were successfully completed by 'ISA'? | SELECT COUNT(*) FROM SpaceMissions WHERE agency = 'ISA' AND status = 'success'; | gretelai_synthetic_text_to_sql |
CREATE TABLE exit_strategies (id INT, company_id INT, type TEXT); INSERT INTO exit_strategies (id, company_id, type) VALUES (1, 1, 'IPO'); | Add a new exit strategy for a company: acquisition. | INSERT INTO exit_strategies (id, company_id, type) VALUES (2, 1, 'acquisition'); | gretelai_synthetic_text_to_sql |
CREATE TABLE CARGO (ID INT, VESSEL_ID INT, CARGO_NAME VARCHAR(50), WEIGHT INT); | Delete records of cargo with a name containing 'oil' from the CARGO table | DELETE FROM CARGO WHERE CARGO_NAME LIKE '%oil%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_min_depths (name VARCHAR(255), basin VARCHAR(255), depth FLOAT); INSERT INTO marine_species_min_depths (name, basin, depth) VALUES ('Species1', 'Atlantic', 123.45), ('Species2', 'Pacific', 567.89), ('Species3', 'Indian', 345.67), ('Species4', 'Atlantic', 789.10); | What is the minimum depth reached by any marine species in the Indian basin? | SELECT MIN(depth) as min_depth FROM marine_species_min_depths WHERE basin = 'Indian'; | gretelai_synthetic_text_to_sql |
SAME AS ABOVE | What is the total salary cost for employees who identify as non-binary and work in the HR department? | SELECT SUM(Employees.Salary) FROM Employees WHERE Gender = 'Non-binary' AND Department = 'HR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donor_id INT, region VARCHAR(20), donation_amount INT); INSERT INTO donations VALUES (1, 'Northeast', 500), (1, 'Northeast', 600), (2, 'Northeast', 700), (3, 'Midwest', 200), (3, 'Midwest', 300), (3, 'Midwest', 400), (4, 'South', 1000), (4, 'South', 1500), (4, 'South', 2000), (5, 'West', 50), (5... | Identify the top 2 regions with the highest total donation amount, excluding regions with less than 5 donations. | SELECT region, SUM(donation_amount) FROM donations GROUP BY region HAVING COUNT(*) >= 5 ORDER BY SUM(donation_amount) DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Usage (id INT, ingredient VARCHAR(20), quantity INT, usage_date DATE); INSERT INTO Usage (id, ingredient, quantity, usage_date) VALUES (1, 'Quinoa', 50, '2022-01-01'), (2, 'Rice', 75, '2022-01-02'); | What is the maximum quantity of a sustainable ingredient used in a week? | SELECT ingredient, MAX(quantity) FROM Usage WHERE usage_date >= DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY) AND ingredient IN ('Quinoa', 'Rice', 'Pasta') GROUP BY ingredient; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (StudentID INT PRIMARY KEY, MentalHealthScreening DATE); INSERT INTO Students (StudentID, MentalHealthScreening) VALUES (1, '2022-02-10'); | What is the percentage of students who have completed a mental health screening in the last month? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Students)) AS Percentage FROM Students WHERE MentalHealthScreening >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, sale_date DATE, quantity INT, price DECIMAL(5,2)); CREATE TABLE products (product_id INT, product_name VARCHAR(100), category VARCHAR(50), is_organic BOOLEAN, country VARCHAR(50)); | How many units of organic skincare products are sold in the EU in the last quarter? | SELECT SUM(quantity) FROM sales JOIN products ON sales.product_id = products.product_id WHERE products.category = 'Skincare' AND products.is_organic = TRUE AND sales.sale_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 3 MONTH) AND products.country IN ('DE', 'FR', 'IT', 'ES', 'PL', 'NL'); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name TEXT, rating FLOAT, country TEXT); INSERT INTO products (product_id, name, rating, country) VALUES (1, 'Shirt', 4.5, 'Italy'); INSERT INTO products (product_id, name, rating, country) VALUES (2, 'Pants', 4.2, 'France'); | What is the average rating of products produced in Italy? | SELECT AVG(rating) FROM products WHERE country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE oceanography (id INT PRIMARY KEY, location VARCHAR(255), depth INT, salinity DECIMAL(5,2), temperature DECIMAL(5,2)); | Delete all records from the oceanography table where the depth is less than 2000 meters | DELETE FROM oceanography WHERE depth < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (id INT, model VARCHAR(255), flight_time FLOAT); INSERT INTO aircraft (id, model, flight_time) VALUES (1, '747', 450.3), (2, '777', 396.8), (3, '787', 402.5); | What was the average flight time for each aircraft model? | SELECT model, AVG(flight_time) avg_flight_time FROM aircraft GROUP BY model; | gretelai_synthetic_text_to_sql |
CREATE TABLE MenuItems (MenuItemID int, RestaurantID int, CuisineType varchar(255), Price decimal(5,2), PriceDate date); INSERT INTO MenuItems (MenuItemID, RestaurantID, CuisineType, Price, PriceDate) VALUES (1, 1, 'Italian', 12.99, '2021-01-01'), (2, 2, 'Mexican', 8.99, '2021-02-01'), (3, 3, 'Chinese', 10.99, '2021-03... | What is the average price of menu items for each cuisine type in the past year? | SELECT R.CuisineType, AVG(MI.Price) as AvgPrice FROM Restaurants R INNER JOIN MenuItems MI ON R.RestaurantID = MI.RestaurantID WHERE MI.PriceDate >= DATEADD(year, -1, GETDATE()) GROUP BY R.CuisineType; | gretelai_synthetic_text_to_sql |
CREATE TABLE inspections (id INT, restaurant_id INT, region VARCHAR(50), safety_score INT); CREATE VIEW region_safety AS SELECT restaurant_id, AVG(safety_score) as avg_safety FROM inspections GROUP BY restaurant_id; | What is the average food safety score for restaurants in each region? | SELECT r.region, AVG(i.safety_score) as avg_safety FROM inspections i JOIN region_safety rs ON i.restaurant_id = rs.restaurant_id JOIN restaurants r ON i.restaurant_id = r.id GROUP BY r.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (state VARCHAR(2), recycling_rate DECIMAL(4,2)); INSERT INTO recycling_rates (state, recycling_rate) VALUES ('US', 35.01), ('CA', 50.03), ('NY', 25.10); | What is the minimum recycling rate in the state of New York? | SELECT MIN(recycling_rate) FROM recycling_rates WHERE state = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_revenue (region TEXT, revenue FLOAT); INSERT INTO tourism_revenue (region, revenue) VALUES ('Japan', 2000000), ('USA', 3000000); | Find the total revenue of sustainable tourism in Japan. | SELECT SUM(revenue) FROM tourism_revenue WHERE region = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (id INT, policy_number TEXT, city TEXT, state TEXT); INSERT INTO policies (id, policy_number, city, state) VALUES (1, 'P1234', 'New York', 'NY'); INSERT INTO policies (id, policy_number, city, state) VALUES (2, 'P5678', 'New York', 'NY'); INSERT INTO policies (id, policy_number, city, state) VALUE... | Find the total number of policies issued in 'New York' and 'Texas'? | SELECT COUNT(*) FROM policies WHERE state IN ('NY', 'TX'); | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections(restaurant VARCHAR(255), score INT, city VARCHAR(255)); INSERT INTO food_safety_inspections(restaurant, score, city) VALUES ('Restaurant1', 95, 'New York'), ('Restaurant2', 85, 'Los Angeles'), ('Restaurant3', 90, 'New York'), ('Restaurant4', 92, 'San Francisco'), ('Restaurant5', 88,... | What is the minimum food safety score for restaurants in New York? | SELECT MIN(score) FROM food_safety_inspections WHERE city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT PRIMARY KEY, date DATE, is_published BOOLEAN); INSERT INTO articles (id, date, is_published) VALUES (1, '2022-01-01', true), (2, '2022-02-01', false), (3, '2022-03-01', true), (4, '2022-04-01', true), (5, '2023-01-01', false); | Show the number of articles published per month in 2022 | SELECT MONTH(date), COUNT(*) FROM articles WHERE YEAR(date) = 2022 AND is_published = true GROUP BY MONTH(date); | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, title VARCHAR(255), rating FLOAT, release_year INT, country VARCHAR(50), genre VARCHAR(50)); INSERT INTO tv_shows (id, title, rating, release_year, country, genre) VALUES (1, 'Show1', 8.5, 2010, 'Canada', 'Comedy'), (2, 'Show2', 8.2, 2012, 'Canada', 'Drama'), (3, 'Show3', 6.8, 2015, 'Cana... | List the titles and release years of the TV shows produced in Canada and have a rating of 8 or higher, categorized by genre? | SELECT title, release_year, genre FROM tv_shows WHERE rating >= 8 AND country = 'Canada' GROUP BY title, release_year, genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicTransit (Province VARCHAR(255), Service VARCHAR(255)); INSERT INTO PublicTransit (Province, Service) VALUES ('Alberta', 'Calgary Transit'), ('British Columbia', 'TransLink'), ('Ontario', 'Toronto Transit Commission'), ('Quebec', 'Société de transport de Montréal'), ('Alberta', 'Edmonton Transit Servi... | How many public transportation services are available in each province, and what is their ranking based on availability? | SELECT Province, Service, ROW_NUMBER() OVER (PARTITION BY Province ORDER BY Service) AS Rank FROM PublicTransit; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID int, ProgramName varchar(50), StartDate date, EndDate date); CREATE TABLE ProgramFinancials (ProgramID int, Year int, Amount float); | Which programs had the highest and lowest total financial impact in the last fiscal year? | SELECT ProgramName, CASE WHEN Amount = (SELECT MAX(Amount) FROM ProgramFinancials WHERE Year = (SELECT EXTRACT(YEAR FROM MIN(StartDate)) FROM Programs)) THEN 'Highest' ELSE 'Lowest' END AS FinancialImpact FROM Programs JOIN ProgramFinancials ON Programs.ProgramID = ProgramFinancials.ProgramID WHERE Year = (SELECT EXTRA... | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovations (id INT PRIMARY KEY, innovation VARCHAR(255), year INT, country VARCHAR(255)); | Create a table named 'military_innovations' | CREATE TABLE military_innovations (id INT PRIMARY KEY, innovation VARCHAR(255), year INT, country VARCHAR(255)); | gretelai_synthetic_text_to_sql |
CREATE TABLE yearly_incidents (year INT, incidents INT); INSERT INTO yearly_incidents (year, incidents) VALUES (2018, 26), (2019, 30), (2020, 29); | Find the year with the most safety incidents | SELECT year, MAX(incidents) FROM yearly_incidents; | 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.