context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE marine_conservation_initiatives (id INT, name TEXT, location TEXT); INSERT INTO marine_conservation_initiatives (id, name, location) VALUES (1, 'Coral Reef Restoration', 'Pacific Islands'), (2, 'Turtle Habitat Protection', 'Caribbean Sea'), (3, 'Plastic Waste Reduction', 'Indian Ocean'); | What is the total number of marine conservation initiatives in the Pacific Islands? | SELECT COUNT(*) FROM marine_conservation_initiatives WHERE location = 'Pacific Islands'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tunnels (id INT, country VARCHAR(20), continent VARCHAR(20), year INT, length FLOAT); INSERT INTO Tunnels (id, country, continent, year, length) VALUES (1, 'Australia', 'Oceania', 2005, 100); INSERT INTO Tunnels (id, country, continent, year, length) VALUES (2, 'New Zealand', 'Oceania', 2008, 120); INSERT ... | Identify the top 3 longest tunnels in 'Oceania' and their construction dates, if available. | SELECT country, year, length FROM (SELECT country, year, length, RANK() OVER (PARTITION BY continent ORDER BY length DESC) as tunnel_rank FROM Tunnels WHERE continent = 'Oceania') tmp WHERE tunnel_rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_union (employee_id INT, department VARCHAR(20), salary DECIMAL(10,2)); INSERT INTO transportation_union (employee_id, department, salary) VALUES (1, 'Transportation Workers Union', 40000.00), (2, 'Drivers Union', 45000.00), (3, 'Mechanics Union', 50000.00), (4, 'Transportation Workers Union'... | What is the average salary of 'Mechanics' in the 'transportation_union' table? | SELECT AVG(salary) FROM transportation_union WHERE department = 'Mechanics Union'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (ocean TEXT, trench TEXT, max_depth INTEGER);INSERT INTO marine_trenches (ocean, trench, max_depth) VALUES ('Pacific', 'Mariana Trench', 10994), ('Southern', 'Southern Antiltic Trench', 7235); | What is the total number of marine trenches in the Southern Ocean? | SELECT COUNT(*) FROM marine_trenches WHERE ocean = 'Southern'; | gretelai_synthetic_text_to_sql |
CREATE TABLE plants (id INT, name TEXT, production_method TEXT, capacity INT); INSERT INTO plants (id, name, production_method, capacity) VALUES (1, 'ChemCo', 'Green Production', 500), (2, 'EcoChem', 'Traditional Production', 400), (3, 'GreenChem', 'Green Production', 600); | What is the average production capacity for chemical plants that use the 'Traditional Production' method, ordered by capacity? | SELECT AVG(capacity) AS avg_capacity FROM plants WHERE production_method = 'Traditional Production' ORDER BY capacity; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO Employees (id, name, department) VALUES (1, 'John Doe', 'HR'); INSERT INTO Employees (id, name, department) VALUES (2, 'Jane Smith', 'IT'); INSERT INTO Employees (id, name, department) VALUES (3, 'Alice Johnson', 'Finance'); | What is the distribution of employees by department? | SELECT department, COUNT(*) AS total FROM Employees GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (ProductID INT, SupplierID INT, Calories INT); INSERT INTO Products (ProductID, SupplierID, Calories) VALUES (1, 1, 500), (2, 2, 300), (3, 1, 600); | Delete records for products delivered by 'Farm Fresh' that have more than 650 calories. | DELETE FROM Products WHERE ProductID IN (SELECT ProductID FROM (SELECT * FROM Products WHERE SupplierID = (SELECT SupplierID FROM Suppliers WHERE SupplierName = 'Farm Fresh')) AS product_farm_fresh WHERE Calories > 650); | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (id INT, genre TEXT); CREATE TABLE songs (id INT, title TEXT, genre_id INT); INSERT INTO genres (id, genre) VALUES (1, 'Pop'), (2, 'Rock'), (3, 'Hip Hop'); INSERT INTO songs (id, title, genre_id) VALUES (1, 'Shake it Off', 1), (2, 'Lose Yourself', 3), (3, 'Bohemian Rhapsody', 2); | Which genre has the most songs in the music streaming platform? | SELECT COUNT(*) FROM songs JOIN genres ON songs.genre_id = genres.id GROUP BY genres.genre ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, join_date DATE, score INT, region VARCHAR(255)); INSERT INTO players (id, join_date, score, region) VALUES (1, '2019-12-31', 100, 'NA'), (2, '2020-01-02', 200, 'EU'), (3, '2019-12-30', 150, 'ASIA'); | What is the average score of players who joined after 2020-01-01, grouped by their region? | SELECT region, AVG(score) FROM players WHERE join_date > '2020-01-01' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (incident_id INT, incident_date DATE, user_id INT, system_id INT, approved_access BOOLEAN);CREATE TABLE users (user_id INT, user_name VARCHAR(255), department VARCHAR(255));CREATE TABLE systems (system_id INT, system_name VARCHAR(255)); | How many security incidents were there in the last quarter that involved a user from the HR department accessing a system outside of their approved access list? | SELECT COUNT(*) FROM security_incidents si JOIN users u ON si.user_id = u.user_id JOIN systems s ON si.system_id = s.system_id WHERE incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) AND approved_access = FALSE AND u.department = 'HR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_equity_programs (id INT PRIMARY KEY, name TEXT, region TEXT, participants INT); INSERT INTO social_equity_programs (id, name, region, participants) VALUES (1, 'Northeast Cannabis Equity', 'Northeast', 150); CREATE TABLE dispensaries (id INT PRIMARY KEY, name TEXT, region TEXT, sales INT); INSERT INT... | What is the total impact of social equity programs and dispensaries in the Northeast, considering sales and participants? | SELECT dispensaries.name, social_equity_programs.name, SUM(dispensaries.sales * social_equity_programs.participants) as total_impact FROM dispensaries CROSS JOIN social_equity_programs WHERE dispensaries.region = social_equity_programs.region GROUP BY dispensaries.name, social_equity_programs.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT PRIMARY KEY, ArtistName VARCHAR(100), Age INT, Gender VARCHAR(10), Genre VARCHAR(50)); CREATE TABLE Concerts (ConcertID INT PRIMARY KEY, ConcertName VARCHAR(100), Venue VARCHAR(100), City VARCHAR(50), ArtistID INT, Date DATE, TotalSeats INT, CONSTRAINT FK_Artists FOREIGN KEY (ArtistID... | Find artists who have had more than 2,000,000 listens and display their average concert ticket sales? | SELECT AVG(TotalSeats) as AvgTicketSales FROM Concerts INNER JOIN SoldArtists ON Concerts.ArtistID = SoldArtists.ArtistID WHERE SoldArtists.ArtistID IN (SELECT ArtistID FROM TotalListens WHERE TotalListens > 2000000); | gretelai_synthetic_text_to_sql |
CREATE TABLE Workers (Id INT, Name VARCHAR(50), Role VARCHAR(50), HourlyRate DECIMAL(5,2), ProjectId INT, HoursWorked INT); CREATE TABLE Projects (Id INT, Name VARCHAR(50), City VARCHAR(50), StartDate DATE, EndDate DATE, Country VARCHAR(50)); | What is the maximum number of hours worked by a single worker on projects in Sydney, Australia? | SELECT MAX(w.HoursWorked) FROM Workers w JOIN Projects p ON w.ProjectId = p.Id WHERE p.City = 'Sydney' AND p.Country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(50), location VARCHAR(50), un_code VARCHAR(10)); CREATE TABLE vessels (id INT, name VARCHAR(50), type VARCHAR(50), year_built INT, port_id INT); CREATE TABLE captains (id INT, name VARCHAR(50), age INT, license_number VARCHAR(20), vessel_id INT); CREATE TABLE cargo (id INT, desc... | What is the total weight of cargo carried by the captain 'Svetlana Petrova'? | SELECT SUM(cargo.weight) AS total_cargo_weight FROM cargo INNER JOIN vessels ON cargo.vessel_id = vessels.id INNER JOIN captains ON vessels.id = captains.vessel_id WHERE captains.name = 'Svetlana Petrova'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Factories (id INT, sector VARCHAR, production_capacity INT); | What is the maximum production capacity of factories in the circular economy sector? | SELECT MAX(production_capacity) FROM Factories WHERE sector = 'circular economy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, hospital_name VARCHAR(255), state VARCHAR(255), num_beds INT); | What are the names of all the hospitals and the number of beds available in each one in the state of New York? | SELECT hospital_name, num_beds FROM hospitals WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE efficiency_stats (id INT PRIMARY KEY, project_id INT, year INT, efficiency FLOAT, FOREIGN KEY (project_id) REFERENCES projects(id)); INSERT INTO efficiency_stats (id, project_id, year, efficiency) VALUES (7, 1, 2020, 0.15), (8, 2, 2020, 0.28); | What is the minimum efficiency achieved by each energy project in a given year? | SELECT project_id, MIN(efficiency) FROM efficiency_stats GROUP BY project_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE african_excavations (id INT, site_name VARCHAR(50), artifact_name VARCHAR(50), weight INT); | Find total weight of artifacts from 'african_excavations' > 500g | SELECT SUM(weight) FROM african_excavations WHERE weight > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE households (id INT, state VARCHAR(20), water_consumption FLOAT); INSERT INTO households (id, state, water_consumption) VALUES (1, 'California', 1200), (2, 'Texas', 1500), (3, 'California', 1100); | What is the average water consumption per household in the state of California? | SELECT AVG(water_consumption) FROM households WHERE state = 'California' | gretelai_synthetic_text_to_sql |
CREATE TABLE DeliveryTimes(id INT, source_country VARCHAR(50), destination_country VARCHAR(50), delivery_time INT); INSERT INTO DeliveryTimes(id, source_country, destination_country, delivery_time) VALUES (1, 'China', 'Germany', 10), (2, 'China', 'France', 12); | What is the average delivery time for shipments from China to Europe? | SELECT AVG(delivery_time) FROM DeliveryTimes WHERE source_country = 'China' AND destination_country LIKE '%Europe%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tours (id INT PRIMARY KEY, name VARCHAR(255), description TEXT, price DECIMAL(5,2), city VARCHAR(255), country VARCHAR(255)); | Update the price field in the tours table for the tour with id 5 | UPDATE tours SET price = 75.00 WHERE id = 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name TEXT, location TEXT, industry_4_0 TEXT, num_technologies INT); | Which factories have implemented Industry 4.0 technologies, and the number of Industry 4.0 technologies they have implemented. | SELECT factory_id, name, COUNT(industry_4_0) as num_technologies FROM factories WHERE industry_4_0 IS NOT NULL GROUP BY factory_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, gender VARCHAR(20), state VARCHAR(20)); INSERT INTO patients (patient_id, age, gender, state) VALUES (1, 35, 'Female', 'California'); INSERT INTO patients (patient_id, age, gender, state) VALUES (2, 42, 'Male', 'Texas'); CREATE TABLE treatments (treatment_id INT, patient_... | How many patients have been treated for anxiety or depression in the mental health clinic? | SELECT COUNT(DISTINCT patients.patient_id) FROM patients INNER JOIN treatments ON patients.patient_id = treatments.patient_id WHERE treatments.condition = 'Depression' OR treatments.condition = 'Anxiety'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabric_stock (id INT PRIMARY KEY, fabric VARCHAR(20), quantity INT); | What is the total quantity of eco-friendly fabric in stock? | SELECT SUM(quantity) FROM fabric_stock WHERE fabric = 'eco-friendly'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet (id INT, type TEXT, is_accessible BOOLEAN); INSERT INTO fleet (id, type, is_accessible) VALUES (1, 'bus', true), (2, 'bus', false), (3, 'tram', true), (4, 'train', false); | How many accessible vehicles are there in the 'fleet' table for each type? | SELECT type, COUNT(*) as count FROM fleet WHERE is_accessible = true GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Property (id INT, address VARCHAR(255), city VARCHAR(255), state VARCHAR(255), country VARCHAR(255), price DECIMAL(10,2), size INT, sustainable_practices BOOLEAN, coop_owned BOOLEAN); CREATE TABLE PropertyOwner (id INT, property_id INT, owner_name VARCHAR(255), owner_email VARCHAR(255), owner_phone VARCHAR... | What are the names of property owners who co-own a property in Canada? | SELECT DISTINCT PropertyOwner.owner_name FROM PropertyOwner FULL OUTER JOIN PropertyCoop ON PropertyOwner.property_id = PropertyCoop.property_id WHERE PropertyCoop.coop_membership = TRUE AND Property.country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (id INT, project VARCHAR(255), budget INT); | Add a new record of a military innovation project. | INSERT INTO military_innovation (id, project, budget) VALUES (1, 'Artificial Intelligence in Combat', 10000000); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE volunteers (id INT PRIMARY KEY, name VARCHAR(255), program_id INT, FOREIGN KEY (program_id) REFERENCES programs(id)); | Insert a new program called 'Gardening' into the 'programs' table and update the 'volunteers' table to add 5 volunteers to this new program. | INSERT INTO programs (name) VALUES ('Gardening'); UPDATE volunteers SET program_id = (SELECT id FROM programs WHERE name = 'Gardening') WHERE id IN (SELECT id FROM (VALUES (1), (2), (3), (4), (5)) as t(id)); | gretelai_synthetic_text_to_sql |
CREATE TABLE MenuItems (MenuItemID int, MenuItemName varchar(255), MenuItemType varchar(255), Cost int, DietaryRestrictions varchar(255)); INSERT INTO MenuItems (MenuItemID, MenuItemName, MenuItemType, Cost, DietaryRestrictions) VALUES (1, 'Margherita Pizza', 'Entree', 8, 'None'), (2, 'Spaghetti Bolognese', 'Entree', 9... | What is the number of menu items that are vegan and do not contain soy? | SELECT COUNT(*) FROM MenuItems WHERE DietaryRestrictions = 'Vegan' AND MenuItemName NOT LIKE '%Tofu%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE football_matches (match_id INT, season INT, tickets_sold INT); INSERT INTO football_matches (match_id, season, tickets_sold) VALUES (1, 2018, 45000), (2, 2018, 50000), (3, 2017, 40000); | What is the total number of tickets sold for football matches in the '2018' season? | SELECT SUM(tickets_sold) FROM football_matches WHERE season = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturer_data (manufacturer VARCHAR(10), vehicle_type VARCHAR(10), safety_rating INT); | Which manufacturer has the highest average safety rating for electric vehicles? | SELECT manufacturer, AVG(safety_rating) AS avg_safety_rating FROM manufacturer_data WHERE vehicle_type = 'Electric' GROUP BY manufacturer ORDER BY avg_safety_rating DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, name VARCHAR(100), country VARCHAR(50)); INSERT INTO Employees (id, name, country) VALUES (1, 'John Doe', 'United States'), (2, 'Jane Smith', 'Canada'); | What is the total number of employees from the United States and Canada? | SELECT COUNT(*) FROM Employees WHERE country IN ('United States', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (PolicyID int, PolicyType varchar(20), PolicyHolderAge int); INSERT INTO Policies (PolicyID, PolicyType, PolicyHolderAge) VALUES (1, 'Auto', 35), (2, 'Home', 50), (3, 'Auto', 25), (4, 'Life', 40); | What is the distribution of policy types across different age groups? | SELECT PolicyType, PolicyHolderAge, COUNT(*) OVER (PARTITION BY PolicyType, PolicyHolderAge) as PolicyCount FROM Policies; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name VARCHAR(255), cuisine VARCHAR(255), calories INT); INSERT INTO dishes (id, name, cuisine, calories) VALUES (1, 'Chicken Tikka Masala', 'Indian', 800), (2, 'Pizza Margherita', 'Italian', 600), (3, 'Pad Thai', 'Thai', 700), (4, 'Beef Empanadas', 'Argentinian', 400), (5, 'Sushi Roll', 'Ja... | Which cuisine type has the highest average calorie count? | SELECT cuisine, AVG(calories) as avg_calories FROM dishes GROUP BY cuisine ORDER BY avg_calories DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_stock (id INT PRIMARY KEY, species VARCHAR(255), quantity INT, location VARCHAR(255)); | Delete records of Cod from the fish_stock table | DELETE FROM fish_stock WHERE species = 'Cod'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargoes (id INT, name VARCHAR(50), at_sea INT); INSERT INTO cargoes (id, name, at_sea) VALUES (1, 'Electronic Goods', 35), (2, 'Machinery Parts', 42), (3, 'Clothing Items', 20); | Delete records of all cargoes that have been at sea for more than 60 days. | DELETE FROM cargoes WHERE at_sea > 60; | gretelai_synthetic_text_to_sql |
CREATE TABLE measles_cases (id INT, state TEXT, year INT); INSERT INTO measles_cases (id, state, year) VALUES (1, 'California', 2020); INSERT INTO measles_cases (id, state, year) VALUES (2, 'Texas', 2019); INSERT INTO measles_cases (id, state, year) VALUES (3, 'New York', 2020); | Find the number of cases of measles in each state in 2020? | SELECT measles_cases.state, COUNT(measles_cases.id) FROM measles_cases WHERE measles_cases.year = 2020 GROUP BY measles_cases.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates(city VARCHAR(20), year INT, rate DECIMAL(5,2)); INSERT INTO recycling_rates VALUES('Mumbai', 2023, 35); | Update the recycling rate for the city of Mumbai to 40% in 2023. | UPDATE recycling_rates SET rate = 40 WHERE city = 'Mumbai' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name VARCHAR(50), type VARCHAR(20)); INSERT INTO programs (id, name, type) VALUES (1, 'Painting 1', 'Visual Arts'), (2, 'Sculpture 1', 'Visual Arts'), (3, 'Painting 2', 'Visual Arts'), (4, 'Photography 1', 'Visual Arts'); CREATE TABLE program_attendance (program_id INT, attendee_count INT... | List the names of visual arts programs with less than 30 attendees in total. | SELECT p.name FROM programs p JOIN program_attendance pa ON p.id = pa.program_id WHERE p.type = 'Visual Arts' AND pa.attendee_count < 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerGroup VARCHAR(20), VolunteerCount INT); INSERT INTO Volunteers (VolunteerGroup, VolunteerCount) VALUES ('Youth Group', 100), ('Senior Group', 50), ('Community Group', 150); | How many volunteers are there in each volunteer group? | SELECT VolunteerGroup, VolunteerCount FROM Volunteers; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name TEXT, produce_type TEXT, quantity INT, is_organic BOOLEAN); INSERT INTO suppliers (id, name, produce_type, quantity, is_organic) VALUES (1, 'Green Earth', 'Produce', 1200, true); INSERT INTO suppliers (id, name, produce_type, quantity, is_organic) VALUES (2, 'Farm Fresh', 'Produce',... | What are the names of all suppliers that provide more than 1000 tons of organic produce? | SELECT name FROM suppliers WHERE produce_type = 'Produce' AND is_organic = true AND quantity > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE trades (asset_name VARCHAR(10), trade_date DATE); INSERT INTO trades (asset_name, trade_date) VALUES ('BTC', '2022-01-01'), ('ETH', '2022-01-02'), ('LTC', '2022-01-03'), ('BTC', '2022-01-04'), ('BTC', '2022-01-05'), ('ETH', '2022-01-06'), ('BTC', '2022-01-07'); | Find the total number of unique digital assets that have been traded in the past month. | SELECT COUNT(DISTINCT asset_name) FROM trades WHERE trade_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT PRIMARY KEY, name VARCHAR(100), origin_country VARCHAR(50)); | List all albums released by a specific artist | CREATE TABLE albums (id INT PRIMARY KEY, title VARCHAR(100), artist_id INT, release_year INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, company VARCHAR(50), country VARCHAR(50), industry VARCHAR(50), number INT); | What is the average number of safety incidents in the textile industry in India? | SELECT AVG(number) FROM incidents WHERE country = 'India' AND industry = 'Textile'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (menu_id INT, dish_name VARCHAR(100), dish_type VARCHAR(20), dish_category VARCHAR(50)); INSERT INTO Menu (menu_id, dish_name, dish_type, dish_category) VALUES (1, 'Quinoa Salad', 'Vegetarian', 'Salad'); INSERT INTO Menu (menu_id, dish_name, dish_type, dish_category) VALUES (2, 'Grilled Chicken', 'Non... | Get the number of vegetarian and non-vegetarian dishes in each category | SELECT dish_category, dish_type, COUNT(*) AS dish_count FROM Menu GROUP BY dish_category, dish_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, country TEXT, amount_donated DECIMAL(10,2)); INSERT INTO donors (id, name, country, amount_donated) VALUES (1, 'Alice', 'India', 5000.00), (2, 'Bob', 'Nigeria', 3000.00), (3, 'Charlie', 'Canada', 7000.00), (4, 'David', 'UK', 8000.00), (5, 'Eve', 'Germany', 9000.00); | List the top 3 donors from Asia, Africa, and Europe, in terms of total donated amount. | SELECT name, SUM(amount_donated) FROM donors WHERE country IN ('India', 'Nigeria', 'UK', 'Germany') GROUP BY name ORDER BY SUM(amount_donated) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEngagement (id INT, country VARCHAR(50), program VARCHAR(100), participants INT); INSERT INTO CommunityEngagement (id, country, program, participants) VALUES (1, 'Samoa', 'Fale-building', 50), (2, 'Samoa', 'Tapa-making', 35); | Update the participants to 40 for program ID 1 in community engagement. | UPDATE CommunityEngagement SET participants = 40 WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (region VARCHAR(20), project_cost INT); INSERT INTO Projects (region, project_cost) VALUES ('Northeast', 5000000), ('Southeast', 7000000), ('Midwest', 6000000), ('Southwest', 8000000), ('West', 9000000); | What is the minimum project cost in each region? | SELECT region, MIN(project_cost) FROM Projects GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE semesters (semester_id INT, semester_name TEXT); INSERT INTO semesters (semester_id, semester_name) VALUES (1, 'Fall'), (2, 'Spring'), (3, 'Summer'); CREATE TABLE student_open_pedagogy (student_id INT, semester_id INT); CREATE TABLE teacher_open_pedagogy (teacher_id INT, semester_id INT); INSERT INTO stude... | What is the total number of students and teachers involved in open pedagogy projects for each semester? | SELECT s.semester_name, COUNT(sop.student_id) AS num_students, COUNT(top.teacher_id) AS num_teachers FROM semesters s LEFT JOIN student_open_pedagogy sop ON s.semester_id = sop.semester_id FULL OUTER JOIN teacher_open_pedagogy top ON s.semester_id = top.semester_id GROUP BY s.semester_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity_metrics (id INT, company_name VARCHAR(100), region VARCHAR(50), employees_of_color INT, women_in_tech INT); INSERT INTO diversity_metrics (id, company_name, region, employees_of_color, women_in_tech) VALUES (1, 'Acme Inc.', 'Europe', 15, 22), (2, 'Bravo Corp.', 'North America', 35, 18), (5, 'Echo... | Delete records from the "diversity_metrics" table for the company 'Echo Ltd.' | DELETE FROM diversity_metrics WHERE company_name = 'Echo Ltd.'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, sector TEXT, total_funding DECIMAL); INSERT INTO projects (id, sector, total_funding) VALUES (1, 'Health', 10000.00), (2, 'Education', 15000.00); | What is the total funding amount for projects in the 'Health' sector? | SELECT SUM(total_funding) FROM projects WHERE sector = 'Health'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT PRIMARY KEY, name VARCHAR(50), department VARCHAR(50), grant_recipient BOOLEAN, grant_date DATE); INSERT INTO students (student_id, name, department, grant_recipient, grant_date) VALUES (1, 'David', 'Humanities', TRUE, '2022-01-01'), (2, 'Gina', 'Biology', TRUE, '2021-01-01'), (3, ... | List the names and departments of graduate students who have received more than one research grant in the past year. | SELECT s.name, s.department FROM students s INNER JOIN grants g ON s.student_id = g.student_id WHERE s.department IN ('Humanities', 'Biology', 'Chemistry') AND s.grant_recipient = TRUE AND g.grant_id IN (SELECT g.grant_id FROM grants g WHERE g.student_id = s.student_id GROUP BY g.student_id HAVING COUNT(*) > 1) AND s.g... | gretelai_synthetic_text_to_sql |
CREATE TABLE Hospitals (name TEXT, location TEXT, type TEXT, num_beds INTEGER, state TEXT); INSERT INTO Hospitals (name, location, type, num_beds, state) VALUES ('Hospital A', 'City A, Rural USA', 'General', 100, 'Rural USA'), ('Hospital B', 'City B, Rural USA', 'Specialty', 50, 'Rural USA'); | What is the number of general hospitals in each state in Rural USA? | SELECT state, COUNT(*) as general_hospitals_count FROM Hospitals WHERE type = 'General' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellite (id INT, name VARCHAR(255), type VARCHAR(255), country VARCHAR(255), launch_date DATE); INSERT INTO satellite VALUES (3, 'GPS Satellite', 'Navigation', 'USA', '1978-02-22'); | What is the average lifespan of different types of satellites and how many have been launched? | SELECT type, COUNT(id) as total, AVG(DATEDIFF(CURDATE(), launch_date)) as avg_lifespan FROM satellite GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, restaurant_id INT, meal_time VARCHAR(255), item VARCHAR(255), price DECIMAL(5,2)); | Update the price of the 'Veggie Burger' to $12.99 in the 'Lunch Menu' of Restaurant A. | UPDATE menus SET price = 12.99 WHERE restaurant_id = (SELECT restaurant_id FROM restaurants WHERE name = 'Restaurant A') AND meal_time = 'Lunch' AND item = 'Veggie Burger'; | gretelai_synthetic_text_to_sql |
CREATE TABLE gas_production (id INT, well_name VARCHAR(50), location VARCHAR(50), company VARCHAR(50), production_type VARCHAR(10), production_quantity INT, production_date DATE); INSERT INTO gas_production VALUES (4, 'Well S', 'North Sea', 'XYZ Gas', 'Gas', 200000, '2022-01-01'); | What is the total gas production in the North Sea for the year 2022? | SELECT SUM(production_quantity) FROM gas_production WHERE location = 'North Sea' AND production_type = 'Gas' AND production_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (CityID INT, CityName VARCHAR(50), WasteGeneration FLOAT); INSERT INTO Cities VALUES (1, 'CityA', 1200), (2, 'CityB', 1800), (3, 'CityC', 1500); CREATE TABLE RecyclingProgram (CityID INT, ProgramName VARCHAR(50)); INSERT INTO RecyclingProgram VALUES (1, 'Program1'), (2, 'Program2'), (3, 'Program3'); | What is the total waste generation of each city in the recycling program? | SELECT Cities.CityName, SUM(Cities.WasteGeneration) as TotalWasteGeneration FROM Cities INNER JOIN RecyclingProgram ON Cities.CityID = RecyclingProgram.CityID GROUP BY Cities.CityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Wins INT, Game VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, Wins, Game, Country) VALUES (1, 22, 'Dota 2', 'Africa'); INSERT INTO Players (PlayerID, Wins, Game, Country) VALUES (2, 25, 'Dota 2', 'Africa'); INSERT INTO Players (PlayerID, Wins, Game, Country) VALUES... | What is the minimum number of wins of players who have played Dota 2 and are from Africa? | SELECT MIN(Wins) as MinWins FROM Players WHERE Game = 'Dota 2' AND Country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (project_id INT, project_name VARCHAR(255), region VARCHAR(255), focus_area VARCHAR(255), PRIMARY KEY(project_id)); INSERT INTO research_projects (project_id, project_name, region, focus_area) VALUES (1, 'Marine Species Research', 'Atlantic Ocean', 'Biodiversity'), (2, 'Coral Conservation... | What is the total number of marine species research projects in the Atlantic Ocean? | SELECT COUNT(*) FROM research_projects WHERE region = 'Atlantic Ocean' AND (focus_area = 'Biodiversity' OR focus_area = 'Coral'); | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investment_id INT, investor_id INT, org_id INT, investment_amount INT); INSERT INTO investments (investment_id, investor_id, org_id, investment_amount) VALUES (1, 1, 2, 50000), (2, 2, 3, 75000), (3, 1, 1, 100000), (4, 3, 2, 35000), (5, 2, 1, 80000); CREATE TABLE investors (investor_id INT, inv... | Who are the top 3 investors in terms of total investment amounts in organizations focused on gender equality? | SELECT investor_name, SUM(investment_amount) AS total_invested FROM investments JOIN investors ON investments.investor_id = investors.investor_id JOIN organizations ON investments.org_id = organizations.org_id WHERE focus_topic = 'Gender Equality' GROUP BY investor_name ORDER BY total_invested DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE residential_green_projects (project_id INT, completion_date DATE, state TEXT); INSERT INTO residential_green_projects (project_id, completion_date, state) VALUES (1, '2022-03-15', 'New York'), (2, '2022-02-28', 'New York'), (3, '2022-01-01', 'New York'); | What is the number of residential green building projects completed in each month of the year 2022, for the state of New York? | SELECT EXTRACT(MONTH FROM completion_date), COUNT(*) FROM residential_green_projects WHERE state = 'New York' AND EXTRACT(YEAR FROM completion_date) = 2022 AND permit_type = 'Residential' GROUP BY EXTRACT(MONTH FROM completion_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_staff (name VARCHAR(255), gender VARCHAR(255), position VARCHAR(255), hospital_id INT); INSERT INTO healthcare_staff (name, gender, position, hospital_id) VALUES ('Dr. John Doe', 'Male', 'Doctor', 1), ('Dr. Jane Smith', 'Female', 'Doctor', 2), ('Dr. Maria Garcia', 'Female', 'Doctor', 3); | What is the number of male doctors in the 'healthcare_staff' table? | SELECT COUNT(*) FROM healthcare_staff WHERE gender = 'Male' AND position = 'Doctor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (CompanyID INT, CompanyName VARCHAR(50)); INSERT INTO Companies (CompanyID, CompanyName) VALUES (1, 'ACME Mining'), (2, 'BIG Excavations'), (3, 'Giga Drilling'); CREATE TABLE Extraction (ExtractionID INT, CompanyID INT, Material VARCHAR(50), Quantity INT); INSERT INTO Extraction (ExtractionID, Co... | What is the total quantity of gold and silver extracted by each company? | SELECT CompanyName, SUM(Quantity) FROM Extraction JOIN Companies ON Extraction.CompanyID = Companies.CompanyID WHERE Material IN ('Gold', 'Silver') GROUP BY CompanyName; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_code CHAR(2), country_name VARCHAR(50)); INSERT INTO countries VALUES ('US', 'United States'), ('CA', 'Canada'), ('MX', 'Mexico'); CREATE TABLE teachers (teacher_id INT, country_code CHAR(2), years_of_experience INT); INSERT INTO teachers VALUES (1, 'US', 5), (2, 'CA', 3), (3, 'MX', 8); ... | Which countries have the highest teacher turnover rates in the past year? | SELECT c.country_name, COUNT(t.teacher_id) AS teacher_count, AVG(t.years_of_experience) AS avg_experience, COUNT(turnover.teacher_id) / COUNT(t.teacher_id) * 100 AS turnover_rate FROM countries c JOIN teachers t ON c.country_code = t.country_code LEFT JOIN turnover ON t.teacher_id = turnover.teacher_id WHERE turnover_d... | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (investment_id INT, region VARCHAR(255), year INT, revenue DECIMAL(10,2)); INSERT INTO network_investments (investment_id, region, year, revenue) VALUES (1, 'Asia', 2021, 800000), (2, 'Europe', 2020, 700000), (3, 'Asia', 2019, 600000); | What is the total revenue for the year 2021 from network infrastructure investments in the region of Asia? | SELECT SUM(revenue) FROM network_investments WHERE region = 'Asia' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_bicycles( bicycle_id INT, availability_status VARCHAR(50), availability_date DATE, city VARCHAR(50)); | How many shared bicycles were available in Berlin on July 4, 2021? | SELECT COUNT(*) FROM shared_bicycles WHERE availability_status = 'available' AND availability_date = '2021-07-04' AND city = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (id INT, project_name TEXT, location TEXT, installed_capacity INT); INSERT INTO renewable_projects (id, project_name, location, installed_capacity) VALUES (1, 'Solar Farm A', 'USA', 50); CREATE TABLE conventional_projects (id INT, project_name TEXT, location TEXT, installed_capacity INT)... | What is the total installed capacity (in MW) of renewable energy projects in the United States? | SELECT SUM(renewable_projects.installed_capacity) FROM renewable_projects WHERE renewable_projects.location = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(255), well_depth FLOAT, region VARCHAR(255)); INSERT INTO wells (well_id, well_name, well_depth, region) VALUES (1, 'A1', 3000, 'North Sea'), (2, 'B2', 2500, 'North Sea'), (3, 'C3', 4000, 'Gulf of Mexico'); | What is the maximum well depth for wells in the 'Gulf of Mexico'? | SELECT MAX(well_depth) FROM wells WHERE region = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (project_id INT, student_id INT, grade_level INT, project_hours INT); INSERT INTO projects (project_id, student_id, grade_level, project_hours) VALUES (1, 1, 10, 5), (2, 1, 10, 3), (3, 2, 10, 6), (4, 2, 10, 7), (5, 3, 11, 4), (6, 3, 11, 8); | What is the total number of hours spent on open pedagogy projects by students in grade 10? | SELECT SUM(project_hours) FROM projects WHERE grade_level = 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (funding_agency VARCHAR(255), project_type VARCHAR(255), country VARCHAR(255), amount DECIMAL(10,2), year INT); | What was the total amount of funding provided by the World Bank to community development projects in Afghanistan in 2012? | SELECT SUM(amount) FROM community_development WHERE funding_agency = 'World Bank' AND project_type = 'community development' AND country = 'Afghanistan' AND year = 2012; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (id INT, city VARCHAR(20), avgAge DECIMAL(5,2)); INSERT INTO Cities (id, city, avgAge) VALUES (1, 'Paris', 40.5), (2, 'London', 34.0), (3, 'Rome', 41.0), (4, 'Berlin', 33.5); | List the top 3 oldest cities with the highest average visitor age. | SELECT city, avgAge FROM (SELECT city, AVG(visitorAge) AS avgAge, ROW_NUMBER() OVER (ORDER BY AVG(visitorAge) DESC) as rn FROM Exhibitions GROUP BY city) t WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE TransportBudget (Sector VARCHAR(50), BudgetAmount NUMERIC(15,2), BudgetYear INT); INSERT INTO TransportBudget (Sector, BudgetAmount, BudgetYear) VALUES ('Transportation', 800000, 2019), ('Transportation', 300000, 2019), ('Transportation', 600000, 2019); | What was the total budget for 'Transportation' sector in the year 2019, including records with a budget more than $500,000? | SELECT SUM(BudgetAmount) FROM TransportBudget WHERE Sector = 'Transportation' AND BudgetYear = 2019 AND BudgetAmount > 500000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (artwork_id INT, artist_id INT, artwork_name TEXT, rating INT, num_reviews INT); INSERT INTO Artworks (artwork_id, artist_id, artwork_name, rating, num_reviews) VALUES (1, 101, 'Painting 1', 8, 30), (2, 101, 'Painting 2', 9, 50), (3, 102, 'Sculpture 1', 7, 25); CREATE TABLE ArtistDetails (artist_i... | Find the top 2 artworks with the highest number of reviews and their corresponding artists. | SELECT a.artwork_name, a.num_reviews, ad.artist_name FROM Artworks a JOIN ArtistDetails ad ON a.artist_id = ad.artist_id ORDER BY a.num_reviews DESC LIMIT 2 | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_tests (id INT, vehicle_model VARCHAR(20), test_result VARCHAR(10), test_score INT); INSERT INTO safety_tests (id, vehicle_model, test_result, test_score) VALUES (1, 'Model X', 'Pass', 90), (2, 'Model Y', 'Pass', 85), (3, 'Model Z', 'Pass', 95), (4, 'Model X', 'Pass', 92), (5, 'Model Y', 'Fail', 80); | Show the three safest vehicle models based on safety test results. | SELECT vehicle_model, AVG(test_score) AS avg_score FROM safety_tests WHERE test_result = 'Pass' GROUP BY vehicle_model ORDER BY avg_score DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE drilling_operations (drill_id INT, well_id INT, start_date DATE, end_date DATE, status VARCHAR(50)); INSERT INTO drilling_operations (drill_id, well_id, start_date, end_date, status) VALUES (1, 1, '2020-01-01', '2020-04-30', 'Completed'), (2, 2, '2020-02-15', '2020-05-25', 'In Progress'), (4, 5, '2020-03-1... | Which wells had drilling operations completed in 2020? | SELECT well_id FROM drilling_operations WHERE status = 'Completed' AND start_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY well_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE software (id INT, name VARCHAR(255)); INSERT INTO software (id, name) VALUES (1, 'Product A'), (2, 'Product B'), (3, 'Product C'); CREATE TABLE vulnerabilities (id INT, software_id INT, discovered_on DATE, severity VARCHAR(255)); INSERT INTO vulnerabilities (id, software_id, discovered_on, severity) VALUES... | For each software product, show the number of vulnerabilities discovered in the last 30 days. | SELECT software.name, COUNT(vulnerabilities.id) as vulnerabilities_in_last_30_days FROM software LEFT JOIN vulnerabilities ON software.id = vulnerabilities.software_id WHERE vulnerabilities.discovered_on >= DATEADD(day, -30, GETDATE()) GROUP BY software.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_agencies (id INT, agency_name TEXT, region TEXT); INSERT INTO intelligence_agencies (id, agency_name, region) VALUES (1, 'National Intelligence Agency', 'Africa'), (2, 'Directorate of Military Intelligence', 'Africa'), (3, 'State Security Agency', 'Africa'); | What are the names of all intelligence agencies operating in 'Africa'? | SELECT agency_name FROM intelligence_agencies WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (id INT, name VARCHAR(50), gender VARCHAR(10), domain VARCHAR(50)); INSERT INTO authors (id, name, gender, domain) VALUES (1, 'Alice', 'Female', 'AI Safety'); CREATE TABLE articles (id INT, title VARCHAR(100), sentiment FLOAT, author_id INT); INSERT INTO articles (id, title, sentiment, author_id) V... | What is the average sentiment score of articles created by female authors in the AI safety domain? | SELECT AVG(articles.sentiment) FROM articles INNER JOIN authors ON articles.author_id = authors.id WHERE authors.gender = 'Female' AND authors.domain = 'AI Safety'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bioprocess (id INT PRIMARY KEY, name TEXT); CREATE TABLE equipment (bioprocess_id INT, reactor_id INT, temperature INT, pressure INT, volume INT, stir_speed INT, pH REAL, FOREIGN KEY (bioprocess_id) REFERENCES bioprocess(id)); | Insert new records into the 'equipment' table for a new bioprocess with the following details: Reactor ID 101, Temperature 37, Pressure 2, Volume 500, Stir_speed 100, pH 7 | INSERT INTO bioprocess (name) VALUES ('NewBioprocess'); INSERT INTO equipment (bioprocess_id, reactor_id, temperature, pressure, volume, stir_speed, pH) VALUES ((SELECT id FROM bioprocess WHERE name = 'NewBioprocess'), 101, 37, 2, 500, 100, 7); | gretelai_synthetic_text_to_sql |
CREATE TABLE Organizations (org_id INT, org_name TEXT); | Insert a new organization 'Code Tenderloin' with org_id '10' into the 'Organizations' table | INSERT INTO Organizations (org_id, org_name) VALUES (10, 'Code Tenderloin'); | gretelai_synthetic_text_to_sql |
CREATE TABLE germany_data (subscriber_id INT, network_type VARCHAR(10), subscriber_type VARCHAR(10)); INSERT INTO germany_data (subscriber_id, network_type, subscriber_type) VALUES (1, '4G', 'mobile'), (2, '5G', 'mobile'), (3, 'Fiber', 'broadband'), (4, 'ADSL', 'broadband'); | What is the total number of mobile and broadband subscribers in Germany for each network type? | SELECT network_type, COUNT(*) as total_subscribers FROM germany_data WHERE subscriber_type IN ('mobile', 'broadband') GROUP BY network_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_projects (id INT, district VARCHAR(50), project_name VARCHAR(100), start_date DATE, end_date DATE, area DECIMAL(10, 2), construction_cost DECIMAL(10, 2)); | Calculate the average construction cost per square meter for all completed projects in the 'construction_projects' table, filtered to show only projects completed between 2016 and 2018? | SELECT AVG(construction_cost / area) FROM construction_projects WHERE YEAR(start_date) BETWEEN 2016 AND 2018 AND end_date IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID int, Sector varchar(50), Year int, Completed int); INSERT INTO Projects (ProjectID, Sector, Year, Completed) VALUES (1, 'Health', 2018, 1), (2, 'Education', 2017, 0), (3, 'Health', 2019, 1), (4, 'Infrastructure', 2018, 1); | How many projects were completed in each sector by year? | SELECT y.Year, s.Sector, COUNT(p.ProjectID) AS CompletedProjects FROM (SELECT DISTINCT Year FROM Projects) y CROSS JOIN (SELECT DISTINCT Sector FROM Projects) s LEFT JOIN Projects p ON y.Year = p.Year AND s.Sector = p.Sector WHERE p.Completed = 1 GROUP BY y.Year, s.Sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE SupplierIngredients (id INT, supplier_id INT, name VARCHAR(255), carbon_footprint INT); | Which suppliers have the highest and lowest average carbon footprint for their ingredients? | SELECT supplier_id, MAX(carbon_footprint) AS max_carbon_footprint, MIN(carbon_footprint) AS min_carbon_footprint FROM SupplierIngredients GROUP BY supplier_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE strains (strain_id INT, name TEXT, state TEXT); INSERT INTO strains (strain_id, name, state) VALUES (1, 'Strain X', 'Oregon'), (2, 'Strain Y', 'Oregon'), (3, 'Strain Z', 'California'); CREATE TABLE sales (sale_id INT, strain_id INT, price DECIMAL, grams INT); INSERT INTO sales (sale_id, strain_id, price, g... | What is the average price per gram of cannabis for each strain in Oregon, grouped by strain? | SELECT s.name, AVG(s.price / s.grams) AS avg_price_per_gram FROM strains st JOIN sales s ON st.strain_id = s.strain_id WHERE st.state = 'Oregon' GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Songs (id INT, title VARCHAR(100), release_quarter INT, genre VARCHAR(50), streams INT); | How many songs were released in each quarter of the year for the 'Electronic' genre? | SELECT genre, release_quarter, COUNT(*) FROM Songs WHERE genre = 'Electronic' GROUP BY genre, release_quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dishes (DishID int, Name varchar(50), Category varchar(50), CaloricContent int); INSERT INTO Dishes (DishID, Name, Category, CaloricContent) VALUES (1, 'Quinoa Salad', 'Organic', 350); CREATE TABLE Restaurants (RestaurantID int, Name varchar(50), Location varchar(50)); INSERT INTO Restaurants (RestaurantID... | Update the nutritional information of a specific dish across all restaurants serving it. | UPDATE Dishes SET CaloricContent = 400 WHERE Name = 'Quinoa Salad'; | gretelai_synthetic_text_to_sql |
CREATE TABLE lifelong_learning (student_id INT, grade INT, progress INT); INSERT INTO lifelong_learning (student_id, grade, progress) VALUES (1, 5, 30), (2, 5, 40), (3, 6, 50), (4, 6, 60), (5, 7, 70), (6, 7, 80); | What is the lifelong learning progress of students in grade 6? | SELECT grade, progress, RANK() OVER (PARTITION BY grade ORDER BY progress DESC) AS progress_rank FROM lifelong_learning WHERE grade = 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE underrepresented_communities (id INT, name VARCHAR(50), department VARCHAR(50), community VARCHAR(50)); INSERT INTO underrepresented_communities (id, name, department, community) VALUES (1, 'Jamal', 'Finance', 'African American'), (2, 'Alicia', 'Finance', 'Latinx'), (3, 'Mei-Ling', 'Finance', 'Asian Americ... | What is the total number of employees from historically underrepresented communities in the Finance department? | SELECT COUNT(*) FROM underrepresented_communities WHERE department = 'Finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE indian_movies (id INT, title VARCHAR(255), budget FLOAT, production_country VARCHAR(100)); INSERT INTO indian_movies (id, title, budget, production_country) VALUES (1, 'Movie1', 5000000, 'India'), (2, 'Movie2', 7000000, 'India'), (3, 'Movie3', 3000000, 'India'); | What is the average budget for all movies produced in India? | SELECT AVG(budget) FROM indian_movies; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_centers (id INT, name VARCHAR(20), location VARCHAR(20), district VARCHAR(20)); | How many recycling centers are located in New York state and which districts do they serve? | SELECT COUNT(*), district FROM recycling_centers WHERE location = 'New York' GROUP BY district; | gretelai_synthetic_text_to_sql |
CREATE TABLE offenses (offender_id INT, offense_date DATE); INSERT INTO offenses (offender_id, offense_date) VALUES (1, '2018-01-01'), (1, '2019-01-01'), (2, '2017-01-01'); | What is the average time between offenses for each offender, ordered by the average time? | SELECT offender_id, AVG(DATEDIFF(day, LAG(offense_date) OVER (PARTITION BY offender_id ORDER BY offense_date), offense_date)) AS avg_time_between_offenses FROM offenses GROUP BY offender_id ORDER BY AVG(DATEDIFF(day, LAG(offense_date) OVER (PARTITION BY offender_id ORDER BY offense_date), offense_date)); | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, name VARCHAR(50), location VARCHAR(50), installed_capacity FLOAT); INSERT INTO wind_farms (id, name, location, installed_capacity) VALUES (1, 'Wind Farm 1', 'Country A', 120.5); INSERT INTO wind_farms (id, name, location, installed_capacity) VALUES (2, 'Wind Farm 2', 'Country B', 250.8)... | What is the total installed capacity of wind farms in the clean_energy schema? | SELECT SUM(installed_capacity) FROM clean_energy.wind_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance (workshop VARCHAR(20), service_date DATE); INSERT INTO maintenance (workshop, service_date) VALUES ('Maintenance', '2021-03-15'), ('Body Shop', '2021-03-17'), ('Maintenance', '2021-03-20'), ('Tires', '2021-03-22'), ('Maintenance', '2021-03-30'); | How many vehicles were serviced in the 'Maintenance' workshop between March 15, 2021 and March 31, 2021? | SELECT COUNT(*) FROM maintenance WHERE workshop = 'Maintenance' AND service_date BETWEEN '2021-03-15' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmer_crops (farmer_id INT, crop_name VARCHAR(50), area FLOAT, production INT); | Find the total area and production of crops for each farmer in 'farmer_crops' table | SELECT farmer_id, SUM(area) AS total_area, SUM(production) AS total_production FROM farmer_crops GROUP BY farmer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_features (hotel_id INT, location VARCHAR(20), feature VARCHAR(30)); | List unique AI-powered hotel features in the Middle East and South America. | SELECT DISTINCT feature FROM hotel_features WHERE location IN ('Middle East', 'South America') AND feature LIKE '%AI%' | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (id INT PRIMARY KEY, name VARCHAR(50), age INT, location VARCHAR(50)); INSERT INTO Farmers (id, name, age, location) VALUES (1, 'Ramesh Patel', 45, 'India'); INSERT INTO Farmers (id, name, age, location) VALUES (2, 'Sita Devi', 50, 'Nepal'); CREATE TABLE Crops (id INT PRIMARY KEY, farmer_id INT, cr... | What is the maximum yield for crops grown by farmers in India since 2020? | SELECT MAX(yield) FROM Crops JOIN Farmers ON Crops.farmer_id = Farmers.id WHERE Farmers.location = 'India' AND year >= 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE antarctic_ocean_temperature (location TEXT, temperature REAL); INSERT INTO antarctic_ocean_temperature (location, temperature) VALUES ('Antarctic Ocean', 2.8), ('Weddell Sea', 1.8), ('Ross Sea', 0.8); | What is the maximum temperature recorded in the Antarctic Ocean? | SELECT MAX(temperature) FROM antarctic_ocean_temperature; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (id INT, title TEXT, release_year INT, genre TEXT, streams INT); INSERT INTO songs (id, title, release_year, genre, streams) VALUES (1, 'Song1', 2021, 'Blues', 180000); INSERT INTO songs (id, title, release_year, genre, streams) VALUES (2, 'Song2', 2021, 'Blues', 160000); INSERT INTO songs (id, title... | Find the difference in streams between the most and least streamed songs in the Blues genre. | SELECT MAX(streams) - MIN(streams) AS stream_diff FROM songs WHERE genre = 'Blues'; | gretelai_synthetic_text_to_sql |
CREATE TABLE african_countries (country VARCHAR(255), water_usage INT); INSERT INTO african_countries (country, water_usage) VALUES ('Egypt', 12000000), ('South Africa', 15000000), ('Nigeria', 10000000); | Which African countries have the highest water usage? | SELECT country, water_usage FROM african_countries ORDER BY water_usage DESC LIMIT 2; | 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.