context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Menu (menu_name VARCHAR(20), item_name VARCHAR(30), price DECIMAL(5,2)); INSERT INTO Menu (menu_name, item_name, price) VALUES ('Lunch', 'Chicken Sandwich', 9.99), ('Lunch', 'Steak Wrap', 12.49), ('Lunch', 'Quinoa Salad', 14.50); | Delete the 'Lunch' menu | DELETE FROM Menu WHERE menu_name = 'Lunch'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourist_demographics (tourist_id INT, age INT, country TEXT); INSERT INTO tourist_demographics (tourist_id, age, country) VALUES (1, 25, 'Canada'), (2, 35, 'Canada'); | What is the distribution of tourists by age group for virtual tours in Canada? | SELECT age_group, COUNT(*) FROM (SELECT FLOOR(age/10)*10 AS age_group FROM tourist_demographics WHERE country = 'Canada') AS subquery GROUP BY age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_infrastructure (country VARCHAR(20), download_speed FLOAT); INSERT INTO network_infrastructure (country, download_speed) VALUES ('Brazil', 150), ('Argentina', 200), ('Colombia', 180); | What is the minimum and maximum broadband internet download speed in South America? | SELECT MIN(download_speed), MAX(download_speed) FROM network_infrastructure WHERE country IN ('Brazil', 'Argentina', 'Colombia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (id INT PRIMARY KEY, province VARCHAR(50), impact_score INT, operation_date DATE); INSERT INTO environmental_impact (id, province, impact_score, operation_date) VALUES (1, 'Alberta', 75, '2020-01-01'), (2, 'British Columbia', 85, '2019-05-05'), (3, 'Quebec', 65, '2021-03-15'); | What's the average environmental impact score for mining operations in each province, in the last 2 years? | SELECT province, AVG(impact_score) as avg_score FROM environmental_impact WHERE operation_date >= DATEADD(year, -2, GETDATE()) GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_continent (farm_id INT, continent VARCHAR(255), species VARCHAR(255)); INSERT INTO farm_continent (farm_id, continent, species) VALUES (1, 'Asia-Pacific', 'Salmon'), (2, 'Asia-Pacific', 'Tuna'), (3, 'Asia-Pacific', 'Cod'), (4, 'Europe', 'Trout'), (5, 'Europe', 'Haddock'); | Find the distinct number of fish species in fish farms in the Asia-Pacific region. | SELECT COUNT(DISTINCT species) FROM farm_continent WHERE continent = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech_development (id INT, name TEXT, location TEXT, year INT); INSERT INTO military_tech_development (id, name, location, year) VALUES (1, 'Project Giraffe', 'South Africa', 2020), (2, 'Project Zebra', 'Morocco', 2019), (3, 'Project Lion', 'Egypt', 2018); | List all military technology development projects in Africa in the year 2020 | SELECT name FROM military_tech_development WHERE location IN ('South Africa', 'Morocco', 'Egypt') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teams (TeamID INT, Name VARCHAR(50), TournamentWins INT, LastTournamentDate DATE); | Which eSports teams have the most tournament wins in the last 3 years? | SELECT t.Name, SUM(t.TournamentWins) as TotalWins FROM Teams t WHERE t.LastTournamentDate >= DATEADD(year, -3, GETDATE()) GROUP BY t.Name HAVING COUNT(*) >= 3 ORDER BY TotalWins DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ModelFairnessScores (ModelID INT, TeamID INT, FairnessScore INT); CREATE TABLE TeamLocations (TeamID INT, Country VARCHAR(20)); | What is the maximum, minimum, and average fairness score for models developed by teams in different countries? | SELECT MIN(ModelFairnessScores.FairnessScore) AS MinFairnessScore, MAX(ModelFairnessScores.FairnessScore) AS MaxFairnessScore, AVG(ModelFairnessScores.FairnessScore) AS AverageFairnessScore FROM ModelFairnessScores INNER JOIN TeamLocations ON ModelFairnessScores.TeamID = TeamLocations.TeamID; | gretelai_synthetic_text_to_sql |
CREATE TABLE EuropiumProduction (country VARCHAR(20), price DECIMAL(5,2), year INT); INSERT INTO EuropiumProduction (country, price, year) VALUES ('Country1', 100.00, 2018), ('Country2', 120.00, 2019); | What is the maximum price of europium produced in any country? | SELECT MAX(price) FROM EuropiumProduction; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_professional_development (teacher_id INT, school_id INT, year INT, hours INT); INSERT INTO teacher_professional_development (teacher_id, school_id, year, hours) VALUES (1, 101, 2019, 20), (2, 101, 2020, 25), (3, 101, 2021, 30), (4, 102, 2019, 25), (5, 102, 2020, 28), (6, 102, 2021, 32); | List the top 3 schools with the most significant increase in teacher professional development hours between 2019 and 2021? | SELECT school_id, teacher_id, year, hours, LAG(hours, 2) OVER (PARTITION BY school_id ORDER BY year) as prev_two_years_hours FROM teacher_professional_development WHERE year BETWEEN 2019 AND 2021 GROUP BY school_id, teacher_id, year, hours ORDER BY school_id, (hours - prev_two_years_hours) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(100), region VARCHAR(50), avg_depth FLOAT); CREATE TABLE ocean_floor_mapping (id INT, region VARCHAR(50), depth FLOAT); | What is the average depth of all marine protected areas in the Pacific region, including those with no recorded depth? | SELECT AVG(coalesce(mpa.avg_depth, ofm.depth)) as avg_depth FROM marine_protected_areas mpa RIGHT JOIN ocean_floor_mapping ofm ON mpa.region = ofm.region WHERE mpa.region = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonorType VARCHAR(10), Amount DECIMAL(10,2)); INSERT INTO Donations (DonorType, Amount) VALUES ('Individual', 500.00), ('Organization', 2000.00); | What is the total amount donated by individuals and organizations? | SELECT SUM(Amount) FROM Donations; | gretelai_synthetic_text_to_sql |
CREATE TABLE fire_calls (id INT, city VARCHAR(20), response_time INT); INSERT INTO fire_calls (id, city, response_time) VALUES (1, 'Miami', 7), (2, 'Miami', 9); | What is the average response time for fire department calls in the city of Miami? | SELECT AVG(response_time) FROM fire_calls WHERE city = 'Miami'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_materials (id INT, country VARCHAR(255), material VARCHAR(255), price DECIMAL(10,2)); INSERT INTO eco_materials VALUES (1, 'USA', 'Organic Cotton', 3.50), (2, 'USA', 'Recycled Polyester', 4.20), (3, 'India', 'Organic Cotton', 2.00), (4, 'India', 'Jute', 1.80); | What is the average price of eco-friendly materials used in production by country? | SELECT country, AVG(price) FROM eco_materials GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INTEGER, name TEXT, last_inspection_date DATE); INSERT INTO vessels (id, name, last_inspection_date) VALUES (1, 'Vessel A', '2021-08-15'), (2, 'Vessel B', '2021-09-03'), (3, 'Vessel C', '2021-07-10'); | Count the number of vessels with safety violations in the last month. | SELECT COUNT(*) FROM vessels WHERE last_inspection_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing (id INT, garment_id INT, garment_material VARCHAR(50), co2_emissions DECIMAL(10, 2), process_date DATE); | What is the total CO2 emissions of manufacturing processes for all silk garments, in the 'manufacturing' table? | SELECT SUM(co2_emissions) AS total_co2_emissions FROM manufacturing WHERE garment_material = 'silk'; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (id INT, country VARCHAR(50), funds DECIMAL(10,2), year INT); INSERT INTO humanitarian_assistance (id, country, funds, year) VALUES (1, 'USA', 15000000.00, 2020); INSERT INTO humanitarian_assistance (id, country, funds, year) VALUES (2, 'Germany', 8500000.00, 2020); | What are the total humanitarian assistance funds spent by each country in 2020? | SELECT country, SUM(funds) as total_funds_2020 FROM humanitarian_assistance WHERE year = 2020 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), capacity INT); INSERT INTO factories (id, name, location, capacity) VALUES (1, 'Ethical Fabrications', 'Bangladesh', 500), (2, 'Fair Factories', 'Cambodia', 300), (3, 'Sustainable Textiles', 'India', 400); CREATE TABLE labor_practices... | Determine the number of factories in each location and the average worker count. | SELECT f.location, COUNT(f.id) AS factory_count, AVG(lp.worker_count) AS avg_worker_count FROM factories f INNER JOIN labor_practices lp ON f.id = lp.factory_id GROUP BY f.location; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists arts_culture; CREATE TABLE if not exists arts_culture.programs(program_id INT, program_name VARCHAR(50), demographic VARCHAR(10), category VARCHAR(20), impact_score INT); | What is the average program impact score for the 'Black/African American' demographic in the 'Visual Arts' category? | SELECT AVG(programs.impact_score) FROM arts_culture.programs WHERE programs.demographic = 'Black/African American' AND programs.category = 'Visual Arts'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TraditionalArts (ID INT, ArtForm TEXT, Material TEXT); INSERT INTO TraditionalArts (ID, ArtForm, Material) VALUES (1, 'Feather Headdress', 'Feathers'), (2, 'Macaw Mask', 'Feathers'); | How many traditional art forms are practiced in 'South America' that use feathers as a primary material? | SELECT COUNT(*) FROM TraditionalArts WHERE Material = 'Feathers' AND PracticedIn = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, neighborhood VARCHAR(20), response_time FLOAT); INSERT INTO emergency_calls (id, neighborhood, response_time) VALUES (1, 'Westside', 6.5), (2, 'Northend', 7.3), (3, 'Westside', 7.1); | What is the average response time for emergency calls in the 'Westside' neighborhood? | SELECT AVG(response_time) FROM emergency_calls WHERE neighborhood = 'Westside'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousShuttles (id INT, trips INT, city VARCHAR(50), date DATE); INSERT INTO AutonomousShuttles (id, trips, city, date) VALUES (1, 30, 'Boston', '2022-01-01'); INSERT INTO AutonomousShuttles (id, trips, city, date) VALUES (2, 45, 'Boston', '2022-01-02'); | How many autonomous shuttle trips were taken in the city of Boston in the last month? | SELECT SUM(trips) FROM AutonomousShuttles WHERE city = 'Boston' AND date >= (CURRENT_DATE - INTERVAL '1 month'); | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, office_location VARCHAR(255), billing_rate DECIMAL(5,2)); INSERT INTO attorneys (attorney_id, office_location, billing_rate) VALUES (1, 'Los Angeles', 300), (2, 'New York', 450), (3, 'Los Angeles', 350), (4, 'Chicago', 400); | What is the total billing rate for attorneys in the Los Angeles office? | SELECT SUM(billing_rate) FROM attorneys WHERE office_location = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), last_workshop_date DATE); INSERT INTO clients VALUES (1, 'John Doe', '2021-06-01'); INSERT INTO clients VALUES (2, 'Jane Smith', '2022-03-15'); | Delete records of clients who have not taken part in any financial wellbeing workshops in the past year. | DELETE FROM clients WHERE last_workshop_date < DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE police_department(id INT, name VARCHAR(20), location VARCHAR(20)); | Add a new column 'community_outreach_program' to the 'police_department' table | ALTER TABLE police_department ADD COLUMN community_outreach_program VARCHAR(50); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, product_id INT, quantity INT, country VARCHAR(50)); CREATE TABLE products (id INT, name VARCHAR(50), natural BOOLEAN); | Count the number of natural skincare products sold in Canada | SELECT COUNT(*) FROM sales JOIN products ON sales.product_id = products.id WHERE products.natural = TRUE AND sales.country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BrandSatisfaction(brand VARCHAR(255), satisfaction_score DECIMAL(3,2)); | List all ethical fashion brands and their customer satisfaction scores. | SELECT brand, satisfaction_score FROM BrandSatisfaction; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_revenue (hotel_id INT, name TEXT, city TEXT, country TEXT, daily_revenue DECIMAL(5,2)); INSERT INTO hotel_revenue (hotel_id, name, city, country, daily_revenue) VALUES (4, 'The Ritz London', 'London', 'UK', 500); | What is the total revenue of hotels in London? | SELECT SUM(daily_revenue) FROM hotel_revenue WHERE city = 'London'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_companies (company VARCHAR(50), department VARCHAR(50), employee_name VARCHAR(50), salary INTEGER); | What is the average salary of developers in the 'tech_companies' table? | SELECT AVG(salary) FROM tech_companies WHERE department = 'Developers'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Renewable_Energy_Projects (project_id INT, project_name VARCHAR(50), total_cost FLOAT, completion_date DATE); | Show the total cost and completion date of each project in the Renewable_Energy_Projects table | SELECT total_cost, completion_date FROM Renewable_Energy_Projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_hours (id INT, volunteer_name TEXT, hours_served DECIMAL, volunteer_date DATE); INSERT INTO volunteer_hours (id, volunteer_name, hours_served, volunteer_date) VALUES (1, 'Alice Johnson', 5.00, '2022-02-01'), (2, 'Bob Brown', 10.00, '2022-02-05'); | What is the average number of volunteer hours per volunteer in the last month? | SELECT AVG(hours_served) as avg_hours_per_volunteer FROM (SELECT volunteer_name, AVG(hours_served) as hours_served FROM volunteer_hours WHERE volunteer_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY volunteer_name) AS avg_hours_by_volunteer; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_services (category VARCHAR(255), name VARCHAR(255), location VARCHAR(255)); | Remove all records from the 'public_services' table where the 'category' is 'Transportation'. | DELETE FROM public_services WHERE category = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE indian_movies (id INT PRIMARY KEY, name VARCHAR(255), release_year INT, revenue INT); INSERT INTO indian_movies (id, name, release_year, revenue) VALUES (1, 'RRR', 2021, 150000000), (2, 'KGF Chapter 2', 2021, 200000000), (3, 'Sooryavanshi', 2021, 120000000); | What is the total revenue generated by Indian movies released in 2021? | SELECT SUM(revenue) FROM indian_movies WHERE release_year = 2021 AND genre = 'Indian Movie'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, name VARCHAR(255), type VARCHAR(255), country_of_origin VARCHAR(255), year INT); INSERT INTO military_equipment (equipment_id, name, type, country_of_origin, year) VALUES (1, 'M1 Abrams', 'Tank', 'USA', 1980), (2, 'Leopard 2', 'Tank', 'Germany', 1979); | Select all military equipment from the USA | SELECT * FROM military_equipment WHERE country_of_origin = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (employee_id INT, employee_name VARCHAR(255), state VARCHAR(255), position VARCHAR(255), industry VARCHAR(255)); INSERT INTO employees (employee_id, employee_name, state, position, industry) VALUES (1, 'John Smith', 'Texas', 'Engineer', 'Mining'), (2, 'Jane Doe', 'California', 'Manager', 'Mining'... | What is the total number of employees in the mining industry by state? | SELECT state, COUNT(*) FROM employees WHERE industry = 'Mining' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (fruit text, weight integer, is_local boolean); INSERT INTO Inventory (fruit, weight, is_local) VALUES ('Bananas', 150, false), ('Apples', 200, true), ('Oranges', 120, false), ('Strawberries', 80, true); | Calculate the average weight of local fruits in the inventory. | SELECT AVG(weight) FROM Inventory WHERE is_local = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGames (PlayerID int, PlayerName varchar(50), Country varchar(50), GameType varchar(50), Wins int); INSERT INTO PlayerGames (PlayerID, PlayerName, Country, GameType, Wins) VALUES (1, 'Leung Chan', 'China', 'Racing', 12), (2, 'Akane Tanaka', 'Japan', 'Racing', 15), (3, 'Park Min-ho', 'South Korea', 'Sh... | How many players have played each game type? | SELECT GameType, COUNT(DISTINCT PlayerID) FROM PlayerGames GROUP BY GameType; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, data_usage FLOAT, state VARCHAR(255)); INSERT INTO mobile_subscribers (subscriber_id, data_usage, state) VALUES (1, 50.5, 'Texas'), (2, 60.3, 'Texas'), (3, 40.2, 'Texas'); | Add new mobile subscribers in Illinois with 35GB and 45GB data usage. | INSERT INTO mobile_subscribers (subscriber_id, data_usage, state) VALUES (4, 35, 'Illinois'), (5, 45, 'Illinois'); | gretelai_synthetic_text_to_sql |
CREATE TABLE appearances (id INT, case_id INT, appearance_date DATE); INSERT INTO appearances (id, case_id, appearance_date) VALUES (1, 1, '2021-01-01'), (2, 1, '2021-03-01'), (3, 1, '2021-05-01'); | What is the maximum number of court appearances for a single case? | SELECT MAX(count) FROM (SELECT case_id, COUNT(*) as count FROM appearances GROUP BY case_id) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites_by_agency (agency VARCHAR(255), launch_date DATE); INSERT INTO satellites_by_agency (agency, launch_date) VALUES ('ISRO', '1975-08-10'); INSERT INTO satellites_by_agency (agency, launch_date) VALUES ('ISRO', '1981-10-31'); | What is the earliest launch date of a satellite by ISRO? | SELECT MIN(launch_date) FROM satellites_by_agency WHERE agency = 'ISRO'; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_demographics (labor_id INT, state VARCHAR(50), employed_date DATE, gender VARCHAR(50), profession VARCHAR(50)); INSERT INTO labor_demographics (labor_id, state, employed_date, gender, profession) VALUES (1, 'Florida', '2022-01-01', 'Female', 'Construction'); INSERT INTO labor_demographics (labor_id, ... | What is the percentage of construction laborers in Florida who identify as female? | SELECT (COUNT(*) FILTER (WHERE gender = 'Female'))::FLOAT / COUNT(*)::FLOAT FROM labor_demographics WHERE state = 'Florida' AND employed_date BETWEEN '2022-01-01' AND '2022-12-31' AND profession = 'Construction'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (id INT, device VARCHAR(50), company VARCHAR(50), quantity INT, month VARCHAR(10), year INT); INSERT INTO Sales (id, device, company, quantity, month, year) VALUES (1, 'Phone X', 'ABC Tech', 500, 'January', 2021), (2, 'Tablet Y', 'XYZ Enterprises', 300, 'February', 2021), (3, 'Laptop Z', 'Tech for Go... | What is the maximum number of devices sold in a month by companies in Latin America? | SELECT MAX(quantity) FROM Sales WHERE company IN (SELECT DISTINCT company FROM Sales WHERE country IN (SELECT DISTINCT country FROM Companies WHERE region = 'Latin America')) AND month = 'March' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, Amount decimal, OrganizationType text); INSERT INTO Donations (DonationID, Amount, OrganizationType) VALUES (1, 5000, 'Environment'); INSERT INTO Donations (DonationID, Amount, OrganizationType) VALUES (2, 7000, 'Health'); INSERT INTO Donations (DonationID, Amount, OrganizationTy... | What is the total amount donated to each organization type? | SELECT OrganizationType, SUM(Amount) as TotalDonation FROM Donations JOIN OrganizationTypes ON Donations.OrganizationType = OrganizationTypes.OrganizationType GROUP BY OrganizationType; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (contract_id INT, country VARCHAR(255), negotiation_start_date DATE, negotiation_end_date DATE); INSERT INTO ContractNegotiations (contract_id, country, negotiation_start_date, negotiation_end_date) VALUES (1, 'Brazil', '2019-03-01', '2019-03-15'), (2, 'India', '2018-05-10', '2018-05-2... | List the countries with the lowest contract negotiation duration, limited to the top 3? | SELECT country, TIMESTAMPDIFF(DAY, negotiation_start_date, negotiation_end_date) AS NegotiationDuration FROM ContractNegotiations ORDER BY NegotiationDuration ASC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, ProgramID INT, DonationAmount DECIMAL(10,2), DonationDate DATE); INSERT INTO Donations (DonationID, DonorID, ProgramID, DonationAmount, DonationDate) VALUES (1, 1, 1, 1000.00, '2021-04-10'), (2, 2, 2, 500.00, '2021-04-15'); CREATE TABLE Programs (ProgramID INT, Progr... | What is the total donation amount for the 'Health' program in the last month? | SELECT SUM(DonationAmount) FROM Donations INNER JOIN Programs ON Donations.ProgramID = Programs.ProgramID WHERE DonationDate >= DATEADD(month, -1, GETDATE()) AND Programs.ProgramName = 'Health' | gretelai_synthetic_text_to_sql |
CREATE TABLE recruiters (recruiter_id INT, recruiter_name VARCHAR(255)); CREATE TABLE interviews (interview_id INT, candidate_id INT, recruiter_id INT, interview_date DATE); INSERT INTO recruiters (recruiter_id, recruiter_name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie'); INSERT INTO interviews (interview_id, candi... | Who are the top 3 recruiters based on the number of candidates they interviewed? | SELECT recruiter_id, recruiter_name, COUNT(*) OVER (PARTITION BY recruiter_id) as total_interviews FROM recruiters r JOIN interviews i ON r.recruiter_id = i.recruiter_id GROUP BY recruiter_id, recruiter_name ORDER BY total_interviews DESC FETCH FIRST 3 ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE luxury_hotels (hotel_id INT, hotel_name VARCHAR(255), country VARCHAR(255), price DECIMAL(10,2)); | What is the average hotel room price per country for luxury hotels? | SELECT country, AVG(price) FROM luxury_hotels GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name TEXT, region TEXT, esg_score FLOAT); INSERT INTO organizations (id, name, region, esg_score) VALUES (1, 'Org A', 'Asia', 8.5), (2, 'Org B', 'Europe', 7.2), (3, 'Org C', 'Asia', 9.1), (4, 'Org D', 'Africa', 6.8), (5, 'Org E', 'Europe', 7.5); | What is the average ESG score for organizations in the Asian region? | SELECT AVG(esg_score) FROM organizations WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Procurement (id INT, vendor VARCHAR(255), item VARCHAR(255), date DATE); INSERT INTO Procurement (id, vendor, item, date) VALUES (1, 'XYZ Corp', 'Helicopter', '2022-04-01'), (2, 'LMN Inc', 'Tank', '2022-05-01'); | What are the vendors that supplied equipment not present in high-value contracts? | SELECT vendor FROM Procurement WHERE item NOT IN (SELECT item FROM Contracts WHERE value > 100000) AND item = 'Tank'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_tech_adoptions (id INT, hotel_id INT, tech_type TEXT, installed_date DATE); CREATE TABLE hotels (id INT, name TEXT, city TEXT, country TEXT, ai_revenue INT); | What is the total revenue generated by hotels in Paris, France with AI technology installed before 2020? | SELECT SUM(h.ai_revenue) FROM hotel_tech_adoptions hta INNER JOIN hotels h ON hta.hotel_id = h.id WHERE h.city = 'Paris' AND h.country = 'France' AND hta.tech_type = 'AI' AND hta.installed_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects(project_id INT, project_name VARCHAR(50), duration INT, cost FLOAT); INSERT INTO defense_projects VALUES (1, 'Project A', 36, 5000000), (2, 'Project B', 24, 4000000), (3, 'Project C', 18, 3000000); | What is the total duration of defense projects with a cost greater than 4 million? | SELECT SUM(duration) FROM defense_projects WHERE cost > 4000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE museums (id INT, name VARCHAR(50), location VARCHAR(30), revenue INT); INSERT INTO museums (id, name, location, revenue) VALUES (1, 'Museum1', 'NYC', 1000000), (2, 'Museum2', 'London', 1500000); CREATE TABLE continents (id INT, location VARCHAR(30), continent VARCHAR(20)); INSERT INTO continents (id, locat... | Show the total revenue generated by each museum from ticket sales, grouped by the continent where the museum is located. | SELECT c.continent, m.name, SUM(m.revenue) as total_revenue FROM museums m JOIN continents c ON m.location = c.location GROUP BY c.continent, m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Staff (staff_id INT, department VARCHAR(255), role VARCHAR(255)); INSERT INTO Staff (staff_id, department, role) VALUES (1, 'Student Support', 'Disability Counselor'); INSERT INTO Staff (staff_id, department, role) VALUES (2, 'Academic Affairs', 'Accessibility Specialist'); | What is the total number of disability support staff in each department? | SELECT department, COUNT(DISTINCT staff_id) as total_staff FROM Staff WHERE role LIKE '%disability%' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE CapacityBuilding (RegionID int, RegionName varchar(50), CapacityValue int); INSERT INTO CapacityBuilding (RegionID, RegionName, CapacityValue) VALUES (1, 'North', 1000); INSERT INTO CapacityBuilding (RegionID, RegionName, CapacityValue) VALUES (2, 'South', 2000); | What was the total capacity building for each region in 2019? | SELECT RegionName, SUM(CapacityValue) as TotalCapacity FROM CapacityBuilding WHERE DonationDate BETWEEN '2019-01-01' AND '2019-12-31' GROUP BY RegionName; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_facilities (name TEXT, state TEXT, category TEXT, budget_allocation INT); INSERT INTO public_facilities (name, state, category, budget_allocation) VALUES ('Facility A', 'New York', 'Community Center', 400000), ('Facility B', 'New York', 'Senior Center', 450000); | What is the total budget allocation for public facilities in the state of New York, excluding community centers? | SELECT SUM(budget_allocation) FROM public_facilities WHERE state = 'New York' AND category <> 'Community Center'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farms (id INT, name TEXT, stocking_density FLOAT); INSERT INTO farms (id, name, stocking_density) VALUES (1, 'Farm A', 25.3); INSERT INTO farms (id, name, stocking_density) VALUES (2, 'Farm B', 23.1); INSERT INTO farms (id, name, stocking_density) VALUES (3, 'Farm C', 28.5); INSERT INTO farms (id, name, st... | What is the maximum and minimum stocking density of fish farms in the 'farms' table? | SELECT MAX(stocking_density), MIN(stocking_density) FROM farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cultivators (cultivator_id INT, name VARCHAR(20), strain_type VARCHAR(10)); INSERT INTO Cultivators (cultivator_id, name, strain_type) VALUES (1, 'Cultivator A', 'Indica'), (2, 'Cultivator B', 'Hybrid'), (3, 'Cultivator C', 'Sativa'); CREATE TABLE CaliforniaCultivators (cultivator_id INT, state VARCHAR(20)... | List all cultivators in California that supply sativa strains to dispensaries. | SELECT c.name FROM Cultivators c JOIN CaliforniaCultivators cc ON c.cultivator_id = cc.cultivator_id WHERE c.strain_type = 'Sativa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (Country VARCHAR(255), Site VARCHAR(255)); INSERT INTO HeritageSites (Country, Site) VALUES ('Spain', 'Alhambra'), ('Spain', 'Sagrada Familia'), ('Spain', 'Prado Museum'), ('France', 'Louvre Museum'), ('France', 'Eiffel Tower'), ('Italy', 'Colosseum'), ('Italy', 'Leaning Tower of Pisa'), ('Ge... | What is the number of heritage sites in each country in Europe? | SELECT Country, COUNT(Site) as Num_Sites FROM HeritageSites WHERE Country IN ('Spain', 'France', 'Italy', 'Germany') GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance_2 (id INT, year INT, country VARCHAR(255), amount DECIMAL(10,2)); INSERT INTO humanitarian_assistance_2 (id, year, country, amount) VALUES (1, 2015, 'USA', 5000000), (2, 2016, 'Japan', 6000000), (3, 2017, 'Germany', 4000000), (4, 2018, 'USA', 7000000), (5, 2019, 'Canada', 5500000), ... | What is the percentage of humanitarian assistance provided by the top 3 contributing countries in each year, including the year, country name, and the percentage? | SELECT year, country, ROUND(100.0 * SUM(amount) / (SELECT SUM(amount) FROM humanitarian_assistance_2 WHERE year = ha.year)::numeric, 2) AS percentage FROM humanitarian_assistance_2 ha GROUP BY year, country HAVING COUNT(*) < 4 ORDER BY year, percentage DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_response.households (id INT, head_name VARCHAR(50), head_gender VARCHAR(10), region VARCHAR(50)); | What is the number of male-led and female-led households in each region? | SELECT region, head_gender, COUNT(*) FROM disaster_response.households GROUP BY region, head_gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_inspections (id INT, state VARCHAR(2), inspections INT); INSERT INTO safety_inspections (id, state, inspections) VALUES (1, 'California', 350), (2, 'Texas', 420), (3, 'New York', 500), (4, 'Ontario', 200); | How many workplace safety inspections were conducted in 'Ontario'? | SELECT state, SUM(inspections) as total_inspections FROM safety_inspections WHERE state = 'Ontario'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), launch_date DATE, price DECIMAL(5,2)); | What is the difference in price between the first and last product launched in the 'products' table? | SELECT product_id, price, FIRST_VALUE(price) OVER (ORDER BY launch_date) as first_price, LAST_VALUE(price) OVER (ORDER BY launch_date) as last_price, LAST_VALUE(price) OVER (ORDER BY launch_date) - FIRST_VALUE(price) OVER (ORDER BY launch_date) as price_difference FROM products; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (user_id INT, transaction_amount DECIMAL(10, 2), transaction_date DATE); INSERT INTO transactions (user_id, transaction_amount, transaction_date) VALUES (1, 50.00, '2022-01-01'), (1, 75.00, '2022-01-10'), (2, 30.00, '2022-01-03'), (2, 120.00, '2022-02-01'), (3, 400.00, '2022-02-10'); | What is the average transaction value per user in the last month? | SELECT AVG(transaction_amount) as avg_transaction_amount FROM transactions WHERE transaction_date >= DATEADD(month, -1, GETDATE()) GROUP BY user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName VARCHAR(255)); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount DECIMAL(10, 2)); | What is the average donation amount for each donor, and which donor has the highest average donation amount? | SELECT DonorID, DonorName, AVG(DonationAmount) AS AvgDonation, RANK() OVER (ORDER BY AVG(DonationAmount) DESC) AS DonorRank FROM Donors JOIN Donations ON Donors.DonorID = Donations.DonorID GROUP BY DonorID, DonorName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Subscribers (SubscriberID INT, Age INT, PlanID INT, UpgradedTo5G BOOLEAN); INSERT INTO Subscribers (SubscriberID, Age, PlanID, UpgradedTo5G) VALUES (1, 24, 1, true), (2, 35, 2, true), (3, 42, 3, true), (4, 19, 1, false), (5, 31, 2, false), (6, 51, 3, false); | What is the percentage of subscribers who upgraded to 5G in 'Telecom' schema grouped by age? | SELECT Age, COUNT(SubscriberID) as TotalSubscribers, COUNT(CASE WHEN UpgradedTo5G THEN 1 END) as UpgradedSubscribers, 100*COUNT(CASE WHEN UpgradedTo5G THEN 1 END)/COUNT(SubscriberID) as Percentage FROM Telecom.Subscribers GROUP BY Age; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, species VARCHAR(255), year INT, volume FLOAT); INSERT INTO forests (id, species, year, volume) VALUES (1, 'Pine', 2018, 1200.5), (2, 'Oak', 2019, 1500.3), (3, 'Maple', 2020, 2000.7), (4, 'Birch', 2020, 1750.6), (5, 'Pine', 2019, 1300.8), (6, 'Spruce', 2018, 1400.9), (7, 'Spruce', 2019, 150... | What is the average volume of timber harvested per year, per species? | SELECT species, AVG(volume) as avg_volume FROM forests GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE readers (id INT, gender TEXT, preference TEXT, age INT, subscribed_to TEXT); INSERT INTO readers (id, gender, preference, age, subscribed_to) VALUES (1, 'Female', 'Politics', 35, 'New York Times'); INSERT INTO readers (id, gender, preference, age, subscribed_to) VALUES (2, 'Male', 'Sports', 28, 'New York T... | What is the average age of female readers who prefer reading articles about politics in the "New York Times"? | SELECT AVG(age) FROM readers WHERE gender = 'Female' AND preference = 'Politics' AND subscribed_to = 'New York Times'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthProvider (ProviderID INT, City VARCHAR(50)); INSERT INTO MentalHealthProvider (ProviderID, City) VALUES (1, 'New York'), (2, 'Los Angeles'), (3, 'Chicago'), (4, 'Houston'), (5, 'Philadelphia'), (6, 'Phoenix'), (7, 'San Antonio'), (8, 'San Diego'), (9, 'Dallas'), (10, 'San Jose'); | List the top 3 cities with the highest number of mental health providers. | SELECT City, COUNT(*) as NumProviders FROM MentalHealthProvider GROUP BY City ORDER BY NumProviders DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE strategies (id INT, sector VARCHAR(20), investment FLOAT); INSERT INTO strategies (id, sector, investment) VALUES (1, 'Education', 50000.0), (2, 'Healthcare', 75000.0), (3, 'Education', 100000.0); | What is the minimum investment in each sector? | SELECT sector, MIN(investment) FROM strategies GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE AlgorithmicFairness (ID INT, Algorithm VARCHAR(255), Category VARCHAR(255), Score FLOAT, Date DATE, CompanyCountry VARCHAR(255)); INSERT INTO AlgorithmicFairness (ID, Algorithm, Category, Score, Date, CompanyCountry) VALUES (1, 'Algo1', 'CategoryA', 0.85, '2020-07-01', 'India'), (2, 'Algo2', 'CategoryB', 0... | What is the maximum algorithmic fairness score for algorithms created in H2 2020, per category, for companies based in India? | SELECT Category, MAX(Score) as Max_Score FROM AlgorithmicFairness WHERE Date BETWEEN '2020-07-01' AND '2020-12-31' AND CompanyCountry = 'India' GROUP BY Category; | gretelai_synthetic_text_to_sql |
CREATE TABLE facility_data (id INT, race VARCHAR(20), ethnicity VARCHAR(20), facility VARCHAR(20)); INSERT INTO facility_data (id, race, ethnicity, facility) VALUES (1, 'White', 'Non-Hispanic', 'Facility A'); INSERT INTO facility_data (id, race, ethnicity, facility) VALUES (2, 'Black', 'Hispanic', 'Facility A'); | What is the racial and ethnic composition of incarcerated individuals in a specific facility? | SELECT facility, race, ethnicity, COUNT(*) AS count FROM facility_data GROUP BY facility, race, ethnicity HAVING facility = 'Facility A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BoeingAircraft (aircraft_id INT, delivery_time INT); CREATE TABLE AircraftManufacturing (aircraft_id INT, manufacturer VARCHAR(50), country VARCHAR(50)); INSERT INTO AircraftManufacturing (aircraft_id, manufacturer, country) VALUES (1, 'Boeing', 'USA'), (2, 'Airbus', 'Europe'); | List all Boeing aircraft with their delivery times. | SELECT Ba.aircraft_id, Ba.delivery_time FROM BoeingAircraft Ba JOIN AircraftManufacturing Am ON Ba.aircraft_id = Am.aircraft_id WHERE Am.manufacturer = 'Boeing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (id INT, name VARCHAR(255), state VARCHAR(255), silver_tons INT); INSERT INTO mine (id, name, state, silver_tons) VALUES (1, 'California Silver Mine', 'California', 800), (2, 'Nevada Silver Mine', 'Nevada', 900), (3, 'Alaskan Gold Mine', 'Alaska', 700); | What is the total amount of silver extracted, for mines located in California or Nevada? | SELECT SUM(silver_tons) as total_silver FROM mine WHERE state IN ('California', 'Nevada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, name TEXT); CREATE TABLE cases (case_id INT, attorney_id INT, billing_amount DECIMAL); | Who are the top 5 attorneys with the highest billing amounts? | SELECT attorneys.name, SUM(cases.billing_amount) AS total_billing_amount FROM attorneys INNER JOIN cases ON attorneys.attorney_id = cases.attorney_id GROUP BY attorneys.name ORDER BY total_billing_amount DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthInnovate_DrugSales(drug VARCHAR(20), year INT, sales DECIMAL(10,2)); INSERT INTO HealthInnovate_DrugSales VALUES('DrugA', 2022, 2500000.00); INSERT INTO HealthInnovate_DrugSales VALUES('DrugB', 2022, 2000000.00); | Which drug had the lowest sales in 2022 for 'HealthInnovate'? | SELECT drug, MIN(sales) FROM HealthInnovate_DrugSales WHERE year = 2022 GROUP BY drug ORDER BY sales ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_subscribers (subscriber_id INT, name VARCHAR(255), last_network_issue_date DATE); | List all broadband subscribers who have not had any network issues in the last month. | SELECT subscriber_id, name FROM broadband_subscribers WHERE last_network_issue_date IS NULL OR last_network_issue_date < DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricSportsCar (Id INT, Name VARCHAR(255), Year INT, Torque INT); INSERT INTO ElectricSportsCar (Id, Name, Year, Torque) VALUES (1, 'Tesla Roadster', 2022, 1000), (2, 'Rimac Nevera', 2022, 1914), (3, 'Lucid Air', 2022, 800); | What is the average torque of electric sports cars manufactured in 2022? | SELECT AVG(Torque) FROM ElectricSportsCar WHERE Year = 2022 AND Name LIKE '%Electric%Sports%' | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, district_id INT, case_type VARCHAR(20), open_date DATE); INSERT INTO cases (case_id, district_id, case_type, open_date) VALUES (1, 1, 'Civil', '2022-01-05'), (2, 2, 'Criminal', '2022-03-10'), (3, 1, 'Civil', '2022-04-01'); | What is the distribution of cases by case type, in each district, in the last month? | SELECT cases.district_id, cases.case_type, COUNT(*) as num_cases FROM cases WHERE open_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY cases.district_id, cases.case_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, name TEXT, title TEXT); INSERT INTO attorneys (attorney_id, name, title) VALUES (1, 'Doe', 'Senior Partner'), (2, 'Roe', 'Partner'), (3, 'Smith', 'Associate'); CREATE TABLE cases (case_id INT, attorney_id INT, category TEXT, billing_amount INT); INSERT INTO cases (case_id, attor... | What is the maximum billing amount for cases in the 'Civil' category, and the corresponding attorney's title? | SELECT MAX(cases.billing_amount), attorneys.title FROM cases INNER JOIN attorneys ON cases.attorney_id = attorneys.attorney_id WHERE cases.category = 'Civil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, FirstName varchar(50), LastName varchar(50), Department varchar(50), Gender varchar(50), Salary decimal(10,2), HireDate date, ManagerID int); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Gender, Salary, HireDate, ManagerID) VALUES (1, 'John', 'Doe', 'IT', '... | What is the number of employees by department and manager? | SELECT Department, ManagerID, COUNT(*) as TotalEmployees FROM Employees GROUP BY Department, ManagerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE storage_facilities (id INT, facility_name TEXT, country TEXT); INSERT INTO storage_facilities (id, facility_name, country) VALUES (1, 'Facility A', 'Canada'), (2, 'Facility B', 'Mexico'); | Insert new records of chemical storage facilities in Argentina. | INSERT INTO storage_facilities (id, facility_name, country) VALUES (3, 'Facility C', 'Argentina'), (4, 'Facility D', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, site VARCHAR(50), year INT, gold_production INT, silver_production INT); | What is the total silver production by 'Site A' and 'Site C' in the 'production' table? | SELECT SUM(silver_production) FROM production WHERE site IN ('Site A', 'Site C'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (item_id INT, name VARCHAR(50), is_organic BOOLEAN, is_local BOOLEAN, quantity INT); INSERT INTO Inventory (item_id, name, is_organic, is_local, quantity) VALUES (1, 'Carrots', true, true, 50), (2, 'Apples', false, false, 100); | What is the total quantity of ingredients that are neither organic nor locally sourced? | SELECT SUM(quantity) FROM Inventory WHERE is_organic = false AND is_local = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), industry VARCHAR(255)); INSERT INTO suppliers (id, name, location, industry) VALUES (4, 'Green Tech Inc', 'Seattle, USA', 'Renewable Energy'); | Get details on suppliers from the renewable energy sector | SELECT * FROM suppliers WHERE industry = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WarehouseTransfers (id INT, source_warehouse_id INT, destination_warehouse_id INT, lead_time INT); INSERT INTO WarehouseTransfers (id, source_warehouse_id, destination_warehouse_id, lead_time) VALUES (7, 14, 15, 6), (8, 14, 15, 4), (9, 16, 14, 5); CREATE TABLE Warehouses (id INT, name TEXT, city TEXT, stat... | What is the minimum lead time for warehouse transfers from the Mumbai warehouse? | SELECT MIN(lead_time) FROM WarehouseTransfers JOIN Warehouses ON WarehouseTransfers.source_warehouse_id = Warehouses.id WHERE Warehouses.name = 'Mumbai Warehouse'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teacher (TeacherID INT, Age INT, CompletedProfessionalDevelopment YEAR); INSERT INTO Teacher (TeacherID, Age, CompletedProfessionalDevelopment) VALUES (1, 35, 2022); INSERT INTO Teacher (TeacherID, Age, CompletedProfessionalDevelopment) VALUES (2, 40, 2021); CREATE VIEW ProfessionalDevelopmentLastYear AS S... | What is the average age of teachers who have completed professional development courses in the last year? | SELECT AVG(Age) FROM ProfessionalDevelopmentLastYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, location TEXT, avg_depth FLOAT); INSERT INTO marine_protected_areas (area_name, location, avg_depth) VALUES ('Bermuda Atlantic National Park', 'Atlantic Ocean', 10.0), ('Galapagos Marine Reserve', 'Atlantic Ocean', 20.0); | What is the minimum depth of all marine protected areas in the Atlantic Ocean? | SELECT MIN(avg_depth) FROM marine_protected_areas WHERE location = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50), State varchar(50)); INSERT INTO Restaurants (RestaurantID, Name, State) VALUES (1, 'Diner A', 'NY'), (2, 'Cafe B', 'CA'), (3, 'Grill C', 'NY'), (4, 'Bakery D', 'CA'); CREATE TABLE Inspections (InspectionID int, RestaurantID int, InspectionDate date, Score in... | Find the number of food safety inspections and the average inspection score for restaurants in New York and California, for inspections that occurred in the last 6 months. | SELECT State, COUNT(*) AS InspectionCount, AVG(Score) AS AverageScore FROM Restaurants R JOIN Inspections I ON R.RestaurantID = I.RestaurantID WHERE InspectionDate >= DATEADD(month, -6, GETDATE()) AND (State = 'NY' OR State = 'CA') GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, state VARCHAR(255), monthly_data_usage INT); | What is the average monthly data usage for customers in Texas? | SELECT AVG(monthly_data_usage) FROM customers WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE equal_opportunity (member_id INT, name VARCHAR(50), union_joined_date DATE); INSERT INTO equal_opportunity (member_id, name, union_joined_date) VALUES (35, 'Avery Carter', '2018-05-22'), (36, 'Bella Johnson', '2019-07-11'), (37, 'Charlie Brown', '2020-10-14'); | What is the earliest union membership date for the 'equal_opportunity' union? | SELECT MIN(union_joined_date) FROM equal_opportunity; | gretelai_synthetic_text_to_sql |
CREATE TABLE agri_innovation (id INT, year INT, project VARCHAR(50), status VARCHAR(20)); INSERT INTO agri_innovation (id, year, project, status) VALUES (1, 2018, 'Precision Agriculture', 'Completed'), (2, 2019, 'Biotech Seeds', 'In Progress'), (3, 2020, 'Farm Robotics', 'Planned'); | How many agricultural innovation projects were completed in 2018 and 2019? | SELECT COUNT(*) FROM agri_innovation WHERE year IN (2018, 2019) AND status = 'Completed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE culinary_classes (class_id INT, participant_name VARCHAR(50), event_type VARCHAR(50)); INSERT INTO culinary_classes (class_id, participant_name, event_type) VALUES (1, 'Aarav', 'Italian Cuisine'), (2, 'Bhavik', 'Chinese Cuisine'), (3, 'Chirag', 'Mexican Cuisine'); | Insert a new record into the 'Culinary Classes' table for the participant 'Rajesh' who attended the 'Indian Cuisine' event. | INSERT INTO culinary_classes (class_id, participant_name, event_type) VALUES (4, 'Rajesh', 'Indian Cuisine'); | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_name VARCHAR(255), sport VARCHAR(255)); INSERT INTO athletes (athlete_name, sport) VALUES ('Usain Bolt', 'Athletics'); INSERT INTO athletes (athlete_name, sport) VALUES ('Carl Lewis', 'Athletics'); CREATE TABLE sprints (athlete_name VARCHAR(255), time FLOAT); INSERT INTO sprints (athlete_... | Return the name of the athlete who has run the fastest 100m sprint | SELECT athlete_name FROM sprints WHERE time = (SELECT MIN(time) FROM sprints); | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShows (ID INT, Location VARCHAR(50), Year INT); INSERT INTO AutoShows (ID, Location, Year) VALUES (1, 'Detroit', 2023), (2, 'Tokyo', 2024), (3, 'Paris', 2023), (4, 'Shanghai', 2024), (5, 'Cape Town', 2025); CREATE TABLE ShowResults (ASID INT, Make VARCHAR(50), Model VARCHAR(50), SafetyRating DECIMAL(3,... | What are the vehicle makes and models with the highest safety ratings at the upcoming auto shows? | SELECT s.Make, s.Model, s.SafetyRating FROM ShowResults s JOIN AutoShows a ON s.ASID = a.ID WHERE a.Year >= 2023 ORDER BY s.SafetyRating DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE silver_mines (id INT, worker_role TEXT, productivity FLOAT, extraction_year INT); INSERT INTO silver_mines (id, worker_role, productivity, extraction_year) VALUES (1, 'Engineer', 11.8, 2016), (2, 'Miner', 8.2, 2016), (3, 'Supervisor', 9.6, 2016); | What is the minimum productivity of workers in the silver mines, categorized by their roles, for the year 2016? | SELECT worker_role, MIN(productivity) FROM silver_mines WHERE extraction_year = 2016 GROUP BY worker_role; | gretelai_synthetic_text_to_sql |
CREATE TABLE government_transparency (year INT, score INT); INSERT INTO government_transparency (year, score) VALUES (2018, 85), (2019, 78), (2020, 82), (2018, 79), (2019, 81), (2020, 83); | What is the average government transparency score for the last 3 years? | SELECT AVG(score) FROM government_transparency WHERE year BETWEEN (SELECT MAX(year) - 2 FROM government_transparency) AND MAX(year); | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), amount INT, year INT); INSERT INTO production (country, amount, year) VALUES ('India', 2000, 2017); INSERT INTO production (country, amount, year) VALUES ('India', 2200, 2018); INSERT INTO production (country, amount, year) VALUES ('India', 2500, 2019); INSERT INTO product... | What is the average annual REE production for India between 2017 and 2021? | SELECT AVG(amount) as avg_annual_production FROM production WHERE country = 'India' AND year BETWEEN 2017 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehiclesUK (vehicle_id INT, model VARCHAR(100), co2_emissions DECIMAL(5,2), country VARCHAR(50), year INT); INSERT INTO ElectricVehiclesUK (vehicle_id, model, co2_emissions, country, year) VALUES (1, 'Model 3', 0, 'UK', 2020), (2, 'Zoe', 0, 'UK', 2020); | What is the minimum CO2 emission of electric vehicles sold in the UK in 2020? | SELECT MIN(co2_emissions) FROM ElectricVehiclesUK WHERE country = 'UK' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE international_tourists (id INT, country VARCHAR(50), visitors INT, visit_date DATE); INSERT INTO international_tourists (id, country, visitors, visit_date) VALUES (1, 'USA', 5000, '2022-01-01'); INSERT INTO international_tourists (id, country, visitors, visit_date) VALUES (2, 'Canada', 4000, '2022-01-01'); | Which country had the most visitors in 2022 from the 'international_tourists' table? | SELECT country, SUM(visitors) as total_visitors FROM international_tourists WHERE visit_date = '2022-01-01' GROUP BY country ORDER BY total_visitors DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (drug_id INT, drug_name VARCHAR(255), approval_date DATE); INSERT INTO drug_approval (drug_id, drug_name, approval_date) VALUES (1, 'Drug1', '2020-01-01'), (2, 'Drug2', '2019-06-15'), (3, 'Drug3', '2021-03-20'); CREATE TABLE drug_launch (drug_id INT, drug_name VARCHAR(255), launch_date DATE);... | Which drugs were launched in the market but not approved? | SELECT dl.drug_name FROM drug_launch dl LEFT JOIN drug_approval da ON dl.drug_name = da.drug_name WHERE da.drug_name IS 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.