context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE MicrofinanceLoans (institution_name VARCHAR(50), loan_year INT, loan_amount DECIMAL(10,2), region VARCHAR(50)); | What were the average socially responsible loan amounts issued by microfinance institutions in South Asia, grouped by institution and year, for loans issued between 2017 and 2021? | SELECT institution_name, AVG(loan_amount) as avg_loan_amount, loan_year FROM MicrofinanceLoans WHERE region = 'South Asia' AND loan_year BETWEEN 2017 AND 2021 GROUP BY institution_name, loan_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (id INT, name VARCHAR(255), type VARCHAR(255)); INSERT INTO Restaurants (id, name, type) VALUES (1, 'FancyBistro', 'FineDining'), (2, 'BudgetEats', 'CasualDining'); CREATE TABLE Menu (id INT, restaurant_id INT, dish VARCHAR(255), calories INT); INSERT INTO Menu (id, restaurant_id, dish, calorie... | What is the average calorie count for dishes served in 'FineDining' restaurants? | SELECT AVG(calories) FROM Menu WHERE restaurant_id IN (SELECT id FROM Restaurants WHERE type = 'FineDining'); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, location TEXT, founder_race TEXT, funding_amount INT); INSERT INTO startups (id, name, location, founder_race, funding_amount) VALUES (1, 'Startup A', 'USA', 'African American', 3000000); INSERT INTO startups (id, name, location, founder_race, funding_amount) VALUES (2, 'Startu... | What is the total funding amount for startups founded by people from underrepresented racial or ethnic groups in the USA? | SELECT SUM(funding_amount) FROM startups WHERE location = 'USA' AND founder_race IN ('African American', 'Hispanic', 'Native American', 'Pacific Islander'); | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends (element VARCHAR(2), quarter INT, year INT, price DECIMAL(5,2)); INSERT INTO market_trends VALUES ('Y', 2, 2022, 30.5), ('Er', 2, 2022, 55.3), ('Y', 2, 2022, 31.2); | What was the average market price for Y and Er in Q2 2022? | SELECT AVG(price) as avg_price FROM market_trends WHERE element IN ('Y', 'Er') AND quarter = 2 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT, dish_name TEXT, calories INT); INSERT INTO dishes (dish_id, dish_name, calories) VALUES (1, 'Pizza', 1200), (2, 'Spaghetti', 1000), (3, 'Salad', 500), (4, 'Sushi', 800), (5, 'Burger', 750); | Show the name and total calories of the dishes that have more than 700 calories | SELECT dish_name, SUM(calories) FROM dishes GROUP BY dish_name HAVING SUM(calories) > 700; | gretelai_synthetic_text_to_sql |
CREATE TABLE stores (store_id INT, country VARCHAR(50), supply_chain VARCHAR(20)); INSERT INTO stores (store_id, country, supply_chain) VALUES (1, 'USA', 'circular'), (2, 'Canada', 'linear'), (3, 'Mexico', 'circular'), (4, 'Brazil', 'circular'); | Which countries have the most stores with circular supply chains? | SELECT country, COUNT(*) as store_count FROM stores WHERE supply_chain = 'circular' GROUP BY country ORDER BY store_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE beauty_products (manufacturing_country VARCHAR(20), sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO beauty_products (manufacturing_country, sale_date, revenue) VALUES ('US', '2021-04-01', 200.00), ('Canada', '2021-04-01', 150.00); | What was the total revenue for beauty products made in the US in Q2 2021? | SELECT SUM(revenue) FROM beauty_products WHERE manufacturing_country = 'US' AND sale_date BETWEEN '2021-04-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (order_id INT PRIMARY KEY, customer_id INT, menu_id INT, order_date DATETIME, quantity INT); CREATE TABLE Menu (menu_id INT PRIMARY KEY, menu_item VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2), region VARCHAR(255)); | What is the total quantity of dishes sold in each region in 2022? | SELECT Menu.region, SUM(Orders.quantity) as total_quantity FROM Orders INNER JOIN Menu ON Orders.menu_id = Menu.menu_id WHERE EXTRACT(YEAR FROM Orders.order_date) = 2022 GROUP BY Menu.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (Employee_ID INT, First_Name VARCHAR(20), Last_Name VARCHAR(20), Department VARCHAR(20), Salary DECIMAL(10,2), Date_Hired DATE); CREATE VIEW Youngest_Employee AS SELECT Employee_ID, First_Name, Last_Name, Department, Salary, Date_Hired FROM Employees WHERE Date_Hired = (SELECT MIN(Date_Hired) FRO... | Who is the youngest employee in the Sales department? | SELECT * FROM Youngest_Sales_Employee; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_farms (name TEXT, capacity INTEGER, country TEXT); INSERT INTO solar_farms (name, capacity, country) VALUES ('Solar Farm 1', 200, 'Germany'), ('Solar Farm 2', 100, 'France'), ('Solar Farm 3', 300, 'Spain'); | Which countries have solar farms with a capacity greater than 150 MW? | SELECT DISTINCT country FROM solar_farms WHERE capacity > 150 | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccinations (id INT, rural BOOLEAN, vaccinated BOOLEAN); INSERT INTO vaccinations (id, rural, vaccinated) VALUES (1, true, true), (2, false, false), (3, true, false); | What is the percentage of unvaccinated children in rural areas? | SELECT COUNT(*) * 100.0 / (SELECT COUNT(*) FROM vaccinations WHERE rural = true) FROM vaccinations WHERE rural = true AND vaccinated = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE certifications (id INT, name TEXT, organization TEXT); INSERT INTO certifications (id, name, organization) VALUES (1, 'MSC', 'Marine Stewardship Council'), (2, 'ASC', 'Aquaculture Stewardship Council'), (3, 'BAP', 'Best Aquaculture Practices'); | List all sustainable seafood certifications and their respective organization names. | SELECT name, organization FROM certifications; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), product_type VARCHAR(20), halal_certified BOOLEAN); INSERT INTO products (product_id, product_name, product_type, halal_certified) VALUES (1, 'moisturizer', 'skincare', true), (2, 'cleanser', 'skincare', false), (3, 'sunscreen', 'skincare', true), (4, 'to... | Show the number of skincare products that are both organic and halal certified | SELECT COUNT(*) FROM products WHERE product_type = 'skincare' AND halal_certified = true AND product_name LIKE 'organic%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_landfill_capacity (country VARCHAR(20), year INT, capacity INT); INSERT INTO country_landfill_capacity (country, year, capacity) VALUES ('India', 2023, 500000), ('China', 2023, 750000), ('USA', 2023, 1000000); | What is the landfill capacity for 'India' in 2023? | SELECT country, capacity FROM country_landfill_capacity WHERE country = 'India' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE service_workers (id INT, name VARCHAR(255), state VARCHAR(255), industry VARCHAR(255), salary DECIMAL(10,2)); INSERT INTO service_workers (id, name, state, industry, salary) VALUES (1, 'James White', 'Texas', 'service', 30000.00), (2, 'Emily Green', 'Florida', 'service', 32000.00); | Which state has the lowest average salary for workers in the 'service' industry? | SELECT state, AVG(salary) FROM service_workers WHERE industry = 'service' GROUP BY state ORDER BY AVG(salary) ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, year INT, restorative_justice BOOLEAN); | How many cases were resolved using restorative justice practices in the cases table in 2021? | SELECT COUNT(*) FROM cases WHERE restorative_justice = TRUE AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE CargoTransport(TransportID INT, VesselID INT, CargoWeight INT, TransportDate DATETIME); INSERT INTO CargoTransport(TransportID, VesselID, CargoWeight, TransportDate) VALUES (4, 6, 12000, '2021-05-05 14:30:00'), (5, 6, 18000, '2021-05-20 11:00:00'); | What is the total cargo weight transported by Vessel6 in May 2021? | SELECT SUM(CargoWeight) FROM CargoTransport WHERE VesselID = 6 AND TransportDate BETWEEN '2021-05-01' AND '2021-05-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EVs (Type VARCHAR(20), Country VARCHAR(20), Rating INT); INSERT INTO EVs VALUES ('Tesla Model 3', 'Norway', 140), ('Nissan Leaf', 'Norway', 120), ('Audi e-Tron', 'Norway', 130), ('Volvo XC40 Recharge', 'Norway', 145); | What is the average energy efficiency rating for electric vehicles (EVs) sold in Norway? | SELECT Type, AVG(Rating) AS Avg_Rating FROM EVs WHERE Country = 'Norway' GROUP BY Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGamePlay (PlayerID int, PlayerName varchar(50), Day varchar(15), Playtime int); INSERT INTO PlayerGamePlay (PlayerID, PlayerName, Day, Playtime) VALUES (1, 'Player1', 'Monday', 120), (2, 'Player2', 'Tuesday', 150), (3, 'Player3', 'Wednesday', 180), (4, 'Player4', 'Thursday', 100), (5, 'Player5', 'Fri... | What is the total playtime for each player, pivoted by day of the week? | SELECT PlayerName, SUM(Monday) as MondayPlaytime, SUM(Tuesday) as TuesdayPlaytime, SUM(Wednesday) as WednesdayPlaytime, SUM(Thursday) as ThursdayPlaytime, SUM(Friday) as FridayPlaytime, SUM(Saturday) as SaturdayPlaytime, SUM(Sunday) as SundayPlaytime FROM (SELECT PlayerName, CASE Day WHEN 'Monday' THEN Playtime ELSE 0 ... | gretelai_synthetic_text_to_sql |
CREATE TABLE communities (name VARCHAR(255), education_programs INT); INSERT INTO communities (name, education_programs) VALUES ('village_1', 3); INSERT INTO communities (name, education_programs) VALUES ('village_2', 5); | Which communities have held the most education programs about tiger conservation? | SELECT name FROM communities ORDER BY education_programs DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, name VARCHAR(255), region VARCHAR(255), avg_annual_rainfall FLOAT); | Average annual rainfall in forests of the Amazon Basin. | SELECT AVG(avg_annual_rainfall) FROM forests WHERE region = 'Amazon Basin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Facility(Id INT, Name VARCHAR(50), Location VARCHAR(50)); CREATE TABLE SafetyProtocol(Id INT, Name VARCHAR(50), FacilityId INT, ImplementationDate DATE); | Which safety protocols were implemented in the first quarter of 2022 by each facility? | SELECT f.Name, QUARTER(s.ImplementationDate) AS Quarter, YEAR(s.ImplementationDate) AS Year, s.Name AS ProtocolName FROM SafetyProtocol s JOIN Facility f ON s.FacilityId = f.Id WHERE YEAR(s.ImplementationDate) = 2022 AND QUARTER(s.ImplementationDate) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnvironmentalImpact (Site VARCHAR(255), CO2Emissions INT, WaterUsage INT, WasteGeneration INT, ReportDate DATE, Country VARCHAR(255)); | What is the maximum waste generation per site for South African mining operations in 2019? | SELECT Site, MAX(WasteGeneration) as MaxWasteGeneration FROM EnvironmentalImpact WHERE ReportDate BETWEEN '2019-01-01' AND '2019-12-31' AND Country = 'South Africa' GROUP BY Site; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Name VARCHAR(50), Specialty VARCHAR(50), MentalHealthParity BOOLEAN); INSERT INTO CommunityHealthWorkers (WorkerID, Name, Specialty, MentalHealthParity) VALUES (1, 'John Doe', 'Mental Health', TRUE); INSERT INTO CommunityHealthWorkers (WorkerID, Name, Specialty, Mental... | How many community health workers have not received mental health parity training? | SELECT COUNT(*) FROM CommunityHealthWorkers WHERE MentalHealthParity = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE EventCategories (event VARCHAR(100), category VARCHAR(50), year INT); | What is the total number of eSports events in the 'Puzzle' category that took place in 2020 or 2021? | SELECT COUNT(*) FROM EventCategories WHERE category = 'Puzzle' AND year IN (2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_healthcare (name VARCHAR(255), type VARCHAR(255), location VARCHAR(255)); | Insert a new record into 'rural_healthcare' table with name 'Rural Mental Health Clinic', type 'Clinic', and location 'Desert Region' | INSERT INTO rural_healthcare (name, type, location) VALUES ('Rural Mental Health Clinic', 'Clinic', 'Desert Region'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Facilities (name VARCHAR(255), chemical VARCHAR(255), environmental_impact_score INT); INSERT INTO Facilities (name, chemical, environmental_impact_score) VALUES ('Facility A', 'Acetone', 60), ('Facility B', 'Ammonia', 90), ('Facility C', 'Chloroform', 75), ('Facility D', 'Ethanol', 50); | Which facilities handle chemicals with an environmental impact score higher than 80? | SELECT name FROM Facilities WHERE environmental_impact_score > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (id INT, genre VARCHAR(255), revenue DECIMAL(5,2)); | What is the total revenue for each game genre in the last quarter? | SELECT genre, SUM(revenue) FROM games WHERE revenue IS NOT NULL AND purchase_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH) GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists individuals (id INT, country VARCHAR(50), is_financially_capable BOOLEAN, age INT, gender VARCHAR(10)); | What is the number of financially capable individuals in each country? | SELECT country, COUNT(*) FROM individuals WHERE is_financially_capable = TRUE GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accidents (id INT, year INT, accident_type VARCHAR(50)); CREATE VIEW AviationAccidents AS SELECT * FROM Accidents WHERE accident_type = 'aviation'; | How many accidents occurred in the aviation industry per year? | SELECT AviationAccidents.year, COUNT(*) as num_accidents FROM AviationAccidents GROUP BY AviationAccidents.year ORDER BY AviationAccidents.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_actors (actor VARCHAR(50), incident_count INT, incident_date DATE); INSERT INTO threat_actors (actor, incident_count, incident_date) VALUES ('Actor A', 20, '2023-01-01'), ('Actor B', 15, '2023-01-02'), ('Actor C', 12, '2023-01-03'), ('Actor A', 18, '2023-01-04'), ('Actor B', 10, '2023-01-05'); | List all the unique threat actors involved in incidents that occurred in the last 6 months, sorted by the number of incidents each actor was involved in. | SELECT actor, incident_count FROM threat_actors WHERE incident_date >= DATEADD(month, -6, GETDATE()) GROUP BY actor ORDER BY SUM(incident_count) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendee_demographics (attendee_id INT, attendee_name VARCHAR(50), attendee_age INT); INSERT INTO attendee_demographics (attendee_id, attendee_name, attendee_age) VALUES (1, 'Jane Smith', 25), (2, 'Michael Johnson', 17), (3, 'Sophia Rodriguez', 16), (4, 'David Kim', 22); CREATE TABLE event_attendance (atte... | Delete the record of an attendee with ID 4 from the event_attendance table. | DELETE FROM event_attendance WHERE attendee_id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE IntelligenceGatheringOperations (operation_name VARCHAR(100), operation_type VARCHAR(50), location VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO IntelligenceGatheringOperations (operation_name, operation_type, location, start_date, end_date) VALUES ('Operation Red Tiger', 'Surveillance', 'Asia'... | What are the latest intelligence gathering operations in the 'IntelligenceGatheringOperations' table? | SELECT operation_name, operation_type, location, start_date, end_date FROM IntelligenceGatheringOperations ORDER BY start_date DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (item_code varchar(5), warehouse_id varchar(5), quantity int); INSERT INTO inventory (item_code, warehouse_id, quantity) VALUES ('E01', 'DEL', 1000), ('E02', 'DEL', 1100); | What is the number of items in warehouse 'DEL'? | SELECT COUNT(DISTINCT item_code) FROM inventory WHERE warehouse_id = 'DEL'; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_organizations (id INT, name VARCHAR(50), country VARCHAR(50), articles_published INT); INSERT INTO news_organizations (id, name, country, articles_published) VALUES (1, 'Org1', 'Africa', 1000), (2, 'Org2', 'Europe', 1500), (3, 'Org3', 'Asia', 2000); | Who are the top 3 news organizations in Africa in terms of articles published in 2021? | SELECT name, country, articles_published FROM news_organizations WHERE country = 'Africa' ORDER BY articles_published DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE JobApplications (ApplicationID INT, ApplicantID INT, JobCategory VARCHAR(50), ApplicationDate DATE); | What is the number of job applicants by job category, for the last 12 months? | SELECT JobCategory, COUNT(DISTINCT ApplicantID) FROM JobApplications WHERE ApplicationDate >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH) GROUP BY JobCategory; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_status (customer_id INT, status VARCHAR(10)); INSERT INTO customer_status (customer_id, status) VALUES (1, 'Basic'), (2, 'Premium'), (3, 'Basic'), (4, 'Premium'); CREATE TABLE transactions_4 (transaction_id INT, customer_id INT, amount DECIMAL(10, 2), success BOOLEAN); INSERT INTO transactions_4 (... | What is the total value of all successful transactions for customers with a "Premium" status? | SELECT SUM(amount) FROM transactions_4 t JOIN customer_status cs ON t.customer_id = cs.customer_id WHERE cs.status = 'Premium' AND t.success = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE TaxiRides (id INT, city VARCHAR(255), ride_type VARCHAR(255), ride_date DATE); CREATE TABLE TaxiServices (id INT, city VARCHAR(255), service_type VARCHAR(255), revenue DECIMAL(10, 2)); | What is the total number of accessible taxi rides in Moscow in 2022? | SELECT COUNT(*) FROM TaxiRides TR INNER JOIN TaxiServices TS ON TR.city = TS.city WHERE TR.city = 'Moscow' AND TR.ride_type = 'Accessible' AND YEAR(ride_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, name VARCHAR(255), major VARCHAR(255), gpa DECIMAL(3,2)); | List the names and GPAs of all students in the "students" table. | SELECT name, gpa FROM students; | gretelai_synthetic_text_to_sql |
CREATE TABLE sites (site_id INT, state VARCHAR(2), num_workers INT, acres FLOAT); | Update the 'acres' column for mining sites located in 'MT' in the 'sites' table. | UPDATE sites SET acres = acres * 1.2 WHERE state = 'MT'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS public_transport;CREATE TABLE IF NOT EXISTS public_transport.bike_share (station_name TEXT, num_bikes_available INTEGER);INSERT INTO public_transport.bike_share (station_name, num_bikes_available) VALUES ('Station A', 15), ('Station B', 8), ('Station C', 23); | Find the number of bicycles available in each station of the 'bike_share' system | SELECT station_name, num_bikes_available FROM public_transport.bike_share; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildings (id INT, name VARCHAR(50), city VARCHAR(50), state VARCHAR(50), country VARCHAR(50), certification VARCHAR(50), certification_rating INT); INSERT INTO GreenBuildings (id, name, city, state, country, certification, certification_rating) VALUES (4, 'SakuraEco', 'Tokyo', 'Tokyo', 'Japan', 'CASB... | What are the green building names and certification ratings in Japan? | SELECT g.name, g.certification_rating FROM GreenBuildings g WHERE g.country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (id INT, policy_id TEXT, system TEXT, description TEXT, last_updated DATE);INSERT INTO policies (id, policy_id, system, description, last_updated) VALUES (1, 'PS-001', 'firewall', 'Block all incoming traffic', '2021-01-03'); | Identify systems that have not had a policy update in the last 30 days. | SELECT system, last_updated FROM policies WHERE last_updated < CURRENT_DATE - INTERVAL '30 days' AND system NOT IN (SELECT system FROM policies WHERE last_updated >= CURRENT_DATE - INTERVAL '30 days'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mumbai_mobility (user_id INT, mode VARCHAR(20)); CREATE TABLE istanbul_mobility (user_id INT, mode VARCHAR(20)); INSERT INTO mumbai_mobility (user_id, mode) VALUES (1, 'Train'), (2, 'Bus'), (3, 'Bike'), (4, 'Shared Scooter'); INSERT INTO istanbul_mobility (user_id, mode) VALUES (5, 'Train'), (6, 'Bus'), (7... | Get the number of multimodal mobility users in Mumbai and Istanbul who used both public transportation and shared scooters. | SELECT COUNT(*) FROM (SELECT user_id FROM mumbai_mobility WHERE mode = 'Shared Scooter' INTERSECT SELECT user_id FROM mumbai_mobility WHERE mode = 'Train') AS intersection UNION ALL SELECT COUNT(*) FROM (SELECT user_id FROM istanbul_mobility WHERE mode = 'Shared Scooter' INTERSECT SELECT user_id FROM istanbul_mobility ... | gretelai_synthetic_text_to_sql |
CREATE TABLE displaced_persons (id INT, country VARCHAR(20), person_id INT, displacement_date DATE); | How many people were displaced due to natural disasters in Indonesia and Philippines? | SELECT country, COUNT(DISTINCT person_id) as displaced_people FROM displaced_persons GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_data (id INT, destination TEXT, visit_date DATE); INSERT INTO tourism_data (id, destination, visit_date) VALUES (1, 'Tokyo', '2022-05-01'), (2, 'Osaka', '2022-05-15'), (3, 'Kyoto', '2022-05-03'), (4, 'Tokyo', '2022-05-05'); | What is the most popular tourist destination in Japan for the month of May? | SELECT destination, COUNT(*) AS num_visitors FROM tourism_data WHERE visit_date BETWEEN '2022-05-01' AND '2022-05-31' GROUP BY destination ORDER BY num_visitors DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (ID INT, Origin VARCHAR(50), Destination VARCHAR(50), Weight INT); INSERT INTO Shipments (ID, Origin, Destination, Weight) VALUES (1, 'Tokyo', 'New York', 100), (2, 'Paris', 'London', 200), (3, 'Brazil', 'India', 300); | What is the total weight of all shipments from 'Paris' to any destination? | SELECT SUM(Shipments.Weight) FROM Shipments WHERE Shipments.Origin = 'Paris'; | gretelai_synthetic_text_to_sql |
CREATE TABLE features (id INT, name TEXT, price FLOAT, location TEXT); INSERT INTO features (id, name, price, location) VALUES (1, 'Virtual tours', 10, 'USA'), (2, 'Concierge service', 20, 'Canada'), (3, 'Room service', 30, 'Mexico'); | What is the average price of room service in Mexico? | SELECT AVG(price) FROM features WHERE name = 'Room service' AND location = 'Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Types (Id INT, Aircraft_Type VARCHAR(50), Max_Passengers INT); INSERT INTO Aircraft_Types (Id, Aircraft_Type, Max_Passengers) VALUES (1, 'B737', 215), (2, 'A320', 186), (3, 'B747', 416); | What is the maximum number of passengers for each aircraft type? | SELECT Aircraft_Type, MAX(Max_Passengers) FROM Aircraft_Types GROUP BY Aircraft_Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE hydro_plants (id INT, country VARCHAR(255), name VARCHAR(255)); INSERT INTO hydro_plants (id, country, name) VALUES (1, 'Canada', 'Hydro Plant A'), (2, 'Canada', 'Hydro Plant B'), (3, 'United States', 'Hydro Plant C'); | How many hydroelectric power plants are in Canada? | SELECT COUNT(*) FROM hydro_plants WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (volunteer_id INT, program_id INT, volunteer_hours INT, volunteer_date DATE); INSERT INTO Volunteers (volunteer_id, program_id, volunteer_hours, volunteer_date) VALUES (1, 1, 5, '2021-06-05'), (2, 2, 8, '2021-04-12'), (3, 1, 3, '2021-06-05'), (1, 3, 6, '2021-12-25'); | How many volunteers engaged in each program in 2021? | SELECT program_id, COUNT(DISTINCT volunteer_id) as unique_volunteers_in_2021 FROM Volunteers WHERE volunteer_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY program_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (Name VARCHAR(50), Region VARCHAR(50), MilitaryPersonnel INT); INSERT INTO Country (Name, Region, MilitaryPersonnel) VALUES ('United States', 'North America', 1400000), ('Canada', 'North America', 65000), ('Mexico', 'North America', 270000), ('Brazil', 'South America', 300000), ('Argentina', 'South... | What is the maximum number of military personnel for countries in a specific region? | SELECT Region, MAX(MilitaryPersonnel) AS MaxMilitaryPersonnel FROM Country GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teachers (TeacherID int, FirstName varchar(20), LastName varchar(20), Age int, Gender varchar(10), Subject varchar(20)); | Insert a new teacher record into the 'Teachers' table | INSERT INTO Teachers (TeacherID, FirstName, LastName, Age, Gender, Subject) VALUES (5678, 'Jane', 'Doe', 35, 'Female', 'English'); | gretelai_synthetic_text_to_sql |
CREATE VIEW Education_Programs AS SELECT 'Eco_Warriors' AS program, 22000 AS budget UNION SELECT 'Nature_Defenders', 25000; | What is the maximum budget for any education program? | SELECT MAX(budget) FROM Education_Programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE Maintenance_Company (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO Maintenance_Company (id, name, region) VALUES (1, 'Lockheed Martin Africa', 'Africa'), (2, 'Boeing Europe', 'Europe'); | List all the defense equipment maintenance companies that operate in Africa? | SELECT DISTINCT name FROM Maintenance_Company WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_loans (id INT, home_value FLOAT, state VARCHAR(255)); CREATE TABLE states (id INT, state VARCHAR(255), region VARCHAR(255)); | Average home value for socially responsible loans in Alaska | SELECT AVG(home_value) FROM socially_responsible_loans INNER JOIN states ON socially_responsible_loans.state = states.state WHERE states.state = 'Alaska'; | gretelai_synthetic_text_to_sql |
CREATE TABLE industry_funding (company_name VARCHAR(100), industry VARCHAR(50), funding_amount INT); | Identify the industry with the lowest average funding amount | SELECT industry, AVG(funding_amount) as avg_funding FROM industry_funding GROUP BY industry ORDER BY avg_funding ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (id INT, city VARCHAR(50), rate FLOAT, month INT, year INT); INSERT INTO recycling_rates (id, city, rate, month, year) VALUES (1, 'New York', 25.6, 1, 2019), (2, 'New York', 26.2, 2, 2019), (3, 'New York', 27.1, 3, 2019); | Show the recycling rate per month for the city of New York in 2019, with the highest rate at the top. | SELECT city, AVG(rate) as avg_rate FROM recycling_rates WHERE city = 'New York' AND year = 2019 GROUP BY city, month ORDER BY avg_rate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, name VARCHAR(50), grade_level VARCHAR(10)); | Count the number of students in each 'grade_level' in the 'students' table | SELECT grade_level, COUNT(*) FROM students GROUP BY grade_level; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_production (country_code CHAR(3), year INT, volume INT); INSERT INTO timber_production (country_code, year, volume) VALUES ('IDN', 2022, 12000), ('IDN', 2021, 11000), ('JPN', 2022, 15000), ('JPN', 2021, 13000); | What is the total timber production for each country in 2022? | SELECT c.country_name, SUM(tp.volume) as total_volume FROM timber_production tp INNER JOIN country c ON tp.country_code = c.country_code WHERE tp.year = 2022 GROUP BY c.country_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalFestivals (festival_id INT, location TEXT, attendance INT); INSERT INTO CulturalFestivals (festival_id, location, attendance) VALUES (1101, 'Food Festival', 7000), (1102, 'Dance Festival', 6000); CREATE TABLE VirtualExperiences (experience_id INT, festival_id INT, platform TEXT); INSERT INTO Virtua... | Identify the cultural festivals with attendance greater than 7500 and their virtual experience platforms. | SELECT f.festival_id, f.location, f.attendance, v.platform FROM CulturalFestivals f JOIN VirtualExperiences v ON f.festival_id = v.festival_id WHERE f.attendance > 7500; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS contract_negotiations;CREATE TABLE IF NOT EXISTS contract_negotiations (negotiation_id INT, negotiation_start_date DATE, negotiation_end_date DATE);INSERT INTO contract_negotiations (negotiation_id, negotiation_start_date, negotiation_end_date) VALUES (1, '2021-01-01', '2021-02-01'), (2, '20... | List defense contract negotiations with their start and end dates, ordered by negotiation_id. | SELECT negotiation_id, negotiation_start_date, negotiation_end_date FROM contract_negotiations ORDER BY negotiation_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT, industry VARCHAR(255), round VARCHAR(255), funding_amount DECIMAL(10,2)); INSERT INTO funding (id, industry, round, funding_amount) VALUES (1, 'Tech', 'Seed', 50000.00), (2, 'Biotech', 'Series A', 200000.00), (3, 'Tech', 'Series B', 750000.00), (4, 'Biotech', 'Seed', 150000.00); | Summarize the total funding by industry and round | SELECT industry, round, SUM(funding_amount) as total_funding FROM funding GROUP BY industry, round; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableCosts (ProjectID int, State varchar(25), Sustainable bit, Cost decimal(10,2)); INSERT INTO SustainableCosts (ProjectID, State, Sustainable, Cost) VALUES (1, 'WA', 1, 100000.00), (2, 'WA', 0, 200000.00), (3, 'WA', 1, 150000.00); | What is the total cost of sustainable building projects in WA? | SELECT State, SUM(Cost) AS TotalCost FROM SustainableCosts WHERE State = 'WA' AND Sustainable = 1 GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE CoOwnedProperties (PropertyID int, Price int, Borough varchar(255), SustainabilityRating int); INSERT INTO CoOwnedProperties (PropertyID, Price, Borough, SustainabilityRating) VALUES (1, 600000, 'Manhattan', 3); | What is the maximum price of a co-owned property in Manhattan with a SustainabilityRating of at least 3? | SELECT MAX(Price) as MaxPrice FROM CoOwnedProperties WHERE Borough = 'Manhattan' AND SustainabilityRating >= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensor_data (sensor_id INT, temperature FLOAT, humidity FLOAT, light_level INT, timestamp TIMESTAMP); | Update the "temperature" in the "sensor_data" table where the "sensor_id" is 2 to 25 | UPDATE sensor_data SET temperature = 25 WHERE sensor_id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Project_Timelines (project VARCHAR(50), start_date DATE, end_date DATE); | How many defense projects in the Project_Timelines table have a duration greater than or equal to 365 days? | SELECT COUNT(*) FROM Project_Timelines WHERE DATEDIFF(day, start_date, end_date) >= 365; | gretelai_synthetic_text_to_sql |
CREATE TABLE BuildingPermits (PermitIssueDate DATE, SustainableBuilding INT); | What is the total number of building permits issued, in each month, for sustainable building projects, for the past year, ordered by year and month? | SELECT DATEPART(YEAR, PermitIssueDate) as Year, DATEPART(MONTH, PermitIssueDate) as Month, COUNT(*) as PermitCount FROM BuildingPermits WHERE PermitIssueDate >= DATEADD(YEAR, -1, GETDATE()) AND SustainableBuilding = 1 GROUP BY DATEPART(YEAR, PermitIssueDate), DATEPART(MONTH, PermitIssueDate) ORDER BY Year, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE innovation_data (project_id INT, project_type VARCHAR(20)); INSERT INTO innovation_data (project_id, project_type) VALUES (1, 'Precision Agriculture'), (2, 'Biotechnology'), (3, 'Precision Agriculture'); | How many agricultural innovation projects have been implemented in the 'innovation_data' table for each type? | SELECT project_type, COUNT(project_id) FROM innovation_data GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE AgriculturalLand (region TEXT, year INTEGER, practices TEXT, acres INTEGER); INSERT INTO AgriculturalLand (region, year, practices, acres) VALUES ('North America', 2015, 'conventional', 5000000), ('North America', 2016, 'sustainable', 1500000), ('North America', 2017, 'sustainable', 3000000), ('North Ameri... | What is the percentage of total agricultural land in North America that has adopted sustainable farming practices since 2015? | SELECT (SUM(CASE WHEN practices = 'sustainable' THEN acres ELSE 0 END) * 100.0 / SUM(acres)) AS percentage FROM AgriculturalLand WHERE region = 'North America' AND year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_tech_patents (patent_id INT, company_id INT, file_date DATE, state VARCHAR(2)); INSERT INTO legal_tech_patents (patent_id, company_id, file_date, state) VALUES (1, 1001, '2018-01-01', 'DC'), (2, 1002, '2019-03-15', 'DC'); | What is the number of legal technology patents filed in the last 5 years by companies in Washington D.C.? | SELECT COUNT(*) FROM legal_tech_patents WHERE state = 'DC' AND file_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (site_id INT, site_name TEXT, excavation_date DATE); CREATE TABLE artifacts (artifact_id INT, site_id INT, artifact_type TEXT); INSERT INTO excavation_sites (site_id, site_name, excavation_date) VALUES (1, 'Site A', '2010-01-01'), (2, 'Site B', '2012-05-05'), (3, 'Site C', '2015-10-10'); I... | What are the names and excavation dates of sites with at least one wooden artifact? | SELECT site_name, excavation_date FROM excavation_sites e JOIN artifacts a ON e.site_id = a.site_id WHERE a.artifact_type = 'wooden'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VRPlatforms (GameID int, Platform varchar(20), MaxPlayers int); INSERT INTO VRPlatforms (GameID, Platform, MaxPlayers) VALUES (11, 'Oculus', 300); INSERT INTO VRPlatforms (GameID, Platform, MaxPlayers) VALUES (12, 'Vive', 250); | What is the maximum number of players and the corresponding game for each platform in the VR category? | SELECT Platform, MAX(MaxPlayers) as MaxPlayers, GameName FROM VRPlatforms vp JOIN VRGames vg ON vp.GameID = vg.GameID WHERE vg.Category = 'VR' GROUP BY Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (id INT, city_id INT, title VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO Policy (id, city_id, title, start_date, end_date) VALUES (3, 3, 'Policy3', '2022-01-01', '2023-12-31'); INSERT INTO Policy (id, city_id, title, start_date, end_date) VALUES (4, 3, 'Policy4', '2021-01-01', '2022-12... | What is the average budget allocation for policies in CityC? | SELECT AVG(ba.allocation) FROM BudgetAllocation ba JOIN Policy p ON ba.policy_id = p.id WHERE p.city_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE FanEvents (FanID INT, EventType VARCHAR(10), EventDate DATE); CREATE TABLE Fans (FanID INT, FanName VARCHAR(50)); | Find the number of fans who have attended both hockey and baseball games in the last year. | SELECT COUNT(DISTINCT FanID) FROM FanEvents WHERE EventType IN ('Hockey', 'Baseball') GROUP BY FanID HAVING COUNT(DISTINCT EventType) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE salmon_farms (id INT, name TEXT, region TEXT, water_temp FLOAT); INSERT INTO salmon_farms (id, name, region, water_temp) VALUES (1, 'Farm A', 'Pacific Northwest', 12.5), (2, 'Farm B', 'Pacific Northwest', 13.2), (3, 'Farm C', 'Pacific Northwest', 11.8); | What is the average water temperature in the Pacific Northwest salmon farms in July? | SELECT AVG(water_temp) FROM salmon_farms WHERE region = 'Pacific Northwest' AND EXTRACT(MONTH FROM datetime) = 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_requests (region TEXT, quarter NUMERIC, aircraft_type TEXT, num_requests NUMERIC); INSERT INTO maintenance_requests (region, quarter, aircraft_type, num_requests) VALUES ('Pacific', 3, 'F-16', 20), ('Atlantic', 2, 'F-15', 15), ('Pacific', 3, 'F-35', 30), ('Atlantic', 1, 'A-10', 10), ('Pacific',... | List the total number of military aircraft maintenance requests in the Pacific region in Q3 2022 | SELECT SUM(num_requests) as total_requests FROM maintenance_requests WHERE region = 'Pacific' AND quarter = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tourism (venue_id INT, name TEXT, country TEXT, available_tours INT); INSERT INTO virtual_tourism (venue_id, name, country, available_tours) VALUES (1, 'Virtually Madrid', 'Spain', 12), (2, 'Vatican City 360', 'Italy', 8), (3, 'Barcelona Online', 'Spain', 15); | How many virtual tours are available in Spain and Italy? | SELECT SUM(available_tours) FROM virtual_tourism WHERE country IN ('Spain', 'Italy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name VARCHAR(50), location VARCHAR(50), treatment VARCHAR(50)); CREATE TABLE treatments (treatment VARCHAR(50), cost INT); | How many patients received treatment at a specific location? | SELECT COUNT(DISTINCT p.name) FROM patients p WHERE p.location = 'specific_location'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryAnimals (Country VARCHAR(255), Type VARCHAR(255), Animals INT); INSERT INTO CountryAnimals (Country, Type, Animals) VALUES ('India', 'Tiger', 20), ('India', 'Elephant', 30), ('China', 'Tiger', 15), ('China', 'Panda', 20), ('Brazil', 'Elephant', 10), ('Brazil', 'Rhino', 15); | What is the number of animals of each type in each country, ordered by the number of animals in descending order? | SELECT Country, Type, SUM(Animals) as TotalAnimals FROM CountryAnimals GROUP BY Country, Type ORDER BY TotalAnimals DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE trips (route_id INT, trip_date DATE); INSERT INTO trips (route_id, trip_date) VALUES (1, '2022-05-01'), (1, '2022-05-01'), (2, '2022-05-01'), (3, '2022-05-01'), (3, '2022-05-01'); | How many passengers traveled on each route on a specific date? | SELECT r.route_name, t.trip_date, COUNT(t.route_id) AS passengers FROM trips t JOIN routes r ON t.route_id = r.route_id GROUP BY r.route_name, t.trip_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), is_cruelty_free BOOLEAN); INSERT INTO products VALUES (1, 'Lipstick 101', true), (2, 'Eye Shadow 202', false); CREATE TABLE sales (sale_id INT, product_id INT, sale_date DATE); INSERT INTO sales VALUES (1, 1, '2022-01-05'), (2, 2, '2022-02-10'), (3, 1, '2... | Which cruelty-free certified products were sold in Canada in Q1 2022? | SELECT products.product_name FROM products INNER JOIN sales ON products.product_id = sales.product_id WHERE products.is_cruelty_free = true AND sale_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (region_id INT, volunteer_name VARCHAR(50), is_disaster_response BOOLEAN); INSERT INTO regions (region_id, volunteer_name, is_disaster_response) VALUES (1, 'John Doe', true), (2, 'Jane Smith', false), (3, 'Alice Johnson', true), (4, 'Bob Brown', true), (5, 'Charlie Davis', false); | How many disaster response volunteers are there in 'regions' table and what are their names? | SELECT COUNT(*), volunteer_name FROM regions WHERE is_disaster_response = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Households (id INT, city VARCHAR(20), daily_consumption FLOAT); INSERT INTO Households (id, city, daily_consumption) VALUES (1, 'New York City', 300.5), (2, 'New York City', 327.8), (3, 'Los Angeles', 425.6); | What is the average daily water consumption per household in New York City? | SELECT AVG(daily_consumption) FROM Households WHERE city = 'New York City'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product (product_id INT, name VARCHAR(255), quantity INT, material VARCHAR(255)); INSERT INTO product (product_id, name, quantity, material) VALUES (1, 'Recycled Paper Notebook', 75, 'recycled paper'); | Calculate the total quantity of 'recycled paper' products in the inventory. | SELECT SUM(quantity) FROM product WHERE material = 'recycled paper'; | gretelai_synthetic_text_to_sql |
CREATE TABLE content (id INT, topic VARCHAR(50)); INSERT INTO content (id, topic) VALUES (1, 'Racial Diversity'), (2, 'Gender Equality'), (3, 'LGBTQ+ Representation'), (4, 'Disability Representation'), (5, 'Religious Diversity'), (6, 'Cultural Diversity'); | What is the distribution of content items across different media representation topics? | SELECT topic, COUNT(*) AS num_content, ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM content), 1) AS percentage FROM content GROUP BY topic; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_providers (provider_id INT, name TEXT, state TEXT); INSERT INTO healthcare_providers (provider_id, name, state) VALUES (1, 'Dr. Ana Perez', 'FL'); CREATE TABLE cultural_competency (provider_id INT, score INT, community TEXT); | Find healthcare providers with low cultural competency scores serving Latinx in FL. | SELECT h.name, c.score FROM healthcare_providers h INNER JOIN cultural_competency c ON h.provider_id = c.provider_id WHERE h.state = 'FL' AND c.community = 'Latinx' AND c.score < 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (name VARCHAR(255), type VARCHAR(255), yearly_revenue INT); INSERT INTO restaurants (name, type, yearly_revenue) VALUES ('El Bio Vegan', 'Restaurant', 300000); | What was the total revenue for 'El Bio Vegan' in 2021? | SELECT yearly_revenue FROM restaurants WHERE name = 'El Bio Vegan' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_incidents(incident_id INT, region VARCHAR(255), year INT); INSERT INTO cybersecurity_incidents(incident_id, region, year) VALUES (1, 'Caribbean', 2020), (2, 'North America', 2019), (3, 'Caribbean', 2021), (4, 'Europe', 2020), (5, 'Caribbean', 2020), (6, 'Asia', 2020); | How many cybersecurity incidents were reported in the Caribbean region in 2020? | SELECT COUNT(*) FROM cybersecurity_incidents WHERE region = 'Caribbean' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE brands (id INT, name TEXT); CREATE TABLE products (id INT, name TEXT, brand_id INT, restock_date DATE); INSERT INTO brands (id, name) VALUES (1, 'Brand A'), (2, 'Brand B'), (3, 'Brand C'); INSERT INTO products (id, name, brand_id, restock_date) VALUES (1, 'Product 1', 1, '2022-01-05'), (2, 'Product 2', 2, ... | How many products have been restocked in the past month for each brand? | SELECT brands.name, COUNT(products.id) FROM brands INNER JOIN products ON brands.id = products.brand_id WHERE products.restock_date >= DATEADD(month, -1, GETDATE()) GROUP BY brands.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests_species (id INT, type VARCHAR(20), species INT); INSERT INTO forests_species (id, type, species) VALUES (1, 'Mangrove', 20), (2, 'Mangrove', 25); | Find the number of distinct tree species in mangrove forests | SELECT COUNT(DISTINCT species) FROM forests_species WHERE type = 'Mangrove'; | gretelai_synthetic_text_to_sql |
CREATE TABLE development_hours (teacher_id INT, district_id INT, hours_developed INT); | What is the average number of hours of professional development per teacher per district? | SELECT district_id, AVG(hours_developed) as avg_hours FROM development_hours GROUP BY district_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_data (project_id INT, region VARCHAR(20), project_status VARCHAR(20)); INSERT INTO infrastructure_data (project_id, region, project_status) VALUES (1, 'Prairies', 'completed'), (2, 'Northern', 'in_progress'), (3, 'Pacific', 'completed'); | List the names and completion status of rural infrastructure projects in the 'infrastructure_data' table for the 'Prairies' region. | SELECT project_name, project_status FROM infrastructure_data WHERE region = 'Prairies'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists intelligence_operations (operation_name VARCHAR(50), start_year INT, end_year INT); | List all intelligence operations that were initiated in 2015 and are still ongoing? | SELECT operation_name FROM intelligence_operations WHERE start_year <= 2015 AND (end_year IS NULL OR end_year > 2015); | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_energy (id INT, region VARCHAR(50), year INT, production FLOAT); | Insert a new wind energy production record for Texas in the year 2025 | INSERT INTO wind_energy (id, region, year, production) VALUES (1, 'Texas', 2025, 5000); | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEventDetailsSydney (event_id INT, city VARCHAR(50), num_visits INT, num_events INT); INSERT INTO CommunityEventDetailsSydney (event_id, city, num_visits, num_events) VALUES (100, 'Sydney', 50, 2), (200, 'Sydney', 75, 3), (300, 'Sydney', 100, 4); | What is the average number of visits per community event in Sydney? | SELECT AVG(num_visits/num_events) FROM CommunityEventDetailsSydney; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (stadium TEXT, attendance INT); INSERT INTO games (stadium, attendance) VALUES ('Stadium X', 12000), ('Stadium X', 15000), ('Stadium Y', 18000); | What is the average attendance for games played at stadium 'Stadium X'? | SELECT AVG(attendance) FROM games WHERE stadium = 'Stadium X'; | gretelai_synthetic_text_to_sql |
CREATE TABLE maritime_safety_incidents (region text, vessel_id integer); INSERT INTO maritime_safety_incidents (region, vessel_id) VALUES ('North Atlantic', 123), ('North Pacific', 456), ('Mediterranean', 789); | What is the total number of vessels involved in maritime safety incidents? | SELECT COUNT(DISTINCT vessel_id) FROM maritime_safety_incidents; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste (waste_id INT, menu_item_id INT, waste_amount INT, waste_date DATE); INSERT INTO waste VALUES (1, 1, 50, '2022-01-01'), (2, 2, 75, '2022-02-01'), (3, 3, 60, '2022-03-01'), (4, 1, 100, '2022-04-01'); CREATE TABLE menu_items (menu_item_id INT, category VARCHAR(255)); INSERT INTO menu_items VALUES (1, '... | Calculate the total waste produced by each menu category in the past year. | SELECT c1.category, SUM(w1.waste_amount) AS total_waste FROM waste w1 INNER JOIN menu_items m1 ON w1.menu_item_id = m1.menu_item_id INNER JOIN (SELECT menu_item_id, category FROM menu_items EXCEPT SELECT menu_item_id, category FROM menu_items WHERE menu_item_id NOT IN (SELECT menu_item_id FROM waste)) c1 ON m1.menu_ite... | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicLibraries (LibraryID INT, LibraryName VARCHAR(100), State VARCHAR(100), Budget DECIMAL(10,2)); INSERT INTO PublicLibraries (LibraryID, LibraryName, State, Budget) VALUES (1, 'Los Angeles Public Library', 'California', 120000.00), (2, 'San Francisco Public Library', 'California', 85000.00); | What is the total number of public libraries in the state of California and their respective budgets? | SELECT SUM(Budget) as TotalBudget, LibraryName FROM PublicLibraries WHERE State = 'California' GROUP BY LibraryName; | 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.