context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE inclusion_efforts (effort_id INT, effort_name VARCHAR(30), region VARCHAR(20)); INSERT INTO inclusion_efforts (effort_id, effort_name, region) VALUES (1, 'Accessible Buildings', 'North'), (2, 'Diversity Training', 'South'), (3, 'Inclusive Hiring', 'East'), (4, 'Community Outreach', 'West'); | Find the number of inclusion efforts in each region | SELECT region, COUNT(*) FROM inclusion_efforts GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (restaurant_id INT, name VARCHAR(255)); CREATE TABLE sourcing (sourcing_id INT, restaurant_id INT, produce VARCHAR(255), local BOOLEAN); | Insert a new sustainable sourcing record for Restaurant C using local produce. | INSERT INTO sourcing (sourcing_id, restaurant_id, produce, local) VALUES (1, (SELECT restaurant_id FROM restaurants WHERE name = 'Restaurant C'), 'local produce', TRUE); | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name VARCHAR(50), type VARCHAR(50), country VARCHAR(50)); INSERT INTO organizations (id, name, type, country) VALUES (1, 'Accessible AI', 'Non-profit', 'USA'), (2, 'Tech for Social Good', 'Non-governmental', 'India'), (3, 'Digital Divide Initiative', 'Non-profit', 'Brazil'); | List all unique 'types' in the 'organizations' table | SELECT DISTINCT type FROM organizations; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (id INT, project_name VARCHAR(255), initiator VARCHAR(255), start_date DATE); INSERT INTO military_innovation (id, project_name, initiator, start_date) VALUES (1, 'Project S', 'USA', '2016-03-14'), (2, 'Project M', 'China', '2017-06-23'); | List all military innovation projects initiated after 2015 | SELECT * FROM military_innovation WHERE start_date > '2015-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers(id INT, name TEXT, age INT);CREATE TABLE volunteer_hours(id INT, volunteer_id INT, hours INT, volunteer_date DATE); | What is the average age of volunteers who have volunteered for more than 20 hours in the last 6 months? | SELECT AVG(volunteers.age) as avg_age FROM volunteers JOIN volunteer_hours ON volunteers.id = volunteer_hours.volunteer_id WHERE volunteer_hours.volunteer_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND CURDATE() GROUP BY volunteers.id HAVING SUM(volunteer_hours.hours) > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_response (id INT, incident_id INT, response_time INT, PRIMARY KEY(id)); | Update 'emergency_response' table to set all response times above 60 minutes to 60 minutes | UPDATE emergency_response SET response_time = 60 WHERE response_time > 60; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (country VARCHAR(20), site VARCHAR(50), visitors INT, month INT); INSERT INTO cultural_sites (country, site, visitors, month) VALUES ('Australia', 'Sydney Opera House', 250000, 1), ('Australia', 'Uluru', 150000, 1), ('Australia', 'Sydney Opera House', 220000, 2), ('Australia', 'Uluru', 14000... | What is the average number of visitors to each Australian cultural site per month? | SELECT site, AVG(visitors) as avg_visitors FROM cultural_sites WHERE country = 'Australia' GROUP BY site; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, name VARCHAR(50), safety_violations INT); INSERT INTO suppliers (supplier_id, name, safety_violations) VALUES (1, 'Green Earth Farms', 0), (2, 'Sunny Harvest', 2), (3, 'Organic Roots', 1); | List all suppliers with no reported food safety violations | SELECT * FROM suppliers WHERE safety_violations = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE Underwater_Species(id INT, year INT, location VARCHAR(50), species VARCHAR(50), population INT, vulnerable_status VARCHAR(50));INSERT INTO Underwater_Species(id, year, location, species, population, vulnerable_status) VALUES (1, 2021, 'Mediterranean Sea', 'Coral X', 200, 'Endangered'); | CREATE TABLE Underwater_Species(id INT, year INT, location VARCHAR(50), species VARCHAR(50), population INT, vulnerable_status VARCHAR(50)); | SELECT location, species, SUM(population) AS Total_Population FROM Underwater_Species WHERE vulnerable_status = 'Endangered' GROUP BY location, species; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_performance (id INT, name TEXT, speed DECIMAL(5,2), arrived_date DATE, country TEXT, cargo_weight INT); INSERT INTO vessel_performance (id, name, speed, arrived_date, country, cargo_weight) VALUES (1, 'Vessel S', 19.2, '2022-09-04', 'India', 7000), (2, 'Vessel T', 20.6, '2022-09-18', 'India', 8000),... | What is the total cargo weight for vessels arriving in India in September 2022? | SELECT SUM(cargo_weight) FROM vessel_performance WHERE YEAR(arrived_date) = 2022 AND MONTH(arrived_date) = 9 AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Organizations (id INT PRIMARY KEY, organization_name VARCHAR(255), country VARCHAR(255), category VARCHAR(255)); | Delete all records in the 'Organizations' table where the category is 'Education' | DELETE FROM Organizations WHERE category = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech;CREATE TABLE if not exists biotech.startups (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(100), funding FLOAT); INSERT INTO biotech.startups (id, name, location, funding) VALUES (1, 'StartupA', 'Boston', 12000000.0), (2, 'StartupB', 'Boston', 10000000.0), (3, 'StartupC', '... | What is the name of the biotech startup in Boston with the least funding? | SELECT name FROM biotech.startups WHERE location = 'Boston' ORDER BY funding LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_expenditure (expenditure_id INT, country TEXT, year INT, amount FLOAT); INSERT INTO military_expenditure (expenditure_id, country, year, amount) VALUES (1, 'United States', 2017, 610), (2, 'United States', 2018, 649), (3, 'United Kingdom', 2017, 47), (4, 'Germany', 2018, 43), (6, 'Russia', 2017, 6... | What is the total military expenditure by non-NATO countries in the last 5 years? | SELECT SUM(amount) FROM military_expenditure WHERE year >= (SELECT YEAR(GETDATE()) - 5) AND country NOT IN (SELECT member_state FROM nato_members); | gretelai_synthetic_text_to_sql |
CREATE TABLE immunization_clinics (id INT, region TEXT, clinic_type TEXT); INSERT INTO immunization_clinics (id, region, clinic_type) VALUES (1, 'East', 'Flu Shot Clinic'), (2, 'West', 'Immunization Clinic'); | What is the total number of immunization clinics in the Western region? | SELECT COUNT(*) FROM immunization_clinics WHERE region = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (drug_name VARCHAR(255), approval_body VARCHAR(255), approval_year INT); CREATE TABLE rd_expenditure (drug_name VARCHAR(255), rd_expenditure FLOAT); INSERT INTO drug_approval (drug_name, approval_body, approval_year) VALUES ('DrugA', 'FDA', 2019), ('DrugB', 'MHRA', 2018), ('DrugC', 'MHRA', 20... | What is the total R&D expenditure for drugs approved by the MHRA in 2020? | SELECT SUM(rd_expenditure) FROM rd_expenditure INNER JOIN drug_approval ON rd_expenditure.drug_name = drug_approval.drug_name WHERE drug_approval.approval_body = 'MHRA' AND drug_approval.approval_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stadiums(id INT, name TEXT, location TEXT, sport TEXT, capacity INT); CREATE VIEW FootballStadiums AS SELECT * FROM Stadiums WHERE sport = 'Football'; | What is the total number of fans who attended football games in the South region last season? | SELECT SUM(attendance) FROM (SELECT stadium_id, COUNT(ticket_id) AS attendance FROM TicketSales WHERE season = 'Last' AND stadium_id IN (SELECT id FROM FootballStadiums WHERE location = 'South')) AS GameAttendance | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, mobility_impairment BOOLEAN, department VARCHAR(255)); INSERT INTO students (id, mobility_impairment, department) VALUES (1, true, 'science'), (2, false, 'engineering'), (3, true, 'science'), (4, true, 'mathematics'), (5, false, 'science'), (6, true, 'mathematics'); CREATE TABLE accommoda... | How many students with mobility impairments have not received any accommodations in the mathematics department? | SELECT COUNT(*) FROM students s WHERE s.mobility_impairment = true AND s.department = 'mathematics' AND s.id NOT IN (SELECT student_id FROM accommodations); | gretelai_synthetic_text_to_sql |
CREATE TABLE reo_production (id INT PRIMARY KEY, reo_type VARCHAR(50), production_quantity INT, production_year INT); | Delete records for Gadolinium Oxide from the reo_production table for the year 2021 | DELETE FROM reo_production WHERE reo_type = 'Gadolinium Oxide' AND production_year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, project_name VARCHAR(50), sensors VARCHAR(50)); INSERT INTO projects (id, project_name, sensors) VALUES (3, 'Cell Culture', 'Sensor X'); INSERT INTO projects (id, project_name, sensors) VALUES (4, 'Fermentation', 'Sensor Y'); | Find bioprocess engineering projects that have sensors. | SELECT project_name FROM projects WHERE sensors IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (id INT, name VARCHAR(255), category VARCHAR(255)); | Delete all nutrition data for menu items without a category assigned | DELETE FROM nutrition_data WHERE menu_item IN (SELECT name FROM menu_items WHERE category IS NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE grad_students (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO grad_students VALUES (1, 'John Doe', 'Physics'); INSERT INTO grad_students VALUES (2, 'Jane Smith', 'Mathematics'); CREATE TABLE research_grants (id INT, student_id INT, year INT, amount DECIMAL(10, 2)); INSERT INTO research_gran... | What is the average number of research grants awarded per department? | SELECT g.department, AVG(r.id) FROM grad_students g JOIN research_grants r ON g.id = r.student_id GROUP BY g.department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (id INT, name TEXT); INSERT INTO Programs (id, name) VALUES (1, 'Youth Education'), (2, 'Women Empowerment'), (3, 'Clean Water'), (4, 'Refugee Support'); CREATE TABLE Volunteers (id INT, program INT, hours INT); INSERT INTO Volunteers (id, program, hours) VALUES (1, 1, 20), (2, 2, 30), (3, 3, 15),... | List the programs that have both volunteer and donor data. | SELECT Programs.name FROM Programs INNER JOIN Volunteers ON Programs.id = Volunteers.program INNER JOIN Donors ON Programs.id = Donors.program; | gretelai_synthetic_text_to_sql |
CREATE TABLE Publications (PublicationID int, FacultyID int, Topic varchar(50)); INSERT INTO Publications (PublicationID, FacultyID, Topic) VALUES (3, 3, 'Genetics'); CREATE TABLE Faculty (FacultyID int, Name varchar(50), Department varchar(50)); INSERT INTO Faculty (FacultyID, Name, Department) VALUES (3, 'Alice Johns... | What are the publication topics and corresponding faculty members in the 'Biology' department? | SELECT Publications.Topic, Faculty.Name FROM Publications INNER JOIN Faculty ON Publications.FacultyID = Faculty.FacultyID WHERE Faculty.Department = 'Biology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists smart_contracts (id INT PRIMARY KEY, name TEXT, language TEXT, version TEXT); INSERT INTO smart_contracts (id, name, language, version) VALUES (1, 'CryptoKitties', 'Solidity', '0.4.24'), (2, 'UniswapV2', 'Vyper', '0.2.6'), (3, 'Gnosis', 'Solidity', '0.5.12'); | Retrieve smart contracts written in Solidity with a version of 0.5.x. | SELECT * FROM smart_contracts WHERE language = 'Solidity' AND version LIKE '0.5.%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, ethical_practice_category VARCHAR(50)); CREATE TABLE sales (sale_id INT, supplier_id INT, quantity_sold INT); INSERT INTO suppliers (supplier_id, ethical_practice_category) VALUES (1, 'Ethical'), (2, 'Unethical'), (3, 'Ethical'); INSERT INTO sales (sale_id, supplier_id, quantity... | What is the total quantity of products sold by each supplier in the ethical labor practice category? | SELECT suppliers.ethical_practice_category, SUM(sales.quantity_sold) AS total_quantity_sold FROM suppliers INNER JOIN sales ON suppliers.supplier_id = sales.supplier_id GROUP BY suppliers.ethical_practice_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor TEXT, donation_date DATE); | How many unique donors made donations in each quarter of 2022? | SELECT DATE_FORMAT(donation_date, '%Y-%V') as quarter, COUNT(DISTINCT donor) as unique_donors FROM donations WHERE donation_date >= '2022-01-01' AND donation_date < '2023-01-01' GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dispensaries (id INT, name TEXT, state TEXT);CREATE TABLE Transactions (id INT, dispensary_id INT, product_type TEXT, transaction_value DECIMAL); | Which dispensaries in California have the highest average transaction value for edibles? | SELECT D.name FROM Dispensaries D JOIN (SELECT dispensary_id, AVG(transaction_value) AS avg_value FROM Transactions WHERE product_type = 'edibles' GROUP BY dispensary_id ORDER BY avg_value DESC LIMIT 1) T ON D.id = T.dispensary_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (id INT PRIMARY KEY, donor_name VARCHAR(255), last_donation DATE, donation_amount FLOAT); | Update records in the 'Donors' table where the donor's name is 'John Smith' and change the last donation date to '2022-01-01' | UPDATE Donors SET last_donation = '2022-01-01' WHERE donor_name = 'John Smith'; | gretelai_synthetic_text_to_sql |
CREATE TABLE readers (id INT, name VARCHAR(50), age INT, preference VARCHAR(50)); INSERT INTO readers (id, name, age, preference) VALUES (1, 'John Doe', 25, 'technology'), (2, 'Jane Smith', 32, 'politics'); | What is the average age of readers who prefer technology news? | SELECT AVG(age) FROM readers WHERE preference = 'technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID int, JoinDate date); INSERT INTO Members (MemberID, JoinDate) VALUES (1, '2021-01-05'); CREATE TABLE Classes (ClassID int, ClassDate date, MemberID int); INSERT INTO Classes (ClassID, ClassDate, MemberID) VALUES (1, '2021-02-01', 1); | How many members joined in Q1 2021 who have not attended any class yet? | SELECT COUNT(MemberID) FROM Members m WHERE YEAR(m.JoinDate) = 2021 AND QUARTER(m.JoinDate) = 1 AND m.MemberID NOT IN (SELECT MemberID FROM Classes); | gretelai_synthetic_text_to_sql |
CREATE TABLE GameGenres (GameID int, GameName varchar(100), Genre varchar(50)); INSERT INTO GameGenres VALUES (6, 'GameF', 'Action'), (8, 'GameH', 'RPG'), (9, 'GameI', 'Simulation'), (10, 'GameJ', 'Strategy'); | Which games belong to the same genres as 'GameF' EXCEPT 'Action' and 'GameE'? | SELECT GameName, Genre FROM GameGenres WHERE Genre IN (SELECT Genre FROM GameGenres WHERE GameName = 'GameF') EXCEPT (SELECT GameName, 'Action' FROM GameGenres WHERE GameName = 'GameF' UNION SELECT 'GameE', Genre FROM GameGenres WHERE GameName = 'GameE'); | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_impact (region VARCHAR(255), drought_category VARCHAR(255), month DATE, usage INT); INSERT INTO drought_impact (region, drought_category, month, usage) VALUES ('Southern', 'Moderate', '2018-01-01', 8000); | What is the total water usage for each drought category in the southern region in 2018?' | SELECT region, drought_category, SUM(usage) FROM drought_impact WHERE region = 'Southern' AND YEAR(month) = 2018 GROUP BY region, drought_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE FactoryWorkers (factory_id INT, number_of_workers INT, has_fair_labor_practices BOOLEAN); INSERT INTO FactoryWorkers (factory_id, number_of_workers, has_fair_labor_practices) VALUES (1, 200, true), (2, 300, false), (3, 150, true); CREATE TABLE Factories (factory_id INT, region VARCHAR(50)); INSERT INTO Fac... | How many workers are employed in factories with fair labor practices in South America? | SELECT COUNT(FactoryWorkers.number_of_workers) FROM FactoryWorkers INNER JOIN Factories ON FactoryWorkers.factory_id = Factories.factory_id WHERE Factories.region = 'South America' AND FactoryWorkers.has_fair_labor_practices = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name TEXT, age INT, gender TEXT, total_assets DECIMAL(10,2)); INSERT INTO clients VALUES (1, 'John Doe', 35, 'Male', 250000.00), (2, 'Jane Smith', 45, 'Female', 500000.00), (3, 'Bob Johnson', 50, 'Male', 800000.00), (4, 'Alice Lee', 40, 'Female', 320000.00); CREATE TABLE investments... | Which female clients have a total asset greater than $300,000 and have invested in real estate? | SELECT c.name, c.total_assets FROM clients c INNER JOIN investments i ON c.client_id = i.client_id WHERE c.gender = 'Female' AND i.investment_type = 'Real Estate' AND c.total_assets > 300000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE Releases (ReleaseID int, SongID int, ReleaseDate date); INSERT INTO Releases (ReleaseID, SongID, ReleaseDate) VALUES (1, 1, '2009-01-01'), (2, 2, '2008-05-15'), (3, 3, '2012-07-25'); | What is the release date and revenue for songs released before 2010? | SELECT Songs.SongName, Releases.ReleaseDate, Sales.Revenue FROM Songs INNER JOIN Releases ON Songs.SongID = Releases.SongID INNER JOIN Sales ON Songs.SongID = Sales.SongID WHERE Releases.ReleaseDate < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT PRIMARY KEY, name TEXT, team TEXT, position TEXT, points_per_game FLOAT); INSERT INTO players (id, name, team, position, points_per_game) VALUES (1, 'Kevin Durant', 'Brooklyn Nets', 'Forward', 26.9), (2, 'Giannis Antetokounmpo', 'Milwaukee Bucks', 'Forward', 29.5), (3, 'Joel Embiid', 'Phila... | Find the average points scored by the top 5 players in the NBA for the current season | SELECT AVG(points_per_game) FROM (SELECT points_per_game FROM players ORDER BY points_per_game DESC LIMIT 5) AS top_five_players; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_weight (component VARCHAR(20), weight INT); INSERT INTO spacecraft_weight (component, weight) VALUES ('Propulsion System', 2000), ('Avionics', 1500), ('Structure', 4000); | What is the total weight of each component in the spacecraft? | SELECT component, weight FROM spacecraft_weight; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, name VARCHAR(50), budget INT, open_data BOOLEAN); INSERT INTO departments (id, name, budget, open_data) VALUES (1, 'Education', 15000000, true), (2, 'Transportation', 20000000, true); CREATE TABLE policies (id INT, department_id INT, title VARCHAR(50), evidence_based BOOLEAN); INSERT I... | What is the total budget of departments that have implemented open data initiatives and have created more than 5 evidence-based policies? | SELECT SUM(budget) as total_budget FROM departments d WHERE open_data = true AND (SELECT COUNT(*) FROM policies p WHERE d.id = p.department_id AND evidence_based = true) > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(50), birth_date DATE); INSERT INTO artists (id, name, birth_date) VALUES (1, 'Claude Monet', '1840-11-14'); CREATE TABLE paintings (id INT, artist_id INT, year INT); INSERT INTO paintings (id, artist_id, year) VALUES (1, 1, 1865); | Find the difference in years between the birth of an artist and the creation of their first painting. | SELECT a.name, DATEDIFF(year, a.birth_date, MIN(p.year)) as age_at_first_painting FROM artists a JOIN paintings p ON a.id = p.artist_id GROUP BY a.name, a.birth_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), last_transaction_date DATE);CREATE TABLE transactions (transaction_id INT, client_id INT, transaction_date DATE); | How many transactions were made by clients with a last name starting with 'S' in Q3 2022? | SELECT COUNT(*) FROM transactions t INNER JOIN clients c ON t.client_id = c.client_id WHERE SUBSTRING(c.name, 1, 1) = 'S' AND t.transaction_date BETWEEN '2022-07-01' AND '2022-09-30' | gretelai_synthetic_text_to_sql |
CREATE TABLE wells_state_owned (id INT, well_name VARCHAR(50), location VARCHAR(50), company VARCHAR(50), num_drills INT, drill_date DATE, is_state_owned BOOLEAN); INSERT INTO wells_state_owned VALUES (1, 'Well G', 'Norway', 'Norwegian Oil', 4, '2019-04-01', true); INSERT INTO wells_state_owned VALUES (2, 'Well H', 'Te... | Identify the number of wells drilled in each country by state-owned companies between 2018 and 2020 | SELECT location, SUM(num_drills) FROM wells_state_owned WHERE is_state_owned = true AND drill_date BETWEEN '2018-01-01' AND '2020-12-31' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Performances (Id INT, PerformanceName VARCHAR(50), LocationCountry VARCHAR(50), Attendance INT);CREATE TABLE DancePerformances (Id INT, PerformanceId INT); | How many dance performances have been held in each country, and what is the average attendance for each country? | SELECT LocationCountry, AVG(Attendance) as AvgAttendance, COUNT(*) as TotalPerformances FROM Performances P INNER JOIN DancePerformances DP ON P.Id = DP.PerformanceId GROUP BY LocationCountry; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_health (id INT, patient_id INT, name TEXT, region TEXT, program_type TEXT); INSERT INTO public_health (id, patient_id, name, region, program_type) VALUES (1, 1, 'Initiative A', 'northeast', 'prevention'); INSERT INTO public_health (id, patient_id, name, region, program_type) VALUES (2, 2, 'Initiativ... | Find the number of unique patients enrolled in 'prevention' and 'treatment' programs in 'northeast' regions. | SELECT COUNT(DISTINCT patient_id) FROM public_health WHERE region = 'northeast' AND program_type IN ('prevention', 'treatment'); | gretelai_synthetic_text_to_sql |
CREATE TABLE borough (id INT, name VARCHAR(50)); INSERT INTO borough (id, name) VALUES (1, 'Manhattan'), (2, 'Brooklyn'), (3, 'Queens'), (4, 'Bronx'), (5, 'Staten Island'); CREATE TABLE incident (id INT, borough_id INT, type VARCHAR(50), timestamp TIMESTAMP); | What is the total number of emergency incidents in each borough? | SELECT borough_id, COUNT(*) as total_incidents FROM incident GROUP BY borough_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales(id INT, team VARCHAR(50), game_date DATE, ticket_type VARCHAR(10), quantity INT);INSERT INTO ticket_sales(id, team, game_date, ticket_type, quantity) VALUES (1, 'Chicago Bulls', '2022-01-01', 'Regular', 300), (2, 'Chicago Bulls', '2022-01-02', 'VIP', 200), (3, 'Chicago Bulls', '2022-03-15', 'R... | How many tickets were sold for the "Chicago Bulls" games in the first quarter of 2022? | SELECT SUM(quantity) FROM ticket_sales WHERE team = 'Chicago Bulls' AND game_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (project_id INT, co2_reduction INT); INSERT INTO co2_emissions (project_id, co2_reduction) VALUES (1, 5000), (2, 6000), (3, 7000), (4, 4000), (5, 8000); | What is the average CO2 emissions reduction for projects using carbon capture technology? | SELECT AVG(co2_reduction) FROM co2_emissions WHERE project_id IN (SELECT project_id FROM carbon_capture); | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), region VARCHAR(50));CREATE TABLE investments (investment_id INT, client_id INT, market VARCHAR(50), value INT);INSERT INTO clients (client_id, name, region) VALUES (1, 'John Doe', 'North America'), (2, 'Jane Smith', 'Asia');INSERT INTO investments (investment_id, c... | Delete all records of clients who have never invested in any market. | DELETE FROM clients c WHERE c.client_id NOT IN (SELECT i.client_id FROM investments i); | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT, name TEXT, state TEXT, yield FLOAT, drought_index FLOAT); INSERT INTO crops (id, name, state, yield, drought_index) VALUES (1, 'Corn', 'Texas', 120, 5), (2, 'Wheat', 'Texas', 80, 3), (3, 'Soybeans', 'Texas', 90, 2); | What is the impact of drought on crop yields in Texas? | SELECT name, yield, drought_index, yield/drought_index as impact FROM crops WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (VisitorID INT, Age INT, EventID INT, EventType VARCHAR(255)); INSERT INTO Visitors (VisitorID, Age, EventID, EventType) VALUES (1, 32, 1, 'Virtual Conference'); INSERT INTO Visitors (VisitorID, Age, EventID, EventType) VALUES (2, 45, 2, 'Webinar'); INSERT INTO Visitors (VisitorID, Age, EventID, E... | What is the average age of visitors who attended virtual events in 2020, broken down by event type? | SELECT EventType, AVG(Age) as AverageAge FROM Visitors WHERE YEAR(EventDate) = 2020 GROUP BY EventType; | gretelai_synthetic_text_to_sql |
CREATE TABLE LifeExpectancy (Gender VARCHAR(255), Continent VARCHAR(255), LifeExpectancy FLOAT); INSERT INTO LifeExpectancy (Gender, Continent, LifeExpectancy) VALUES ('Male', 'Europe', 74.1), ('Female', 'Europe', 81.1); | What is the average life expectancy for each gender in Europe? | SELECT Gender, AVG(LifeExpectancy) FROM LifeExpectancy WHERE Continent = 'Europe' GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT PRIMARY KEY, date DATE, amount DECIMAL(10,2)); INSERT INTO sales (id, date, amount) VALUES (1, '2022-01-01', 1000.00), (2, '2022-02-01', 2000.00), (3, '2023-01-01', 3000.00); | Determine the total revenue for the year 2022 | SELECT SUM(amount) FROM sales WHERE YEAR(date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_categories (category_id INT, category_name TEXT); CREATE TABLE menu (menu_id INT, category_id INT, dish_name TEXT, calories INT); | Display the total calories for each dish category in the menu_categories and menu tables. | SELECT menu_categories.category_name, SUM(menu.calories) FROM menu INNER JOIN menu_categories ON menu.category_id = menu_categories.category_id GROUP BY menu_categories.category_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, name TEXT, country TEXT, join_date DATE); INSERT INTO volunteers (id, name, country, join_date) VALUES (1, 'Carlos Rodriguez', 'Mexico', '2021-01-10'); INSERT INTO volunteers (id, name, country, join_date) VALUES (2, 'Ana Silva', 'Brazil', '2021-03-15'); INSERT INTO volunteers (id, name... | What is the total number of volunteers who joined in Q1 2021 and are from Latin America? | SELECT COUNT(*) FROM volunteers WHERE join_date BETWEEN '2021-01-01' AND '2021-03-31' AND country IN ('Mexico', 'Brazil', 'Argentina', 'Colombia', 'Peru', 'Chile'); | gretelai_synthetic_text_to_sql |
CREATE TABLE accessible_tech (product_id INT, product_release_year INT, company_region VARCHAR(15));INSERT INTO accessible_tech (product_id, product_release_year, company_region) VALUES (1, 2019, 'North America'), (2, 2020, 'Europe'), (3, 2018, 'Asia'); | Find the number of accessible technology products released in 2019 and 2020 that were developed by companies based in North America or Europe. | SELECT COUNT(*) FROM accessible_tech WHERE product_release_year BETWEEN 2019 AND 2020 AND company_region IN ('North America', 'Europe'); | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (name VARCHAR(255), region VARCHAR(255), animal_type VARCHAR(255), population INT); INSERT INTO habitats (name, region, animal_type, population) VALUES ('borneo', 'Southeast Asia', 'orangutan', 200); INSERT INTO habitats (name, region, animal_type, population) VALUES ('sumatra', 'Southeast Asia', ... | What is the average population of orangutans in Southeast Asian habitats? | SELECT AVG(population) FROM habitats WHERE region = 'Southeast Asia' AND animal_type = 'orangutan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_data (maintenance_id INT, equipment_id INT); | Delete all records from the 'maintenance_data' table where the 'equipment_id' is less than 100 | DELETE FROM maintenance_data WHERE equipment_id < 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (dish VARCHAR(255), customer_location VARCHAR(50), order_date DATE); INSERT INTO orders (dish, customer_location, order_date) VALUES ('Chicken Shawarma', 'Toronto', '2021-10-01'), ('Beef Shawarma', 'Toronto', '2021-10-02'), ('Falafel Plate', 'Montreal', '2021-10-01'); | How many of each dish were sold to customers in a specific location last week? | SELECT customer_location, dish, COUNT(*) FROM orders WHERE order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY) GROUP BY customer_location, dish; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (id INT, dish_id INT, order_date DATE, quantity INT); CREATE TABLE customers (id INT, is_vegetarian BOOLEAN); CREATE TABLE dishes (id INT, name TEXT); | What are the top 5 most sold dishes among vegetarian customers in the last month? | SELECT dishes.name, SUM(orders.quantity) as total_quantity FROM orders JOIN customers ON orders.id = customers.id JOIN dishes ON orders.dish_id = dishes.id WHERE customers.is_vegetarian = true AND orders.order_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE GROUP BY dishes.name ORDER BY total_qua... | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_union (id INT, name VARCHAR); INSERT INTO mining_union (id, name) VALUES (1, 'Karen'); CREATE TABLE finance_union (id INT, name VARCHAR); INSERT INTO finance_union (id, name) VALUES (1, 'Larry'); | List the members who are in the 'mining' union but not in the 'finance' union. | SELECT name FROM mining_union WHERE name NOT IN (SELECT name FROM finance_union); | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, region VARCHAR(20), co2_emissions INT); INSERT INTO suppliers (id, region, co2_emissions) VALUES (1, 'North', 500), (2, 'South', 800), (3, 'East', 300); | What is the total CO2 emissions by region in the 'suppliers' table? | SELECT region, SUM(co2_emissions) FROM suppliers GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE uk_taxis (city VARCHAR(20), num_taxis INT); | How many autonomous taxis are there in each city in the UK? | SELECT city, SUM(num_taxis) AS total_autonomous_taxis FROM uk_taxis GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouses (warehouse_id INT, product_id INT, quantity INT, is_ethically_sourced BOOLEAN); INSERT INTO warehouses (warehouse_id, product_id, quantity, is_ethically_sourced) VALUES (1, 101, 50, TRUE), (1, 102, 30, TRUE), (2, 103, 70, TRUE), (2, 104, 40, FALSE), (3, 105, 60, TRUE); CREATE TABLE products (pro... | What is the total quantity of ethically sourced products in all warehouses, grouped by product category? | SELECT p.category, SUM(w.quantity) FROM warehouses w INNER JOIN products p ON w.product_id = p.product_id WHERE w.is_ethically_sourced = TRUE GROUP BY p.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPrograms (region VARCHAR(255), program VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO MilitaryPrograms (region, program, budget) VALUES ('North America', 'ProgramA', 400000000.00), ('North America', 'ProgramB', 600000000.00), ('North America', 'ProgramC', 50000000.00), ('Asia', 'ProgramD', 300000... | What is the average number of military technology programs in the North American region, excluding programs with a budget above $1 billion? | SELECT AVG(budget) FROM MilitaryPrograms WHERE region = 'North America' AND budget < 1000000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, type TEXT, safety_score FLOAT);CREATE TABLE cargos (id INT, vessel_id INT, material TEXT, weight FLOAT, destination TEXT, date DATE); INSERT INTO vessels (id, name, type, safety_score) VALUES (1, 'VesselG', 'Tanker', 87.5); INSERT INTO cargos (id, vessel_id, material, weight, de... | What is the total weight of oil transported by vessels with a safety score above 85 in the Atlantic Ocean in Q4 2021? | SELECT SUM(c.weight) FROM vessels v JOIN cargos c ON v.id = c.vessel_id WHERE v.safety_score > 85 AND c.material = 'Oil' AND c.destination = 'Atlantic' AND c.date BETWEEN '2021-10-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE site (site_id INT, site_name VARCHAR(50), num_employees INT); | How many employees work at each site, sorted by the number of employees? | SELECT site_name, num_employees FROM site ORDER BY num_employees DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtifactMaterials (MaterialID INT, ArtifactID INT, Material TEXT); INSERT INTO ArtifactMaterials (MaterialID, ArtifactID, Material) VALUES (1, 1, 'Gold'); INSERT INTO ArtifactMaterials (MaterialID, ArtifactID, Material) VALUES (2, 2, 'Silver'); INSERT INTO ArtifactMaterials (MaterialID, ArtifactID, Materia... | What is the number of artifacts made of gold or silver, grouped by excavation site? | SELECT e.SiteName, COUNT(*) AS Count FROM ExcavationSites e JOIN ArtifactAnalysis a ON e.SiteID = a.SiteID JOIN ArtifactMaterials m ON a.ArtifactID = m.ArtifactID WHERE m.Material IN ('Gold', 'Silver') GROUP BY e.SiteName; | gretelai_synthetic_text_to_sql |
CREATE TABLE InfrastructureProjects (id INT, name TEXT, category TEXT, budget FLOAT); INSERT INTO InfrastructureProjects (id, name, category, budget) VALUES (1, 'Highway 12 Expansion', 'Transportation', 2000000); INSERT INTO InfrastructureProjects (id, name, category, budget) VALUES (2, 'Bridgewater Park Pedestrian Pat... | How many infrastructure projects are there for each category? | SELECT category, COUNT(*) FROM InfrastructureProjects GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (species VARCHAR(255), animal_count INT, country VARCHAR(255)); CREATE TABLE countries (country VARCHAR(255), region VARCHAR(255)); | Find the number of animals per species, grouped by region in the "animal_population" and "countries" tables | SELECT c1.region, e1.species, SUM(e1.animal_count) as total_count FROM animal_population e1 INNER JOIN countries c1 ON e1.country = c1.country GROUP BY c1.region, e1.species; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, join_date DATE); INSERT INTO mobile_subscribers (subscriber_id, join_date) VALUES (1, '2021-01-01'), (2, '2021-03-01'), (3, '2020-12-01'); | List all mobile subscribers who joined in the first quarter of 2021 and their respective joining dates. | SELECT * FROM mobile_subscribers WHERE join_date BETWEEN '2021-01-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_budget (id INT PRIMARY KEY, project_name VARCHAR(50), budget FLOAT); INSERT INTO creative_ai_budget (id, project_name, budget) VALUES (1, 'AI-generated Art', 75000.0), (2, 'AI-written Poetry', 32000.0), (3, 'AI-composed Music', 48000.0), (4, 'AI-designed Fashion', 51000.0), (5, 'AI-generated Ar... | List of creative AI projects with budget over 50000. | SELECT project_name, budget FROM creative_ai_budget WHERE budget > 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_sales (id INT, garment_id INT, category VARCHAR(20), sale_date DATE, quantity INT);CREATE VIEW weekly_sales_by_category AS SELECT EXTRACT(YEAR_WEEK FROM sale_date) as year_week, category, SUM(quantity) as total_sold FROM garment_sales GROUP BY year_week, category; | Determine the most sold garment category by week. | SELECT year_week, category, total_sold, RANK() OVER (PARTITION BY year_week ORDER BY total_sold DESC) as sales_rank FROM weekly_sales_by_category WHERE sales_rank = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), age INT, game VARCHAR(50), matches_played INT, first_played DATE); INSERT INTO players (id, name, age, game, matches_played, first_played) VALUES (1, 'Jane Doe', 22, 'World of Tanks', 50, '2022-01-01'); | What is the average number of matches played per day by all players in World of Tanks? | SELECT AVG(matches_played / (CURRENT_DATE - first_played)) AS avg_matches_per_day FROM players WHERE game = 'World of Tanks'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, type VARCHAR(255)); INSERT INTO vessels (id, type) VALUES (1, 'Tanker'), (2, 'Bulk Carrier'), (3, 'Container Ship'); CREATE TABLE cargo (id INT, vessel_id INT, weight INT); INSERT INTO cargo (id, vessel_id, weight) VALUES (1, 1, 50000), (2, 2, 75000), (3, 3, 100000); | What is the total cargo weight for each vessel type? | SELECT v.type, SUM(c.weight) as total_weight FROM cargo c JOIN vessels v ON c.vessel_id = v.id GROUP BY v.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT, country VARCHAR, military_personnel INT); | What is the total number of military personnel from each country involved in peacekeeping operations? | SELECT country, SUM(military_personnel) FROM peacekeeping_operations GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity_reports (report_id INT, state VARCHAR(255), year INT, total_complaints INT); | Insert a new record of a mental health parity report for the state of California in 2022 | INSERT INTO mental_health_parity_reports (report_id, state, year, total_complaints) VALUES (1, 'California', 2022, 250); | gretelai_synthetic_text_to_sql |
CREATE TABLE blockchain_companies (company_id INT, company_name VARCHAR(50), platform VARCHAR(50)); INSERT INTO blockchain_companies (company_id, company_name, platform) VALUES (1, 'Ethereum Foundation', 'Ethereum'); INSERT INTO blockchain_companies (company_id, company_name, platform) VALUES (2, 'Blockstream', 'Bitcoi... | What is the total transaction amount for each company, ranked by the total transaction amount in descending order? | SELECT b.company_name, SUM(bt.amount) as total_amount, ROW_NUMBER() OVER (ORDER BY SUM(bt.amount) DESC) as rank FROM blockchain_transactions bt JOIN blockchain_companies b ON bt.company_id = b.company_id GROUP BY b.company_id, b.company_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, campaign_name VARCHAR(50), start_date DATE, end_date DATE, budget FLOAT, region VARCHAR(50)); INSERT INTO campaigns (id, campaign_name, start_date, end_date, budget, region) VALUES (5, 'EmpowerMinds', '2022-01-01', '2022-03-31', 22000, 'Asia'); INSERT INTO campaigns (id, campaign_name, s... | What is the budget quartile (1-4) for each mental health campaign by region, ordered by budget in descending order? | SELECT id, campaign_name, start_date, end_date, budget, region, NTILE(4) OVER (ORDER BY budget DESC) as quartile FROM campaigns; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (ShipmentID INT, DeliveryAddress VARCHAR(255), ShipmentType VARCHAR(50), ShipmentDuration INT); INSERT INTO Shipments (ShipmentID, DeliveryAddress, ShipmentType, ShipmentDuration) VALUES (1, '123 Main St', 'Air', 48), (2, '456 Elm St', 'Ground', 72), (3, '789 Oak St', 'Air', 60), (4, '321 Pine St... | Update the delivery address for all shipments with a shipment ID between 10 and 20 to a new address. | UPDATE Shipments SET DeliveryAddress = 'New Address' WHERE ShipmentID BETWEEN 10 AND 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE Routes (id INT, name VARCHAR(255), vehicle_id INT); CREATE TABLE Vehicles (id INT, model VARCHAR(255), accessibility VARCHAR(50)); | List all the routes and their associated vehicles that have 'accessible' as a feature. | SELECT Routes.name, Vehicles.model FROM Routes JOIN Vehicles ON Routes.vehicle_id = Vehicles.id WHERE accessibility = 'accessible'; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_exchanges (exchange_name TEXT, transaction_volume INTEGER, transaction_date DATE); | What is the maximum and minimum transaction volume for each decentralized exchange in the past week? | SELECT exchange_name, MAX(transaction_volume) AS max_volume, MIN(transaction_volume) AS min_volume FROM decentralized_exchanges WHERE transaction_date >= DATEADD(week, -1, GETDATE()) GROUP BY exchange_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnvironmentalImpact (ImpactID INT, Department VARCHAR(20), ImpactQuantity INT, ImpactDate DATE);CREATE VIEW DepartmentImpact AS SELECT Department, SUM(ImpactQuantity) as TotalImpact FROM EnvironmentalImpact GROUP BY Department; | What are the departments with an environmental impact above the threshold of 150,000? | SELECT Department FROM DepartmentImpact WHERE TotalImpact >= 150000; | gretelai_synthetic_text_to_sql |
CREATE TABLE gulf_of_guinea_forecasts (forecast_id INT, well_id INT, start_year INT, end_year INT, production_forecast FLOAT); INSERT INTO gulf_of_guinea_forecasts (forecast_id, well_id, start_year, end_year, production_forecast) VALUES (21, 17, 2022, 2022, 900.0), (22, 17, 2023, 2023, 950.0), (23, 18, 2022, 2022, 1000... | Get the well ID, start year, and average production forecast for wells in the Gulf of Guinea, ordered by the forecast start year. | SELECT well_id, start_year, AVG(production_forecast) OVER (PARTITION BY well_id ORDER BY start_year ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as avg_forecast FROM gulf_of_guinea_forecasts WHERE wells.location = 'Gulf of Guinea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE StrainPriceHistory (StrainName VARCHAR(255), Price DECIMAL(10,2), EffectiveDate DATE, Location VARCHAR(255)); | Update the price of 'Blue Dream' to $1200 per pound in the strain price history table. | UPDATE StrainPriceHistory SET Price = 1200 WHERE StrainName = 'Blue Dream' AND EffectiveDate = CURDATE() AND Location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (id INT, name TEXT);CREATE TABLE songs (id INT, title TEXT, genre_id INT); INSERT INTO genres (id, name) VALUES (1, 'Rock'), (2, 'Pop'), (3, 'Jazz'); INSERT INTO songs (id, title, genre_id) VALUES (1, 'Song 1', 1), (2, 'Song 2', 2), (3, 'Song 3', 3), (4, 'Song 4', 1); | Identify the number of unique genres in the platform's catalog. | SELECT COUNT(DISTINCT genres.name) FROM genres JOIN songs ON genres.id = songs.genre_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, gender VARCHAR(10), age INT, join_date DATE); INSERT INTO members (member_id, gender, age, join_date) VALUES (1, 'Female', 26, '2021-01-15'), (2, 'Male', 45, '2020-07-28'); | What is the average heart rate of female members aged 25-34 who joined in 2021? | SELECT AVG(heart_rate) FROM workout_data JOIN members ON workout_data.member_id = members.member_id WHERE members.gender = 'Female' AND members.age BETWEEN 25 AND 34 AND members.join_date >= '2021-01-01' AND members.join_date < '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, category VARCHAR(20), price DECIMAL(5,2)); INSERT INTO products (product_id, category, price) VALUES (1, 'electronics', 150.00), (2, 'electronics', 200.00), (3, 'electronics', 125.00); | What is the minimum price of a product in the 'electronics' category? | SELECT MIN(price) FROM products WHERE category = 'electronics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtPieces (ArtPieceID INT, Name TEXT, Artist TEXT, YearAdded INT); INSERT INTO ArtPieces (ArtPieceID, Name, Artist, YearAdded) VALUES (1, 'Starry Night', 'Vincent van Gogh', 1889); INSERT INTO ArtPieces (ArtPieceID, Name, Artist, YearAdded) VALUES (2, 'The Persistence of Memory', 'Salvador Dalí', 1931); IN... | How can I update the artist name for a specific art piece in the museum collection? | UPDATE ArtPieces SET Artist = 'New Artist Name' WHERE ArtPieceID = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, state VARCHAR(20), carbon_offset FLOAT); INSERT INTO green_buildings (id, state, carbon_offset) VALUES (1, 'Texas', 123.4), (2, 'California', 234.5), (3, 'Texas', 345.6), (4, 'New_York', 456.7); CREATE TABLE green_building_types (id INT, green_building_id INT, type VARCHAR(20)); IN... | What is the total carbon offset for green buildings in 'Texas'? | SELECT SUM(gb.carbon_offset) FROM green_buildings gb JOIN green_building_types gbt ON gb.id = gbt.green_building_id WHERE gb.state = 'Texas' AND gbt.type = 'Residential'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, Name VARCHAR(50), TotalDonation DECIMAL(10,2)); INSERT INTO Donors (DonorID, Name, TotalDonation) VALUES (1, 'John Doe', 500.00), (2, 'Jane Smith', 350.00), (3, 'Mike Johnson', 200.00); | Insert a new record for a donation of $250.00 from a donor named 'David Lee' and give him a DonorID of 6. | INSERT INTO Donors (DonorID, Name, TotalDonation) VALUES (6, 'David Lee', 250.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE company_profiles (company_id INT, founding_year INT, num_employees INT); INSERT INTO company_profiles (company_id, founding_year, num_employees) VALUES (1, 2010, 15), (2, 2011, 10), (3, 2010, 12), (4, 2011, 20), (5, 2009, 25); | What is the average number of employees for companies founded in 2011? | SELECT AVG(num_employees) FROM company_profiles WHERE founding_year = 2011; | gretelai_synthetic_text_to_sql |
CREATE TABLE harvest_data (id INT PRIMARY KEY, farm_id INT, yield FLOAT, date DATE); | Insert a new record into the "harvest_data" table with the following data: farm_id: 2, yield: 60, date: '2023-01-08' | INSERT INTO harvest_data (farm_id, yield, date) VALUES (2, 60, '2023-01-08'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (id INT PRIMARY KEY, state VARCHAR(2), parity_law TEXT, year INT); | Add a row to the 'mental_health_parity' table | INSERT INTO mental_health_parity (id, state, parity_law) VALUES (1, 'CA', 'California Mental Health Parity Act'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_ethics (region TEXT, project TEXT, budget INTEGER); INSERT INTO ai_ethics (region, project, budget) VALUES ('Americas', 'AI Ethics for Government', 250000); INSERT INTO ai_ethics (region, project, budget) VALUES ('Americas', 'AI Ethics for Business', 300000); | What is the total budget for AI projects in the 'americas' region in the 'ai_ethics' table? | SELECT SUM(budget) FROM ai_ethics WHERE region = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplies (id INT, supply_name VARCHAR(50), quantity INT, distribution_date DATE, country_code CHAR(2)); | How many disaster relief supplies were distributed in each country in 2018? | SELECT country_code, SUM(quantity) FROM supplies WHERE YEAR(distribution_date) = 2018 GROUP BY country_code; | gretelai_synthetic_text_to_sql |
CREATE TABLE individuals (individual_id INT, name VARCHAR(50), region VARCHAR(50), limited_internet_access BOOLEAN); INSERT INTO individuals (individual_id, name, region, limited_internet_access) VALUES (1, 'David', 'Rural America', TRUE), (2, 'Evelyn', 'Urban Africa', FALSE), (3, 'Frank', 'Rural Asia', TRUE); | How many individuals in each region have limited access to the internet due to infrastructure challenges? | SELECT region, COUNT(*), SUM(limited_internet_access) FROM individuals GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_income_data (city VARCHAR(255), income FLOAT); INSERT INTO city_income_data (city, income) VALUES ('Seattle', 85000), ('Portland', 70000); | What is the average income in 'Seattle'? | SELECT AVG(income) FROM city_income_data WHERE city = 'Seattle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name VARCHAR(50), revenue INT); INSERT INTO products (product_id, name, revenue) VALUES (1, 'Lipstick A', 200), (2, 'Lipstick B', 300), (3, 'Eyeshadow C', 150); CREATE TABLE ingredient_suppliers (ingredient_id INT, supplier_country VARCHAR(50), product_id INT); INSERT INTO ingredi... | What is the total revenue for ingredients sourced from US-based suppliers? | SELECT SUM(products.revenue) FROM products INNER JOIN ingredient_suppliers ON products.product_id = ingredient_suppliers.product_id WHERE ingredient_suppliers.supplier_country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (item_id INT, dish_type VARCHAR(10), price DECIMAL(5,2), region VARCHAR(20)); INSERT INTO menu (item_id, dish_type, price, region) VALUES (1, 'vegan', 12.99, 'San Francisco'), (2, 'vegetarian', 9.99, 'Los Angeles'); | What is the average price of vegan dishes in the San Francisco region? | SELECT AVG(price) FROM menu WHERE dish_type = 'vegan' AND region = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE soccer_teams (team_id INT, team_name VARCHAR(100), num_games INT); | What are the names of all the teams in the 'soccer_teams' table that have played more than 20 games? | SELECT team_name FROM soccer_teams WHERE num_games > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_clinics (id INT, name VARCHAR(50), location VARCHAR(50), num_workers INT, avg_age INT); | What is the average age of healthcare workers in the "rural_clinics" table? | SELECT AVG(avg_age) FROM rural_clinics; | 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.