context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE regional_categories (equipment_type TEXT, maintenance_category TEXT, region TEXT); INSERT INTO regional_categories (equipment_type, maintenance_category, region) VALUES ('F-35', 'Electrical', 'Pacific'), ('M1 Abrams', 'Mechanical', 'Pacific'), ('Humvee', 'Electrical', 'Pacific'), ('Black Hawk', 'Mechanical... | Show the total number of military equipment types by maintenance category for the Pacific region | SELECT maintenance_category, COUNT(*) FROM regional_categories WHERE region = 'Pacific' GROUP BY maintenance_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_data (hotel_id INT, hotel_name TEXT, region TEXT, country TEXT, stars INT); INSERT INTO hotel_data (hotel_id, hotel_name, region, country, stars) VALUES (1, 'Park Hotel', 'Central', 'Switzerland', 5), (2, 'Four Seasons', 'Eastern', 'Canada', 5), (3, 'The Plaza', 'Northern', 'USA', 4); | What is the total number of hotels and their average rating for each region in the hotel_data table? | SELECT region, AVG(stars) as avg_rating, COUNT(DISTINCT hotel_id) as hotel_count FROM hotel_data GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE parks (state VARCHAR(255), park_name VARCHAR(255), park_type VARCHAR(255), area FLOAT); INSERT INTO parks (state, park_name, park_type, area) VALUES ('State A', 'Park 1', 'Public', 50.0), ('State A', 'Park 2', 'Public', 75.0), ('State A', 'Park 3', 'Private', 60.0), ('State B', 'Park 4', 'Public', 80.0), (... | What is the number of public parks in each state and their total area? | SELECT s1.state, s1.park_type, COUNT(s1.park_name) as num_parks, SUM(s1.area) as total_area FROM parks s1 WHERE s1.park_type = 'Public' GROUP BY s1.state, s1.park_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, grade_level VARCHAR(10), mental_health_score INT, semester VARCHAR(10), ethnicity VARCHAR(20)); INSERT INTO student_mental_health (student_id, grade_level, mental_health_score, semester, ethnicity) VALUES (1, '9th', 80, 'Fall 2022', 'African American'), (2, '10th', 75... | What are the total mental health scores for students who identify as African American or Black in 'Fall 2022'? | SELECT SUM(mental_health_score) as total_score FROM student_mental_health WHERE semester = 'Fall 2022' AND (ethnicity = 'African American' OR ethnicity = 'Black'); | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure.projects (id INT, project_name VARCHAR(50), location VARCHAR(50), budget FLOAT); INSERT INTO rural_infrastructure.projects (id, project_name, location, budget) VALUES (1, 'Road', 'Africa', 150000), (2, 'Bridge', 'Asia', 200000), (3, 'Irrigation System', 'South America', 500000); | What is the average budget for rural infrastructure projects in the 'rural_infrastructure' schema in Africa? | SELECT AVG(budget) FROM rural_infrastructure.projects WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name VARCHAR(50), type VARCHAR(50)); CREATE TABLE cargo_transport(vessel_id INT, cargo_type VARCHAR(50), quantity INT, transport_date DATE); INSERT INTO vessels VALUES (1, 'Vessel1', 'Container'); INSERT INTO cargo_transport VALUES (1, 'Container', 1500, '2022-01-01'); | How many containers were transported by vessels with the 'Container' type in the last 6 months? | SELECT vessels.name, SUM(cargo_transport.quantity) FROM vessels INNER JOIN cargo_transport ON vessels.id = cargo_transport.vessel_id WHERE cargo_transport.transport_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND vessels.type = 'Container' GROUP BY vessels.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, post_date DATE); INSERT INTO posts (id, user_id, post_date) VALUES (1, 1, '2022-01-01'), (2, 2, '2022-01-10'), (3, 1, '2022-02-01'), (4, 3, '2022-03-01'), (5, 1, '2022-03-01'), (6, 1, '2022-03-01'); CREATE TABLE users (id INT, country VARCHAR(255)); INSERT INTO users (id, countr... | What is the maximum number of posts made by a single user in a day? | SELECT user_id, MAX(post_count) FROM (SELECT user_id, COUNT(*) AS post_count FROM posts GROUP BY user_id, post_date) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE parttime_workers (id INT, industry VARCHAR(20), salary FLOAT, union_member BOOLEAN); INSERT INTO parttime_workers (id, industry, salary, union_member) VALUES (1, 'healthcare', 30000.0, false), (2, 'healthcare', 32000.0, false), (3, 'manufacturing', 25000.0, true), (4, 'retail', 20000.0, false), (5, 'retail... | How many part-time workers are there in total in the 'retail' industry, and how many of them are union members? | SELECT COUNT(*), SUM(union_member) FROM parttime_workers WHERE industry = 'retail'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name VARCHAR(255), type VARCHAR(255), revenue FLOAT); INSERT INTO restaurants (id, name, type, revenue) VALUES (1, 'Restaurant A', 'Italian', 5000.00), (2, 'Restaurant B', 'Vegan', 7000.00); | What is the total revenue for vegan menu items? | SELECT SUM(revenue) FROM restaurants WHERE type = 'Vegan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy.projects (project_category VARCHAR(255), solar_capacity INT); INSERT INTO renewable_energy.projects (project_category, solar_capacity) VALUES ('Solar Farms', 50000), ('Wind Farms', 30000), ('Solar Farms', 60000), ('Geothermal', 40000); | What is the maximum solar capacity installed for each renewable energy project category in the 'renewable_energy' schema? | SELECT project_category, MAX(solar_capacity) FROM renewable_energy.projects GROUP BY project_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE BlockchainEthicalBrands (id INT, garments_sold INT); INSERT INTO BlockchainEthicalBrands (id, garments_sold) VALUES (1, 3500), (2, 4000), (3, 3750), (4, 4200), (5, 3900); | What is the total number of garments sold by ethical fashion brands using blockchain technology? | SELECT SUM(garments_sold) FROM BlockchainEthicalBrands; | gretelai_synthetic_text_to_sql |
CREATE TABLE workforce_diversity (id INT, name VARCHAR(50), position VARCHAR(50), gender VARCHAR(50), hours_worked INT); | What is the average number of hours worked per week by workers in the 'workforce_diversity' table by gender? | SELECT gender, AVG(hours_worked) FROM workforce_diversity WHERE position = 'worker' GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_plans (plan_id INT, speed FLOAT, plan_type VARCHAR(50)); INSERT INTO broadband_plans (plan_id, speed, plan_type) VALUES (1, 600, 'Fiber'), (2, 450, 'Cable'), (3, 550, 'Fiber'); | Which broadband plans have speeds greater than 500 Mbps? | SELECT plan_id, plan_type FROM broadband_plans WHERE speed > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE source_countries (id INT, country VARCHAR(50), num_ecotourists INT, total_eco_rating INT); INSERT INTO source_countries (id, country, num_ecotourists, total_eco_rating) VALUES (1, 'United States', 2000, 15000), (2, 'Australia', 1500, 12000), (3, 'Canada', 1200, 10000), (4, 'United Kingdom', 1800, 18000), (... | List the top 5 source countries for ecotourism by the total eco-rating in descending order. | SELECT sc.country, SUM(sc.total_eco_rating) AS total_eco_rating FROM source_countries sc JOIN eco_ratings er ON sc.country = er.source_country GROUP BY sc.country ORDER BY total_eco_rating DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (id INT, name TEXT, industry TEXT, employees INT, funding FLOAT); INSERT INTO Companies (id, name, industry, employees, funding) VALUES (1, 'SunForce', 'Renewable Energy', 50, 10000000.00); INSERT INTO Companies (id, name, industry, employees, funding) VALUES (2, 'WindWave', 'Renewable Energy', 1... | What is the average number of employees for companies in the renewable energy sector? | SELECT AVG(employees) FROM Companies WHERE industry = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE subsea_system (id INT PRIMARY KEY, name TEXT, operator TEXT, system_type TEXT); | Delete all records in the 'subsea_system' table where the 'operator' is 'Kappa Corp.' and the 'system_type' is 'flowline' | DELETE FROM subsea_system WHERE operator = 'Kappa Corp.' AND system_type = 'flowline'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teams (id INT, name VARCHAR(50), members INT); | How many employees work in the circular economy team? | SELECT COUNT(*) FROM Teams WHERE name = 'circular economy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Labor_Statistics (Year INT, Location TEXT, Workers INT); INSERT INTO Labor_Statistics (Year, Location, Workers) VALUES (2018, 'California', 5000), (2019, 'New York', 7000), (2020, 'Texas', 6000); | What is the minimum number of construction laborers in California in 2018? | SELECT MIN(Workers) FROM Labor_Statistics WHERE Year = 2018 AND Location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Southern_Ocean (area_name text, species_name text, species_abundance numeric); | What is the total number of marine species in the Southern Ocean? | SELECT COUNT(DISTINCT species_name) FROM Southern_Ocean WHERE area_name = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE beneficiaries (id INT, name VARCHAR(255), program VARCHAR(255), service_date DATE); INSERT INTO beneficiaries (id, name, program, service_date) VALUES (1, 'Beneficiary 1', 'health_and_nutrition', '2022-01-01'), (2, 'Beneficiary 2', 'education', '2022-01-02'), (3, 'Beneficiary 3', 'health_and_nutrition', '2... | Find the number of unique beneficiaries served by 'health_and_nutrition' and 'education' programs in 'humanitarian_aid' database. | SELECT COUNT(DISTINCT name) FROM beneficiaries WHERE program IN ('health_and_nutrition', 'education'); | gretelai_synthetic_text_to_sql |
CREATE TABLE experiments (id INT, name VARCHAR(50), technology VARCHAR(50), description TEXT, target VARCHAR(50)); INSERT INTO experiments (id, name, technology, description, target) VALUES (3, 'Experiment3', 'CRISPR', 'Gene regulation using CRISPR...', 'Animals'); | Which genetic research experiments used CRISPR technology for gene regulation in animals? | SELECT name FROM experiments WHERE technology = 'CRISPR' AND target = 'Animals'; | gretelai_synthetic_text_to_sql |
CREATE TABLE nba_scorers (scorer_id INT, scorer_name VARCHAR(50), team_id INT, season INT, points INT); INSERT INTO nba_scorers (scorer_id, scorer_name, team_id, season, points) VALUES (1, 'Michael Jordan', 1, 1986, 3712), (2, 'Kobe Bryant', 2, 2006, 2832); | What is the highest number of points scored by a player in a single season in the NBA, by team? | SELECT team_id, MAX(points) FROM nba_scorers GROUP BY team_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, location VARCHAR(20), entry_fee INT); INSERT INTO Exhibitions (exhibition_id, location, entry_fee) VALUES (1, 'Istanbul', 6), (2, 'Istanbul', 10), (3, 'Istanbul', 5); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT); INSERT INTO Visitors (visitor_id, exhibition_id) ... | What is the total number of visitors who attended exhibitions in Istanbul with an entry fee below 7? | SELECT COUNT(DISTINCT visitor_id) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.exhibition_id WHERE e.location = 'Istanbul' AND e.entry_fee < 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibitions (exhibition_id INT, name VARCHAR(20), start_date DATE); | Insert a new record into the 'exhibitions' table with an exhibition ID of 3, a name of 'Digital Art', and a start date of '2023-04-01' | INSERT INTO exhibitions (exhibition_id, name, start_date) VALUES (3, 'Digital Art', '2023-04-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitarySpending (Year INT, Country VARCHAR(50), Spending FLOAT); INSERT INTO MilitarySpending (Year, Country, Spending) VALUES (2016, 'Algeria', 8.3), (2016, 'Angola', 4.1), (2017, 'Algeria', 8.5), (2017, 'Angola', 4.3); | Rank the top 3 countries with the largest increase in military spending between 2016 and 2018? | SELECT Country, MAX(Spending) - MIN(Spending) as Increase FROM MilitarySpending WHERE Year IN (2016, 2018) GROUP BY Country ORDER BY Increase DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name TEXT, is_cruelty_free BOOLEAN); | Delete all records of non-cruelty-free skincare products. | DELETE FROM products WHERE is_cruelty_free = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterUsage (id INT, location VARCHAR(50), date DATE, usage FLOAT); INSERT INTO WaterUsage (id, location, date, usage) VALUES (1, 'Austin', '2022-01-01', 120000), (2, 'Atlanta', '2022-01-01', 150000); | What is the average water usage per month in Austin and Atlanta? | SELECT location, AVG(usage) as avg_usage FROM WaterUsage WHERE date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE stadium_seats (seat_id INT, section VARCHAR(50), row VARCHAR(50), price DECIMAL(5,2)); INSERT INTO stadium_seats VALUES (1, '100', 'A', 100.00); INSERT INTO stadium_seats VALUES (2, '100', 'B', 90.00); INSERT INTO stadium_seats VALUES (3, '200', 'C', 80.00); INSERT INTO stadium_seats VALUES (4, '200', 'D',... | What is the average ticket price for each section in the stadium, ranked from the highest to the lowest? | SELECT section, AVG(price) as avg_price, RANK() OVER (ORDER BY AVG(price) DESC) as rank FROM stadium_seats GROUP BY section ORDER BY rank; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_parks.timber_volume (species VARCHAR(255), volume DECIMAL(5,2)); | List the top 3 tree species with the highest timber volume in the state_parks schema, in ascending order. | SELECT species FROM state_parks.timber_volume ORDER BY volume ASC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE NATO_Troops_Equipment_PKO (id INT, year INT, troops INT, equipment INT); | What is the total number of troops and equipment deployed by NATO in peacekeeping operations in the last 5 years? | SELECT SUM(troops) as total_troops, SUM(equipment) as total_equipment FROM NATO_Troops_Equipment_PKO WHERE year BETWEEN (YEAR(CURRENT_DATE) - 5) AND YEAR(CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE workouts (id INT, user_id INT, workout_date DATE, calories INT, country VARCHAR(50)); INSERT INTO workouts (id, user_id, workout_date, calories, country) VALUES (1, 123, '2022-01-01', 300, 'USA'); INSERT INTO workouts (id, user_id, workout_date, calories, country) VALUES (2, 456, '2022-01-02', 400, 'Canada... | What is the minimum number of calories burned in a single workout by users from Australia? | SELECT MIN(calories) FROM workouts WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (element VARCHAR(10), year INT, month INT, quantity INT); | What is the total production quantity of Holmium for the year 2020 from the 'production' table? | SELECT SUM(quantity) FROM production WHERE element = 'Holmium' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_membership_statistics (member_id INT, name VARCHAR(50), union_joined_date DATE); INSERT INTO union_membership_statistics (member_id, name, union_joined_date) VALUES (7, 'Eli Wilson', '2021-03-17'), (8, 'Fiona Kim', '2016-11-11'); | How many members are there in the 'union_membership_statistics' union? | SELECT COUNT(*) FROM union_membership_statistics; | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts(id INT, name VARCHAR(255), gender VARCHAR(10)); CREATE TABLE missions(id INT, name VARCHAR(255)); CREATE TABLE shuttle_flights(astronaut_id INT, mission_id INT); INSERT INTO astronauts(id, name, gender) VALUES (1, 'John Doe', 'Male'); INSERT INTO missions(id, name) VALUES (1, 'STS-42'); INSERT I... | List all astronauts who have flown on the Space Shuttle Discovery. | SELECT a.name FROM astronauts a INNER JOIN shuttle_flights sf ON a.id = sf.astronaut_id INNER JOIN missions m ON sf.mission_id = m.id WHERE m.name = 'STS-42'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, city VARCHAR(50), carbon_footprint DECIMAL(3,1)); INSERT INTO eco_hotels (hotel_id, city, carbon_footprint) VALUES (1, 'Rio de Janeiro', 3.5), (2, 'Rio de Janeiro', 4.2), (3, 'Rio de Janeiro', 3.8), (4, 'São Paulo', 4.5); | Update the carbon footprint ratings for eco-friendly hotels in Rio de Janeiro with a rating below 4. | UPDATE eco_hotels SET carbon_footprint = carbon_footprint + 0.5 WHERE city = 'Rio de Janeiro' AND carbon_footprint < 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthcareFacilities (Id INT, Name TEXT, Location TEXT, Services TEXT); INSERT INTO HealthcareFacilities (Id, Name, Location, Services) VALUES (1, 'Hospital A', 'City X', 'General, Emergency, Surgery'); INSERT INTO HealthcareFacilities (Id, Name, Location, Services) VALUES (2, 'Clinic A', 'City X', 'Family... | What are the names of healthcare facilities that do not offer mental health services? | SELECT Name FROM HealthcareFacilities WHERE Services NOT LIKE '%Mental Health%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_data (id INT, species TEXT, ocean TEXT, biomass FLOAT, country TEXT); INSERT INTO fish_data (id, species, ocean, biomass, country) VALUES (1, 'Species A', 'Arctic', 1200, 'Country A'), (2, 'Species B', 'Arctic', 1500, 'Country B'), (3, 'Species C', 'Arctic', 1800, 'Country A'); | What is the total biomass of fish in the Arctic ocean caught by fishing vessels from each country? | SELECT country, SUM(biomass) FROM fish_data WHERE ocean = 'Arctic' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT, dish_name VARCHAR(255), cuisine VARCHAR(255)); INSERT INTO dishes (dish_id, dish_name, cuisine) VALUES (1, 'Fried Rice', 'Chinese'), (2, 'Tacos', 'Mexican'), (3, 'Spaghetti Bolognese', 'Italian'); | What is the total number of dishes in the Chinese and Mexican cuisine categories? | SELECT SUM(CASE WHEN cuisine IN ('Chinese', 'Mexican') THEN 1 ELSE 0 END) FROM dishes; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), area_id INT, depth FLOAT, size INT, country VARCHAR(255)); INSERT INTO marine_protected_areas (name, area_id, depth, size, country) VALUES ('Buck Island Reef National Monument', 7, 10, 1760, 'US Virgin Islands'), ('Montego Bay Marine Park', 8, 20, 1500, 'Jamaica')... | What is the average size of marine protected areas in the Caribbean? | SELECT AVG(size) FROM marine_protected_areas WHERE country = 'Caribbean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE royalties (royalty_id INT, artist_id INT, platform VARCHAR(50), amount DECIMAL(5,2)); | What is the distribution of royalties by platform, for a specific artist? | SELECT r.platform, SUM(r.amount) AS total_royalties FROM royalties r WHERE r.artist_id = [artist_id] GROUP BY r.platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(50), hire_date DATE); | Delete the record for employee "James Smith" from the "employees" table | DELETE FROM employees WHERE first_name = 'James' AND last_name = 'Smith'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment_sales (id INT, defense_contractor_id INT, sale_date DATE); INSERT INTO military_equipment_sales (id, defense_contractor_id, sale_date) VALUES (1, 1, '2021-01-01'), (2, 1, '2021-02-01'), (3, 2, '2021-03-01'), (4, 3, '2021-04-01'); CREATE TABLE defense_contractors (id INT, name VARCHAR(255... | Display the names of all defense contractors that have not engaged in any military equipment sales in the past 6 months. | SELECT d.name FROM defense_contractors d LEFT JOIN military_equipment_sales m ON d.id = m.defense_contractor_id WHERE m.sale_date IS NULL OR m.sale_date < DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_varieties (id INT, crop_name VARCHAR(50), yield INT, revenue INT); CREATE TABLE expenses (id INT, variety_id INT, cost INT); | What is the average yield and production cost for each variety of crop in the "crop_varieties" and "expenses" tables? | SELECT crop_varieties.crop_name, AVG(crop_varieties.yield) AS avg_yield, AVG(expenses.cost) AS avg_cost FROM crop_varieties INNER JOIN expenses ON crop_varieties.id = expenses.variety_id GROUP BY crop_varieties.crop_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSitesReviews (ID INT, SiteName VARCHAR(100), Reviews INT); INSERT INTO HeritageSitesReviews (ID, SiteName, Reviews) VALUES (1, 'Machu Picchu', 5000); INSERT INTO HeritageSitesReviews (ID, SiteName, Reviews) VALUES (2, 'Taj Mahal', 8000); | What is the percentage of visitor reviews for each heritage site out of the total number of reviews? | SELECT SiteName, Reviews, 100.0 * Reviews / SUM(Reviews) OVER () AS Percentage FROM HeritageSitesReviews; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, name TEXT, department TEXT); INSERT INTO attorneys (attorney_id, name, department) VALUES (1, 'Jane Smith', 'Litigation'), (2, 'Bob Johnson', 'Corporate'); CREATE TABLE cases (case_id INT, attorney_id INT, billing_amount INT); INSERT INTO cases (case_id, attorney_id, billing_amo... | What is the maximum billing amount for cases handled by attorneys in the litigation department? | SELECT MAX(billing_amount) FROM cases WHERE attorney_id IN (SELECT attorney_id FROM attorneys WHERE department = 'Litigation') | gretelai_synthetic_text_to_sql |
CREATE TABLE Training (EmployeeID INT, TrainingName VARCHAR(50)); INSERT INTO Training (EmployeeID, TrainingName) VALUES (1, 'Diversity and Inclusion Training'), (2, 'Cybersecurity Training'), (3, 'Compliance Training'), (4, 'Cybersecurity Training'); | What is the count of employees who have completed compliance training? | SELECT COUNT(DISTINCT EmployeeID) FROM Training WHERE TrainingName = 'Compliance Training'; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_sessions (user_id INT, game_name VARCHAR(10), login_date DATE); INSERT INTO game_sessions (user_id, game_name, login_date) VALUES (8, 'B', '2021-01-02'), (8, 'C', '2021-01-03'), (8, 'B', '2021-01-05'), (9, 'D', '2021-01-06'), (10, 'A', '2021-01-07'); | Determine the number of unique games played by user 8 in January 2021 | SELECT COUNT(DISTINCT game_name) FROM game_sessions WHERE user_id = 8 AND login_date BETWEEN '2021-01-01' AND '2021-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mammals (id INT, name VARCHAR(255), conservation_status VARCHAR(255)); CREATE TABLE birds (id INT, name VARCHAR(255), conservation_status VARCHAR(255)); | Show the number of marine mammals and birds by their conservation status. | SELECT 'Mammals' AS animal_group, conservation_status, COUNT(*) as count FROM mammals GROUP BY conservation_status UNION ALL SELECT 'Birds', conservation_status, COUNT(*) FROM birds GROUP BY conservation_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (Material VARCHAR(50), Cost DECIMAL(5,2)); INSERT INTO Production (Material, Cost) VALUES ('Organic Cotton', 3.50), ('Hemp', 2.80), ('Recycled Polyester', 4.20), ('Tencel', 3.10); | Which ethical materials have the highest production costs? | SELECT Material, Cost FROM Production ORDER BY Cost DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE UNESCO_Intangible_Heritage (id INT, year INT, art_form VARCHAR(100)); INSERT INTO UNESCO_Intangible_Heritage (id, year, art_form) VALUES (1, 2001, 'Argentine Tango'), (2, 2003, 'Kilim weaving in Turkey'), (3, 2005, 'Falconry, a living human heritage'); | Identify the traditional art forms that were first inscribed in the Representative List of the Intangible Cultural Heritage of Humanity in 2001. | SELECT art_form FROM UNESCO_Intangible_Heritage WHERE year = 2001; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_sales (id INT PRIMARY KEY, year INT, make VARCHAR(255), model VARCHAR(255), country VARCHAR(255), units_sold INT); INSERT INTO ev_sales (id, year, make, model, country, units_sold) VALUES (1, 2020, 'Tesla', 'Model 3', 'USA', 300000); | Show all records from the electric vehicle sales table | SELECT * FROM ev_sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE RecycledMaterials (id INT, material VARCHAR(50), quantity INT); INSERT INTO RecycledMaterials (id, material, quantity) VALUES (1, 'Recycled Polyester', 1500), (2, 'Reclaimed Wood', 800), (3, 'Regenerated Leather', 1200); | What is the total quantity of recycled materials used in production? | SELECT SUM(quantity) FROM RecycledMaterials; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_materials (country VARCHAR(50), fashion_production_sector VARCHAR(50), organic_material_type VARCHAR(50), percentage_use FLOAT); | Create a table for 'organic_materials' in the 'fashion_production' sector | CREATE TABLE organic_materials (country VARCHAR(50), fashion_production_sector VARCHAR(50), organic_material_type VARCHAR(50), percentage_use FLOAT); | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (product_id INT, product_name VARCHAR(100), is_organic BOOLEAN, calorie_count INT); INSERT INTO Inventory (product_id, product_name, is_organic, calorie_count) VALUES (1, 'Apple', true, 95), (2, 'Banana', true, 105), (3, 'Chips', false, 150); | What is the average calorie count for organic products in our inventory? | SELECT AVG(calorie_count) FROM Inventory WHERE is_organic = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE nfl_scores (game_id INT, season INT, home_team TEXT, away_team TEXT, home_score INT, away_score INT); INSERT INTO nfl_scores (game_id, season, home_team, away_team, home_score, away_score) VALUES (1, 1966, 'Green Bay Packers', 'Dallas Cowboys', 34, 27), (2, 1990, 'Buffalo Bills', 'Los Angeles Raiders', 51,... | What is the highest scoring game in the history of the NFL? | SELECT MAX(GREATEST(home_score, away_score)) FROM nfl_scores; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleRegistrations (vehicle_id INT, vehicle_type TEXT, registration_date DATE, state TEXT); CREATE TABLE ElectricVehicles (vehicle_id INT, vehicle_model TEXT); | How many electric vehicles are registered in each state, based on the last registration date? | SELECT state, COUNT(DISTINCT vehicle_id) AS electric_vehicle_count FROM VehicleRegistrations vr INNER JOIN ElectricVehicles ev ON vr.vehicle_id = ev.vehicle_id WHERE registration_date = (SELECT MAX(registration_date) FROM VehicleRegistrations) GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE planets (id INT PRIMARY KEY, name VARCHAR(50), distance_to_sun FLOAT); INSERT INTO planets (id, name, distance_to_sun) VALUES (1, 'Mercury', 0.39), (2, 'Venus', 0.72), (3, 'Earth', 1), (4, 'Mars', 1.52); | Add a new planet 'Pluto' to the table | INSERT INTO planets (id, name, distance_to_sun) VALUES (5, 'Pluto', 3.67); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, city VARCHAR(20), visitors INT); CREATE TABLE VisitorExhibitions (visitor_id INT, exhibition_id INT); INSERT INTO Exhibitions (id, city, visitors) VALUES (1, 'Paris', 3000), (2, 'London', 4000), (3, 'New York', 5000); INSERT INTO VisitorExhibitions (visitor_id, exhibition_id) VALUES (1... | Find the total number of visits for each exhibition in descending order. | SELECT e.id, e.city, COUNT(ve.visitor_id) AS total_visits FROM Exhibitions e JOIN VisitorExhibitions ve ON e.id = ve.exhibition_id GROUP BY e.id ORDER BY total_visits DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name TEXT); INSERT INTO organizations (id, name) VALUES (1, 'Org1'), (2, 'Org2'), (3, 'Org3'); CREATE TABLE applications (id INT, organization_id INT, name TEXT, type TEXT); INSERT INTO applications (id, organization_id, name, type) VALUES (1, 1, 'App1', 'Creative AI'), (2, 1, 'App2'... | Find the number of creative AI applications developed by each organization. | SELECT organizations.name, COUNT(applications.id) as total_applications FROM organizations INNER JOIN applications ON organizations.id = applications.organization_id WHERE applications.type = 'Creative AI' GROUP BY organizations.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT PRIMARY KEY, dish_name VARCHAR(50)); INSERT INTO dishes (dish_id, dish_name) VALUES (1, 'Chia Pudding'), (2, 'Veggie Wrap'); CREATE TABLE dishes_ingredients (dish_id INT, ingredient_id INT, quantity INT); | Insert new dish 'Quinoa Salad' with ingredients: Quinoa, Avocado, Corn, Black Beans, Lime. | INSERT INTO dishes (dish_id, dish_name) VALUES (3, 'Quinoa Salad'); INSERT INTO dishes_ingredients (dish_id, ingredient_id, quantity) VALUES (3, 5, 200), (3, 6, 150), (3, 7, 100), (3, 8, 150), (3, 9, 50); | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_farms (id INT, region_id INT, area FLOAT); CREATE TABLE regions (id INT, name VARCHAR(50)); | What is the total area of land used for organic farming and the number of organic farms in each region from the "organic_farms" and "regions" tables? | SELECT regions.name AS region, SUM(organic_farms.area) AS total_organic_area, COUNT(organic_farms.id) AS num_organic_farms FROM organic_farms INNER JOIN regions ON organic_farms.region_id = regions.id GROUP BY regions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_date DATE); INSERT INTO donations (id, donation_date) VALUES (1, '2022-01-01'), (2, '2022-02-01'), (3, '2022-03-01'); | How many donations were made in the last quarter? | SELECT COUNT(*) FROM donations WHERE donation_date >= '2022-01-01' AND donation_date < '2022-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT, project_name VARCHAR(50), location VARCHAR(50), investment FLOAT); INSERT INTO renewable_energy (id, project_name, location, investment) VALUES (1, 'Solar Farm', 'Arizona', 12000000), (2, 'Wind Turbines', 'Texas', 8000000); | Find the total investment in all renewable energy projects in the 'renewable_energy' schema. | SELECT SUM(investment) FROM renewable_energy; | gretelai_synthetic_text_to_sql |
CREATE TABLE SiteA (artifact_id INT, artifact_name VARCHAR(50), description TEXT); INSERT INTO SiteA (artifact_id, artifact_name, description) VALUES (1, 'Pottery Shard', 'Fragments of ancient pottery'); | Which artifacts were found in 'SiteA'? | SELECT artifact_name FROM SiteA; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, name VARCHAR(50), last_name VARCHAR(50), current_team VARCHAR(50), previous_team VARCHAR(50), salary DECIMAL(10, 2)); INSERT INTO players (player_id, name, last_name, current_team, previous_team, salary) VALUES (1, 'John', 'Doe', 'Red Sox', 'Yankees', 20000000), (2, 'Jane', 'Smith',... | What are the average salaries of players who switched teams in the last season? | SELECT AVG(salary) FROM players WHERE current_team <> previous_team AND game_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(100), Country varchar(50), DonationAmount decimal(10,2)); INSERT INTO Donors (DonorID, DonorName, Country, DonationAmount) VALUES (1, 'John Doe', 'Mexico', 500.00); | What is the average donation amount per donor from 'Mexico' in the year 2020? | SELECT AVG(DonationAmount) FROM Donors WHERE Country = 'Mexico' AND YEAR(DonationDate) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethics_org (name VARCHAR(50), initiatives INT, region VARCHAR(50)); INSERT INTO ethics_org (name, initiatives, region) VALUES ('Ethics Asia', 12, 'Asia'), ('AI Watchdog', 15, 'Asia'); | Which ethical AI organizations have the most initiatives in Asia? | SELECT name FROM ethics_org WHERE region = 'Asia' ORDER BY initiatives DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_publication_dates (title VARCHAR(100), publication_date DATE); INSERT INTO news_publication_dates (title, publication_date) VALUES ('Article 1', '2021-01-01'), ('Article 2', '2021-02-03'), ('Article 3', '2021-02-15'), ('Article 4', '2021-03-05'), ('Article 5', '2021-04-10'); | How many news articles were published in each month of 2021? | SELECT EXTRACT(MONTH FROM publication_date) AS month, COUNT(*) AS articles_published FROM news_publication_dates GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Project_Budget (id INT, project_name TEXT, location TEXT, budget INT); INSERT INTO Project_Budget (id, project_name, location, budget) VALUES (1, 'Residential Tower', 'Los Angeles', 7000000), (2, 'Commercial Building', 'Los Angeles', 9000000); | What is the maximum budget for projects in Los Angeles with 'Residential' in their names? | SELECT MAX(budget) FROM Project_Budget WHERE location = 'Los Angeles' AND project_name LIKE '%Residential%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT PRIMARY KEY, source VARCHAR(255), severity VARCHAR(255), mitigation_date DATE); INSERT INTO vulnerabilities (id, source, severity, mitigation_date) VALUES (1, 'NSA', 'High', '2021-08-01'); | How many high severity vulnerabilities were reported by each source in July 2021, which have not been mitigated yet? | SELECT source, COUNT(*) as num_vulnerabilities FROM vulnerabilities WHERE severity = 'High' AND mitigation_date > '2021-07-01' GROUP BY source HAVING num_vulnerabilities > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, stars FLOAT, is_eco_friendly BOOLEAN); CREATE TABLE countries (country_id INT, name TEXT, region TEXT); | Display the average hotel rating and the number of eco-friendly hotels in each region. | SELECT c.region, AVG(h.stars) AS avg_rating, SUM(h.is_eco_friendly) AS eco_friendly_hotels FROM hotels h INNER JOIN countries c ON h.country = c.name GROUP BY c.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_counts (well_name TEXT); INSERT INTO well_counts (well_name) VALUES ('Well A'), ('Well B'), ('Well C'), ('Well D'), ('Well E'), ('Well F'); | How many wells are there in total? | SELECT COUNT(*) FROM well_counts; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableDestinations (DestinationID INT, Destination VARCHAR(20)); INSERT INTO SustainableDestinations (DestinationID, Destination) VALUES (1, 'Eco-Village'), (2, 'GreenCity'); CREATE TABLE Visits (VisitorID INT, Nationality VARCHAR(20), DestinationID INT, VisitMonth INT, VisitYear INT); INSERT INTO Vis... | Find the total number of visitors to sustainable destinations in Europe, grouped by their nationality and the month of their visit in 2021. | SELECT Nationality, VisitMonth, COUNT(*) as Total FROM Visits JOIN SustainableDestinations ON Visits.DestinationID = SustainableDestinations.DestinationID WHERE VisitYear = 2021 AND Destination IN ('Eco-Village', 'GreenCity') GROUP BY Nationality, VisitMonth; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, area FLOAT, city VARCHAR(20), walkability_score INT); INSERT INTO properties (id, area, city, walkability_score) VALUES (1, 1500, 'Austin', 80), (2, 1200, 'Austin', 75), (3, 1800, 'Austin', 78), (4, 1100, 'Denver', 60), (5, 1400, 'Austin', 72); | What is the total area of properties in the city of Austin with a walkability score above 70? | SELECT SUM(area) FROM properties WHERE city = 'Austin' AND walkability_score > 70; | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (ID INT PRIMARY KEY, Age INT, DailySteps INT, Date DATE); | How many users have achieved their daily step goal for the past week, and what is the average age of these users? | SELECT AVG(Age), COUNT(*) FROM Users WHERE DailySteps >= (SELECT AVG(DailySteps) FROM Users WHERE Date = (SELECT MAX(Date) FROM Users)) AND Date >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (station_id INT, name VARCHAR(255), latitude DECIMAL(9,6), longitude DECIMAL(9,6)); CREATE VIEW station_info AS SELECT name, latitude, longitude FROM stations; | List the station names and their corresponding latitudes and longitudes, ordered by name. | SELECT name, latitude, longitude FROM station_info ORDER BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (id INT, mine_id INT, pollution_level FLOAT, FOREIGN KEY (mine_id) REFERENCES mines(id)); INSERT INTO environmental_impact (id, mine_id, pollution_level) VALUES (7, 11, 2.8); INSERT INTO environmental_impact (id, mine_id, pollution_level) VALUES (8, 12, 2.3); CREATE TABLE mines (id INT... | Delete the environmental impact records of mines located in Colorado. | DELETE e FROM environmental_impact e JOIN mines m ON e.mine_id = m.id WHERE m.location = 'Colorado'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerAge INT, Game VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, PlayerAge, Game, Country) VALUES (1, 22, 'Valorant', 'Australia'); INSERT INTO Players (PlayerID, PlayerAge, Game, Country) VALUES (2, 25, 'Valorant', 'Canada'); INSERT INTO Players (PlayerID, Playe... | What is the minimum age of players who have played Valorant and are from Oceania? | SELECT MIN(PlayerAge) as MinAge FROM Players WHERE Game = 'Valorant' AND Country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE counseling (session_id INT, student_id INT, region VARCHAR(20), session_date DATE); INSERT INTO counseling (session_id, student_id, region, session_date) VALUES (1, 1, 'East', '2021-03-01'), (2, 2, 'North', '2021-04-15'), (3, 3, 'East', '2020-12-31'), (4, 4, 'West', '2021-06-05'), (5, 5, 'South', '2021-11-... | What is the total number of mental health counseling sessions provided to students in the "East" region? | SELECT COUNT(*) FROM counseling WHERE region = 'East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE canada_tourism (destination VARCHAR(50), year INT, visitors INT); INSERT INTO canada_tourism (destination, year, visitors) VALUES ('Banff', 2019, 500000), ('Banff', 2022, 700000), ('Whistler', 2019, 300000), ('Whistler', 2022, 500000); | Which destinations in Canada have the highest increase in visitors from 2019 to 2022? | SELECT destination, MAX(visitors) - MIN(visitors) AS increase FROM canada_tourism WHERE year IN (2019, 2022) GROUP BY destination ORDER BY increase DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultivation_facilities (facility_id INT, name TEXT, state TEXT); INSERT INTO cultivation_facilities (facility_id, name, state) VALUES (1, 'Facility A', 'Washington'), (2, 'Facility B', 'Washington'); CREATE TABLE harvests (harvest_id INT, facility_id INT, yield INT); INSERT INTO harvests (harvest_id, facil... | What is the average yield per harvest for each cultivation facility in Washington, grouped by facility? | SELECT f.name, AVG(h.yield) AS avg_yield FROM cultivation_facilities f JOIN harvests h ON f.facility_id = h.facility_id WHERE f.state = 'Washington' GROUP BY f.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Algorithms (AlgorithmId INT, Name TEXT, FairnessScore FLOAT, Country TEXT); INSERT INTO Algorithms (AlgorithmId, Name, FairnessScore, Country) VALUES (1, 'AlgorithmA', 0.85, 'Saudi Arabia'), (2, 'AlgorithmB', 0.9, 'UAE'), (3, 'AlgorithmC', 0.75, 'Israel'); | What is the average fairness score of all algorithms created in the Middle East? | SELECT AVG(FairnessScore) FROM Algorithms WHERE Country = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm (FarmID int, FarmName varchar(50), Location varchar(50)); INSERT INTO Farm (FarmID, FarmName, Location) VALUES (1, 'Farm A', 'Country A'); INSERT INTO Farm (FarmID, FarmName, Location) VALUES (2, 'Farm B', 'Country B'); CREATE TABLE FishStock (FishStockID int, FishSpecies varchar(50), FarmID int, Biom... | What is the total biomass of fish in farms located in Country A? | SELECT SUM(Biomass) FROM FishStock WHERE FarmID IN (SELECT FarmID FROM Farm WHERE Location = 'Country A'); | gretelai_synthetic_text_to_sql |
CREATE TABLE car_insurance (policyholder_name TEXT, policy_number INTEGER); CREATE TABLE life_insurance (policyholder_name TEXT, policy_number INTEGER); INSERT INTO car_insurance VALUES ('Alice', 123), ('Bob', 456), ('Charlie', 789), ('Dave', 111); INSERT INTO life_insurance VALUES ('Bob', 999), ('Eve', 888), ('Alice',... | Which policyholders have policies in both the car and life insurance categories, and what are their policy numbers? | SELECT policyholder_name, policy_number FROM car_insurance WHERE policyholder_name IN (SELECT policyholder_name FROM life_insurance); | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, department VARCHAR(20)); CREATE TABLE workers (worker_id INT, factory_id INT, salary DECIMAL(5,2), department VARCHAR(20)); INSERT INTO factories (factory_id, department) VALUES (1, 'textiles'), (2, 'metalwork'), (3, 'electronics'); INSERT INTO workers (worker_id, factory_id, sal... | What is the average salary of workers in the 'textiles' department across all factories? | SELECT AVG(w.salary) FROM workers w INNER JOIN factories f ON w.factory_id = f.factory_id WHERE f.department = 'textiles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT, region VARCHAR(20), attendee_count INT); INSERT INTO Events (event_id, region, attendee_count) VALUES (1, 'Midwest', 600), (2, 'Southeast', 400), (3, 'Northeast', 350); | What is the average attendance for events in the 'Midwest' region with an attendance of over 400? | SELECT AVG(attendee_count) FROM Events WHERE region = 'Midwest' AND attendee_count > 400 | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (user_id INT, username VARCHAR(50), registration_date DATE, unsubscription_date DATE, country VARCHAR(50)); INSERT INTO Users (user_id, username, registration_date, unsubscription_date, country) VALUES (11, 'UserK', '2022-01-01', '2022-02-01', 'India'); INSERT INTO Users (user_id, username, registrat... | How many users unsubscribed from the music streaming service in India? | SELECT COUNT(*) FROM Users WHERE unsubscription_date IS NOT NULL AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_requests (region TEXT, quarter NUMERIC, num_requests NUMERIC); INSERT INTO maintenance_requests (region, quarter, num_requests) VALUES ('Pacific', 2, 50), ('Atlantic', 2, 60), ('Pacific', 3, 55), ('Atlantic', 1, 45); | Compare military equipment maintenance requests in the Pacific and Atlantic regions for Q2 2022 | SELECT region, num_requests FROM maintenance_requests WHERE region IN ('Pacific', 'Atlantic') AND quarter = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency_projects (project_name VARCHAR(50), country VARCHAR(20), budget DECIMAL(10,2)); INSERT INTO energy_efficiency_projects (project_name, country, budget) VALUES ('Project E', 'Colombia', 60000.00), ('Project F', 'Indonesia', 75000.00); | What is the combined budget for energy efficiency projects in Colombia and Indonesia? | SELECT SUM(budget) FROM energy_efficiency_projects eep WHERE eep.country IN ('Colombia', 'Indonesia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE public.community_policing (id serial PRIMARY KEY, city varchar(255), score int); INSERT INTO public.community_policing (city, score) VALUES ('Los Angeles', 80), ('Los Angeles', 85), ('Los Angeles', 90); | What is the total number of community policing scores in the city of Los Angeles? | SELECT COUNT(*) FROM public.community_policing WHERE city = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapists (therapist_id INT PRIMARY KEY, therapist_name TEXT, specialization TEXT); CREATE TABLE patients (patient_id INT PRIMARY KEY, patient_name TEXT, date_of_birth DATE, diagnosis TEXT); CREATE TABLE therapy_sessions (session_id INT PRIMARY KEY, patient_id INT, therapist_id INT, session_date DATE, ses... | Display the names of therapists who have conducted therapy sessions for patients diagnosed with 'Anxiety Disorder' | SELECT therapists.therapist_name FROM therapists INNER JOIN (SELECT patients.patient_id, therapy_sessions.therapist_id FROM patients INNER JOIN therapy_sessions ON patients.patient_id = therapy_sessions.patient_id WHERE patients.diagnosis = 'Anxiety Disorder') AS therapy_sessions_filtered ON therapists.therapist_id = t... | gretelai_synthetic_text_to_sql |
CREATE TABLE rainfall_data_2021 (id INT, region VARCHAR(20), rainfall DECIMAL(5,2), capture_date DATE); INSERT INTO rainfall_data_2021 (id, region, rainfall, capture_date) VALUES (1, 'North', 50.2, '2021-06-01'), (2, 'South', 75.6, '2021-07-01'), (3, 'North', 34.8, '2021-06-15'); | What is the average rainfall in millimeters for each region in the 'rainfall_data_2021' table for the month of June? | SELECT region, AVG(rainfall) FROM rainfall_data_2021 WHERE MONTH(capture_date) = 6 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE member_workouts (workout_id INT, member_id INT, heart_rate INT, date DATE); INSERT INTO member_workouts VALUES (1,1,155,'2022-01-15'); INSERT INTO member_workouts VALUES (2,2,145,'2022-01-16'); | Which members had a heart rate over 150 during their last workout? | SELECT member_workouts.member_id, member_workouts.heart_rate FROM member_workouts INNER JOIN (SELECT member_id, MAX(date) AS max_date FROM member_workouts GROUP BY member_id) AS max_dates ON member_workouts.member_id = max_dates.member_id AND member_workouts.date = max_dates.max_date WHERE member_workouts.heart_rate > ... | gretelai_synthetic_text_to_sql |
CREATE TABLE europium_production (id INT, year INT, producer VARCHAR(255), europium_prod FLOAT); INSERT INTO europium_production (id, year, producer, europium_prod) VALUES (1, 2021, 'China', 123.4), (2, 2021, 'USA', 234.5), (3, 2021, 'Australia', 345.6), (4, 2021, 'Myanmar', 456.7), (5, 2021, 'India', 567.8); | What is the running total of Europium production for the top 3 producers in 2021? | SELECT producer, SUM(europium_prod) OVER (PARTITION BY producer ORDER BY europium_prod) AS running_total FROM europium_production WHERE year = 2021 AND producer IN ('China', 'USA', 'Australia') ORDER BY europium_prod; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_schedule (id INT, member_id INT, workout_date DATE, workout_duration INT); | Add a new table workout_schedule with columns id, member_id, workout_date, workout_duration and insert records for 3 members with id 21, 22, 23 with workout_date as '2023-03-01', '2023-03-02', '2023-03-03' and workout_duration as '60', '45', '90' respectively | INSERT INTO workout_schedule (id, member_id, workout_date, workout_duration) VALUES (1, 21, '2023-03-01', 60), (2, 22, '2023-03-02', 45), (3, 23, '2023-03-03', 90); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (pub_date DATE, title TEXT, author TEXT); | What is the number of articles published per month for each author in the 'articles' table? | SELECT DATE_TRUNC('month', pub_date) AS month, author, COUNT(*) FROM articles GROUP BY month, author; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT PRIMARY KEY, name TEXT, state TEXT, total_beds INT); | Add a new record to the "hospitals" table for a hospital located in "NY" with 600 total beds | INSERT INTO hospitals (name, state, total_beds) VALUES ('Hospital NY', 'NY', 600); | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping (id INT, operation VARCHAR(50), service1 VARCHAR(10), service2 VARCHAR(10), year INT); INSERT INTO peacekeeping (id, operation, service1, service2, year) VALUES (1, 'Op1', 'Marine Corps', 'Army', 2017); | Find the number of peacekeeping operations where the Marine Corps and Army participated together. | SELECT COUNT(*) FROM peacekeeping WHERE (service1 = 'Marine Corps' AND service2 = 'Army') OR (service1 = 'Army' AND service2 = 'Marine Corps'); | gretelai_synthetic_text_to_sql |
CREATE TABLE FactoryWorkers (id INT, factory_id INT, worker_count INT, region TEXT, certification TEXT); INSERT INTO FactoryWorkers (id, factory_id, worker_count, region, certification) VALUES (1, 1, 1000, 'Asia', 'Fair Trade'), (2, 2, 750, 'Africa', 'Global Organic Textile Standard'), (3, 3, 1500, 'South America', 'Fa... | Which region has the highest number of textile workers in fair trade certified factories? | SELECT region, COUNT(*) AS count FROM FactoryWorkers WHERE certification = 'Fair Trade' GROUP BY region ORDER BY count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Districts (DistrictName VARCHAR(20), AvgSchoolBudget DECIMAL(5,2)); INSERT INTO Districts (DistrictName, AvgSchoolBudget) VALUES ('District3', 5500.00), ('District4', 6500.00); | Find the average budget for schools in 'District3' | SELECT AVG(AvgSchoolBudget) FROM Districts WHERE DistrictName = 'District3'; | 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.