context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE DEElectricVehicleSales (id INT, manufacturer VARCHAR(30), sales INT); | What is the market share of electric vehicle manufacturers in Germany? | SELECT manufacturer, ROUND(100.0 * sales / (SELECT SUM(sales) FROM DEElectricVehicleSales), 1) as market_share FROM DEElectricVehicleSales GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (menu_id INT, menu_name VARCHAR(50), category VARCHAR(50), quantity_sold INT, price DECIMAL(5,2), month_sold INT, is_vegetarian BOOLEAN); INSERT INTO menu (menu_id, menu_name, category, quantity_sold, price, month_sold, is_vegetarian) VALUES (18, 'Vegetarian Tacos', 'Mexican', 15, 7.99, 1, true); | What is the average price of vegetarian menu items sold in the 'Mexican' category? | SELECT AVG(price) FROM menu WHERE is_vegetarian = true AND category = 'Mexican'; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT, name VARCHAR(255), habitat_type VARCHAR(255), avg_depth FLOAT); | List the top 5 deepest marine species habitats. | SELECT name, avg_depth FROM species ORDER BY avg_depth DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE asian_countries (country TEXT); INSERT INTO asian_countries VALUES ('China'), ('Japan'), ('India'), ('Indonesia'), ('Vietnam'); CREATE TABLE explainable_ai_satisfaction (model_name TEXT, satisfaction_score INTEGER, country TEXT); | Which explainable AI models have the highest satisfaction scores in Asia? | SELECT model_name, satisfaction_score FROM explainable_ai_satisfaction WHERE country IN (SELECT * FROM asian_countries) ORDER BY satisfaction_score DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT PRIMARY KEY, name VARCHAR(50), age INT, sport VARCHAR(50)); | Delete all records from the players table | DELETE FROM players; | gretelai_synthetic_text_to_sql |
CREATE TABLE Genre (GenreID INT, Name VARCHAR(50), Revenue INT); | What is the average revenue per song for each genre? | SELECT Genre.Name, AVG(Genre.Revenue) as AvgRevenuePerSong FROM Genre GROUP BY Genre.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE engineers (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), department VARCHAR(20)); | How many engineers work in the 'electrical' department in the 'engineers' table? | SELECT COUNT(*) FROM engineers WHERE department = 'electrical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, donor_id, amount, donation_date) VALUES (1, 101, 500.00, '2021-01-01'), (2, 102, 300.00, '2021-02-15'), (3, 101, 600.00, '2021-04-01'); | What is the total donation amount from first-time donors in the last quarter? | SELECT SUM(amount) FROM donations WHERE donor_id IN (SELECT id FROM donors WHERE donation_date > DATE_SUB(CURDATE(), INTERVAL 3 MONTH)) AND donor_id NOT IN (SELECT id FROM donors WHERE donation_date < DATE_SUB(CURDATE(), INTERVAL 6 MONTH)); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vulnerabilities (id INT, name VARCHAR(255), category VARCHAR(255), risk_score INT, resolved DATE); INSERT INTO Vulnerabilities (id, name, category, risk_score, resolved) VALUES (6, 'FREAK', 'Network', 6, '2022-03-10'); | What is the average risk score of vulnerabilities in the 'Network' category that have been resolved in the last month? | SELECT AVG(risk_score) FROM Vulnerabilities WHERE category = 'Network' AND resolved >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH) AND resolved IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE City_Labor (labor_id INT, labor_cost FLOAT, labor_city VARCHAR(20), labor_date DATE); INSERT INTO City_Labor (labor_id, labor_cost, labor_city, labor_date) VALUES (1, 500, 'Dallas', '2022-04-01'), (2, 600, 'Houston', '2022-04-15'), (3, 700, 'Austin', '2022-03-01'); | What is the total labor cost for each city in Texas in Q2 2022? | SELECT labor_city, SUM(labor_cost) OVER (PARTITION BY labor_city) AS total_labor_cost FROM City_Labor WHERE labor_date >= '2022-04-01' AND labor_date < '2022-07-01' AND labor_city LIKE 'Texas%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_development (teacher_id INT, teacher_name VARCHAR(50), course_title VARCHAR(100)); INSERT INTO teacher_development (teacher_id, teacher_name, course_title) VALUES (1, 'John Doe', 'Python Programming'), (2, 'Jane Smith', 'Data Analysis with SQL'), (3, 'John Doe', 'Machine Learning Fundamentals'); | What are the professional development courses taken by teacher 'John Doe'? | SELECT course_title FROM teacher_development WHERE teacher_name = 'John Doe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_spending (country VARCHAR(50), spending INT); INSERT INTO military_spending (country, spending) VALUES ('United States', 700000000), ('China', 228000000), ('Russia', 61000000), ('India', 50000000); CREATE TABLE countries (country VARCHAR(50), population INT); INSERT INTO countries (country, popula... | What is the average military spending per country for the top 3 countries with the highest military spending? | SELECT AVG(ms.spending) as avg_spending FROM (SELECT * FROM military_spending ORDER BY spending DESC LIMIT 3) ms; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(255), age INT, country VARCHAR(255)); | Insert new player records with the specified details. | INSERT INTO players (id, name, age, country) VALUES (5, 'Sophia Garcia', 32, 'Mexico'), (6, 'Hiroshi Tanaka', 29, 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_bed (bed_id INT, hospital_id INT, type TEXT, status TEXT, state TEXT); CREATE TABLE hospital (hospital_id INT, name TEXT, location TEXT, beds INT, state TEXT); | What is the percentage of hospital beds in rural areas of each state that are occupied? | SELECT state, AVG(CASE WHEN status = 'occupied' THEN 100.0 ELSE 0.0 END) FROM hospital_bed a INNER JOIN hospital b ON a.hospital_id = b.hospital_id WHERE b.location LIKE '%rural%' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE SeaIceData (Location VARCHAR(100), Date DATE, Thickness INT, Temperature FLOAT); INSERT INTO SeaIceData (Location, Date, Thickness, Temperature) VALUES ('Location A', '2022-06-01', 5, -1.5); INSERT INTO SeaIceData (Location, Date, Thickness, Temperature) VALUES ('Location B', '2022-06-05', 6, -2.5); | What is the maximum sea ice thickness and minimum sea surface temperature recorded for each location in the past month? | SELECT Location, MAX(Thickness) OVER (PARTITION BY Location ORDER BY Location ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MaxThickness, MIN(Temperature) OVER (PARTITION BY Location ORDER BY Location ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS MinTemperature FROM SeaIceData WHERE Date >... | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), Country varchar(50)); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (1, 'John Doe', 'USA'); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (2, 'Jane Smith', 'Canada'); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (3, 'Richard Thompso... | How many donors from the United Kingdom have made a donation in 2019 or later? | SELECT COUNT(DISTINCT DON.DonorID) FROM Donors DON INNER JOIN Donations D ON D.DonorID = DON.DonorID WHERE DON.Country = 'UK' AND D.DonationDate >= '2019-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShows (Id INT, Name VARCHAR(50), Location VARCHAR(50), Date DATE); CREATE TABLE ElectricVehicles (Id INT, Name VARCHAR(50), AutoShowId INT); INSERT INTO AutoShows (Id, Name, Location, Date) VALUES (1, 'New York Auto Show', 'New York', '2022-04-15'), (2, 'Los Angeles Auto Show', 'California', '2022-11-1... | List all auto shows with the highest electric vehicle participation. | SELECT AutoShows.Name FROM AutoShows INNER JOIN ElectricVehicles ON AutoShows.Id = ElectricVehicles.AutoShowId GROUP BY AutoShows.Name ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, animal_species VARCHAR(255), animal_age VARCHAR(255)); INSERT INTO animal_population (id, animal_species, animal_age) VALUES (1, 'Giraffe', 'Juvenile'), (2, 'Giraffe', 'Adult'), (3, 'Giraffe', 'Adult'), (4, 'Zebra', 'Juvenile'), (5, 'Zebra', 'Adult'), (6, 'Lion', 'Senior'), (7, '... | Calculate the number of animals in each age group (juvenile, adult, senior) for each animal species. | SELECT animal_species, animal_age, COUNT(*) AS animal_count FROM animal_population GROUP BY animal_species, animal_age; | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (ProductionID INT PRIMARY KEY, ProductionLine VARCHAR(50), WasteID INT, FOREIGN KEY (WasteID) REFERENCES Waste(WasteID)); CREATE TABLE Waste (WasteID INT PRIMARY KEY, WasteType VARCHAR(50), DisposalMethod VARCHAR(50)); INSERT INTO Waste (WasteID, WasteType, DisposalMethod) VALUES (1, 'Metal', 'D... | Get the details of production lines that have waste disposal methods marked as 'Donation'. | SELECT Production.ProductionLine FROM Production INNER JOIN Waste ON Production.WasteID = Waste.WasteID WHERE Waste.DisposalMethod = 'Donation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Brands (id INT, name VARCHAR(255), is_cruelty_free BOOLEAN); CREATE TABLE Products (id INT, brand_id INT, name VARCHAR(255), price DECIMAL(5,2)); INSERT INTO Brands (id, name, is_cruelty_free) VALUES (1, 'Lush', true), (2, 'Estee Lauder', false); INSERT INTO Products (id, brand_id, name, price) VALUES (1, ... | Which cruelty-free brand has the lowest price for a product? | SELECT b.name as cruelty_free_brand, p.name as least_expensive_product, p.price as price FROM Brands b JOIN Products p ON b.id = p.brand_id WHERE b.is_cruelty_free = true AND p.price = (SELECT MIN(price) FROM Products WHERE brand_id = b.id); | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, year INT, biodiversity FLOAT, carbon_sequestration FLOAT); | Find total carbon sequestration in 2019 for forests with a biodiversity index above 0.75. | SELECT SUM(carbon_sequestration) FROM forests WHERE year = 2019 AND biodiversity > 0.75; | gretelai_synthetic_text_to_sql |
CREATE VIEW defense_contracts AS SELECT contractor_name, contract_value FROM military_contracts; | Show the total value of defense contracts awarded to each contractor in the defense_contracts view. | SELECT contractor_name, SUM(contract_value) FROM defense_contracts GROUP BY contractor_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, founded_year INT, industry TEXT, founder_gender TEXT, funding FLOAT); | What is the average funding amount for startups founded by women? | SELECT AVG(funding) FROM startups WHERE founder_gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (id INT, worker_id INT, incident_date DATE, violation_count INT); INSERT INTO mental_health_parity (id, worker_id, incident_date, violation_count) VALUES (1, 123, '2021-01-01', 5), (2, 123, '2021-01-15', 3); CREATE TABLE community_health_workers (id INT, name VARCHAR(50), region VARCHA... | How many mental health parity violation incidents were reported in total by community health workers in California and Texas? | SELECT SUM(violation_count) FROM mental_health_parity INNER JOIN community_health_workers ON mental_health_parity.worker_id = community_health_workers.id WHERE community_health_workers.region IN ('California', 'Texas'); | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_algorithms (id INT PRIMARY KEY, algorithm_id INT, risk_score DECIMAL(5,4), safety_category VARCHAR(50), measurement_date DATE); INSERT INTO safety_algorithms (id, algorithm_id, risk_score, safety_category, measurement_date) VALUES (1, 1, 0.7654, 'Low', '2021-01-15'), (2, 2, 0.8912, 'Medium', '2021-0... | Update the safety category of an algorithm to 'Critical' if its risk score is higher than 0.85. | UPDATE safety_algorithms SET safety_category = 'Critical' WHERE risk_score > 0.85; | gretelai_synthetic_text_to_sql |
CREATE TABLE SeaLevelRise (year INT, avg_rise FLOAT); INSERT INTO SeaLevelRise (year, avg_rise) VALUES (2011, 1.5); INSERT INTO SeaLevelRise (year, avg_rise) VALUES (2012, 1.7); INSERT INTO SeaLevelRise (year, avg_rise) VALUES (2013, 1.9); INSERT INTO SeaLevelRise (year, avg_rise) VALUES (2014, 2.1); INSERT INTO SeaLev... | What is the average sea level rise in the Arctic Ocean in the last 10 years? | SELECT AVG(avg_rise) FROM SeaLevelRise WHERE year BETWEEN 2011 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (SatelliteID INT, SatelliteName VARCHAR(50), LaunchDate DATE, Manufacturer VARCHAR(50), Status VARCHAR(50)); INSERT INTO Satellites (SatelliteID, SatelliteName, LaunchDate, Manufacturer, Status) VALUES (1, 'Sat1', '2020-01-01', 'SpaceTech', 'Active'); | What is the current status of satellites manufactured by SpaceTech? | SELECT SatelliteID, SatelliteName, LaunchDate, Manufacturer, (CASE WHEN Status = 'Active' THEN 'Operational' ELSE 'Inactive' END) AS NewStatus FROM Satellites WHERE Manufacturer = 'SpaceTech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RuralClinicD (patient_id INT, age INT, gender VARCHAR(10)); INSERT INTO RuralClinicD (patient_id, age, gender) VALUES (1, 45, 'Female'), (2, 60, 'Female'), (3, 35, 'Male'), (4, 25, 'Male'); | What is the youngest male patient in 'RuralClinicD'? | SELECT MIN(age) FROM RuralClinicD WHERE gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name TEXT, is_vegan BOOLEAN, price DECIMAL); INSERT INTO products (product_id, name, is_vegan, price) VALUES (1, 'Lipstick', TRUE, 15.99); INSERT INTO products (product_id, name, is_vegan, price) VALUES (2, 'Eye Shadow', TRUE, 12.49); | What is the sum of the prices of all vegan cosmetics? | SELECT SUM(price) FROM products WHERE is_vegan = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselOrganizations (vessel VARCHAR(255), organization VARCHAR(255)); INSERT INTO VesselOrganizations (vessel, organization) VALUES ('Vessel1', 'CoastalGuard'), ('Vessel2', 'MaritimePolice'), ('Vessel3', 'CoastalGuard'); | Count the number of vessels in 'CoastalGuard' and 'MaritimePolice' organizations | (SELECT organization, COUNT(*) FROM VesselOrganizations WHERE organization = 'CoastalGuard') UNION (SELECT organization, COUNT(*) FROM VesselOrganizations WHERE organization = 'MaritimePolice'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Asia (Country VARCHAR(50), LifeExpectancy FLOAT); INSERT INTO Asia (Country, LifeExpectancy) VALUES ('Japan', 84.2), ('China', 77.1), ('India', 69.7), ('Indonesia', 71.7), ('Vietnam', 76.1), ('Thailand', 75.3), ('South Korea', 82.7), ('Philippines', 71.9), ('Pakistan', 67.3), ('Bangladesh', 72.6); | What is the average life expectancy in Asian countries? | SELECT AVG(LifeExpectancy) FROM Asia; | gretelai_synthetic_text_to_sql |
CREATE TABLE Soil_Sensors (id INT, farm_id INT, model VARCHAR(50), location VARCHAR(50), moisture FLOAT); INSERT INTO Soil_Sensors (id, farm_id, model, location, moisture) VALUES (1, 1, 'Precision Drip', 'Field A', 0.35); INSERT INTO Soil_Sensors (id, farm_id, model, location, moisture) VALUES (2, 1, 'Precision Drip', ... | What is the maximum moisture level for each unique location in farms with the 'Precision Drip' irrigation system model and more than 1 record? | SELECT model, MAX(moisture) FROM Soil_Sensors WHERE model = 'Precision Drip' GROUP BY model, location HAVING COUNT(*) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(255), department VARCHAR(255), salary INT); INSERT INTO employees (id, name, department, salary) VALUES (1, 'John Doe', 'Manufacturing', 50000); INSERT INTO employees (id, name, department, salary) VALUES (2, 'Jane Smith', 'Manufacturing', 55000); INSERT INTO employees (id, ... | What is the average salary of employees in the manufacturing sector? | SELECT AVG(salary) as avg_salary FROM employees WHERE department = 'Manufacturing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SculptureGarden(id INT, age INT, gender VARCHAR(10), visit_date DATE); | What is the percentage of visitors who identified as female and attended "Sculpture Garden" events? | SELECT 100.0 * COUNT(*) / (SELECT COUNT(*) FROM SculptureGarden) FROM SculptureGarden WHERE gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(255)); CREATE TABLE Sales (id INT, artist_id INT, sale_date DATE); CREATE TABLE Works (id INT, artist_id INT, sale_date DATE); | What is the number of works sold by the top 10 artists? | SELECT artist_id, COUNT(*) AS works_sold FROM (SELECT artist_id, ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS rank FROM Sales JOIN Works ON Sales.id = Works.id GROUP BY artist_id) subquery WHERE rank <= 10 GROUP BY artist_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID int, ArtistName varchar(50), Gender varchar(10), BirthYear int); CREATE TABLE Artworks (ArtworkID int, ArtistID int, ArtworkTitle varchar(50), ArtworkYear int, Revenue int); | What are the top 5 artworks by female artists that have generated the highest revenue? | SELECT Artworks.ArtworkTitle, Artworks.Revenue FROM Artworks INNER JOIN Artists ON Artworks.ArtistID = Artists.ArtistID WHERE Artists.Gender = 'female' GROUP BY Artworks.ArtworkTitle ORDER BY Revenue DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (drug VARCHAR(50), year INT, expenses INT); INSERT INTO clinical_trials (drug, year, expenses) VALUES ('DrugG', 2022, 8000000), ('DrugH', 2022, 9000000); | What are the total clinical trial expenses for drug 'DrugG' in 2022? | SELECT expenses FROM clinical_trials WHERE drug = 'DrugG' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlantDReactorPressures (ReactorID INT, Pressure DECIMAL(5,2), Timestamp DATETIME, Plant VARCHAR(255)); | What is the maximum pressure recorded for each reactor in Chemical Plant D in the past month? | SELECT ReactorID, MAX(Pressure) FROM PlantDReactorPressures WHERE Plant = 'Chemical Plant D' AND Timestamp BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH) AND CURRENT_DATE() GROUP BY ReactorID; | gretelai_synthetic_text_to_sql |
CREATE TABLE desserts (id INT, name VARCHAR(255), sugar_content INT, country VARCHAR(255)); INSERT INTO desserts (id, name, sugar_content, country) VALUES (1, 'Cheesecake', 25, 'USA'), (2, 'Tiramisu', 20, 'Italy'); | What is the average sugar content of our desserts, excluding those from the United States? | SELECT AVG(sugar_content) FROM desserts WHERE country NOT LIKE 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine_productivity (mine_name VARCHAR(255), year INT, productivity FLOAT); INSERT INTO mine_productivity (mine_name, year, productivity) VALUES ('Turquoise Tunnels', 2016, 11.87), ('Garnet Grotto', 2017, 13.21); CREATE TABLE geology_survey (mine_name VARCHAR(255), survey_date DATE, mineral_deposits INT); IN... | Which mines have both productivity rates above 10 and geology survey data? | SELECT mine_name FROM mine_productivity WHERE productivity > 10 INTERSECT SELECT mine_name FROM geology_survey; | gretelai_synthetic_text_to_sql |
CREATE TABLE OIL_PRODUCTION_HISTORY (WELL_NAME VARCHAR(255), PRODUCTION_DATE DATE, QUANTITY INT); | What is the daily production quantity of the 'PACIFIC_OIL' well in the 'OIL_PRODUCTION_HISTORY' table for the last 30 days? | SELECT QUANTITY FROM OIL_PRODUCTION_HISTORY WHERE WELL_NAME = 'PACIFIC_OIL' AND PRODUCTION_DATE >= CURDATE() - INTERVAL 30 DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (menu_id INT, menu_name VARCHAR(20)); INSERT INTO Menu (menu_id, menu_name) VALUES (1, 'Breakfast'), (2, 'Lunch'), (3, 'Dinner'); CREATE TABLE Menu_Orders (order_id INT, menu_id INT, order_date DATE); INSERT INTO Menu_Orders (order_id, menu_id, order_date) VALUES (1, 1, '2021-01-01'), (2, 2, '2021-01-... | What is the total number of meals served in the breakfast menu for the year 2021? | SELECT COUNT(*) FROM Menu_Orders INNER JOIN Menu ON Menu_Orders.menu_id = Menu.menu_id WHERE Menu.menu_name = 'Breakfast' AND YEAR(Menu_Orders.order_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name TEXT, location TEXT, depth FLOAT); INSERT INTO marine_protected_areas (name, location, depth) VALUES ('Ross Sea Marine Protected Area', 'Southern', 5500.0), ('Kerguelen Islands Plateau', 'Southern', 3000.0), ('South Georgia and South Sandwich Islands', 'Southern', 1000.0); | What is the minimum depth of marine protected areas in the Southern Ocean? | SELECT MIN(depth) FROM marine_protected_areas WHERE location = 'Southern'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, investor VARCHAR(255), project_type VARCHAR(255), amount INT, date DATE); INSERT INTO investments (id, investor, project_type, amount, date) VALUES (27, 'ImpactFirst', 'renewable_energy', 750000, '2021-06-11'); INSERT INTO investments (id, investor, project_type, amount, date) VALUES (... | List all investments made by 'ImpactFirst' in 'renewable_energy' projects in 2021. | SELECT * FROM investments WHERE investor = 'ImpactFirst' AND project_type = 'renewable_energy' AND date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(10)); INSERT INTO Employees (EmployeeID, Gender) VALUES (1, 'Female'), (2, 'Male'), (3, 'Non-binary'); | What is the count of employees by gender? | SELECT Gender, COUNT(*) FROM Employees GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE Producers (id INT, producer_name VARCHAR(255), state VARCHAR(255), income DECIMAL(10, 2)); INSERT INTO Producers (id, producer_name, state, income) VALUES (1, 'Sahara Extracts', 'Nevada', 250000.00); CREATE TABLE Cannabis_Extraction (id INT, producer_id INT, extraction_month INT, extraction_weight DECIMAL(... | What is the maximum weight of cannabis extracted by a producer in Nevada in a single month? | SELECT MAX(extraction_weight) FROM Producers p JOIN Cannabis_Extraction e ON p.id = e.producer_id WHERE p.state = 'Nevada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(255), location VARCHAR(255)); CREATE TABLE transactions (transaction_id INT, customer_id INT, category_id INT, transaction_date DATE, amount DECIMAL(10,2)); CREATE TABLE products (product_id INT, name VARCHAR(255), category_id INT); | Find the monthly transaction volume for the top 3 product categories with the highest transaction values in the last quarter, for customers living in New York? | SELECT p.category_id, p.name, DATE_FORMAT(t.transaction_date, '%Y-%m') as transaction_month, SUM(t.amount) as monthly_transaction_volume FROM customers c INNER JOIN transactions t ON c.customer_id = t.customer_id INNER JOIN products p ON t.product_id = p.product_id WHERE c.location = 'New York' AND p.category_id IN (SE... | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, location VARCHAR(50), description TEXT, price DECIMAL(5,2)); | Insert a new virtual tour into the "virtual_tours" table for 'Barcelona' with an ID of 21, a description of 'A virtual tour of the Sagrada Familia', and a price of 17.50 | INSERT INTO virtual_tours (tour_id, location, description, price) VALUES (21, 'Barcelona', 'A virtual tour of the Sagrada Familia', 17.50); | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, country VARCHAR(50), timestamp DATETIME); | Which countries have had the most security incidents in the last year? | SELECT country, COUNT(*) as num_incidents FROM security_incidents WHERE timestamp > DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY country ORDER BY num_incidents DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Consumer_Preferences (id INT, consumer_id INT, product_id INT, preference_score INT); CREATE TABLE Consumers (id INT, name VARCHAR(255), age INT, location VARCHAR(255), cruelty_free BOOLEAN); CREATE TABLE Products (id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2)); CREATE TABLE Brands (... | Which cruelty-free brands have the highest average preference score for makeup products? | SELECT b.name, AVG(cp.preference_score) as average_score FROM Consumer_Preferences cp JOIN Consumers c ON cp.consumer_id = c.id JOIN Products p ON cp.product_id = p.id JOIN Brands b ON p.id = b.id WHERE c.cruelty_free = true AND p.category = 'Makeup' GROUP BY b.name ORDER BY average_score DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_missions (spacecraft_name TEXT, mission_date DATE); | Find the number of missions each spacecraft has been on, and rank them in descending order? | SELECT spacecraft_name, COUNT(mission_date) as mission_count, RANK() OVER (ORDER BY COUNT(mission_date) DESC) as mission_rank FROM spacecraft_missions GROUP BY spacecraft_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (post_id INT, user_id INT, post_date DATE); CREATE TABLE users (user_id INT, name VARCHAR(255)); INSERT INTO posts (post_id, user_id, post_date) VALUES (1, 1, '2020-01-01'); INSERT INTO users (user_id, name) VALUES (1, 'Jamal'); | How many posts were made by users with the name 'Jamal' between 2020 and 2021, inclusive? | SELECT COUNT(*) FROM posts JOIN users ON posts.user_id = users.user_id WHERE users.name = 'Jamal' AND posts.post_date >= '2020-01-01' AND posts.post_date <= '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), salary FLOAT, employment_status VARCHAR(50), gender VARCHAR(10), diversity_training BOOLEAN); INSERT INTO employees (id, name, department, salary, employment_status, gender, diversity_training) VALUES (1, 'John Doe', 'IT', 75000.0, 'Full-time', '... | What is the average salary of employees who have completed a diversity and inclusion training, grouped by their department and employment status? | SELECT employees.department, employees.employment_status, AVG(employees.salary) FROM employees INNER JOIN departments ON employees.department = departments.name WHERE employees.diversity_training = TRUE GROUP BY employees.department, employees.employment_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country TEXT, posts TEXT); | How many users have posted content related to 'mental health', in the last week, from 'Asia-Pacific' countries? | SELECT COUNT(DISTINCT id) FROM users WHERE posts LIKE '%#mentalhealth%' AND country IN (SELECT country FROM countries WHERE region = 'Asia-Pacific') AND posts IS NOT NULL AND posts != ''; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtifactTypes (TypeID INT, ArtifactID INT, ArtifactType TEXT); INSERT INTO ArtifactTypes (TypeID, ArtifactID, ArtifactType) VALUES (1, 1, 'Pottery'); INSERT INTO ArtifactTypes (TypeID, ArtifactID, ArtifactType) VALUES (2, 2, 'Jewelry'); INSERT INTO ArtifactTypes (TypeID, ArtifactID, ArtifactType) VALUES (3... | What are the most common artifact types at each excavation site? | SELECT e.SiteName, t.ArtifactType, COUNT(*) AS Count FROM ExcavationSites e JOIN ArtifactAnalysis a ON e.SiteID = a.SiteID JOIN ArtifactTypes t ON a.ArtifactID = t.ArtifactID GROUP BY e.SiteName, t.ArtifactType; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (program_id INT, program_name TEXT, start_year INT); | How many carbon offset programs were initiated per year in the carbon_offset_programs table? | SELECT start_year, COUNT(program_id) FROM carbon_offset_programs GROUP BY start_year; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA disability_services; CREATE TABLE students (id INT, name VARCHAR(50), accommodation VARCHAR(50), program VARCHAR(50)); | Find the names and accommodations of students who are enrolled in the "adaptive_technology" support program in the "disability_services" schema. | SELECT name, accommodation FROM disability_services.students WHERE program = 'adaptive_technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy_Feedback (Feedback_ID INT PRIMARY KEY, Council_ID INT, Policy_Area VARCHAR(30), Feedback VARCHAR(100)); | Insert a new feedback for the Transportation policy | INSERT INTO Policy_Feedback (Feedback_ID, Council_ID, Policy_Area, Feedback) VALUES (4, 4, 'Transportation', 'Bike lanes needed in city'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (id INT, name VARCHAR(20), age INT, city VARCHAR(20)); INSERT INTO Visitors (id, name, age, city) VALUES (1, 'Alex', 45, 'Sydney'), (2, 'Beth', 30, 'Sydney'); | Who is the oldest visitor from Sydney? | SELECT name, MAX(age) as max_age FROM Visitors WHERE city = 'Sydney' | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT, organization TEXT, sector TEXT, year INT, amount INT); INSERT INTO funding (id, organization, sector, year, amount) VALUES (1, 'UNICEF', 'Refugee', 2019, 100000), (2, 'World Food Programme', 'Disaster Response', 2018, 200000); | What is the total amount of funding received by organizations supporting the refugee sector in the year 2019? | SELECT SUM(amount) FROM funding WHERE sector = 'Refugee' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE platform (platform_id INT, platform_name TEXT, location TEXT); INSERT INTO platform (platform_id, platform_name, location) VALUES (1, 'Alpha', 'North Sea'), (2, 'Bravo', 'Gulf of Mexico'); | What are the names of all platforms in the North Sea? | SELECT platform_name FROM platform WHERE location = 'North Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Asteroid_Belt(asteroid_id INT, asteroid_name VARCHAR(30), distance FLOAT); INSERT INTO Asteroid_Belt(asteroid_id, asteroid_name, distance) VALUES (1, 'Ceres', 413.7), (2, 'Vesta', 568.2), (3, 'Pallas', 434.1), (4, 'Hygiea', 404.2), (5, 'Eunomia', 438.6), (6, 'Juno', 594.3), (7, 'Iris', 345.6), (8, 'Flora',... | Retrieve the average distance of asteroids in the 'Asteroid_Belt' table | SELECT AVG(distance) FROM Asteroid_Belt; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (PatientID INT, Age INT, Gender VARCHAR(10), Disease VARCHAR(20), Region VARCHAR(20)); INSERT INTO Patients (PatientID, Age, Gender, Disease, Region) VALUES (1, 34, 'Male', 'Influenza', 'Los Angeles'); INSERT INTO Patients (PatientID, Age, Gender, Disease, Region) VALUES (2, 42, 'Female', 'Pneumon... | What is the maximum age of male patients diagnosed with any disease in the 'New York' region? | SELECT MAX(Age) FROM Patients WHERE Gender = 'Male' AND Region = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_production (well_id INT, measurement_date DATE, production_rate FLOAT, location TEXT); INSERT INTO well_production (well_id, measurement_date, production_rate, location) VALUES (1, '2022-01-01', 500, 'Texas'), (1, '2022-03-01', 550, 'Texas'), (2, '2022-01-01', 700, 'California'), (2, '2022-03-01', 750... | What is the percentage change in production rate for each well between January and March? | SELECT a.well_id, a.location, (b.production_rate - a.production_rate) * 100.0 / a.production_rate AS Percentage_Change FROM well_production a JOIN well_production b ON a.well_id = b.well_id WHERE a.measurement_date = '2022-01-01' AND b.measurement_date = '2022-03-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Loans (LoanID INT, IssueDate DATE, Amount DECIMAL(10,2), IsShariahCompliant BOOLEAN); INSERT INTO Loans (LoanID, IssueDate, Amount, IsShariahCompliant) VALUES (1, '2022-01-01', 5000.00, true), (2, '2022-02-01', 3000.00, true), (3, '2022-01-01', 7000.00, false); | What is the total amount of Shariah-compliant loans issued per month, with a running total, for the last 12 months? | SELECT IssueDate, Amount, SUM(Amount) OVER (ORDER BY IssueDate ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as RunningTotal FROM Loans WHERE IsShariahCompliant = true AND IssueDate >= DATEADD(month, -12, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE production (system VARCHAR(20), crop VARCHAR(10), quantity INT); INSERT INTO production (system, crop, quantity) VALUES ('IFS1', 'corn', 200), ('IFS1', 'beans', 150), ('IFS1', 'squash', 75), ('IFS2', 'corn', 175), ('IFS2', 'beans', 125), ('IFS2', 'squash', 50), ('IFS3', 'corn', 250), ('IFS3', 'beans', 200)... | What is the sum of the production quantities of corn, beans, and squash in all indigenous food systems? | SELECT SUM(quantity) FROM production WHERE crop IN ('corn', 'beans', 'squash'); | gretelai_synthetic_text_to_sql |
CREATE TABLE animal (id INT, name VARCHAR(50), species VARCHAR(50), population INT); CREATE TABLE habitat (id INT, name VARCHAR(50), location VARCHAR(50)); CREATE TABLE conservation_effort (id INT, habitat_id INT, animal_id INT, start_date DATE, end_date DATE); INSERT INTO animal (id, name, species, population) VALUES ... | List all animals and their population counts in habitats where conservation efforts are ongoing | SELECT a.name, a.species, COUNT(a.id) as population_count FROM animal a INNER JOIN habitat h ON h.id = a.habitat_id INNER JOIN conservation_effort ce ON ce.habitat_id = h.id WHERE ce.end_date >= CURDATE() GROUP BY a.name, a.species; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT, state VARCHAR(50), consumption FLOAT, date DATE); INSERT INTO water_usage (id, state, consumption, date) VALUES (1, 'New York', 18000, '2022-08-01'); INSERT INTO water_usage (id, state, consumption, date) VALUES (2, 'New York', 19000, '2022-08-02'); | Find the total water consumption in liters for the state of New York in the month of August 2022 | SELECT SUM(consumption) FROM water_usage WHERE state = 'New York' AND date >= '2022-08-01' AND date <= '2022-08-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE plant_safety_incidents (id INT, incident_date DATE, plant_name VARCHAR(255), region VARCHAR(255), incident_description VARCHAR(255)); INSERT INTO plant_safety_incidents (id, incident_date, plant_name, region, incident_description) VALUES (1, '2022-02-01', 'Plant A', 'South America', 'Chemical leak'), (2, '... | How many safety incidents were reported by the chemical plant in the South American region in the last 6 months? | SELECT COUNT(*) FROM plant_safety_incidents WHERE plant_name = 'Plant A' AND region = 'South America' AND incident_date >= '2022-01-01' AND incident_date < '2022-07-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players_stats (player_id INT PRIMARY KEY, player_name VARCHAR(255), position VARCHAR(50), saves INT, team_id INT, FOREIGN KEY (player_id) REFERENCES players(player_id), FOREIGN KEY (team_id) REFERENCES teams(team_id)); | What is the minimum number of saves for each goalkeeper in the players table, grouped by their team, and only for goalkeepers who have more than 50 saves in total? | SELECT t.team_name, MIN(saves) as min_saves FROM players_stats p JOIN teams t ON p.team_id = t.team_id WHERE position = 'goalkeeper' GROUP BY t.team_name HAVING SUM(saves) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offsets (id INT, country VARCHAR(255), initiative VARCHAR(255), funded_amount INT); INSERT INTO carbon_offsets (id, country, initiative, funded_amount) VALUES (1, 'Australia', 'Tree planting', 50000), (2, 'Australia', 'Renewable energy', 100000), (3, 'Canada', 'Energy efficiency', 75000); | Find carbon offset initiatives in Australia and their corresponding funded amounts. | SELECT initiative, funded_amount FROM carbon_offsets WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE affordable_housing (id INT, property_id INT, square_footage FLOAT, energy_rating INT); | Which properties in the 'affordable_housing' table have a square footage larger than 2000 sq ft? | SELECT property_id, square_footage FROM affordable_housing WHERE square_footage > 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, category VARCHAR(255), sustainability_score FLOAT); INSERT INTO products (product_id, category, sustainability_score) VALUES (1, 'Skincare', 80), (2, 'Makeup', 85), (3, 'Skincare', 70), (4, 'Makeup', 75); | What is the average sustainability score for cosmetic products, by product category, ordered by average score in descending order? | SELECT category, AVG(sustainability_score) as avg_score FROM products GROUP BY category ORDER BY avg_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE subjects (subject_id INT, subject_area VARCHAR(20), teacher_id INT, hours_pd INT); INSERT INTO subjects (subject_id, subject_area, teacher_id, hours_pd) VALUES (1, 'Math', 1, 5), (2, 'Science', 2, 3), (3, 'English', 3, 4), (4, 'Social Studies', 4, 6), (5, 'Art', 5, 2); | What is the distribution of teacher professional development hours by subject area? | SELECT subject_area, SUM(hours_pd) as total_hours FROM subjects GROUP BY subject_area; | gretelai_synthetic_text_to_sql |
CREATE TABLE bsc_dexes (dex_name VARCHAR(50), daily_volume DECIMAL(18,2), tx_time DATETIME); | What is the daily transaction volume for the top 3 decentralized exchanges on the Binance Smart Chain? | SELECT dex_name, SUM(daily_volume) FROM bsc_dexes GROUP BY dex_name LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_communities (id INT, community_name VARCHAR(255), location VARCHAR(255), country VARCHAR(255), initiative_type VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO rural_communities (id, community_name, location, country, initiative_type, start_date, end_date) VALUES (1, 'Community A', 'Village... | List all community development initiatives in 'rural_communities' table for Country Y? | SELECT * FROM rural_communities WHERE country = 'Country Y' AND initiative_type = 'Community Development'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Land (Location VARCHAR(20), System VARCHAR(20), Area FLOAT); INSERT INTO Land (Location, System, Area) VALUES ('Australia', 'Indigenous Food Systems', 5000000), ('New Zealand', 'Indigenous Food Systems', 3000000), ('Canada', 'Conventional Agriculture', 8000000); | What is the total area of land used for indigenous food systems in Australia and New Zealand? | SELECT SUM(Area) FROM Land WHERE Location IN ('Australia', 'New Zealand') AND System = 'Indigenous Food Systems'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_management (wm_id INT, area_id INT, department VARCHAR(20), amount INT); INSERT INTO waste_management (wm_id, area_id, department, amount) VALUES (1, 1, 'waste_management', 4000), (2, 1, 'public_transportation', 7000), (3, 2, 'waste_management', 5000), (4, 2, 'public_transportation', 8000); | What is the average budget allocated for waste management in rural areas? | SELECT AVG(w.amount) FROM waste_management w JOIN urban_areas a ON w.area_id = a.area_id WHERE w.department = 'waste_management' AND a.area_type = 'rural'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount FLOAT, cause TEXT, donation_date DATE); INSERT INTO donors (donor_id, donor_name, donation_amount, cause, donation_date) VALUES (1, 'John Doe', 50000, 'Education', '2021-01-01'); | What are the top 5 donors by total donation amount to educational causes in 2021? | SELECT donor_name, SUM(donation_amount) as total_donation FROM donors WHERE cause = 'Education' AND donation_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY donor_name ORDER BY total_donation DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (id INT, name VARCHAR(50), country VARCHAR(50), region VARCHAR(50)); CREATE TABLE Languages (id INT, country VARCHAR(50), language VARCHAR(50), spoken INT); | List the languages spoken in the regions with the highest number of heritage sites? | SELECT region, name FROM HeritageSites H INNER JOIN (SELECT country, region FROM HeritageSites GROUP BY region ORDER BY COUNT(*) DESC LIMIT 1) T ON H.region = T.region; SELECT language FROM Languages WHERE country IN (SELECT country FROM (SELECT country, region FROM HeritageSites GROUP BY region ORDER BY COUNT(*) DESC ... | gretelai_synthetic_text_to_sql |
CREATE TABLE UnionL(industry VARCHAR(20), member_id INT); INSERT INTO UnionL(industry, member_id) VALUES('Education', 12001), ('Retail', 12002), ('Education', 12003), ('Construction', 12004), ('Retail', 12005); | List all the unique industries represented in union 'L' that have more than 40 members. | SELECT industry FROM UnionL GROUP BY industry HAVING COUNT(DISTINCT member_id) > 40; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_date DATE, region TEXT, amount DECIMAL(10,2)); INSERT INTO donations (id, donation_date, region, amount) VALUES (1, '2020-10-01', 'Northeast', 100.00), (2, '2020-11-15', 'Southeast', 250.50), (3, '2020-12-31', 'Northeast', 150.25); | What were the total donations in Q4 2020 by region? | SELECT region, SUM(amount) FROM donations WHERE donation_date BETWEEN '2020-10-01' AND '2020-12-31' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_program (id INT, name VARCHAR(255), recycling_type VARCHAR(255)); | Delete all records from the 'recycling_program' table where the 'recycling_type' is 'E-waste' | DELETE FROM recycling_program WHERE recycling_type = 'E-waste'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_treatment (id INT, location TEXT, volume FLOAT); INSERT INTO wastewater_treatment (id, location, volume) VALUES (1, 'Miami', 1000000), (2, 'Tampa', 800000), (3, 'Jacksonville', 900000); | What is the total volume of wastewater treated in Florida? | SELECT SUM(volume) as total_volume FROM wastewater_treatment WHERE location = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm (FarmID int, FarmName varchar(50), WaterTemperature numeric); INSERT INTO Farm (FarmID, FarmName, WaterTemperature) VALUES (1, 'Farm A', 22); INSERT INTO Farm (FarmID, FarmName, WaterTemperature) VALUES (2, 'Farm B', 18); INSERT INTO Farm (FarmID, FarmName, WaterTemperature) VALUES (3, 'Farm C', 15); ... | What is the average feeding rate for Trout in farms with water temperature between 10 and 25 degrees Celsius? | SELECT AVG(FeedingRate) FROM FishStock fs WHERE FishSpecies = 'Trout' AND fs.FarmID IN (SELECT FarmID FROM Farm WHERE WaterTemperature BETWEEN 10 AND 25); | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicTransportation(Quarter VARCHAR(10), Score INT); INSERT INTO PublicTransportation VALUES ('Q3 2017', 80), ('Q3 2017', 70), ('Q3 2018', 85), ('Q3 2018', 75), ('Q3 2019', 90), ('Q3 2019', 80); | What was the citizen satisfaction score for public transportation in Q3 2018? | SELECT AVG(Score) FROM PublicTransportation WHERE Quarter = 'Q3 2018'; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, animal_name VARCHAR(50), population INT); CREATE TABLE critical_habitats (id INT, habitat_name VARCHAR(50), animal_name VARCHAR(50)); INSERT INTO animal_population VALUES (1, 'Elephant', 1000); | What are the names of animals in 'animal_population' table that do not have a corresponding record in 'critical_habitats' table? | SELECT DISTINCT ap.animal_name FROM animal_population ap LEFT JOIN critical_habitats ch ON ap.animal_name = ch.animal_name WHERE ch.animal_name IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_manufacturing (id INT PRIMARY KEY, chemical_name VARCHAR(100), manufacturing_location VARCHAR(100), production_volume INT); INSERT INTO chemical_manufacturing (id, chemical_name, manufacturing_location, production_volume) VALUES (1, 'Hydrochloric Acid', 'USA', 1000), (2, 'Sulfuric Acid', 'China', ... | Update the production_volume for Sodium Hydroxide in the chemical_manufacturing table. | UPDATE chemical_manufacturing SET production_volume = 850 WHERE chemical_name = 'Sodium Hydroxide'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sea_Bass_Stock (farm VARCHAR(20), quantity INT); INSERT INTO Sea_Bass_Stock (farm, quantity) VALUES ('Baltic Farm 1', 3000), ('Baltic Farm 2', 4000), ('North Sea Farm 1', 5000), ('North Sea Farm 2', 6000); | What is the sum of sea bass stock for farms in the Baltic and North seas? | SELECT SUM(quantity) FROM Sea_Bass_Stock WHERE farm LIKE '%Baltic%' OR farm LIKE '%North%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtClasses (ClassID INT, AgeGroup VARCHAR(50), StartDate DATE, EndDate DATE, Price DECIMAL(10,2)); INSERT INTO ArtClasses (ClassID, AgeGroup, StartDate, EndDate, Price) VALUES (1, '5-10', '2022-07-01', '2022-07-31', 100.00), (2, '11-15', '2022-07-01', '2022-07-31', 150.00); | What was the total revenue from art classes by age group in H1 2022? | SELECT SUM(Price) AS TotalRevenue, AgeGroup FROM ArtClasses WHERE MONTH(StartDate) BETWEEN 1 AND 6 GROUP BY AgeGroup; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_applications (id INT, name VARCHAR, number_of_transactions INT); INSERT INTO decentralized_applications (id, name, number_of_transactions) VALUES (1, 'DA1', 1000), (2, 'DA2', 2000), (3, 'DA3', 1500), (4, 'DA4', 2500), (5, 'DA5', 500), (6, 'DA6', 3000); | Rank the decentralized applications by the total number of transactions, and assign a rank of 1 to the decentralized application with the highest number of transactions. | SELECT *, RANK() OVER (ORDER BY number_of_transactions DESC) as rank FROM decentralized_applications; | gretelai_synthetic_text_to_sql |
CREATE TABLE factory_efficiency (factory_id INT, year INT, quarter INT, production_rate FLOAT, defect_rate FLOAT); INSERT INTO factory_efficiency VALUES (1, 2021, 1, 0.95, 0.05), (2, 2021, 1, 0.90, 0.10), (3, 2021, 2, 0.96, 0.04), (4, 2021, 2, 0.92, 0.08); | Which factories have a higher than average defect rate? | SELECT factory_id, defect_rate FROM factory_efficiency WHERE defect_rate > (SELECT AVG(defect_rate) FROM factory_efficiency); | gretelai_synthetic_text_to_sql |
CREATE TABLE company (company_id INT, company_name VARCHAR(50), is_b_corp BOOLEAN); CREATE VIEW company_sales AS SELECT company_id, SUM(quantity) AS total_quantity FROM sales GROUP BY company_id; | What is the total quantity of cosmetic products sold by companies that are certified B-Corporations? | SELECT SUM(total_quantity) FROM company_sales INNER JOIN company ON company_sales.company_id = company.company_id WHERE is_b_corp = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contractors (id INT, name VARCHAR(100));CREATE TABLE Hires (id INT, contractor_id INT, job_category VARCHAR(50), veteran BOOLEAN); INSERT INTO Contractors (id, name) VALUES (1, 'Lockheed Martin'), (2, 'Boeing'); INSERT INTO Hires (id, contractor_id, job_category, veteran) VALUES (1, 1, 'Engineering', TRUE)... | What is the total number of veteran hires by defense contractors, broken down by contractor and job category? | SELECT c.name, h.job_category, SUM(h.veteran) AS veteran_hires FROM Hires h JOIN Contractors c ON h.contractor_id = c.id GROUP BY c.name, h.job_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE workplace_safety (id INT, company VARCHAR, incident_date DATE, description VARCHAR, severity VARCHAR); INSERT INTO workplace_safety (id, company, incident_date, description, severity) VALUES (13, 'LMN Inc', '2022-04-07', 'Equipment damage', 'Minor'); INSERT INTO workplace_safety (id, company, incident_date... | What is the average severity of workplace safety incidents per company? | SELECT company, AVG(CASE WHEN severity IN ('Minor', 'Moderate', 'Major') THEN severity END) OVER (PARTITION BY company) as avg_severity FROM workplace_safety; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_consumption (consumption_date DATE, consumption_gallons INT); INSERT INTO water_consumption (consumption_date, consumption_gallons) VALUES ('2022-01-01', 98345200), ('2022-01-02', 87345200), ('2022-01-03', 76345200); | What is the average water consumption per day for the last 30 days? | SELECT AVG(consumption_gallons) as avg_consumption FROM water_consumption WHERE consumption_date >= DATEADD(day, -30, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE port (port_id INT, port_name VARCHAR(50)); INSERT INTO port (port_id, port_name) VALUES (1, 'Oakland'), (2, 'Seattle'); CREATE TABLE vessels (vessel_id INT, port_id INT, quantity_containers INT, year INT); INSERT INTO vessels (vessel_id, port_id, quantity_containers, year) VALUES (101, 1, 500, 2020), (102,... | What is the total quantity of containers loaded on vessels in the ports of Oakland and Seattle for the year 2020, excluding vessels that have less than 500 containers? | SELECT SUM(quantity_containers) FROM vessels JOIN port ON vessels.port_id = port.port_id WHERE (port.port_name = 'Oakland' OR port.port_name = 'Seattle') AND vessels.year = 2020 AND vessels.quantity_containers >= 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (ID INT, Age INT, Gender VARCHAR(10), Rating INT, City VARCHAR(20), State VARCHAR(20), Country VARCHAR(20), Sexuality VARCHAR(20)); INSERT INTO Visitors (ID, Age, Gender, Rating, City, State, Country, Sexuality) VALUES (1, 30, 'Non-binary', 8, 'San Francisco', 'CA', 'USA', 'LGBTQ+'); CREATE TABLE ... | What is the number of visitors who identified as LGBTQ+ that attended virtual exhibitions in San Francisco, CA, USA in 2024 and their average rating? | SELECT AVG(Visitors.Rating), COUNT(Visitors.ID) FROM Visitors INNER JOIN Exhibitions ON Visitors.City = Exhibitions.City AND Visitors.State = Exhibitions.State AND Visitors.Country = Exhibitions.Country WHERE Exhibitions.Virtual = TRUE AND Visitors.Sexuality = 'LGBTQ+' AND Exhibitions.Date BETWEEN '2024-01-01' AND '202... | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, gender TEXT, num_funding_rounds INT); | What is the average number of funding rounds per female-founded startup? | SELECT AVG(num_funding_rounds) FROM startup WHERE gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParityRegulations (State VARCHAR(20), Year INT, Regulation VARCHAR(100)); INSERT INTO MentalHealthParityRegulations (State, Year, Regulation) VALUES ('California', 2011, 'Regulation 1'), ('California', 2015, 'Regulation 2'), ('California', 2019, 'Regulation 3'), ('Texas', 2012, 'Regulation A'),... | List all mental health parity regulations in California and Texas that were implemented since 2010. | SELECT * FROM MentalHealthParityRegulations WHERE State IN ('California', 'Texas') AND Year >= 2010; | 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.