context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE oil_production (id INT, location VARCHAR(20), production_date DATE, oil_production INT); | Show the total oil production in the Caspian Sea for each year from 2010 to 2020. | SELECT production_date, SUM(oil_production) FROM oil_production WHERE location LIKE 'Caspian Sea%' AND production_date BETWEEN '2010-01-01' AND '2020-12-31' GROUP BY production_date ORDER BY production_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_sustainability (id INT PRIMARY KEY, menu_item VARCHAR(255), sustainability_rating DECIMAL(3,2)); | Get the top 3 menu items with the highest sustainability rating | SELECT menu_item, sustainability_rating FROM menu_sustainability ORDER BY sustainability_rating DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, name VARCHAR(20), start_date DATE, end_date DATE); INSERT INTO Exhibitions VALUES (1, 'Exhibition A', '2022-01-01', '2022-03-31'), (2, 'Exhibition B', '2022-02-01', '2022-04-30'), (3, 'Exhibition C', '2022-03-01', '2022-05-31'); | What is the earliest and latest date that each exhibition was open to the public? | SELECT Exhibitions.name, MIN(Exhibitions.start_date) AS earliest_date, MAX(Exhibitions.end_date) AS latest_date FROM Exhibitions GROUP BY Exhibitions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_facilities (facility_name VARCHAR(50), state VARCHAR(50), offers_telehealth BOOLEAN); INSERT INTO healthcare_facilities (facility_name, state, offers_telehealth) VALUES ('Clinic A', 'California', TRUE), ('Clinic B', 'California', FALSE), ('Hospital C', 'Texas', TRUE), ('Hospital D', 'Texas', TRU... | Determine the number of healthcare facilities in each state, offering telehealth services. | SELECT state, COUNT(*) as facility_count FROM healthcare_facilities WHERE offers_telehealth = TRUE GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE crime_incidents (id INT, borough VARCHAR(20), type VARCHAR(20)); INSERT INTO crime_incidents (id, borough, type) VALUES (1, 'Brooklyn', 'theft'), (2, 'Queens', 'burglary'); CREATE TABLE emergency_calls (id INT, borough VARCHAR(20), type VARCHAR(20)); INSERT INTO emergency_calls (id, borough, type) VALUES (... | What is the total number of crime incidents, emergency calls, and fire incidents in each borough of NYC? | SELECT borough, 'crime incidents' AS type, COUNT(*) FROM crime_incidents GROUP BY borough UNION ALL SELECT borough, 'emergency calls' AS type, COUNT(*) FROM emergency_calls GROUP BY borough UNION ALL SELECT borough, 'fire incidents' AS type, COUNT(*) FROM fire_incidents GROUP BY borough; | gretelai_synthetic_text_to_sql |
CREATE TABLE district (did INT, name VARCHAR(255)); INSERT INTO district VALUES (1, 'Downtown'), (2, 'Uptown'); CREATE TABLE calls (call_id INT, district_id INT, response_time INT, year INT); | List the total number of crimes and response time for each district in 2021. | SELECT d.name, COUNT(c.call_id), AVG(c.response_time) FROM district d JOIN calls c ON d.did = c.district_id WHERE c.year = 2021 GROUP BY d.did; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback (Year INT, Service VARCHAR(255), Region VARCHAR(255), Score DECIMAL(3,2)); INSERT INTO Feedback (Year, Service, Region, Score) VALUES (2021, 'Healthcare', 'North', 8.50), (2021, 'Education', 'North', 8.75), (2021, 'Transportation', 'North', 8.25), (2021, 'Utilities', 'North', 8.90); | What is the average citizen feedback score for all services in the North region in 2021? | SELECT AVG(Score) FROM Feedback WHERE Year = 2021 AND Region = 'North'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (company_id INT, diversity_training BOOLEAN, diversity_training_start_date DATE); | List all companies that have implemented 'workforce diversity training' programs and the start dates of these programs. | SELECT companies.company_id, companies.diversity_training_start_date FROM companies WHERE companies.diversity_training = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), Ethnicity VARCHAR(20));CREATE VIEW DepartmentDiversity AS SELECT Department, COUNT(DISTINCT Ethnicity) as DiversityCount FROM Employees GROUP BY Department; | Which departments have the most diverse workforces? | SELECT Department FROM DepartmentDiversity WHERE ROW_NUMBER() OVER(ORDER BY DiversityCount DESC) <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinic_services (clinic_id INT, region VARCHAR(10), offers_telemedicine BOOLEAN); INSERT INTO clinic_services (clinic_id, region, offers_telemedicine) VALUES (1, 'South America', TRUE), (2, 'North America', FALSE), (3, 'South America', TRUE), (4, 'Oceania', FALSE); | How many rural clinics offer telemedicine services in South America? | SELECT COUNT(*) FROM clinic_services WHERE region = 'South America' AND offers_telemedicine = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (FarmerID int, FarmerName text, Location text); INSERT INTO Farmers (FarmerID, FarmerName, Location) VALUES (1, 'Michael Jordan', 'Colorado'); CREATE TABLE Production (Product text, FarmerID int, Quantity int); INSERT INTO Production (Product, FarmerID, Quantity) VALUES ('Potatoes', 1, 1000); INSER... | What is the maximum production of 'Potatoes' by any farmer in 'Colorado' or 'Arizona'? | SELECT MAX(Quantity) FROM Production JOIN Farmers ON Production.FarmerID = Farmers.FarmerID WHERE Product = 'Potatoes' AND (Location = 'Colorado' OR Location = 'Arizona'); | 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', 800.00), (3, 'Alice Johnson', 1500.00), (4, 'Bob Brown', 1000.00), (5, 'Charlie Davis', 2000.00); | List the names and donation amounts of the top 5 donors in 2022. | SELECT Name, TotalDonation FROM Donors WHERE YEAR(DonationDate) = 2022 ORDER BY TotalDonation DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_categories (program_category VARCHAR(20), budget INT);INSERT INTO program_categories VALUES ('Arts', 0), ('Education', 5000), ('Health', 10000), ('Science', 2000); | What are the unique program categories and their corresponding budgets, excluding categories with a budget of zero? | SELECT program_category, budget FROM program_categories WHERE budget > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE contributor (name VARCHAR(255), country VARCHAR(255), algorithms INTEGER); INSERT INTO contributor (name, country, algorithms) VALUES ('Google', 'USA', 20), ('IBM', 'USA', 15), ('Microsoft', 'USA', 12), ('OpenAI', 'USA', 8), ('DeepMind', 'UK', 7); | Who are the top 3 contributors to explainable AI algorithms? | SELECT name, algorithms FROM contributor ORDER BY algorithms DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(50), diversity_score DECIMAL(3,2)); CREATE TABLE diversity_data (id INT, company_id INT, gender_diversity DECIMAL(3,2), racial_diversity DECIMAL(3,2)); | List all companies and their diversity metrics | SELECT companies.name, companies.diversity_score, diversity_data.gender_diversity, diversity_data.racial_diversity FROM companies INNER JOIN diversity_data ON companies.id = diversity_data.company_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductionCosts (productID INT, materialType VARCHAR(20), cost DECIMAL(5,2)); INSERT INTO ProductionCosts (productID, materialType, cost) VALUES (1, 'Organic Cotton', 15.50), (2, 'Polyester', 8.25), (3, 'Hemp', 20.00), (4, 'Bamboo', 18.00), (5, 'Recycled Polyester', 12.00); | What is the total production cost of garments made from sustainable materials? | SELECT SUM(cost) FROM ProductionCosts WHERE materialType IN ('Organic Cotton', 'Hemp', 'Bamboo', 'Recycled Polyester'); | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPersonnel (region VARCHAR(255), country VARCHAR(255), personnel INT); INSERT INTO MilitaryPersonnel (region, country, personnel) VALUES ('Africa', 'CountryA', 4000), ('Africa', 'CountryB', 6000), ('Africa', 'CountryC', 5000), ('Asia', 'CountryD', 3000), ('Asia', 'CountryE', 2000); | What is the total number of military personnel in the African region, excluding personnel from countries with less than 5000 personnel? | SELECT region, COUNT(*) FROM MilitaryPersonnel WHERE region = 'Africa' GROUP BY region HAVING SUM(personnel) > 5000; | gretelai_synthetic_text_to_sql |
CREATE VIEW properties AS SELECT * FROM property; | Insert a new row with inclusive housing data into the properties view | INSERT INTO properties (id, inclusive_housing, price) VALUES (789, TRUE, 450000.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (mine_id INT, year INT, co2_emissions INT, water_consumption INT, waste_generation INT); | Insert new environmental impact stats for the 'Amethyst Ascent' mine in Amazonas, Brazil | INSERT INTO environmental_impact (mine_id, year, co2_emissions, water_consumption, waste_generation) VALUES (8, 2021, 10000, 400000, 9000); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, company_name VARCHAR(100), contract_value DECIMAL(10, 2), contract_date DATE); | Find the number of defense contracts awarded to each company in table 'defense_contracts' | SELECT company_name, COUNT(*) as num_contracts FROM defense_contracts GROUP BY company_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (id INT, name VARCHAR(50), age INT, platform VARCHAR(50), favorite_game_id INT, num_reviews INT); INSERT INTO Players (id, name, age, platform, favorite_game_id, num_reviews) VALUES (1, 'Player1', 25, 'PC', 1, 50), (2, 'Player2', 30, 'Console', NULL, 0), (3, 'Player3', 35, 'Mobile', 3, 10); | Delete all records of players who have never reviewed a game. | DELETE FROM Players WHERE num_reviews = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, branch VARCHAR(10), maintenance_requested BOOLEAN, maintenance_fulfilled BOOLEAN, maintenance_request_date DATE, maintenance_fulfillment_date DATE); | Calculate the average time to fulfill military equipment maintenance requests for the Army | SELECT AVG(maintenance_fulfillment_date - maintenance_request_date) FROM military_equipment WHERE branch = 'Army' AND maintenance_requested = TRUE AND maintenance_fulfilled = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Staff (staff_id INT, staff_name TEXT); CREATE TABLE Staff_Accommodations (staff_id INT, student_id INT); CREATE VIEW Staff_Accommodations_Count AS SELECT staff_id, COUNT(*) FROM Staff_Accommodations GROUP BY staff_id; CREATE VIEW Max_Staff_Accommodations AS SELECT staff_id, COUNT(*) FROM Staff_Accommodatio... | Which disability services staff members have served the most students with disabilities? | SELECT Staff.staff_name, Max_Staff_Accommodations.COUNT(*) FROM Staff INNER JOIN Max_Staff_Accommodations ON Staff.staff_id = Max_Staff_Accommodations.staff_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_accommodations (student_id INT, accommodation_year INT, accommodation_type VARCHAR(255)); | Find the number of unique students who received accommodations in 2021 and 2022 | SELECT accommodation_year, COUNT(DISTINCT student_id) FROM student_accommodations WHERE accommodation_year IN (2021, 2022) GROUP BY accommodation_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE trip_data (trip_id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, mode_1 VARCHAR(10), mode_2 VARCHAR(10)); | Calculate the percentage of multi-modal trips using trains and buses. | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM trip_data)) AS percentage FROM trip_data WHERE mode_1 = 'Train' AND mode_2 = 'Bus'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargos (cargo_id INT, cargo_name VARCHAR(50), vessel_name VARCHAR(50)); INSERT INTO cargos (cargo_id, cargo_name, vessel_name) VALUES (1, 'Container 1', 'Sea Titan'), (2, 'Coal', 'Marine Express'), (3, 'Grain', 'Ocean Breeze'); | How many cargos were transported by the vessel 'Sea Titan'? | SELECT COUNT(*) FROM cargos WHERE vessel_name = 'Sea Titan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonationDate date, DonationAmount numeric, DonorCommunity varchar(50)); | What was the average donation amount by donors from underrepresented communities in Q4 2020? | SELECT AVG(DonationAmount) FROM (SELECT DonationAmount FROM Donors WHERE DonationDate BETWEEN '2020-10-01' AND '2020-12-31' AND DonorCommunity IN ('Historically Black Colleges and Universities', 'Indigenous Communities', 'LGBTQ+ Organizations')) AS UnderrepresentedDonors; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites_by_country (country VARCHAR(255), num_satellites INT); INSERT INTO satellites_by_country (country, num_satellites) VALUES ('USA', 1796); INSERT INTO satellites_by_country (country, num_satellites) VALUES ('Russia', 1447); INSERT INTO satellites_by_country (country, num_satellites) VALUES ('China... | Who are the top 3 countries with the most satellites in orbit? | SELECT country, num_satellites FROM satellites_by_country ORDER BY num_satellites DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (company_id INT, company_name TEXT, PRIMARY KEY (company_id)); CREATE TABLE employee (employee_id INT, company_id INT, employee_count INT, PRIMARY KEY (employee_id), FOREIGN KEY (company_id) REFERENCES company(company_id)); CREATE TABLE sale (sale_id INT, company_id INT, year INT, revenue INT, PRIM... | Display the total revenue generated from timber sales for each company, along with the number of employees for those companies, in a given year. | SELECT c.company_name, s.year, SUM(s.revenue) AS total_revenue, COUNT(e.employee_count) AS total_employees FROM company c INNER JOIN sale s ON c.company_id = s.company_id INNER JOIN employee e ON c.company_id = e.company_id GROUP BY c.company_name, s.year ORDER BY s.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_ratings (hotel_id INT, country VARCHAR(50), rating FLOAT); INSERT INTO hotel_ratings (hotel_id, country, rating) VALUES (1, 'Japan', 4.2), (2, 'Japan', 4.6), (3, 'Japan', 4.5), (4, 'Italy', 4.7); CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, rating FLOAT); INSERT INTO virtual_tours (tour_id,... | What is the minimum virtual tour rating for hotels in Japan? | SELECT MIN(vt.rating) FROM hotel_ratings hr JOIN virtual_tours vt ON hr.hotel_id = vt.hotel_id WHERE hr.country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_handling (handling_id INT, port_id INT, handling_time INT); | What is the average cargo handling time per port, including ports with no handling time? | SELECT p.port_name, AVG(ch.handling_time) as avg_handling_time FROM ports p LEFT JOIN cargo_handling ch ON p.port_id = ch.port_id GROUP BY p.port_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teachers (TeacherID INT PRIMARY KEY, Coach BOOLEAN, Hours INT); INSERT INTO Teachers (TeacherID, Coach, Hours) VALUES (1, 1, 25); | What is the average number of hours of professional development completed by teachers who are also coaches? | SELECT AVG(Hours) FROM Teachers WHERE Coach = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (ComplaintID INT, State VARCHAR(255), FilingDate DATE, ResolutionDate DATE); INSERT INTO MentalHealthParity (ComplaintID, State, FilingDate, ResolutionDate) VALUES (1, 'California', '2021-01-05', '2021-02-10'), (2, 'Texas', '2021-03-12', '2021-04-15'), (3, 'New York', '2021-06-20', '2021... | What is the average mental health parity complaint resolution time by state? | SELECT State, AVG(DATEDIFF(ResolutionDate, FilingDate)) as AvgResolutionTimeDays FROM MentalHealthParity GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (investment_id INT, investment_name VARCHAR(255), investment_type VARCHAR(255), investment_amount DECIMAL(10,2), date DATE); | Delete a network investment from the 'network_investments' table | DELETE FROM network_investments WHERE investment_id = 4001; | gretelai_synthetic_text_to_sql |
CREATE TABLE north_sea_data (data_id INT, well_id INT, date_explored DATE, type VARCHAR(50), cost FLOAT); INSERT INTO north_sea_data (data_id, well_id, date_explored, type, cost) VALUES (1, 5, '2020-01-01', 'Seismic', 150000.0), (2, 5, '2020-02-01', 'Drilling', 500000.0), (3, 6, '2019-12-15', 'Seismic', 200000.0), (4, ... | Which wells in the North Sea have experienced the highest total exploration cost, ordered by the exploration date? | SELECT well_id, SUM(cost) OVER (PARTITION BY well_id ORDER BY date_explored DESC) as total_cost FROM north_sea_data WHERE location = 'North Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (category VARCHAR(255), revenue NUMERIC); INSERT INTO menu (category, revenue) VALUES ('Appetizers', 500), ('Entrees', 2000), ('Desserts', 1000); | What was the total revenue for each menu category last week? | SELECT category, SUM(revenue) FROM menu WHERE revenue >= (SELECT AVG(revenue) FROM menu) AND date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY) GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft_Development (id INT, name VARCHAR(100), manufacturer VARCHAR(100), launch_date DATE, status VARCHAR(20)); INSERT INTO Spacecraft_Development (id, name, manufacturer, launch_date, status) VALUES (3, 'Artemis 1', 'NASA', '2022-08-29', 'Development'); | What is the latest spacecraft launch for each manufacturer, still in development? | SELECT manufacturer, MAX(launch_date) as latest_launch FROM Spacecraft_Development WHERE status = 'Development' GROUP BY manufacturer | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (project_id INT, animals INT); INSERT INTO habitat_preservation (project_id, animals) VALUES (1, 50), (2, 75), (3, 100); | what is the maximum number of animals in a single habitat preservation project? | SELECT MAX(animals) FROM habitat_preservation; | gretelai_synthetic_text_to_sql |
CREATE TABLE founders (id INT, name TEXT, gender TEXT); INSERT INTO founders (id, name, gender) VALUES (1, 'Alice', 'Female'), (2, 'Bob', 'Male'); CREATE TABLE companies (id INT, name TEXT, sector TEXT); INSERT INTO companies (id, name, sector) VALUES (1, 'MedHealth', 'Healthcare'), (2, 'TechBoost', 'Technology'); CREA... | What is the total number of startups founded by women in the healthcare sector? | SELECT COUNT(*) FROM founders f JOIN founders_companies fc ON f.id = fc.founder_id JOIN companies c ON fc.company_id = c.id WHERE f.gender = 'Female' AND c.sector = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProjectTimeline (ProjectID INT, ProjectName VARCHAR(50), LaunchDate DATE); INSERT INTO ProjectTimeline (ProjectID, ProjectName, LaunchDate) VALUES (1, 'Ethical AI 1.0', '2018-01-01'); INSERT INTO ProjectTimeline (ProjectID, ProjectName, LaunchDate) VALUES (2, 'Ethical AI 2.0', '2020-01-01'); | List the names and launch dates of all projects focused on ethical AI that were launched in 2020 or later. | SELECT ProjectName, LaunchDate FROM ProjectTimeline WHERE ProjectName LIKE '%Ethical AI%' AND YEAR(LaunchDate) >= 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_funds (id INT, investment DECIMAL(10,2), location VARCHAR(50)); INSERT INTO ethical_funds (id, investment, location) VALUES (1, 8000, 'Australia'), (2, 5000, 'New Zealand'), (3, 9000, 'Australia'); | What is the total investment in ethical funds in Oceania, excluding New Zealand? | SELECT SUM(investment) FROM ethical_funds WHERE location <> 'New Zealand' AND location = 'Oceania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_aid (id INT PRIMARY KEY, organization_id INT, food_aid_amount INT); INSERT INTO food_aid (id, organization_id, food_aid_amount) VALUES (1, 1, 100000); INSERT INTO food_aid (id, organization_id, food_aid_amount) VALUES (2, 2, 200000); INSERT INTO food_aid (id, organization_id, food_aid_amount) VALUES (... | What is the total number of food_aid_amount records for organization_id 3 in the food_aid table? | SELECT SUM(food_aid_amount) FROM food_aid WHERE organization_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE heart_rate_data (id INT, user_id INT, heart_rate FLOAT, record_date DATE); INSERT INTO heart_rate_data (id, user_id, heart_rate, record_date) VALUES (1, 5, 85.6, '2022-12-02'), (2, 6, 91.2, '2023-01-15'), (3, 7, 89.8, '2022-12-18'), (4, 8, 76.4, '2022-11-11'); | What's the highest heart rate recorded for a user in December 2022? | SELECT MAX(heart_rate) FROM heart_rate_data WHERE record_date BETWEEN '2022-12-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, mental_health_score INT); | Insert records into student mental health table | INSERT INTO student_mental_health (student_id, mental_health_score) VALUES (1, 80), (2, 85), (3, 70); | gretelai_synthetic_text_to_sql |
CREATE TABLE VR_Sessions (session_id INT, user_id INT, session_duration FLOAT); INSERT INTO VR_Sessions (session_id, user_id, session_duration) VALUES (101, 1, 1.5), (102, 1, 2.0), (103, 2, 0.5), (104, 3, 3.0), (105, 4, 1.0), (106, 5, 4.5); INSERT INTO VR_Users (user_id, total_sessions INT) VALUES (1, 2), (2, 1), (3, 1... | What is the average number of hours played per day for users in the 'VR_Users' table who have played for at least one hour in a single session? | SELECT AVG(session_duration / total_sessions) as avg_hours_per_day FROM VR_Sessions JOIN VR_Users ON VR_Sessions.user_id = VR_Users.user_id WHERE session_duration >= 1.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50), last_login DATETIME); | Delete records in the 'users' table where 'last_login' is before '2020-01-01' | DELETE FROM users WHERE last_login < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_funding (program VARCHAR(255), year INT, funding_amount FLOAT); | Which climate mitigation programs received the most funding in 2020, and what was the average funding amount per program? | SELECT program, AVG(funding_amount) AS avg_funding FROM climate_funding WHERE year = 2020 GROUP BY program ORDER BY avg_funding DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_id INT, state_name VARCHAR(50), parity_score DECIMAL(3,2)); INSERT INTO states (state_id, state_name, parity_score) VALUES (1, 'California', 85.2), (2, 'New York', 82.7), (3, 'Texas', 78.3), (4, 'Florida', 76.8), (5, 'Illinois', 74.5); | List the top 3 states with the highest mental health parity scores. | SELECT state_name, parity_score FROM states ORDER BY parity_score DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE individuals (individual_id INT, region VARCHAR(50), financial_capability_score DECIMAL(5, 2)); INSERT INTO individuals (individual_id, region, financial_capability_score) VALUES (1, 'North', 75.50), (2, 'South', 80.25), (3, 'East', 68.75), (4, 'West', 90.00), (5, 'North', 72.25), (6, 'South', 85.00), (7, '... | Calculate the percentage of financially capable individuals in each region and display the region and percentage. | SELECT region, AVG(financial_capability_score) AS avg_score, AVG(financial_capability_score) OVER (PARTITION BY region) * 100.0 AS percentage FROM individuals; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, initiative_name VARCHAR(255), budget INT); | Update the initiative_name for the record with an id of 3 in the 'community_development' table to 'microfinance_program'. | UPDATE community_development SET initiative_name = 'microfinance_program' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE LandfillCapacity (ID INT PRIMARY KEY, Landfill VARCHAR(50), City VARCHAR(50), Year INT, Capacity INT); INSERT INTO LandfillCapacity (ID, Landfill, City, Year, Capacity) VALUES (1, 'North Disposal Site', 'Los Angeles', 2017, 1000000), (2, 'South Disposal Site', 'Los Angeles', 2017, 1500000); | What was the capacity of all landfills in the city of Los Angeles in the year 2017? | SELECT Landfill, Capacity FROM LandfillCapacity WHERE City = 'Los Angeles' AND Year = 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name TEXT); INSERT INTO customers (customer_id, name) VALUES (1, 'John Doe'); INSERT INTO customers (customer_id, name) VALUES (2, 'Jane Smith'); | Insert a new customer 'Alex Thompson' with customer ID 3. | INSERT INTO customers (customer_id, name) VALUES (3, 'Alex Thompson'); | gretelai_synthetic_text_to_sql |
CREATE TABLE FairTradeCertified (id INT, country VARCHAR, certified BOOLEAN); | What is the percentage of fair trade certified factories in each country? | SELECT country, 100.0 * AVG(CAST(certified AS FLOAT)) as percentage_certified FROM FairTradeCertified GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, drug_id INT, region VARCHAR(255), sales_amount DECIMAL(10, 2), quarter INT, year INT); | What was the total sales for each drug in 2021? | SELECT d.drug_name, SUM(s.sales_amount) as total_sales FROM sales s JOIN drugs d ON s.drug_id = d.drug_id WHERE s.year = 2021 GROUP BY d.drug_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers(id INT, technology VARCHAR(20), type VARCHAR(10), joined DATE); INSERT INTO subscribers(id, technology, type, joined) VALUES (1, '4G', 'mobile', '2021-01-01'), (2, '5G', 'mobile', '2022-01-01'), (3, 'ADSL', 'broadband', '2022-02-01'), (4, 'FTTH', 'broadband', '2022-03-01'); | List mobile subscribers who joined after the latest broadband subscribers. | SELECT * FROM subscribers WHERE technology = 'mobile' AND joined > (SELECT MAX(joined) FROM subscribers WHERE type = 'broadband'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessel_Specs (ID INT, Vessel_Name VARCHAR(50), Classification_Society VARCHAR(10), Max_Speed DECIMAL(5,2)); INSERT INTO Vessel_Specs (ID, Vessel_Name, Classification_Society, Max_Speed) VALUES (1, 'Vessel1', 'ABS', 25.6); INSERT INTO Vessel_Specs (ID, Vessel_Name, Classification_Society, Max_Speed) VALUES ... | What is the maximum speed of vessels that have a classification society of 'ABS'? | SELECT MAX(Max_Speed) FROM Vessel_Specs WHERE Classification_Society = 'ABS'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation_projects (id INT, project_name VARCHAR(255), location VARCHAR(255), sector VARCHAR(255), cost FLOAT); INSERT INTO agricultural_innovation_projects (id, project_name, location, sector, cost) VALUES (1, 'Precision Agriculture', 'Country 1', 'Agriculture', 35000.00), (2, 'Drip Irrigati... | Calculate the average cost of agricultural innovation projects per country and rank them in ascending order. | SELECT location, AVG(cost) AS avg_cost, RANK() OVER (ORDER BY AVG(cost)) AS location_rank FROM agricultural_innovation_projects GROUP BY location ORDER BY avg_cost ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE causes (id INT, name VARCHAR(255)); INSERT INTO causes (id, name) VALUES (1, 'Climate Change'), (2, 'Human Rights'), (3, 'Poverty Reduction'); CREATE TABLE donors (id INT, name VARCHAR(255)); INSERT INTO donors (id, name) VALUES (1, 'Laura Gonzalez'), (2, 'Jose Luis Rodriguez'), (3, 'Maria Garcia'), (4, 'C... | Display the number of unique donors and total donation amounts for each cause, joining the donors, donations, and causes tables. | SELECT c.name, COUNT(DISTINCT d.donor_id) as donor_count, SUM(donations.amount) as total_donation FROM causes c JOIN donations ON c.id = donations.cause_id JOIN donors ON donations.donor_id = donors.id GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_aid_organizations (org_id INT, org_name TEXT, city TEXT, cases_handled INT); INSERT INTO legal_aid_organizations VALUES (1, 'LegalAid1', 'San Francisco', 250), (2, 'LegalAid2', 'Dallas', 300), (3, 'LegalAid3', 'New York', 200); | What is the number of cases handled by legal aid organizations in each city? | SELECT city, SUM(cases_handled) FROM legal_aid_organizations GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE inclusive_housing (id INT, state VARCHAR, policy_count INT); INSERT INTO inclusive_housing (id, state, policy_count) VALUES (1, 'California', 50), (2, 'New York', 40), (3, 'Texas', 30), (4, 'Florida', 20); | What is the total number of inclusive housing policies in the state of California? | SELECT SUM(policy_count) FROM inclusive_housing WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, city VARCHAR(20), exhibition_date DATE, visitor_count INT); | How many visitors attended exhibitions in each city in the last month? | SELECT city, SUM(visitor_count) FROM Exhibitions WHERE exhibition_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mining_Operations(Mine_Name TEXT, Production_Tonnes INT, Location TEXT); INSERT INTO Mining_Operations(Mine_Name, Production_Tonnes, Location) VALUES('Katanga', 500000, 'DRC'); | What is the production tonnage for the 'Katanga' mine? | SELECT Production_Tonnes FROM Mining_Operations WHERE Mine_Name = 'Katanga'; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (region_id INT, region_name VARCHAR(255)); INSERT INTO regions (region_id, region_name) VALUES (1, 'Northeast'), (2, 'Southeast'), (3, 'Midwest'), (4, 'Southwest'), (5, 'West'); CREATE TABLE products (product_id INT, product_name VARCHAR(255), is_vegan BOOLEAN, quantity_sold INT, region_id INT); | What is the total quantity of vegan eyeshadows sold by region? | SELECT r.region_name, SUM(p.quantity_sold) as total_quantity_sold FROM regions r INNER JOIN products p ON r.region_id = p.region_id WHERE p.is_vegan = TRUE GROUP BY r.region_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts (astronaut_id INT, name TEXT, age INT, medical_condition TEXT); INSERT INTO astronauts (astronaut_id, name, age, medical_condition) VALUES (1, 'Alexei Leonov', 85, 'Asthma'), (2, 'Buzz Aldrin', 92, NULL), (3, 'Neil Armstrong', 82, NULL), (4, 'Valentina Tereshkova', 83, 'Claustrophobia'); CREATE ... | List all astronauts who have a medical condition and the missions they have participated in. | SELECT a.name AS astronaut_name, s.name AS mission_name FROM astronauts a JOIN astronaut_missions am ON a.astronaut_id = am.astronaut_id JOIN space_missions s ON am.mission_id = s.mission_id WHERE a.medical_condition IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE north_america_community_events (id INT, event_name TEXT, year INT, num_attendees INT); INSERT INTO north_america_community_events (id, event_name, year, num_attendees) VALUES (1, 'Dance festival', 2010, 500), (2, 'Art exhibition', 2011, 400), (3, 'Music festival', 2012, 300), (4, 'Language preservation wor... | Determine the number of community engagement events held in North America from 2010 to 2020, and calculate the percentage change in the number of events from 2010 to 2020. | SELECT (COUNT(*) - (SELECT COUNT(*) FROM north_america_community_events WHERE year = 2010)) * 100.0 / (SELECT COUNT(*) FROM north_america_community_events WHERE year = 2010) as pct_change FROM north_america_community_events WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name VARCHAR(50), age INT); CREATE TABLE transactions (id INT, customer_id INT, transaction_amount DECIMAL(10, 2), transaction_date DATE); INSERT INTO transactions (id, customer_id, transaction_amount, transaction_date) VALUES (1, 1, 12000.00, '2022-01-01'), (2, 1, 8000.00, '2022-02-01')... | Find the number of customers who have made a transaction over 10000 in the last 3 months for each month. | SELECT EXTRACT(MONTH FROM transaction_date) as month, COUNT(DISTINCT customer_id) as num_customers FROM transactions WHERE transaction_amount > 10000 AND transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_records (equipment_id INT, maintenance_date DATE); | Find mining equipment that is older than 15 years and has a maintenance record | SELECT * FROM Mining_Equipment WHERE purchase_date < DATE_SUB(CURRENT_DATE, INTERVAL 15 YEAR) AND equipment_id IN (SELECT equipment_id FROM maintenance_records); | gretelai_synthetic_text_to_sql |
CREATE TABLE Content (ContentID int, ContentType varchar(50), LanguageID int); INSERT INTO Content (ContentID, ContentType, LanguageID) VALUES (1, 'Movie', 1), (2, 'Podcast', 2), (3, 'Blog', 3); | Delete all content in the 'Blog' content type | DELETE FROM Content WHERE ContentType = 'Blog'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(50), ocean_name VARCHAR(50)); | Update the ocean_name for species_id 1 to 'Indian Ocean'. | UPDATE marine_species SET ocean_name = 'Indian Ocean' WHERE species_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleSales (Region VARCHAR(50), VehicleType VARCHAR(50), Sales INT); INSERT INTO VehicleSales (Region, VehicleType, Sales) VALUES ('North America', 'Electric', 50000), ('North America', 'Gasoline', 100000), ('Europe', 'Electric', 75000), ('Europe', 'Gasoline', 125000), ('Asia', 'Electric', 100000), ('Asi... | What is the percentage of electric vehicles sold in each region? | SELECT Region, (SUM(CASE WHEN VehicleType = 'Electric' THEN Sales ELSE 0 END) / SUM(Sales)) * 100 as Percentage FROM VehicleSales GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability_months (session_id INT, month INT, year INT); INSERT INTO financial_capability_months (session_id, month, year) VALUES (1, 1, 2022), (2, 2, 2022), (3, 3, 2022), (4, 4, 2022), (5, 5, 2022), (6, 6, 2022); | How many financial capability training sessions were held in each month of 2022? | SELECT CONCAT(month, '/', year) AS month_year, COUNT(*) FROM financial_capability_months GROUP BY month_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE vr_game_data (id INT, player_id INT, game VARCHAR(20), playtime_hours INT); INSERT INTO vr_game_data (id, player_id, game, playtime_hours) VALUES (1, 1, 'VR Game1', 2), (2, 2, 'VR Game2', 3), (3, 1, 'VR Game1', 4); | What is the average number of hours played per day for VR games? | SELECT AVG(playtime_hours / 24) FROM vr_game_data WHERE game LIKE 'VR%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (id INT PRIMARY KEY, source VARCHAR(255), capacity_mw FLOAT, country VARCHAR(255)); | Update the 'capacity_mw' value to 40 in the 'renewable_energy' table where the 'source' is 'Wind' | UPDATE renewable_energy SET capacity_mw = 40 WHERE source = 'Wind'; | gretelai_synthetic_text_to_sql |
CREATE TABLE av_types (av_id INT, av_type VARCHAR(50));CREATE TABLE av_prices (price_id INT, av_id INT, price DECIMAL(5, 2));INSERT INTO av_types (av_id, av_type) VALUES (1, 'Wayve'), (2, 'NVIDIA'), (3, 'Zoox');INSERT INTO av_prices (price_id, av_id, price) VALUES (1, 1, 300000), (2, 2, 400000), (3, 3, 500000); | List all autonomous vehicle (AV) types and their average prices | SELECT av.av_type, AVG(ap.price) as avg_price FROM av_types av JOIN av_prices ap ON av.av_id = ap.av_id GROUP BY av.av_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name VARCHAR(50), city VARCHAR(50)); CREATE TABLE bookings (booking_id INT, hotel_id INT, guest_name VARCHAR(50), checkin_date DATE, checkout_date DATE, price DECIMAL(10,2)); | Find the total number of hotels in each city and the number of bookings for those hotels | SELECT h.city, COUNT(DISTINCT h.hotel_id) AS hotel_count, SUM(b.booking_id) AS booking_count FROM hotels h LEFT JOIN bookings b ON h.hotel_id = b.hotel_id GROUP BY h.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name TEXT, longitude FLOAT, latitude FLOAT); INSERT INTO vessels VALUES (1, 'VesselA', -58.5034, -34.6037), (7, 'VesselG', -65.0178, -37.8140); | Which vessels are near the coast of Argentina? | SELECT DISTINCT name FROM vessels WHERE longitude BETWEEN -74.0356 AND -54.8258 AND latitude BETWEEN -55.0216 AND -33.4294; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (id INT PRIMARY KEY, mine_site_id INT, pollution_level INT, CO2_emission INT, FOREIGN KEY (mine_site_id) REFERENCES mine_sites(id)); CREATE TABLE minerals_extracted (id INT PRIMARY KEY, mine_site_id INT, mineral VARCHAR(255), quantity INT, extraction_year INT, FOREIGN KEY (mine_site_id... | Calculate the average CO2 emission for silver mines with more than 1200 units extracted in 2018. | SELECT AVG(e.CO2_emission) as avg_co2 FROM environmental_impact e JOIN minerals_extracted m ON e.mine_site_id = m.mine_site_id WHERE m.mineral = 'silver' AND m.quantity > 1200 AND m.extraction_year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (country VARCHAR(255), amount NUMERIC, quarter INT, year INT); INSERT INTO military_innovation (country, amount, quarter, year) VALUES ('USA', 1200000, 2, 2022), ('China', 900000, 2, 2022), ('Russia', 700000, 2, 2022); | What is the total spending on military innovation by different countries in Q2 2022? | SELECT country, SUM(amount) FROM military_innovation WHERE quarter = 2 AND year = 2022 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (id INT, organization VARCHAR(50), budget INT); | How many military innovation projects were initiated by each organization in the 'military_innovation' table, with a budget greater than $10 million? | SELECT organization, COUNT(*) as num_projects FROM military_innovation WHERE budget > 10000000 GROUP BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE TicketPrices (id INT, region VARCHAR(20), quarter INT, year INT, category VARCHAR(20), price FLOAT); INSERT INTO TicketPrices (id, region, quarter, year, category, price) VALUES (7, 'Americas', 2, 2021, 'Music', 150); INSERT INTO TicketPrices (id, region, quarter, year, category, price) VALUES (8, 'America... | What is the maximum ticket price for music concerts in the Americas in Q2 2021? | SELECT MAX(price) FROM TicketPrices WHERE region = 'Americas' AND quarter = 2 AND year = 2021 AND category = 'Music'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Bridges (name TEXT, cost FLOAT, location TEXT); | Which tunnels cost more than any bridge in California? | CREATE TABLE Tunnels (name TEXT, cost FLOAT, location TEXT); | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_name VARCHAR(30), reach INT, conversions INT); INSERT INTO campaigns (campaign_name, reach, conversions) VALUES ('Mental Health Awareness Campaign', 10000, 1500); INSERT INTO campaigns (campaign_name, reach, conversions) VALUES ('Suicide Prevention Campaign', 8000, 1200); INSERT INTO ca... | What is the success rate of the 'Suicide Prevention Campaign'? | SELECT (CONVERT(FLOAT, conversions) / reach) * 100.0 FROM campaigns WHERE campaign_name = 'Suicide Prevention Campaign'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT, project_name VARCHAR(50), completion_year INT, region VARCHAR(50)); INSERT INTO genetic_research (id, project_name, completion_year, region) VALUES (1, 'Genome Mapping', 2019, 'North America'); INSERT INTO genetic_research (id, project_name, completion_year, region) VALUES (2, 'DN... | How many genetic research projects were completed in Africa in 2018? | SELECT COUNT(*) FROM genetic_research WHERE completion_year = 2018 AND region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, launch_date DATE); INSERT INTO campaigns VALUES (1, '2018-05-12'), (2, '2019-02-28'), (3, '2020-11-15'), (4, '2021-07-08'); | How many mental health campaigns were launched per year, ordered by launch date? | SELECT COUNT(campaign_id) as campaigns_per_year, YEAR(launch_date) as launch_year FROM campaigns GROUP BY launch_year ORDER BY launch_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, region TEXT); CREATE TABLE conservation_status (id INT, species_id INT, status TEXT); INSERT INTO marine_species (id, name, region) VALUES (1, 'Mediterranean Monk Seal', 'Mediterranean Sea'); INSERT INTO conservation_status (id, species_id, status) VALUES (1, 1, 'Critical... | How many marine species are there in the Mediterranean Sea with a conservation status of 'Critically Endangered'? | SELECT COUNT(marine_species.id) FROM marine_species INNER JOIN conservation_status ON marine_species.id = conservation_status.species_id WHERE marine_species.region = 'Mediterranean Sea' AND conservation_status.status = 'Critically Endangered'; | gretelai_synthetic_text_to_sql |
CREATE TABLE isps (id INT, name VARCHAR(255));CREATE TABLE mobile_subscribers (id INT, isp_id INT, monthly_revenue DECIMAL(10,2));CREATE TABLE broadband_subscribers (id INT, isp_id INT, monthly_revenue DECIMAL(10,2)); | What is the total revenue generated from mobile and broadband subscribers for each ISP, and what is the percentage contribution of mobile and broadband revenue to the total revenue? | SELECT isp.name, SUM(mobile_subscribers.monthly_revenue) as mobile_revenue, SUM(broadband_subscribers.monthly_revenue) as broadband_revenue, (SUM(mobile_subscribers.monthly_revenue) + SUM(broadband_subscribers.monthly_revenue)) as total_revenue, (SUM(mobile_subscribers.monthly_revenue) / (SUM(mobile_subscribers.monthly... | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), location VARCHAR(255), sustainability_rating INT); INSERT INTO suppliers (id, name, location, sustainability_rating) VALUES (1, 'Supplier A', 'Paris', 86); | What are the suppliers located in 'Paris' with a sustainability rating greater than 85? | SELECT name FROM suppliers WHERE location = 'Paris' AND sustainability_rating > 85; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (element VARCHAR(10), country VARCHAR(20), quantity INT, year INT); INSERT INTO production (element, country, quantity, year) VALUES ('Europium', 'China', 1200, 2020), ('Europium', 'China', 1300, 2021), ('Europium', 'USA', 1100, 2020), ('Europium', 'USA', 1200, 2021); | What is the total quantity of 'Europium' produced by all countries in 2020 and 2021? | SELECT SUM(quantity) FROM production WHERE element = 'Europium' AND (year = 2020 OR year = 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, industry TEXT, founder_race TEXT); INSERT INTO startup VALUES (1, 'StartupA', 'Biotech', 'African American'); INSERT INTO startup VALUES (2, 'StartupB', 'Tech', 'Asian'); | What is the total funding received by startups founded by underrepresented minorities in the biotech industry? | SELECT SUM(funding_amount) FROM investment_round ir JOIN startup s ON ir.startup_id = s.id WHERE s.industry = 'Biotech' AND s.founder_race = 'African American'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founder_gender TEXT); INSERT INTO company (id, name, founder_gender) VALUES (1, 'Acme Inc', 'Female'), (2, 'Beta Corp', 'Male'); | Find companies founded by women that have not raised any funds. | SELECT * FROM company WHERE founder_gender = 'Female' AND id NOT IN (SELECT company_id FROM investment) | gretelai_synthetic_text_to_sql |
CREATE TABLE workforce (id INT, name VARCHAR(50), gender VARCHAR(50), position VARCHAR(50), department VARCHAR(50)); INSERT INTO workforce (id, name, gender, position, department) VALUES (1, 'John Doe', 'Male', 'Engineer', 'Mining'), (2, 'Jane Smith', 'Female', 'Technician', 'Environment'), (3, 'Alice Johnson', 'Female... | What is the number of employees in each department in the mining industry? | SELECT department, COUNT(*) as num_employees FROM workforce GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists smart_cities (city_id INT, city_name VARCHAR(255), country VARCHAR(255), adoption_score FLOAT); | What is the average adoption score for smart cities in the 'smart_cities' table, by country? | SELECT country, AVG(adoption_score) as avg_score FROM smart_cities WHERE adoption_score IS NOT NULL GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists well_production (well_id INT, well_name TEXT, location TEXT, production_year INT, oil_production FLOAT, gas_production FLOAT); INSERT INTO well_production (well_id, well_name, location, production_year, oil_production, gas_production) VALUES (1, 'Well L', 'Eagle Ford', 2021, 1234.56, 987.65),... | Calculate the total oil and gas production (in BOE) for each well in the Eagle Ford formation | SELECT well_name, (AVG(oil_production) + (AVG(gas_production) / 6)) AS avg_total_production FROM well_production WHERE location = 'Eagle Ford' GROUP BY well_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_name VARCHAR(255), daily_sales INT, daily_waste INT); CREATE TABLE inventory_adjustments (adjustment_type VARCHAR(255), item_name VARCHAR(255), quantity_adjusted INT); | Identify dishes with high food waste and their average waste percentages. | SELECT d.dish_name, AVG(d.daily_waste * 100.0 / d.daily_sales) as avg_waste_percentage FROM dishes d INNER JOIN inventory_adjustments ia ON d.dish_name = ia.item_name WHERE ia.adjustment_type = 'food_waste' GROUP BY d.dish_name HAVING COUNT(ia.adjustment_type) > 30 ORDER BY avg_waste_percentage DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE FitnessMembers (member_id INT, name VARCHAR(50), age INT, gender VARCHAR(10)); INSERT INTO FitnessMembers (member_id, name, age, gender) VALUES (1, 'John Doe', 25, 'Male'); INSERT INTO FitnessMembers (member_id, name, age, gender) VALUES (2, 'Jane Smith', 30, 'Female'); CREATE TABLE OnlineMembers (member_i... | What is the total number of members from FitnessMembers and OnlineMembers tables? | SELECT COUNT(*) FROM FitnessMembers UNION ALL SELECT COUNT(*) FROM OnlineMembers; | gretelai_synthetic_text_to_sql |
CREATE TABLE Art (ArtID INT, Type VARCHAR(255), Region VARCHAR(255), Continent VARCHAR(255), Quantity INT); INSERT INTO Art (ArtID, Type, Region, Continent, Quantity) VALUES (1, 'Painting', 'Asia', 'Asia', 25), (2, 'Sculpture', 'Africa', 'Africa', 18), (3, 'Textile', 'South America', 'South America', 30), (4, 'Pottery'... | What is the total number of traditional art pieces by type, region, and continent? | SELECT Type, Region, Continent, SUM(Quantity) as Total_Quantity FROM Art GROUP BY Type, Region, Continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (water_usage_id INT, mine_id INT, date DATE, water_used FLOAT); INSERT INTO water_usage (water_usage_id, mine_id, date, water_used) VALUES (1, 1, '2021-01-01', 5000), (2, 1, '2021-01-02', 5500), (3, 2, '2021-01-01', 6000), (4, 2, '2021-01-02', 6500), (5, 3, '2021-01-01', 7000), (6, 3, '2021-01-... | What is the average water usage per day, per mine, for the past month? | SELECT mine_id, AVG(water_used) as avg_daily_water_usage FROM water_usage WHERE date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE GROUP BY mine_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE national_security_budget (budget_id INT PRIMARY KEY, year INT, allocation DECIMAL(10,2)); INSERT INTO national_security_budget (budget_id, year, allocation) VALUES (1, 2020, 700.50), (2, 2021, 750.25), (3, 2022, 800.00), (4, 2023, 850.75); | What were the national security budget allocations for the last 2 years? | SELECT year, allocation FROM national_security_budget WHERE year IN (2021, 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE geologists (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), years_of_experience INT); | What is the maximum years of experience for geologists in the 'geologists' table? | SELECT MAX(years_of_experience) FROM geologists; | gretelai_synthetic_text_to_sql |
CREATE TABLE field (id INT, type VARCHAR(20)); CREATE TABLE nutrients (id INT, field_id INT, nitrogen INT, phosphorus INT); | Increase the nitrogen levels for all soy fields by 10%. | UPDATE nutrients SET nitrogen = nutrients.nitrogen * 1.10 FROM field WHERE field.type = 'soy'; | 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.