context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE FireDepartment ( id INT, department VARCHAR(25), city VARCHAR(20), firefighters_count INT); INSERT INTO FireDepartment (id, department, city, firefighters_count) VALUES (1, 'SFFD', 'San Francisco', 1500); INSERT INTO FireDepartment (id, department, city, firefighters_count) VALUES (2, 'FDNY', 'New York', 1... | What is the average number of firefighters per department, per city? | SELECT city, AVG(firefighters_count) OVER (PARTITION BY city) as avg_firefighters FROM FireDepartment; | gretelai_synthetic_text_to_sql |
CREATE TABLE SkincareSuppliers (supplier_id INT, supplier_name VARCHAR(100), address VARCHAR(255), phone VARCHAR(20), product_id INT, cruelty_free BOOLEAN); | List all suppliers of cruelty-free skincare products and their contact information. | SELECT supplier_name, address, phone FROM SkincareSuppliers WHERE cruelty_free = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE ship_details (ship_name VARCHAR(50), current_capacity INT); INSERT INTO ship_details VALUES ('MSC Maya', 19224); INSERT INTO ship_details VALUES ('OOCL Hong Kong', 21413); INSERT INTO ship_details VALUES ('Cosco Shipping Universe', 21914); | What is the current capacity of the container ship 'Cosco Shipping Universe'? | SELECT current_capacity FROM ship_details WHERE ship_name = 'Cosco Shipping Universe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtSales3 (GalleryName TEXT, SaleDate DATE, NumPieces INTEGER); INSERT INTO ArtSales3 (GalleryName, SaleDate, NumPieces) VALUES ('Paris Art Gallery', '2021-01-01', 10), ('Paris Art Gallery', '2021-02-15', 15), ('Paris Art Gallery', '2021-03-20', 20); | What was the total number of art pieces sold at the "Paris Art Gallery" in the first quarter of 2021? | SELECT SUM(NumPieces) FROM ArtSales3 WHERE GalleryName = 'Paris Art Gallery' AND QUARTER(SaleDate) = 1 AND YEAR(SaleDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE PortCall (CallID INT, VesselID INT, PortID INT, CallDateTime DATETIME); INSERT INTO PortCall (CallID, VesselID, PortID, CallDateTime) VALUES (1, 1, 1, '2022-01-01 10:00:00'); INSERT INTO PortCall (CallID, VesselID, PortID, CallDateTime) VALUES (2, 1, 2, '2022-01-03 14:00:00'); | Identify the next port of call for each vessel. | SELECT VesselID, PortID, LEAD(PortID) OVER (PARTITION BY VesselID ORDER BY CallDateTime) as NextPort FROM PortCall; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_production (well_id INT, year INT, production FLOAT); INSERT INTO well_production (well_id, year, production) VALUES (1, 2018, 1500000); INSERT INTO well_production (well_id, year, production) VALUES (2, 2019, 1600000); INSERT INTO well_production (well_id, year, production) VALUES (3, 2018, 1800000); | Find the well with the highest production for each year in the last 5 years | SELECT well_id, year, production FROM (SELECT well_id, year, production, ROW_NUMBER() OVER (PARTITION BY year ORDER BY production DESC) AS rank FROM well_production WHERE year BETWEEN EXTRACT(YEAR FROM CURRENT_DATE)-5 AND EXTRACT(YEAR FROM CURRENT_DATE)) subquery WHERE rank = 1; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists military_equipment_sales;CREATE TABLE if not exists military_equipment_sales_table(supplier text, purchaser text, sale_value integer, sale_year integer);INSERT INTO military_equipment_sales_table(supplier, purchaser, sale_value, sale_year) VALUES('Boeing', 'France', 500, 2019), ('Boeing', 'G... | What is the total value of military equipment sales by Boeing to the European Union countries in 2019? | SELECT SUM(sale_value) FROM military_equipment_sales_table WHERE supplier = 'Boeing' AND purchaser IN ('France', 'Germany', 'United Kingdom') AND sale_year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID int, Name varchar(50), Community varchar(50)); INSERT INTO Customers (CustomerID, Name, Community) VALUES (1, 'John Smith', 'Historically Underrepresented Community'); CREATE TABLE Accounts (AccountID int, CustomerID int, Balance decimal(10,2)); INSERT INTO Accounts (AccountID, Custom... | Display the average account balance of all customers in the database who are members of historically underrepresented communities. | SELECT AVG(A.Balance) FROM Accounts A INNER JOIN Customers C ON A.CustomerID = C.CustomerID WHERE C.Community = 'Historically Underrepresented Community'; | gretelai_synthetic_text_to_sql |
CREATE TABLE soccer_stadiums (stadium_name TEXT, location TEXT, capacity INT, games_hosted INT); CREATE TABLE soccer_attendance (stadium_name TEXT, date TEXT, fans_attended INT); | What is the total number of fans that attended soccer games in the top 3 European countries in 2021? | SELECT s.location, SUM(a.fans_attended) FROM soccer_stadiums s JOIN soccer_attendance a ON s.stadium_name = a.stadium_name WHERE s.location IN ('England', 'Spain', 'Germany') GROUP BY s.location; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, membership_type VARCHAR(50), join_date DATE); INSERT INTO members (member_id, membership_type, join_date) VALUES (1, 'Premium', '2021-01-01'), (2, 'Basic', '2021-02-01'), (3, 'Premium', '2021-03-01'), (4, 'Basic', '2021-04-01'), (5, 'Premium', '2021-05-01'); | Find the earliest join date for members who have a premium membership. | SELECT member_id, join_date FROM members WHERE membership_type = 'Premium' ORDER BY join_date ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INTEGER, vessel_name TEXT, last_inspection_date DATE); CREATE TABLE southern_ocean (region_name TEXT, region_description TEXT); CREATE TABLE inspection_results (inspection_id INTEGER, vessel_id INTEGER, inspection_date DATE, result TEXT); | How many vessels have been inspected for illegal fishing activities in the Southern Ocean in the last 3 years?" | SELECT COUNT(DISTINCT v.vessel_id) FROM vessels v INNER JOIN inspection_results ir ON v.vessel_id = ir.vessel_id INNER JOIN southern_ocean so ON ir.inspection_date >= (CURRENT_DATE - INTERVAL '3 years') AND so.region_name = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_applications (application_id INT, application_category VARCHAR(50), safety_rating DECIMAL(3,2)); INSERT INTO ai_applications (application_id, application_category, safety_rating) VALUES (1, 'Autonomous Vehicles', 0.85), (2, 'Healthcare', 0.92), (3, 'Finance', 0.90), (4, 'Education', 0.80); | What is the average safety rating for each AI application, partitioned by application category, ordered by rating in descending order? | SELECT application_category, AVG(safety_rating) as avg_safety_rating FROM ai_applications GROUP BY application_category ORDER BY avg_safety_rating DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INTEGER, species_name TEXT, ocean_basin TEXT); | What is the total number of marine species in each ocean basin? | SELECT ocean_basin, COUNT(species_id) FROM marine_species GROUP BY ocean_basin; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (project_type VARCHAR(255), carbon_offsets INT); | What is the average carbon offset of projects in the 'carbon_offset_programs' table, grouped by project type? | SELECT project_type, AVG(carbon_offsets) FROM carbon_offset_programs GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_incidents (id INT, incident_date DATE, region VARCHAR(255)); INSERT INTO cybersecurity_incidents (id, incident_date, region) VALUES (1, '2020-01-01', 'European Union'); INSERT INTO cybersecurity_incidents (id, incident_date, region) VALUES (2, '2021-03-15', 'United States'); | What is the total number of cybersecurity incidents reported in the European Union in the last 2 years? | SELECT COUNT(*) AS total_incidents FROM cybersecurity_incidents WHERE region = 'European Union' AND incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE Cyber_Strategies (id INT, name VARCHAR(50), location VARCHAR(20), type VARCHAR(20), budget INT); INSERT INTO Cyber_Strategies (id, name, location, type, budget) VALUES (1, 'Cyber Shield', 'Europe', 'Defense', 7000000); | Which cybersecurity strategies are located in the 'Europe' region from the 'Cyber_Strategies' table? | SELECT * FROM Cyber_Strategies WHERE location = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SiteB (artifact_id INT, artifact_type TEXT); INSERT INTO SiteB (artifact_id, artifact_type) VALUES (1, 'Pottery'), (2, 'Tools'), (3, 'Jewelry'); | List the unique artifact types in 'SiteB'. | SELECT DISTINCT artifact_type FROM SiteB; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers_fl(county VARCHAR(50), state VARCHAR(2), workers INT); INSERT INTO community_health_workers_fl(county, state, workers) VALUES ('Miami-Dade', 'FL', 200), ('Broward', 'FL', 150), ('Palm Beach', 'FL', 120); | Find the number of community health workers by county in Florida. | SELECT county, workers FROM community_health_workers_fl WHERE state = 'FL'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donor (donor_id INT, name VARCHAR(100), country_of_origin VARCHAR(50)); INSERT INTO donor (donor_id, name, country_of_origin) VALUES (1, 'John Doe', 'France'), (2, 'Jane Smith', 'USA'); CREATE TABLE donation (donation_id INT, donor_id INT, amount DECIMAL(10,2)); INSERT INTO donation (donation_id, donor_id,... | What is the average donation amount per donor from 'country_of_origin' France? | SELECT AVG(d.amount) FROM donation d JOIN donor don ON d.donor_id = don.donor_id WHERE don.country_of_origin = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Departments (DepartmentID INT, DepartmentName VARCHAR(50)); CREATE TABLE Students (StudentID INT, StudentName VARCHAR(50), DepartmentID INT); INSERT INTO Students (StudentID, StudentName, DepartmentID) VALUES (1, 'James Lee', 1); INSERT INTO Students (StudentID, StudentName, DepartmentID) VALUES (2, 'Grace... | Create a table that displays the number of students enrolled in each department | CREATE TABLE Department_Enrollment AS SELECT d.DepartmentName, COUNT(s.StudentID) as StudentCount FROM Departments d JOIN Students s ON d.DepartmentID = s.DepartmentID GROUP BY d.DepartmentName; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(50), size FLOAT, ocean VARCHAR(20)); INSERT INTO marine_protected_areas (id, name, size, ocean) VALUES (1, 'Maldives Atolls', 90000, 'Indian'); INSERT INTO marine_protected_areas (id, name, size, ocean) VALUES (2, 'Chagos Marine Protected Area', 640000, 'Indian'... | Calculate the total number of marine protected areas in the Indian Ocean. | SELECT COUNT(*) FROM marine_protected_areas WHERE ocean = 'Indian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_building (id INT, project_id INT, sustainable_practice VARCHAR(255), timeline FLOAT);CREATE TABLE project (id INT, name VARCHAR(255), city VARCHAR(255), state VARCHAR(255)); | What is the total number of sustainable building projects in the state of California, along with their respective timelines? | SELECT sustainable_building.id, project.name, sustainable_building.sustainable_practice, sustainable_building.timeline FROM sustainable_building INNER JOIN project ON sustainable_building.project_id = project.id WHERE project.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount DECIMAL, donation_date DATE); | Find the number of donations and total amount donated by each donor in 'donors' table | SELECT donor_name, COUNT(donation_amount) as num_donations, SUM(donation_amount) as total_donated FROM donors GROUP BY donor_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE GarmentWorkers (id INT, country VARCHAR, minimum_wage DECIMAL); | What is the minimum wage in Bangladesh for garment workers? | SELECT minimum_wage FROM GarmentWorkers WHERE country = 'Bangladesh' ORDER BY minimum_wage ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, financial_capability_score INT, financial_wellbeing_score INT); INSERT INTO customers (id, financial_capability_score, financial_wellbeing_score) VALUES (1, 90, 75), (2, 80, 70), (3, 85, 80), (4, 95, 85); | What is the average financial wellbeing score of customers who have a financial capability score above 85? | SELECT AVG(financial_wellbeing_score) as avg_score FROM customers WHERE financial_capability_score > 85; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_france (recipient_country VARCHAR(255), year INT, amount DECIMAL(10,2)); INSERT INTO climate_finance_france VALUES ('Bangladesh', 2022, 250), ('Pakistan', 2022, 200), ('Nepal', 2022, 150), ('Sri Lanka', 2022, 300); | Which country received the least climate finance from France in 2022? | SELECT recipient_country, MIN(amount) FROM climate_finance_france WHERE donor_country = 'France' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hotels (hotel_id INT, hotel_name VARCHAR(50), country VARCHAR(50)); CREATE TABLE Bookings (booking_id INT, hotel_id INT, booking_amt FLOAT, ota_source BOOLEAN); INSERT INTO Hotels (hotel_id, hotel_name, country) VALUES (1, 'Hotel1', 'CountryY'), (2, 'Hotel2', 'CountryX'); INSERT INTO Bookings (booking_id, ... | What is the total revenue from bookings made through OTAs for hotels in 'CountryY'? | SELECT SUM(booking_amt) FROM Hotels h JOIN Bookings b ON h.hotel_id = b.hotel_id WHERE h.country = 'CountryY' AND ota_source = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(id INT, equipment_name VARCHAR(50), sale_date DATE, country VARCHAR(50), government_agency VARCHAR(50)); INSERT INTO sales VALUES (1, 'Tank', '2020-01-01', 'Russia', 'Ministry of Defense'); | Which military equipment sales contracts were negotiated with the Russian government in 2020? | SELECT sales.equipment_name, sales.sale_date, sales.country, sales.government_agency FROM sales WHERE sales.country = 'Russia' AND YEAR(sale_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), location VARCHAR(50), environmental_impact_score INT); INSERT INTO mining_operations (id, name, location, environmental_impact_score) VALUES (1, 'Mining Operation 1', 'Canada', 80), (2, 'Mining Operation 2', 'Canada', 20); | List all mining operations that have a high environmental impact score in Canada? | SELECT * FROM mining_operations WHERE environmental_impact_score >= 50 AND location = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, founding_date DATE, founding_team TEXT, industry TEXT, total_funding FLOAT); INSERT INTO startups (id, name, founding_date, founding_team, industry, total_funding) VALUES (1, 'Acme Inc', '2010-01-01', 'John, Jane', 'Fintech', 5000000); | What is the total funding raised by startups in the Fintech industry? | SELECT SUM(total_funding) FROM startups WHERE industry = 'Fintech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Field15 (date DATE, temperature FLOAT); INSERT INTO Field15 VALUES ('2021-08-01', 25), ('2021-08-02', 22); CREATE TABLE Field16 (date DATE, temperature FLOAT); INSERT INTO Field16 VALUES ('2021-08-01', 27), ('2021-08-02', 23); | What is the average temperature difference between Field15 and Field16 for each day in the month of August? | SELECT AVG(f15.temperature - f16.temperature) as avg_temperature_difference FROM Field15 f15 INNER JOIN Field16 f16 ON f15.date = f16.date WHERE EXTRACT(MONTH FROM f15.date) = 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops(crop_id INT, name VARCHAR(255), origin VARCHAR(255), type VARCHAR(255)); INSERT INTO crops(crop_id, name, origin, type) VALUES (1, 'Corn', 'USA', 'Grain'), (2, 'Quinoa', 'Bolivia', 'Grain'), (3, 'Rice', 'China', 'Grain'); | Delete all records from 'crops' table where the 'origin' is not 'USA' and 'type' is 'Grain'. | DELETE FROM crops WHERE origin != 'USA' AND type = 'Grain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_trenches (name VARCHAR(50), location VARCHAR(50), avg_depth FLOAT); INSERT INTO ocean_trenches | What is the average depth of all trenches in the Indian Ocean? | SELECT AVG(avg_depth) FROM ocean_trenches WHERE location = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (country_code CHAR(3), country_name VARCHAR(50)); INSERT INTO country VALUES ('CAN', 'Canada'), ('FRA', 'France'), ('DEU', 'Germany'); | What is the average arrival age of visitors for each country? | SELECT country_code, AVG(arrival_age) OVER (PARTITION BY country_code) FROM visitor_stats; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), amount FLOAT); | Add a new record with the name 'Donation 1' and amount 500 into the 'donations' table. | INSERT INTO donations (name, amount) VALUES ('Donation 1', 500); | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id int, factory_country varchar(50), is_ethical boolean, num_workers int, avg_salary decimal(5,2)); | What is the number of workers and their average salary in factories with ethical labor practices, partitioned by country? | SELECT factory_country, COUNT(*) as num_ethical_factories, AVG(num_workers) as avg_num_workers, AVG(avg_salary) as avg_salary FROM factories WHERE is_ethical = true GROUP BY factory_country; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_control_initiatives (initiative_id INT, initiative_name TEXT, status TEXT); | Add a new pollution control initiative with initiative ID 303 and status 'non-compliant'. | INSERT INTO pollution_control_initiatives (initiative_id, initiative_name, status) VALUES (303, 'Initiative Z', 'non-compliant'); | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicUniversities (UniversityID INT, UniversityName VARCHAR(100), State VARCHAR(100)); INSERT INTO PublicUniversities (UniversityID, UniversityName, State) VALUES (1, 'University at Buffalo', 'New York'), (2, 'Binghamton University', 'New York'), (3, 'Stony Brook University', 'New York'); | How many public universities are there in the state of New York, and what are their names? | SELECT COUNT(*) as NumberOfUniversities, UniversityName FROM PublicUniversities WHERE State = 'New York' GROUP BY UniversityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE movie (id INT, title VARCHAR(255), rating DECIMAL(3,2), country VARCHAR(255)); INSERT INTO movie (id, title, rating, country) VALUES (1, 'Movie1', 7.5, 'Canada'), (2, 'Movie2', 8.2, 'USA'), (3, 'Movie3', 6.9, 'Mexico'); | What is the average rating of movies produced in Canada and the USA? | SELECT AVG(rating) FROM movie WHERE country IN ('Canada', 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, name VARCHAR(255));CREATE TABLE employees (id INT, department_id INT, salary INT, hire_date DATE); | What is the total salary expense for each department in 2021? | SELECT d.name, SUM(e.salary) AS salary_expense FROM departments d INNER JOIN employees e ON d.id = e.department_id WHERE e.hire_date >= '2021-01-01' AND e.hire_date < '2022-01-01' GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendee_data (id INT, event_name TEXT, attendee_age INT, event_category TEXT); INSERT INTO attendee_data (id, event_name, attendee_age, event_category) VALUES (1, 'Classical Music Concert', 50, 'Music'), (2, 'Rock Music Festival', 30, 'Music'); | What is the number of attendees at each type of event in the 'music' category, grouped by age range? | SELECT event_category, CASE WHEN attendee_age BETWEEN 18 AND 30 THEN '18-30' WHEN attendee_age BETWEEN 31 AND 50 THEN '31-50' ELSE '51+' END AS age_range, COUNT(*) FROM attendee_data WHERE event_category = 'Music' GROUP BY event_category, age_range; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_stock (id INT, species VARCHAR(50), biomass FLOAT, ocean_name VARCHAR(50)); INSERT INTO fish_stock (id, species, biomass, ocean_name) VALUES (1, 'Sardine', 1500, 'Mediterranean Sea'), (2, 'Anchovy', 2000, 'Mediterranean Sea'), (3, 'Tuna', 3000, 'Mediterranean Sea'); | List the top 3 species with the highest biomass in the Mediterranean Sea. | SELECT species, biomass FROM fish_stock WHERE ocean_name = 'Mediterranean Sea' ORDER BY biomass DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountyJ_Budget (Year INT, Service VARCHAR(20), Budget FLOAT); INSERT INTO CountyJ_Budget (Year, Service, Budget) VALUES (2015, 'Education', 5000000), (2016, 'Education', 5500000), (2017, 'Education', 6000000), (2018, 'Education', 6500000), (2019, 'Education', 7000000), (2020, 'Education', 7500000), (2021, ... | Calculate the average budget allocated to education services in 'CountyJ' for even-numbered years between 2015 and 2022. | SELECT AVG(Budget) FROM CountyJ_Budget WHERE Year BETWEEN 2015 AND 2022 AND Year % 2 = 0 AND Service = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dispensaries (id INT, name TEXT, state TEXT);CREATE TABLE Sales (id INT, dispensary_id INT, sale_amount DECIMAL, sale_date DATE, tax_rate DECIMAL); | What is the sum of taxes collected from dispensaries in California in the last month? | SELECT SUM(S.sale_amount * S.tax_rate) FROM Dispensaries D JOIN Sales S ON D.id = S.dispensary_id WHERE D.state = 'California' AND S.sale_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings.city_energy_consumption (city VARCHAR(50), consumption FLOAT); INSERT INTO green_buildings.city_energy_consumption (city, consumption) VALUES ('London', 5000.0), ('Tokyo', 6000.0), ('Sydney', 7000.0), ('Paris', 8000.0); | Identify the top 3 cities with the highest total energy consumption in the 'green_buildings' schema. | SELECT city, SUM(consumption) AS total_consumption FROM green_buildings.city_energy_consumption GROUP BY city ORDER BY total_consumption DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_preparedness_events (event_id INT, event_name VARCHAR(255), event_date DATE, location VARCHAR(255)); INSERT INTO disaster_preparedness_events (event_id, event_name, event_date, location) VALUES (1001, 'National Night Out', '2023-08-01', 'Central Park'); INSERT INTO disaster_preparedness_events (ev... | Insert a new disaster preparedness event with id 2001, name 'Earthquake Drill', date 2023-09-15, and location 'Los Angeles'. | INSERT INTO disaster_preparedness_events (event_id, event_name, event_date, location) VALUES (2001, 'Earthquake Drill', '2023-09-15', 'Los Angeles'); | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (id INT PRIMARY KEY, name VARCHAR(255), community VARCHAR(255), state VARCHAR(255), added_date DATE); | Which support programs were added in the last quarter for the Latinx community in California? | SELECT name FROM support_programs WHERE community = 'Latinx' AND state = 'California' AND added_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_buildings (city VARCHAR(20), sqft INT, sustainability VARCHAR(20)); INSERT INTO sustainable_buildings (city, sqft, sustainability) VALUES ('San Francisco', 80000, 'Sustainable'); INSERT INTO sustainable_buildings (city, sqft, sustainability) VALUES ('Los Angeles', 90000, 'Sustainable'); | What is the combined square footage of sustainable buildings in San Francisco and Los Angeles? | SELECT SUM(sqft) FROM sustainable_buildings WHERE city IN ('San Francisco', 'Los Angeles'); | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name TEXT, type TEXT, cost FLOAT); INSERT INTO dishes (id, name, type, cost) VALUES (1, 'Quinoa Salad', 'vegetarian', 7.50), (2, 'Chickpea Curry', 'vegetarian', 9.25), (3, 'Beef Stew', 'non-vegetarian', 12.00); | What is the total inventory value of vegetarian dishes? | SELECT SUM(cost) FROM dishes WHERE type = 'vegetarian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SecurityIncidents (id INT, incident_type VARCHAR(255), incident_date DATE); | List all security incidents that involved a firewall in the last quarter. | SELECT * FROM SecurityIncidents WHERE incident_type LIKE '%firewall%' AND incident_date >= DATEADD(quarter, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (donation_id INT, donor_name VARCHAR(50), location VARCHAR(50), amount DECIMAL(10,2)); INSERT INTO Donations (donation_id, donor_name, location, amount) VALUES (1, 'Emily Wong', 'City Library', 75.00); | Update the amount of 'Emily Wong's donation to 100 | UPDATE Donations SET amount = 100 WHERE donor_name = 'Emily Wong'; | gretelai_synthetic_text_to_sql |
CREATE TABLE parcels (id INT, shipped_date DATE, origin VARCHAR(20), destination VARCHAR(20)); INSERT INTO parcels (id, shipped_date, origin, destination) VALUES (1, '2022-02-10', 'Japan', 'Australia'), (2, '2022-02-25', 'Japan', 'Australia'); | What is the total number of parcels shipped from Japan to Australia in February? | SELECT COUNT(*) FROM parcels WHERE origin = 'Japan' AND destination = 'Australia' AND MONTH(shipped_date) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10));CREATE VIEW ESportsEventsView (PlayerID, EventCount, Platform) AS SELECT PlayerID, COUNT(*), GamePlatform FROM ESportsEvents JOIN Games ON ESportsEvents.GameID = Games.GameID GROUP BY PlayerID, GamePlatform; | List all players who have participated in ESports events for a single platform, along with their demographic information. | SELECT p.PlayerID, p.Age, p.Gender FROM Players p INNER JOIN ESportsEventsView ev ON p.PlayerID = ev.PlayerID GROUP BY p.PlayerID HAVING COUNT(DISTINCT ev.Platform) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name VARCHAR(50), description VARCHAR(255)); INSERT INTO campaigns (id, name, description) VALUES (1, 'Hope Rising', 'A campaign to fight depression and promote hope.'); INSERT INTO campaigns (id, name, description) VALUES (2, 'Breaking the Stigma', 'A campaign to break stigma around men... | What are the names of all campaigns that have the word 'hope' in their description, excluding campaigns that also include the word 'stigma' in their description? | SELECT name FROM campaigns WHERE description LIKE '%hope%' AND description NOT LIKE '%stigma%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers_NA (FarmerID INT, Country VARCHAR(20), Gender VARCHAR(10), Indigenous BOOLEAN, Metric FLOAT); INSERT INTO Farmers_NA (FarmerID, Country, Gender, Indigenous, Metric) VALUES (1, 'United States', 'Female', true, 4.1), (2, 'Canada', 'Female', true, 3.5), (3, 'Mexico', 'Male', true, 4.6), (4, 'United St... | What is the average agricultural innovation metric for Indigenous farmers in North America, ranked by country? | SELECT Country, AVG(Metric) as Avg_Metric FROM Farmers_NA WHERE Country IN ('United States', 'Canada', 'Mexico') AND Indigenous = true GROUP BY Country ORDER BY Avg_Metric DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name VARCHAR(20), material VARCHAR(20), quantity INT); INSERT INTO products (id, name, material, quantity) VALUES (1, 'beam', 'steel', 100), (2, 'plate', 'steel', 200), (3, 'rod', 'aluminum', 150), (4, 'foil', 'aluminum', 50); | Show total quantity of raw materials for 'steel' and 'aluminum' products | SELECT SUM(quantity) FROM products WHERE material IN ('steel', 'aluminum'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Directors (DirectorID INT, DirectorName TEXT, Gender TEXT, Country TEXT); INSERT INTO Directors (DirectorID, DirectorName, Gender, Country) VALUES (1, 'Greta Gerwig', 'Female', 'USA'); | What is the total watch time of movies produced by women directors in the US? | SELECT SUM(WatchTime) FROM Movies JOIN Directors ON Movies.DirectorID = Directors.DirectorID WHERE Directors.Gender = 'Female' AND Directors.Country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development(id INT, initiative TEXT, location TEXT, budget INT); INSERT INTO community_development (id, initiative, location, budget) VALUES (1, 'Village Empowerment Program', 'Africa', 50000); | What is the average budget for community development initiatives in 'Africa'? | SELECT AVG(budget) FROM community_development WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (Country VARCHAR(50), Year INT, Temperature DECIMAL(5,2)); INSERT INTO WeatherData (Country, Year, Temperature) VALUES ('Canada', 2020, 5.3), ('Canada', 2019, 4.6), ('Mexico', 2020, 22.1), ('Mexico', 2019, 21.8); | Determine the percentage change in average temperature for each country between 2019 and 2020. | SELECT Country, (AVG(Temperature) - LAG(AVG(Temperature)) OVER (PARTITION BY Country ORDER BY Year)) * 100.0 / LAG(AVG(Temperature)) OVER (PARTITION BY Country ORDER BY Year) as PercentageChange FROM WeatherData GROUP BY Country, Year; | gretelai_synthetic_text_to_sql |
CREATE TABLE account (account_id INT, customer_id INT, state VARCHAR(255), account_balance DECIMAL(10,2)); INSERT INTO account (account_id, customer_id, state, account_balance) VALUES (1, 1, 'Texas', 2000.00), (2, 2, 'Texas', 3000.00); | What is the minimum account balance for customers in Texas? | SELECT MIN(account_balance) FROM account WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation (id INT, project_name VARCHAR(50), country VARCHAR(50), year INT, cost FLOAT); INSERT INTO climate_adaptation (id, project_name, country, year, cost) VALUES (1, 'Flood Protection', 'China', 2015, 10000000); | What is the total cost of climate adaptation projects in Asia for each year since 2015? | SELECT year, SUM(cost) FROM climate_adaptation WHERE country LIKE '%Asia%' GROUP BY year ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE networks (network_id INT, network_name VARCHAR(255), network_type VARCHAR(255), operator VARCHAR(255), creation_time TIMESTAMP); CREATE TABLE network_nodes (node_id INT, node_name VARCHAR(255), network_id INT, algorithm_id INT, operator VARCHAR(255), creation_time TIMESTAMP); CREATE TABLE consensus_algorit... | What is the total number of nodes and the number of unique consensus algorithms for each network? | SELECT n.network_name, COUNT(nn.node_id) as total_nodes, COUNT(DISTINCT ca.algorithm_name) as unique_algorithms FROM networks n JOIN network_nodes nn ON n.network_id = nn.network_id JOIN consensus_algorithms ca ON nn.algorithm_id = ca.algorithm_id GROUP BY n.network_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolicyAdvocacy (PolicyAdvocacyID INT, PolicyName VARCHAR(50), Budget DECIMAL(5,2)); INSERT INTO PolicyAdvocacy (PolicyAdvocacyID, PolicyName, Budget) VALUES (1, 'Accessibility Laws', 5000.00); INSERT INTO PolicyAdvocacy (PolicyAdvocacyID, PolicyName, Budget) VALUES (2, 'Inclusion Programs', 7000.00); | What is the total budget allocated for policy advocacy in the last quarter? | SELECT SUM(Budget) as TotalBudget FROM PolicyAdvocacy WHERE Date BETWEEN DATEADD(quarter, -1, GETDATE()) AND GETDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainability_metrics (id INT, metric VARCHAR(50), value INT, year INT); | What is the total CO2 emissions reduction achieved through sustainable practices? | SELECT SUM(value) FROM sustainability_metrics WHERE metric = 'CO2 emissions reduction' AND year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), products VARCHAR(255)); INSERT INTO suppliers (id, name, products) VALUES (1, 'Green Materials Inc', 'Electric Vehicles'); INSERT INTO suppliers (id, name, products) VALUES (2, 'Sustainable Energy Inc', 'Electric Vehicles'); | What are the names of all suppliers that provide materials for the production of electric vehicles? | SELECT name FROM suppliers WHERE products LIKE '%Electric Vehicles%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mineral_Production_5 (year INT, month INT, samarium_production FLOAT); | What is the average monthly production of Samarium in 2020 from the Mineral_Production_5 table? | SELECT AVG(samarium_production) FROM Mineral_Production_5 WHERE year = 2020 AND month BETWEEN 1 AND 12; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_policing (id INT, city VARCHAR(20), year INT, events INT); | What is the minimum number of community policing events held in the city of Chicago in the year 2021? | SELECT MIN(events) FROM community_policing WHERE city = 'Chicago' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousResearch (project VARCHAR(20), company VARCHAR(20)); INSERT INTO AutonomousResearch (project, company) VALUES ('Tesla Autopilot', 'Tesla'); INSERT INTO AutonomousResearch (project, company) VALUES ('Baidu Apollo', 'Baidu'); | Find the autonomous driving research projects that are conducted by companies from the USA and China. | SELECT project FROM AutonomousResearch WHERE company IN ('Tesla', 'Baidu'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name TEXT, country TEXT);CREATE TABLE shipments (shipment_id INT, shipment_weight INT, ship_date DATE, port_id INT); INSERT INTO ports VALUES (1, 'Port of Oakland', 'USA'), (2, 'Port of Los Angeles', 'USA'); INSERT INTO shipments VALUES (1, 1200, '2023-01-05', 1), (2, 1800, '2023-0... | What is the total weight of containers shipped from the Port of Oakland to the USA in Q1 of 2023? | SELECT SUM(shipment_weight) FROM shipments JOIN ports ON shipments.port_id = ports.port_id WHERE ports.country = 'USA' AND ports.port_name IN ('Port of Oakland', 'Port of Los Angeles') AND ship_date BETWEEN '2023-01-01' AND '2023-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, structure_type VARCHAR(255), seismic_zone INT, cost FLOAT); INSERT INTO projects (id, structure_type, seismic_zone, cost) VALUES (1, 'Building', 3, 350000.0), (2, 'Building', 4, 450000.0), (3, 'Bridge', 2, 700000.0); | What is the sum of costs for building projects in seismic zones 3 and 4? | SELECT SUM(cost) FROM projects WHERE structure_type = 'Building' AND seismic_zone IN (3, 4); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists rural_clinics; use rural_clinics; CREATE TABLE clinics (id int, name varchar(255)); CREATE TABLE doctors (id int, name varchar(255), clinic_id int); | What is the name of clinics and their respective number of doctors in 'rural_clinics' schema? | SELECT c.name, COUNT(d.id) as doctor_count FROM clinics c INNER JOIN doctors d ON c.id = d.clinic_id GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (ID INT PRIMARY KEY, WasteType VARCHAR(50), Sector VARCHAR(50), City VARCHAR(50), Year INT, Quantity DECIMAL(10,2)); INSERT INTO WasteGeneration (ID, WasteType, Sector, City, Year, Quantity) VALUES (1, 'Municipal Solid Waste', 'Commercial', 'Chicago', 2019, 5000.50), (2, 'Plastic', 'Residen... | What was the total waste generated in the city of Chicago in 2019, categorized by waste type? | SELECT WasteType, SUM(Quantity) FROM WasteGeneration WHERE City = 'Chicago' AND Year = 2019 GROUP BY WasteType; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterUsage (Date DATE, Location VARCHAR(50), ResidentialUsage INT, IndustrialUsage INT); INSERT INTO WaterUsage (Date, Location, ResidentialUsage, IndustrialUsage) VALUES ('2022-04-01', 'Los Angeles, CA', 4000000, 6000000), ('2022-04-01', 'San Francisco, CA', 2000000, 3000000); | What is the combined water usage for all locations on a specific date? | SELECT Date, SUM(ResidentialUsage + IndustrialUsage) as TotalUsage FROM WaterUsage GROUP BY Date; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, city VARCHAR(50), response_time FLOAT); INSERT INTO emergency_calls (id, city, response_time) VALUES (1, 'CityA', 6.5), (2, 'CityA', 7.3), (3, 'CityB', 8.1); | What is the average response time for emergency calls in CityA? | SELECT AVG(response_time) FROM emergency_calls WHERE city = 'CityA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE station_usage (user_id INT, station_name VARCHAR(255), usage_date DATE); INSERT INTO station_usage (user_id, station_name, usage_date) VALUES (1, 'Times Square', '2022-03-01'), (2, 'Grand Central', '2022-03-05'), (1, 'Times Square', '2022-03-10'), (3, '34th Street', '2022-03-15'); | List the count of unique users who have used each subway station at least once in the last month. | SELECT station_name, COUNT(DISTINCT user_id) FROM station_usage WHERE usage_date >= DATEADD(month, -1, CURRENT_DATE) GROUP BY station_name | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_change_docs (id INT, title VARCHAR(255), rating FLOAT); INSERT INTO climate_change_docs (id, title, rating) VALUES (1, 'Doc1', 7.8), (2, 'Doc2', 8.5), (3, 'Doc3', 9.0); | What is the minimum rating for any documentary about climate change? | SELECT MIN(rating) FROM climate_change_docs; | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_palmyra (artifact_id INTEGER, site_name TEXT, artifact_type TEXT, age INTEGER); INSERT INTO artifact_palmyra (artifact_id, site_name, artifact_type, age) VALUES (1, 'Palmyra', 'Ceramic', 1500), (2, 'Palmyra', 'Ceramic', 1600), (3, 'Palmyra', 'Ceramic', 1700), (4, 'Palmyra', 'Stone', 2000), (5, 'Pa... | Calculate the average age of 'Ceramic' artifacts from site 'Palmyra'. | SELECT AVG(age) FROM artifact_palmyra WHERE site_name = 'Palmyra' AND artifact_type = 'Ceramic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (project_id INT, name VARCHAR(50), start_date DATE); | Which smart city projects started after 2022? | SELECT * FROM projects WHERE start_date > '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(255)); CREATE TABLE cargo (id INT, port_id INT, cargo_type VARCHAR(255), timestamp TIMESTAMP, weight INT); INSERT INTO ports VALUES (1, 'Port A'), (2, 'Port B'), (3, 'Port C'); INSERT INTO cargo VALUES (1, 1, 'container', '2022-01-01 10:00:00', 20), (2, 2, 'container', '2022-01-... | What is the total cargo handled by each port in the last week? | SELECT p.name, SUM(c.weight) as total_cargo FROM ports p JOIN cargo c ON p.id = c.port_id WHERE c.timestamp >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) GROUP BY p.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), Salary FLOAT); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (1, 'Finance', 85000.00), (2, 'IT', 70000.00), (3, 'Finance', 90000.00); | What is the maximum salary in the finance department? | SELECT MAX(Salary) FROM Employees WHERE Department = 'Finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales (sale_date DATE, customer_country VARCHAR(50), sale_value INT); CREATE TABLE Geopolitical_Risk_Assessments (assessment_date DATE, customer_country VARCHAR(50), risk_score INT); INSERT INTO Military_Equipment_Sales (sale_date, customer_country, sale_value) VALUES ('2020-01-01', 'Rus... | What is the geopolitical risk assessment score for Russia on the date of the latest military equipment sale? | SELECT R.customer_country, MAX(M.sale_date) AS latest_sale_date, R.risk_score AS risk_assessment_score FROM Military_Equipment_Sales M JOIN Geopolitical_Risk_Assessments R ON M.customer_country = R.customer_country WHERE M.sale_date = (SELECT MAX(sale_date) FROM Military_Equipment_Sales) GROUP BY R.customer_country, R.... | gretelai_synthetic_text_to_sql |
CREATE TABLE Trips (TripID INT, Autonomous BOOLEAN, Mode VARCHAR(50)); INSERT INTO Trips (TripID, Autonomous, Mode) VALUES (1, true, 'Ride-Hailing'), (2, false, 'Ride-Hailing'), (3, true, 'Ride-Hailing'), (4, false, 'Bus'), (5, false, 'Subway'), (6, true, 'Ride-Hailing'); | Determine the total number of trips taken by autonomous vehicles | SELECT COUNT(*) as TotalTrips FROM Trips WHERE Autonomous = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, name TEXT, biomass FLOAT, mpa_id INT); | What is the total biomass of all species in marine protected areas deeper than 200m? | SELECT SUM(biomass) FROM marine_species JOIN marine_protected_areas ON marine_species.mpa_id = marine_protected_areas.mpa_id WHERE marine_protected_areas.avg_depth > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT PRIMARY KEY, name VARCHAR(50), species VARCHAR(50), population INT); | Delete the 'Tasmanian Devil' record from the 'animals' table | DELETE FROM animals WHERE name = 'Tasmanian Devil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety_incidents (incident_id INT, incident_date DATE, ai_subfield TEXT, incident_description TEXT); INSERT INTO ai_safety_incidents (incident_id, incident_date, ai_subfield, incident_description) VALUES (1, '2021-01-05', 'Algorithmic Fairness', 'AI system showed bias against certain groups'); INSERT IN... | What is the distribution of AI safety incidents by month for the AI subfield of algorithmic fairness in 2021? | SELECT DATE_PART('month', incident_date) as month, COUNT(*) as incidents FROM ai_safety_incidents WHERE incident_date BETWEEN '2021-01-01' AND '2021-12-31' AND ai_subfield = 'Algorithmic Fairness' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE platforms (platform_id INT, location VARCHAR(255), status VARCHAR(255)); | List all the offshore platforms and their drilling status in the North Sea | SELECT platform_id, location, status FROM platforms WHERE location = 'North Sea' AND platform_id IN (SELECT platform_id FROM wells); | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_practices (id INT PRIMARY KEY, country VARCHAR(50), wage DECIMAL(5,2)); INSERT INTO labor_practices (id, country, wage) VALUES (1, 'Italy', 15.50), (2, 'France', 14.25), (3, 'Germany', 16.75); | What is the average wage in Italy | SELECT AVG(wage) FROM labor_practices WHERE country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(50), founding_year INT, country VARCHAR(50)); INSERT INTO company (id, name, founding_year, country) VALUES (1, 'Acme Inc', 2018, 'USA'), (2, 'Beta Corp', 2019, 'Canada'), (3, 'Gamma Startup', 2015, 'USA'), (4, 'Delta Company', 2017, 'Mexico'); | How many companies have been founded in each country in the last 5 years? | SELECT country, COUNT(*) FROM company WHERE founding_year >= YEAR(CURRENT_DATE) - 5 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name TEXT, location TEXT, biomass FLOAT); INSERT INTO fish_farms (id, name, location, biomass) VALUES (1, 'Farm A', 'Caribbean Sea', 250.5), (2, 'Farm B', 'Caribbean Sea', 300.0), (3, 'Farm C', 'Atlantic Ocean', 200.0); | What is the maximum biomass (kg) of fish in fish farms located in the Caribbean Sea? | SELECT MAX(biomass) FROM fish_farms WHERE location = 'Caribbean Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AgeGroups (PlayerID INT, Age INT, GameType VARCHAR(20)); INSERT INTO AgeGroups (PlayerID, Age, GameType) VALUES (1, 20, 'Adventure'), (2, 25, 'Action'), (3, 30, 'Adventure'), (4, 35, 'Simulation'), (5, 22, 'Adventure'); | How many players are there in each age group for adventure games? | SELECT Age, COUNT(*) FROM AgeGroups WHERE GameType = 'Adventure' GROUP BY Age; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID INT, VesselName VARCHAR(50), MaxSpeed DECIMAL(3,1)); INSERT INTO Vessels (VesselID, VesselName, MaxSpeed) VALUES (1, 'Sea Lion', 28.5), (2, 'Harbor Star', 22.3), (3, 'Ocean Wave', 31.7); | What is the average speed of vessels that have a maximum speed of over 25 knots? | SELECT AVG(MaxSpeed) FROM Vessels WHERE MaxSpeed > 25; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS cybersecurity_sales (solution_id int, cost float, company varchar(30), region varchar(30)); INSERT INTO cybersecurity_sales (solution_id, cost, company, region) VALUES (1, 250000, 'SecureNet', 'Africa'), (2, 300000, 'SecureNet', 'Africa'), (3, 280000, 'SecureNet', 'Africa'); | What is the minimum cost of cybersecurity solutions provided by SecureNet to African countries? | SELECT MIN(cost) FROM cybersecurity_sales WHERE company = 'SecureNet' AND region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, area_size INTEGER, avg_depth REAL, ocean_basin TEXT); | What is the total volume of marine protected areas in the Pacific Ocean? | SELECT SUM(area_size) FROM marine_protected_areas WHERE ocean_basin = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT, country VARCHAR(255), operation VARCHAR(255)); CREATE TABLE defense_diplomacy (id INT, country VARCHAR(255), event VARCHAR(255)); | Which countries have participated in both peacekeeping operations and defense diplomacy events? | SELECT country FROM peacekeeping_operations pkops INNER JOIN defense_diplomacy ddip ON pkops.country = ddip.country GROUP BY country HAVING COUNT(DISTINCT pkops.operation) > 0 AND COUNT(DISTINCT ddip.event) > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID INT, Division VARCHAR(20)); INSERT INTO Customers (CustomerID, Division) VALUES (1, 'Retail Banking'), (2, 'Retail Banking'), (3, 'Corporate Banking'); CREATE TABLE Transactions (TransactionID INT, CustomerID INT, Amount DECIMAL(10,2)); INSERT INTO Transactions (TransactionID, Custome... | Determine the difference between the maximum and minimum transaction amounts for each customer. | SELECT CustomerID, MAX(Amount) - MIN(Amount) as AmountDifference FROM Transactions INNER JOIN Customers ON Transactions.CustomerID = Customers.CustomerID GROUP BY CustomerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS vessel_performance (id INT PRIMARY KEY, vessel_name VARCHAR(255), maximum_speed DECIMAL(5,2)); INSERT INTO vessel_performance (id, vessel_name, maximum_speed) VALUES (1, 'Yamato', 32.7); | List all vessels and their maximum speeds from the 'vessel_performance' table | SELECT vessel_name, maximum_speed FROM vessel_performance; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(255), region VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO projects (id, name, region, budget) VALUES (1, 'Project A', 'Europe', 60000000.00), (2, 'Project B', 'Europe', 40000000.00), (3, 'Project C', 'Asia', 50000000.00); | Which defense projects in the European region have a budget greater than $50 million? | SELECT name as project_name, budget FROM projects WHERE region = 'Europe' AND budget > 50000000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE tram_rides (id INT, route_id INT, timestamp TIMESTAMP, on_time BOOLEAN); CREATE VIEW tram_on_time_summary AS SELECT route_id, COUNT(*) as total_rides, COUNT(on_time) as on_time_rides FROM tram_rides WHERE on_time = true GROUP BY route_id; | What is the on-time percentage of trams in Melbourne? | SELECT 100.0 * AVG(on_time_rides * 1.0 / total_rides) as on_time_percentage FROM tram_on_time_summary; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (project_id INT, animals INT); INSERT INTO habitat_preservation (project_id, animals) VALUES (1, 50), (2, 75), (3, 100); | what is the average number of animals in habitat preservation projects in 2021? | SELECT AVG(animals) FROM habitat_preservation WHERE year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Boeing787Flights (id INT, flight_date DATE, num_passengers INT); | What is the average number of passengers for Boeing 787 Dreamliner flights? | SELECT AVG(num_passengers) FROM Boeing787Flights WHERE num_passengers IS NOT NULL; | 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.