context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE AIProjects (ProjectID INT, ProjectName TEXT, Country TEXT, Completion BOOLEAN); INSERT INTO AIProjects (ProjectID, ProjectName, Country, Completion) VALUES (1, 'Project A', 'Germany', TRUE); INSERT INTO AIProjects (ProjectID, ProjectName, Country, Completion) VALUES (2, 'Project B', 'France', FALSE); INSER... | How many ethical AI projects have been completed in European countries? | SELECT COUNT(*) FROM AIProjects WHERE Country IN ('Germany', 'France', 'UK') AND Completion = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (id INT, customer VARCHAR(255), quantity INT, country VARCHAR(255), quarter INT, year INT); | What is the total quantity of items in inventory for customers in Australia in Q3 2022? | SELECT SUM(quantity) FROM Inventory WHERE country = 'Australia' AND quarter = 3 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_companies (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), mission VARCHAR(255)); | Update the "mission" of the company with id 1 in the "tech_companies" table to 'Promote ethical AI' | WITH updated_data AS (UPDATE tech_companies SET mission = 'Promote ethical AI' WHERE id = 1 RETURNING *) SELECT * FROM updated_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE Trout_Farms (Farm_ID INT, Farm_Name TEXT, Location TEXT, Production_Volume INT); INSERT INTO Trout_Farms (Farm_ID, Farm_Name, Location, Production_Volume) VALUES (1, 'Farm X', 'Canada', 200), (2, 'Farm Y', 'US', 250), (3, 'Farm Z', 'Canada', 300); | What is the most common location for Trout_Farms? | SELECT Location, COUNT(*) AS Count FROM Trout_Farms GROUP BY Location ORDER BY Count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE transparency_sales (sale_id INT, product_id INT, sale_quantity INT); INSERT INTO transparency_sales (sale_id, product_id, sale_quantity) VALUES (1, 1, 20), (2, 2, 50), (3, 3, 15), (4, 4, 100), (5, 5, 15); | What is the maximum sale quantity of products in the transparency_sales table? | SELECT MAX(sale_quantity) FROM transparency_sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients(id INT, name TEXT, location TEXT, financial_wellbeing_score INT); | What is the average financial wellbeing score for clients in urban areas? | SELECT AVG(c.financial_wellbeing_score) FROM clients c WHERE c.location LIKE '%urban%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE theater_performances (performance_id INT, participant_name VARCHAR(50), event_type VARCHAR(50)); INSERT INTO theater_performances (performance_id, participant_name, event_type) VALUES (1, 'Ava', 'Drama'), (2, 'Bella', 'Musical'), (3, 'Chloe', 'Tragedy'); | Insert a new record into the 'Theater Performances' table for the participant 'Zoe' who attended the 'Comedy' event. | INSERT INTO theater_performances (performance_id, participant_name, event_type) VALUES (4, 'Zoe', 'Comedy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department) VALUES (1, 'John', 'Doe', 'Mining Operations'); | What is the total number of employees in the 'Mining Operations' department? | SELECT COUNT(*) FROM Employees WHERE Department = 'Mining Operations'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_projects (project_id INT, year INT, region VARCHAR(255), amount FLOAT); INSERT INTO climate_finance_projects VALUES (1, 2019, 'Southeast Asia', 3000000); | What is the total climate finance for Southeast Asian projects in 2019? | SELECT SUM(amount) FROM climate_finance_projects WHERE region = 'Southeast Asia' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO graduate_students (id, name, department) VALUES (1, 'Charlie', 'Computer Science'); INSERT INTO graduate_students (id, name, department) VALUES (2, 'Dana', 'Electrical Engineering'); CREATE TABLE research_grants (id INT, grad... | What is the total grant amount awarded to graduate students in the Engineering department for the year 2022? | SELECT SUM(rg.amount) FROM research_grants rg JOIN graduate_students gs ON rg.graduate_student_id = gs.id WHERE gs.department = 'Engineering' AND rg.year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astrophysics_Research (id INT, research_name VARCHAR(255), researcher_id INT, field_of_study VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO Astrophysics_Research VALUES (1, 'Dark Matter Research', 1001, 'Dark Matter', '2015-01-01', '2018-12-31'), (2, 'Exoplanets Research', 1002, 'Exoplanets', '... | What is the total duration of Exoplanets research for each researcher since 2017? | SELECT researcher_id, SUM(DATEDIFF(end_date, start_date)) as total_days_researched FROM Astrophysics_Research WHERE field_of_study = 'Exoplanets' GROUP BY researcher_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name TEXT, type TEXT, location TEXT); INSERT INTO projects VALUES (1, 'Project A', 'investigative', 'Europe'); INSERT INTO projects VALUES (2, 'Project B', 'regular', 'Europe'); CREATE TABLE regions (id INT, location TEXT); INSERT INTO regions VALUES (1, 'South America'); INSERT INTO re... | What is the total number of investigative journalism projects in 'Europe' and 'South America'? | SELECT COUNT(projects.id) FROM projects INNER JOIN regions ON projects.location = regions.location WHERE regions.location IN ('Europe', 'South America') AND projects.type = 'investigative'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_bed (bed_id INT, hospital_id INT, type TEXT, status TEXT); CREATE TABLE hospital (hospital_id INT, name TEXT, location TEXT, beds INT); | How many hospital beds are available in rural hospitals of New York? | SELECT a.location, SUM(b.beds) FROM hospital a INNER JOIN hospital_bed b ON a.hospital_id = b.hospital_id WHERE a.location LIKE '%rural%' AND b.status = 'available' GROUP BY a.location; | gretelai_synthetic_text_to_sql |
CREATE TABLE TransitData (bus_id INT, fleet_number INT, vehicle_type VARCHAR(10), PRIMARY KEY (bus_id)); | Update the 'vehicle_type' to 'Hybrid' for records with 'fleet_number' 5678 in the 'TransitData' table | UPDATE TransitData SET vehicle_type = 'Hybrid' WHERE fleet_number = 5678; | gretelai_synthetic_text_to_sql |
CREATE TABLE primary_care_physicians(id INT, name TEXT, state TEXT, specialty TEXT); INSERT INTO primary_care_physicians(id, name, state, specialty) VALUES (1, 'Dr. Smith', 'California', 'Primary Care'), (2, 'Dr. Johnson', 'California', 'Cardiology'), (3, 'Dr. Brown', 'New York', 'Primary Care'), (4, 'Dr. Davis', 'New ... | List the number of primary care physicians in each state | SELECT state, COUNT(*) FROM primary_care_physicians WHERE specialty = 'Primary Care' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (region VARCHAR(255), budget INT); INSERT INTO habitat_preservation (region, budget) VALUES ('Asia', 100000), ('Africa', 150000), ('South_America', 75000); | What is the total conservation budget allocated for each region in the 'habitat_preservation' table? | SELECT region, SUM(budget) as total_budget FROM habitat_preservation GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE MusicProducers (ProducerName TEXT, Country TEXT, Year INTEGER, ArtistCountry TEXT); INSERT INTO MusicProducers (ProducerName, Country, Year, ArtistCountry) VALUES ('David Guetta', 'France', 2021, 'USA'), ('Martin Garrix', 'Netherlands', 2021, 'Canada'), ('Kygo', 'Norway', 2021, 'Australia'), ('Alan Walker'... | List all the music producers and their respective countries who have worked with artists from more than one country in 2021. | SELECT ProducerName, Country FROM MusicProducers WHERE Year = 2021 GROUP BY ProducerName, Country HAVING COUNT(DISTINCT ArtistCountry) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE alternative_sentencing_programs (id INT, program_name VARCHAR(255), num_participants INT); INSERT INTO alternative_sentencing_programs (id, program_name, num_participants) VALUES (1, 'Community Service', 500), (2, 'Probation', 800), (3, 'Restorative Justice', 300); | What is the total number of alternative sentencing programs in the justice system? | SELECT SUM(num_participants) FROM alternative_sentencing_programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE mass_sales (product VARCHAR(20), revenue DECIMAL(10,2), state VARCHAR(20), year INT); INSERT INTO mass_sales (product, revenue, state, year) VALUES ('Flower', 70000, 'Massachusetts', 2021), ('Concentrate', 60000, 'Massachusetts', 2021), ('Edibles', 50000, 'Massachusetts', 2021); | Which product category had the lowest total revenue in Massachusetts in 2021? | SELECT product, MIN(revenue) as min_revenue FROM mass_sales WHERE state = 'Massachusetts' AND year = 2021 GROUP BY product; | gretelai_synthetic_text_to_sql |
CREATE TABLE Departments (id INT, department VARCHAR(255)); INSERT INTO Departments (id, department) VALUES (1, 'Design'), (2, 'Production'), (3, 'Marketing'), (4, 'Logistics'); CREATE TABLE Energy_Consumption (id INT, department_id INT, year INT, H1 INT, H2 INT); INSERT INTO Energy_Consumption (id, department_id, year... | What was the total energy consumption for each department in H2 of 2022? | SELECT d.department, SUM(e.H2) FROM Energy_Consumption e JOIN Departments d ON e.department_id = d.id WHERE e.year = 2022 GROUP BY d.department; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_values(investment_id INT, investment_type VARCHAR(20), value FLOAT, country VARCHAR(10)); | What's the total value of social impact investments in India? | SELECT SUM(value) FROM investment_values WHERE investment_type = 'social_impact' AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (id INT, name TEXT, country TEXT, budget_accessible_tech FLOAT); INSERT INTO Companies (id, name, country, budget_accessible_tech) VALUES (1, 'TechCo', 'Germany', 250000), (2, 'GreenTech', 'France', 350000), (3, 'EthicalLabs', 'UK', 450000), (4, 'Tech4All', 'Spain', 500000), (5, 'InclusiveTech', ... | What is the total budget spent on accessible technology by companies in the EU? | SELECT SUM(budget_accessible_tech) FROM Companies WHERE country IN ('Germany', 'France', 'UK', 'Spain', 'Italy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, country VARCHAR(255), name VARCHAR(255), carbon_emissions_reduction INT, start_year INT); INSERT INTO projects (id, country, name, carbon_emissions_reduction, start_year) VALUES (1, 'US', 'Project1', 1500, 2015), (2, 'US', 'Project2', 2000, 2017), (3, 'US', 'Project3', 1000, 2016); | What is the total carbon emissions reduction achieved by clean energy projects in the US since 2015? | SELECT SUM(carbon_emissions_reduction) FROM projects WHERE country = 'US' AND start_year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (MenuID INT, MenuItem VARCHAR(50), MenuType VARCHAR(50), IsVegan BOOLEAN, Price DECIMAL(5, 2)); INSERT INTO Menu (MenuID, MenuItem, MenuType, IsVegan, Price) VALUES (1, 'Vegan Biryani', 'Meal', true, 15.99); CREATE TABLE Orders (OrderID INT, MenuID INT, CustomerLocation VARCHAR(50), OrderDate DATE); I... | How many customers in India ordered a vegan dish in the last month? | SELECT COUNT(*) FROM Orders JOIN Menu ON Orders.MenuID = Menu.MenuID WHERE Menu.IsVegan = true AND Menu.MenuType = 'Meal' AND Orders.OrderDate >= DATEADD(MONTH, -1, GETDATE()) AND CustomerLocation = 'India' AND MenuItem LIKE '%vegan%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transport_Union (union_member_id INT, member_id INT, salary FLOAT, safety_rating FLOAT); INSERT INTO Transport_Union (union_member_id, member_id, salary, safety_rating) VALUES (1, 101, 65000.00, 9.50), (1, 102, 62000.00, 9.25), (2, 201, 68000.00, 8.75), (2, 202, 66000.00, 9.75); | Find the average salary of members in the 'Transport_Union' having a safety_rating above 9. | SELECT AVG(salary) FROM Transport_Union WHERE safety_rating > 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, type TEXT);CREATE TABLE cargoes (id INT, vessel_id INT, tonnage INT, cargo_type TEXT); INSERT INTO vessels (id, name, type) VALUES (1, 'Fishing Vessel A', 'Fishing'), (2, 'Fishing Vessel B', 'Fishing'); INSERT INTO cargoes (id, vessel_id, tonnage, cargo_type) VALUES (1, 1, 1000,... | What is the total tonnage of cargo transported by vessels in the 'Fishing' category in the last month? | SELECT SUM(cargoes.tonnage) FROM cargoes JOIN vessels ON cargoes.vessel_id = vessels.id WHERE vessels.type = 'Fishing' AND cargoes.id >= DATEADD('month', -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE Weather (location VARCHAR(50), month VARCHAR(10), avg_temp FLOAT); INSERT INTO Weather (location, month, avg_temp) VALUES ('Arctic Circle', 'January', -30.1); | What is the average temperature in the Arctic Circle in January? | SELECT avg_temp FROM Weather WHERE location = 'Arctic Circle' AND month = 'January' | gretelai_synthetic_text_to_sql |
CREATE TABLE basketball_matches (player VARCHAR(50), points INT, match_date DATE); | List the names of players who have scored the most points in a single match, in descending order, in the basketball_matches dataset. | SELECT player FROM basketball_matches WHERE points = (SELECT MAX(points) FROM basketball_matches) ORDER BY points DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE charging_stations (company VARCHAR(255), city VARCHAR(255), charging_level VARCHAR(255), count INT); | Update the 'count' to 30 for the 'company' 'Mercedes' in the 'charging_stations' table | UPDATE charging_stations SET count = 30 WHERE company = 'Mercedes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID varchar(10), LastInspectionDate date); CREATE TABLE SafetyIncidents (IncidentID int, VesselID varchar(10), IncidentDate date); INSERT INTO Vessels (VesselID, LastInspectionDate) VALUES ('VesselA', '2021-06-01'), ('VesselB', '2021-07-01'); INSERT INTO SafetyIncidents (IncidentID, VesselID,... | List all vessels with safety incidents in the last 30 days | SELECT Vessels.VesselID FROM Vessels JOIN SafetyIncidents ON Vessels.VesselID = SafetyIncidents.VesselID WHERE SafetyIncidents.IncidentDate > DATEADD(day, -30, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (id INT, faculty_id INT, department VARCHAR(50), year INT, amount FLOAT); INSERT INTO grants (id, faculty_id, department, year, amount) VALUES (1, 1001, 'Biology', 2018, 10000.00), (2, 1001, 'Biology', 2019, 15000.00), (3, 1002, 'Biology', 2018, 20000.00), (4, 1003, 'Biology', 2019, 5000.00); | What is the maximum number of research grants awarded to a single faculty member in the Biology department? | SELECT MAX(amount) FROM grants WHERE faculty_id IN (SELECT faculty_id FROM grants WHERE department = 'Biology' GROUP BY faculty_id HAVING COUNT(DISTINCT year) > 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE if NOT EXISTS crop_planting_3 (id int, crop varchar(50), planting_area float, country varchar(50)); INSERT INTO crop_planting_3 (id, crop, planting_area, country) VALUES (1, 'Canola', 35000, 'Canada'), (2, 'Wheat', 50000, 'Canada'); | List the total planting area for each crop type in Canada? | SELECT crop, SUM(planting_area) FROM crop_planting_3 WHERE country = 'Canada' GROUP BY crop; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (product_id INT, product_name VARCHAR(50), sustainable BOOLEAN, cost INT); CREATE TABLE SupplierProducts (supplier_id INT, product_id INT); INSERT INTO Products (product_id, product_name, sustainable, cost) VALUES (1, 'Quinoa', true, 5), (2, 'Tofu', true, 8), (3, 'Beef', false, 20); INSERT INTO Su... | Show the total cost of non-sustainable food items from suppliers located in 'GreenValley'. | SELECT SUM(Products.cost) FROM Products INNER JOIN SupplierProducts ON Products.product_id = SupplierProducts.product_id INNER JOIN Vendors ON SupplierProducts.supplier_id = Vendors.vendor_id WHERE Vendors.location = 'GreenValley' AND Products.sustainable = false | gretelai_synthetic_text_to_sql |
CREATE TABLE public_libraries (library_name VARCHAR(50), state VARCHAR(20), num_books INT); INSERT INTO public_libraries (library_name, state, num_books) VALUES ('Library 1', 'California', 50000), ('Library 2', 'California', 80000), ('Library 3', 'California', 60000); | What is the number of public libraries and the number of books available in these libraries in California, and what is the average number of books per library in California? | SELECT COUNT(*) as num_libraries, SUM(num_books) as total_books, AVG(num_books) as avg_books_per_library FROM public_libraries WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemicals (id INT, name VARCHAR(255), category VARCHAR(255), safety_stock_level FLOAT, region VARCHAR(255)); | What is the minimum safety stock level for each chemical category, for chemical manufacturing in the North America region? | SELECT category, MIN(safety_stock_level) as min_level FROM chemicals WHERE region = 'North America' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (school_id INT, school_name TEXT); CREATE TABLE teachers (teacher_id INT, teacher_name TEXT, school_id INT); CREATE TABLE courses (course_id INT, course_name TEXT, completion_date DATE); CREATE TABLE teacher_courses (teacher_id INT, course_id INT); INSERT INTO schools VALUES (1, 'School A'), (2, 'S... | How many professional development courses have been completed by teachers from each school? | SELECT s.school_name, COUNT(tc.course_id) FROM schools s INNER JOIN teachers t ON s.school_id = t.school_id INNER JOIN teacher_courses tc ON t.teacher_id = tc.teacher_id INNER JOIN courses c ON tc.course_id = c.course_id GROUP BY s.school_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (menu_item_id INT, restaurant_id INT, name VARCHAR(255), revenue DECIMAL(10, 2)); | Identify the menu items that have a higher than average revenue for all menu items. | SELECT m.name, AVG(o.revenue) OVER (PARTITION BY m.restaurant_id) AS avg_revenue FROM menu_items m JOIN orders o ON m.menu_item_id = o.menu_item_id WHERE m.revenue > AVG(o.revenue) OVER (PARTITION BY m.restaurant_id); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID int, Age int, Gender varchar(10), GamePreference varchar(20)); INSERT INTO Players (PlayerID, Age, Gender, GamePreference) VALUES (1, 25, 'Male', 'FPS'); INSERT INTO Players (PlayerID, Age, Gender, GamePreference) VALUES (2, 30, 'Female', 'RPG'); | What is the total number of players who prefer FPS and RPG games, and what is the average age of these players? | SELECT COUNT(*) AS PlayerCount, AVG(Age) AS AvgAge FROM Players WHERE GamePreference IN ('FPS', 'RPG'); | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permit (id INT, project_name VARCHAR(255), issue_date DATE, expiration_date DATE, permit_type VARCHAR(50)); INSERT INTO building_permit (id, project_name, issue_date, expiration_date, permit_type) VALUES (2, 'Wind Power', '2021-07-15', '2022-06-30', 'Sustainable'); | How many sustainable building permits were issued between July 2021 and December 2021? | SELECT COUNT(*) FROM building_permit WHERE permit_type = 'Sustainable' AND issue_date BETWEEN '2021-07-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (Product VARCHAR(50), Sales FLOAT, Date DATE); INSERT INTO Sales (Product, Sales, Date) VALUES ('T-Shirt', 500, '2022-01-01'), ('Trousers', 700, '2022-01-01'), ('Jacket', 300, '2022-01-01'), ('T-Shirt', 600, '2022-02-01'), ('Trousers', 800, '2022-02-01'), ('Jacket', 350, '2022-02-01'); | What is the monthly sales trend for ethical fashion products? | SELECT DATE_TRUNC('month', Date) AS Month, AVG(Sales) FROM Sales GROUP BY Month ORDER BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, name VARCHAR(50), department VARCHAR(50), salary FLOAT); INSERT INTO Employees (id, name, department, salary) VALUES (1, 'John Doe', 'Mining', 75000.00), (2, 'Jane Smith', 'HR', 60000.00), (3, 'Mike Johnson', 'Mining', 80000.00), (4, 'Sara Davis', 'HR', 65000.00); | How many employees work in the Mining department compared to the HR department? | SELECT department, COUNT(*) FROM Employees GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (PolicyholderID INT, Age INT, Region VARCHAR(10)); CREATE TABLE Policies (PolicyID INT, PolicyholderID INT, Coverage VARCHAR(20), Region VARCHAR(10)); INSERT INTO Policyholders (PolicyholderID, Age, Region) VALUES (1, 35, 'West'); INSERT INTO Policyholders (PolicyholderID, Age, Region) VALUES... | List all policies with a coverage type of 'Premium' and their corresponding policyholders' ages. | SELECT Policies.Coverage, Policyholders.Age FROM Policies INNER JOIN Policyholders ON Policies.PolicyholderID = Policyholders.PolicyholderID WHERE Policies.Coverage = 'Premium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_health_v2 (depth INT, temp FLOAT, dissolved_oxygen FLOAT); INSERT INTO ocean_health_v2 (depth, temp, dissolved_oxygen) VALUES (10, 26.5, 5.0), (15, 28.0, 4.5), (20, 24.5, 6.0), (25, 23.0, 7.0), (30, 27.5, 5.5); | What is the minimum dissolved oxygen level (dissolved_oxygen) for each depth (depth) in the 'ocean_health_v2' table, where the water temperature (temp) is above 25 degrees Celsius? | SELECT depth, MIN(dissolved_oxygen) FROM ocean_health_v2 WHERE temp > 25 GROUP BY depth; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country_Year (Country TEXT, Year INT, Fish_Weight FLOAT); INSERT INTO Country_Year (Country, Year, Fish_Weight) VALUES ('China', 2019, 1200000), ('Indonesia', 2019, 800000), ('India', 2019, 600000), ('China', 2020, 1400000), ('Indonesia', 2020, 900000), ('India', 2020, 700000); | What is the total fish weight for each country per year? | SELECT Country, Year, SUM(Fish_Weight) OVER (PARTITION BY Country) AS Total_Fish_Weight FROM Country_Year; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterScarcity (region VARCHAR(20), scarcity_level VARCHAR(20)); INSERT INTO WaterScarcity (region, scarcity_level) VALUES ('RegionA', 'Moderate'), ('RegionB', 'Severe'), ('RegionC', 'Critical'); | Which regions are facing severe water scarcity in 'WaterScarcity' table? | SELECT region FROM WaterScarcity WHERE scarcity_level = 'Severe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements (id INT, state VARCHAR(255), city VARCHAR(255), year INT, num_employees INT); INSERT INTO cb_agreements (id, state, city, year, num_employees) VALUES (1, 'California', 'San Francisco', 2020, 500), (2, 'California', 'Los Angeles', 2019, 700), (3, 'Texas', 'Dallas', 2020, 800); | How many collective bargaining agreements were signed in California in the year 2020? | SELECT COUNT(*) FROM cb_agreements WHERE state = 'California' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT PRIMARY KEY, donor_id INT, donation_amount DECIMAL(10,2), donation_date DATE, nonprofit_id INT); CREATE TABLE donors (id INT PRIMARY KEY, name VARCHAR(100), city VARCHAR(50)); CREATE TABLE nonprofits (id INT PRIMARY KEY, name VARCHAR(100), city VARCHAR(50), mission VARCHAR(200)); INSERT I... | Insert a new donation from a donor to a nonprofit | INSERT INTO donations (id, donor_id, donation_amount, donation_date, nonprofit_id) VALUES (1, 1, 250, '2023-01-01', 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2)); INSERT INTO products (product_id, product_name, category, price) VALUES (1, 'Liquid Eyeliner', 'Cosmetics', 19.99), (2, 'Organic Moisturizer', 'Skincare', 35.00), (3, 'Concealer', 'Cosmetics', 12.50), (4, 'Aloe... | What is the average price of skincare products that contain only organic ingredients? | SELECT AVG(price) FROM products JOIN ingredients ON products.product_id = ingredients.product_id WHERE category = 'Skincare' AND is_organic = true GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists bus_fares (id INT, city VARCHAR(20), max_fare DECIMAL(3,2)); INSERT INTO bus_fares (id, city, max_fare) VALUES (1, 'Tokyo', 3.50), (2, 'Seoul', 2.80); | What is the maximum fare for buses in Tokyo? | SELECT max_fare FROM bus_fares WHERE city = 'Tokyo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, country VARCHAR(50)); INSERT INTO wells (well_id, country) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); | Find the number of wells drilled in each country, ordered by the most wells drilled | SELECT country, COUNT(well_id) as total_wells FROM wells GROUP BY country ORDER BY total_wells DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturing (manufacturing_id INT, material VARCHAR(20), water_usage FLOAT, manufacturing_date DATE); INSERT INTO Manufacturing (manufacturing_id, material, water_usage, manufacturing_date) VALUES (1, 'Organic Cotton', 1500.0, '2022-01-01'); | What is the total water usage in manufacturing, grouped by month and material type? | SELECT DATE_FORMAT(manufacturing_date, '%Y-%m') as month, material, SUM(water_usage) as total_water_usage FROM Manufacturing GROUP BY month, material; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (id INT, name VARCHAR(50), gender VARCHAR(10), community VARCHAR(30));CREATE TABLE posts (id INT, title VARCHAR(50), author_id INT, post_type VARCHAR(10), publish_date DATE); | What is the total number of articles and blogs published by women authors from underrepresented communities in the last 6 months? | SELECT COUNT(*) FROM posts p JOIN authors a ON p.author_id = a.id WHERE a.gender = 'female' AND a.community IN ('LGBTQ+', 'Minority Races', 'Indigenous') AND p.publish_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Underrepresented_Communities (community TEXT, year INT); CREATE TABLE AI_Safety_Research (research_name TEXT, year INT, domain TEXT); INSERT INTO Underrepresented_Communities VALUES ('Community-A', 2020), ('Community-B', 2020); INSERT INTO AI_Safety_Research VALUES ('AI and Community-A', 2020, 'Safety'); | Which underrepresented communities were studied in AI safety research in 2020? | SELECT Underrepresented_Communities.community FROM Underrepresented_Communities INNER JOIN AI_Safety_Research ON Underrepresented_Communities.community = AI_Safety_Research.community WHERE AI_Safety_Research.domain = 'Safety' AND Underrepresented_Communities.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE soil (id INT PRIMARY KEY, type VARCHAR(50), nutrients VARCHAR(50), location VARCHAR(50)); INSERT INTO soil (id, type, nutrients, location) VALUES (1, 'Sandy', 'Nitrogen, Phosphorus, Potassium', 'Farmfield'); | What is the name and crop of all farmers who grow crops in 'Sandy' soil? | SELECT farmers.name, farmers.crop FROM farmers INNER JOIN soil ON farmers.location = soil.location WHERE soil.type = 'Sandy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Website_Visitors (id INT, country VARCHAR(20), visit_year INT, num_visits INT); INSERT INTO Website_Visitors (id, country, visit_year, num_visits) VALUES (1, 'Canada', 2022, 2500), (2, 'Canada', 2022, 3000), (3, 'Germany', 2022, 4000); | What is the total number of visitors to the museum's website from Canada and Germany in 2022?' | SELECT SUM(num_visits) FROM Website_Visitors WHERE country IN ('Canada', 'Germany') AND visit_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteByMine (WasteID INT, MineType VARCHAR(10), Waste INT); INSERT INTO WasteByMine (WasteID, MineType, Waste) VALUES (1, 'Coal', 1000), (2, 'Coal', 1500), (3, 'Gold', 500); | What is the average amount of waste produced by coal and gold mines? | SELECT MineType, AVG(Waste) FROM WasteByMine WHERE MineType IN ('Coal', 'Gold') GROUP BY MineType; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_activity (id INT, user_id INT, country VARCHAR(255), activity_date DATE); | Find all users who have accessed the network from multiple countries within the past month. | SELECT user_id FROM (SELECT user_id, country, COUNT(*) as activity_count FROM user_activity WHERE activity_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY user_id, country) subquery GROUP BY user_id HAVING COUNT(*) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects (proj_id INT, proj_name VARCHAR(50), region VARCHAR(50), start_date DATE, end_date DATE); CREATE TABLE defense_contracts (cont_id INT, cont_name VARCHAR(50), proj_id INT, cont_status VARCHAR(50), cont_end_date DATE); | Update contract details for 'North America' defense projects with timelines > 2025 | UPDATE defense_contracts dc SET cont_status = 'Active' FROM defense_projects dp WHERE dc.proj_id = dp.proj_id AND dp.region = 'North America' AND dp.start_date < '2026-01-01' AND dp.end_date > '2026-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE High_Risk_Accounts (customer_id INT, name VARCHAR(50), division VARCHAR(20), account_balance DECIMAL(10,2), fraud_flag BOOLEAN); INSERT INTO High_Risk_Accounts (customer_id, name, division, account_balance, fraud_flag) VALUES (4, 'Bob Brown', 'High-Risk', 6000.00, true), (5, 'Charlie Davis', 'High-Risk', 8... | What are the names and account balances of customers who have accounts in the High-Risk division and are also flagged for potential fraud? | SELECT hra.name, hra.account_balance FROM High_Risk_Accounts hra WHERE hra.division = 'High-Risk' AND hra.fraud_flag = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_gardens (id INT, name VARCHAR(20), location VARCHAR(30), area DECIMAL(5,2)); | What is the total area of urban gardens in the 'urban_gardens' table? | SELECT SUM(area) FROM urban_gardens; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval_2 (drug_name TEXT, approval_date DATE, region TEXT); INSERT INTO drug_approval_2 (drug_name, approval_date, region) VALUES ('Drexo', '2020-02-01', 'Canada'), ('Curely', '2018-12-12', 'United States'); | List all drug approval dates for the drug 'Curely' in North America. | SELECT approval_date FROM drug_approval_2 WHERE drug_name = 'Curely' AND region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningSites (SiteID INT, SiteName VARCHAR(50), Location VARCHAR(50), AnnualCoalMined INT); INSERT INTO MiningSites (SiteID, SiteName, Location, AnnualCoalMined) VALUES (1, 'Site A', 'New York', 5000), (2, 'Site B', 'Ohio', 7000); | List all the mining sites, their locations and the total amount of coal mined annually, in descending order of coal mined | SELECT SiteName, Location, AnnualCoalMined FROM MiningSites ORDER BY AnnualCoalMined DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE rehabilitation_center (animal_id INT, species_id INT, admission_date DATE); INSERT INTO rehabilitation_center (animal_id, species_id, admission_date) VALUES (1, 1, '2021-01-05'), (2, 2, '2021-01-12'), (3, 3, '2021-02-18'), (4, 1, '2021-01-15'); | Which animal species have been admitted to the rehabilitation center more than once? | SELECT species_id, COUNT(*) FROM rehabilitation_center GROUP BY species_id HAVING COUNT(*) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE VRDevices (DeviceID INT, DeviceName VARCHAR(20)); | Insert new VR device 'Valve Index' into 'VRDevices' table. | INSERT INTO VRDevices (DeviceID, DeviceName) VALUES (4, 'Valve Index'); | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue (revenue_id INT, hotel_id INT, revenue_date DATE, revenue_channel TEXT, amount FLOAT); INSERT INTO revenue (revenue_id, hotel_id, revenue_date, revenue_channel, amount) VALUES (1, 1, '2022-07-01', 'Direct', 800), (2, 2, '2022-08-15', 'OTA', 700), (3, 1, '2022-09-30', 'Direct', 900); CREATE TABLE ho... | What is the total revenue generated by hotels in the Middle East region that have adopted AI-powered concierge systems? | SELECT region, SUM(amount) FROM revenue r JOIN hotels h ON r.hotel_id = h.hotel_id WHERE ai_concierge = true GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (MetricID INT, MetricType VARCHAR(255), MetricValue INT); | Delete all records in the 'HealthEquityMetrics' table where the metric value is below the median. | DELETE FROM HealthEquityMetrics WHERE MetricValue < (SELECT AVG(MetricValue) FROM HealthEquityMetrics) - (SELECT STDDEV(MetricValue) FROM HealthEquityMetrics); | gretelai_synthetic_text_to_sql |
CREATE TABLE currencies (id INT, name VARCHAR(255), exchange_rate DECIMAL(10, 2)); CREATE TABLE donations (id INT, donor_id INT, donation_date DATE, amount DECIMAL(10, 2), currency_id INT); | What is the total value of donations by currency in the last 6 months? | SELECT currencies.name, SUM(donations.amount * currencies.exchange_rate) FROM donations JOIN currencies ON donations.currency_id = currencies.id WHERE donations.donation_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND CURRENT_DATE GROUP BY donations.currency_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, name VARCHAR(50), location VARCHAR(50), production FLOAT); INSERT INTO wells (well_id, name, location, production) VALUES (1, 'F1', 'Arabian Sea', 4000), (2, 'F2', 'Arabian Sea', 3000), (3, 'F3', 'Arabian Sea', 5000); | What is the total production of wells in the Arabian Sea? | SELECT SUM(production) FROM wells WHERE location = 'Arabian Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor_mapping_projects (project_name TEXT, budget FLOAT); INSERT INTO ocean_floor_mapping_projects (project_name, budget) VALUES ('Atlantic Deep Sea Exploration', 30000000.0), ('Pacific Ocean Mapping Project', 20000000.0), ('Arctic Sea Floor Survey', 22000000.0); | Which ocean floor mapping projects have a budget over 25 million? | SELECT project_name FROM ocean_floor_mapping_projects WHERE budget > 25000000.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE PilotHours (PilotID INT, Name VARCHAR(100), Service VARCHAR(50), TotalHours FLOAT); | What is the total number of hours flown by all pilots in the Air Force? | SELECT SUM(TotalHours) FROM PilotHours WHERE Service = 'Air Force'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, SupplierName VARCHAR(50), Location VARCHAR(50)); INSERT INTO Suppliers (SupplierID, SupplierName, Location) VALUES (1, 'Supplier A', 'Northeast'), (2, 'Supplier B', 'Southeast'); CREATE TABLE Products (ProductID INT, ProductName VARCHAR(50), SupplierID INT, IsOrganic BOOLEAN); IN... | Identify the suppliers that sell both organic and non-organic products? | SELECT SupplierID FROM Products GROUP BY SupplierID HAVING COUNT(DISTINCT IsOrganic) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE justice_schemas.restorative_sessions (id INT PRIMARY KEY, session_type TEXT, duration_minutes INT, was_successful BOOLEAN); | What is the average duration of successful restorative justice sessions in the justice_schemas.restorative_sessions table, grouped by type of session? | SELECT session_type, AVG(duration_minutes) FROM justice_schemas.restorative_sessions WHERE was_successful = TRUE GROUP BY session_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (artwork_id INT, artwork_name VARCHAR(50), artwork_type VARCHAR(50), gallery_name VARCHAR(50)); INSERT INTO Artworks (artwork_id, artwork_name, artwork_type, gallery_name) VALUES (1, 'David', 'Sculpture', 'Renaissance'), (2, 'Mona Lisa', 'Painting', 'Renaissance'); | What is the total number of sculptures in the 'Renaissance' gallery? | SELECT COUNT(*) FROM Artworks WHERE artwork_type = 'Sculpture' AND gallery_name = 'Renaissance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE biodiversity (id INT, species VARCHAR(255), population INT); INSERT INTO biodiversity (id, species, population) VALUES (1, 'Polar Bear', 5000), (2, 'Arctic Fox', 10000), (3, 'Caribou', 20000); | What is the average population of species in the 'biodiversity' table for those with a population less than 10000? | SELECT AVG(population) FROM biodiversity WHERE population < 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE LuxuryCars (Id INT, Make VARCHAR(50), Model VARCHAR(50), Horsepower FLOAT); INSERT INTO LuxuryCars (Id, Make, Model, Horsepower) VALUES (1, 'BMW', '7 Series', 340), (2, 'BMW', '8 Series', 440), (3, 'BMW', 'X5', 300), (4, 'BMW', 'X6', 400); | What is the average horsepower of luxury cars produced by BMW? | SELECT AVG(Horsepower) FROM LuxuryCars WHERE Make = 'BMW' AND Model LIKE '%Luxury%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE museums (museum_id INT, museum_name TEXT, country TEXT); CREATE TABLE virtual_tours (tour_id INT, museum_id INT, revenue INT); INSERT INTO museums (museum_id, museum_name, country) VALUES (1, 'Museum A', 'Italy'), (2, 'Museum B', 'Italy'); INSERT INTO virtual_tours (tour_id, museum_id, revenue) VALUES (1, ... | What is the total revenue of virtual tours for a museum in Italy? | SELECT SUM(revenue) FROM virtual_tours INNER JOIN museums ON virtual_tours.museum_id = museums.museum_id WHERE museum_name = 'Museum A' AND country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales (id INT, country VARCHAR(50), year INT, value FLOAT); INSERT INTO military_sales (id, country, year, value) VALUES (1, 'Australia', 2021, 1000000); INSERT INTO military_sales (id, country, year, value) VALUES (2, 'New Zealand', 2021, 2000000); | What was the total military equipment sales value to Oceania countries in 2021? | SELECT SUM(value) FROM military_sales WHERE YEAR(FROM_UNIXTIME(timestamp)) = 2021 AND country IN ('Australia', 'New Zealand'); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, equipment_type VARCHAR(255), last_maintenance_date DATE, next_maintenance_date DATE, unit_id INT, maintenance_cost FLOAT); | What is the total number of military equipment units that have not been maintained for over a year, and what is the total maintenance cost for those units? | SELECT COUNT(*) AS num_equipment, SUM(maintenance_cost) AS total_cost FROM military_equipment WHERE DATEDIFF(next_maintenance_date, last_maintenance_date) > 365; | gretelai_synthetic_text_to_sql |
CREATE TABLE SociallyResponsibleLending (id INT, institution_name VARCHAR(50), country VARCHAR(50), loan_amount FLOAT); INSERT INTO SociallyResponsibleLending (id, institution_name, country, loan_amount) VALUES (1, 'ACME Socially Responsible Lending', 'USA', 5000), (2, 'XYZ Socially Responsible Lending', 'USA', 7000), ... | What is the average loan amount for socially responsible lending institutions in the United States? | SELECT AVG(loan_amount) as avg_loan_amount FROM SociallyResponsibleLending WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, location VARCHAR(20), coowners INT); INSERT INTO properties (id, location, coowners) VALUES (1, 'urban', 2), (2, 'rural', 1); | What is the minimum number of co-owners for properties in urban areas? | SELECT MIN(coowners) FROM properties WHERE location = 'urban'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, gender VARCHAR(10)); INSERT INTO users (id, gender) VALUES (1, 'Male'); INSERT INTO users (id, gender) VALUES (2, 'Female'); CREATE TABLE runs (id INT, user_id INT, hr INT); INSERT INTO runs (id, user_id, hr) VALUES (1, 1, 145); INSERT INTO runs (id, user_id, hr) VALUES (2, 2, 135); INSERT... | What is the average heart rate for users who identify as female and have completed more than 20 runs? | SELECT AVG(hr) FROM runs JOIN users ON runs.user_id = users.id WHERE gender = 'Female' AND id IN (SELECT user_id FROM runs GROUP BY user_id HAVING COUNT(*) > 20); | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (StudentID INT, Age INT, Gender VARCHAR(10), CoursesTaken VARCHAR(20)); INSERT INTO Students (StudentID, Age, Gender, CoursesTaken) VALUES (1, 22, 'Male', 'Lifelong Learning'); INSERT INTO Students (StudentID, Age, Gender, CoursesTaken) VALUES (2, 20, 'Female', 'Open Pedagogy'); INSERT INTO Studen... | What is the percentage of students who have taken a course on open pedagogy? | SELECT (COUNT(*) FILTER (WHERE CoursesTaken = 'Open Pedagogy')) * 100.0 / COUNT(*) FROM Students; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityData (resident_id INT, age INT, gender VARCHAR(10)); | What is the maximum age of male residents in 'CityData' table? | SELECT MAX(age) FROM CityData WHERE gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE basketball_games (game_id INT, home_team INT, away_team INT, home_team_score INT, away_team_score INT); INSERT INTO basketball_games (game_id, home_team, away_team, home_team_score, away_team_score) VALUES (1, 1, 2, 100, 90), (2, 2, 1, 95, 105); | What is the highest score in the 'basketball_games' table? | SELECT GREATEST(home_team_score, away_team_score) AS highest_score FROM basketball_games; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_type VARCHAR(50), event_date DATE); INSERT INTO events (event_id, event_type, event_date) VALUES (1, 'Dance', '2022-01-10'), (2, 'Theater', '2022-01-15'), (3, 'Music', '2022-02-01'), (4, 'Dance', '2021-12-25'); | How many dance events were held in the last year? | SELECT COUNT(*) FROM events WHERE event_type = 'Dance' AND event_date >= DATEADD(year, -1, CURRENT_TIMESTAMP); | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, program_id INT, gender VARCHAR(10)); INSERT INTO graduate_students (id, program_id, gender) VALUES (1, 1, 'Female'), (2, 1, 'Male'), (3, 2, 'Female'), (4, 2, 'Non-binary'), (5, 3, 'Male'), (6, 3, 'Female'); CREATE TABLE graduate_programs (id INT, name VARCHAR(255)); INSERT INTO g... | How many graduate students are enrolled in each program by gender? | SELECT gp.name, g.gender, COUNT(g.id) FROM graduate_students g JOIN graduate_programs gp ON g.program_id = gp.id GROUP BY gp.name, g.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, user_group VARCHAR(30)); CREATE TABLE transactions (transaction_id INT, user_id INT, transaction_value FLOAT, transaction_date DATE); INSERT INTO users (user_id, user_group) VALUES (1, 'LGBTQ+'); INSERT INTO transactions (transaction_id, user_id, transaction_value, transaction_date) VAL... | What is the average transaction value for users who identify as LGBTQ+, per device type, for the first quarter of 2020? | SELECT device_type, AVG(transaction_value) FROM transactions INNER JOIN users ON transactions.user_id = users.user_id WHERE EXTRACT(MONTH FROM transaction_date) BETWEEN 1 AND 3 AND user_group = 'LGBTQ+' GROUP BY device_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy_initiatives(location VARCHAR(20), launch_date DATE); INSERT INTO circular_economy_initiatives VALUES('Osaka', '2020-01-01'), ('Osaka', '2020-03-15'), ('Tokyo', '2019-12-31'); | How many circular economy initiatives were launched in Osaka in 2020? | SELECT COUNT(*) as initiatives FROM circular_economy_initiatives WHERE location = 'Osaka' AND YEAR(launch_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, sector VARCHAR(20), ESG_rating FLOAT); INSERT INTO companies (id, sector, ESG_rating) VALUES (1, 'technology', 7.5), (2, 'finance', 8.2), (3, 'technology', 7.8); | What is the maximum ESG rating for companies in the 'finance' sector? | SELECT MAX(ESG_rating) FROM companies WHERE sector = 'finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), brand VARCHAR(20), price DECIMAL(5,2)); | Insert a new record into the 'products' table with the following data: 'Product 100', 'Ethical Jeans', 'Eco-Friendly', 65.99 | INSERT INTO products (product_id, product_name, brand, price) VALUES (100, 'Ethical Jeans', 'Eco-Friendly', 65.99); | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends (year INT, ree_price FLOAT); INSERT INTO market_trends (year, ree_price) VALUES (2019, 25.5), (2020, 30.2), (2021, 35.1), (2022, 40.5), (2023, 45.6), (2024, 50.4); CREATE TABLE company_activity (year INT, active BOOLEAN); INSERT INTO company_activity (year, active) VALUES (2019, true), (2020,... | Identify REE market trends by year, price, and the number of companies active in REE production. | SELECT market_trends.year, market_trends.ree_price, COUNT(DISTINCT company_activity.year) as active_companies FROM market_trends INNER JOIN company_activity ON market_trends.year = company_activity.year GROUP BY market_trends.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, state TEXT); INSERT INTO donors (id, name, state) VALUES (1, 'Emily Smith', 'New York'); CREATE TABLE donations (id INT, donor_id INT, org_id INT, donation_amount DECIMAL(10,2)); INSERT INTO donations (id, donor_id, org_id, donation_amount) VALUES (1, 1, 1, 100.00); | List the organizations that have received donations from donors located in 'New York', but have not received donations from donors located in 'Texas' or 'Florida'. | SELECT organizations.name FROM organizations WHERE organizations.id IN (SELECT donations.org_id FROM donations JOIN donors ON donations.donor_id = donors.id WHERE donors.state = 'New York') AND organizations.id NOT IN (SELECT donations.org_id FROM donations JOIN donors ON donations.donor_id = donors.id WHERE donors.sta... | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID int, Age int, Gender varchar(10), GameGenre varchar(20)); INSERT INTO Players (PlayerID, Age, Gender, GameGenre) VALUES (1, 30, 'Male', 'VirtualReality'); | What is the average age of players who play VR games, grouped by the genre of the game? | SELECT GameGenre, AVG(Age) FROM Players WHERE GameGenre = 'VirtualReality' GROUP BY GameGenre; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouses (warehouse_id INT, warehouse_state VARCHAR(50)); INSERT INTO warehouses (warehouse_id, warehouse_state) VALUES (1, 'New York'); CREATE TABLE packages (package_id INT, package_weight INT, warehouse_id INT, recipient_state VARCHAR(50)); INSERT INTO packages (package_id, package_weight, warehouse_i... | What is the total weight of packages shipped to California from warehouse 1? | SELECT SUM(package_weight) FROM packages WHERE warehouse_id = 1 AND recipient_state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, client_name VARCHAR(255), last_contact_date DATE); INSERT INTO clients (client_id, client_name, last_contact_date) VALUES (1, 'John Smith', '2022-01-01'), (2, 'Jane Doe', '2022-02-15'), (3, 'Bob Johnson', '2022-06-30'); CREATE TABLE billing (bill_id INT, client_id INT, bill_date DAT... | List all clients who have not been billed in the last 6 months. | SELECT c.client_name FROM clients c LEFT OUTER JOIN billing b ON c.client_id = b.client_id WHERE b.bill_date IS NULL OR b.bill_date < DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_amount DECIMAL(10,2), donation_date DATE, program_name VARCHAR(50)); INSERT INTO donations (id, donation_amount, donation_date, program_name) VALUES (1, 50.00, '2020-01-05', 'Program A'), (2, 100.00, '2020-03-15', 'Program B'), (3, 75.00, '2020-01-20', 'Program A'), (4, 150.00, ... | What is the average donation amount for each program, excluding anonymous donations, in the year 2020? | SELECT p.program_name, AVG(d.donation_amount) AS avg_donation FROM donations d JOIN programs p ON d.program_name = p.program_name WHERE d.donor_name != 'Anonymous' AND YEAR(d.donation_date) = 2020 GROUP BY p.program_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donor_state VARCHAR(2));CREATE TABLE states (state_id INT, state_name VARCHAR(50), state_population INT); INSERT INTO donations (donation_id, donor_state) VALUES (1, 'NY'), (2, 'CA'), (3, 'IL'), (4, 'TX'), (5, 'AZ'); INSERT INTO states (state_id, state_name, state_population) VA... | What is the average donation amount per capita for each state in the US? | SELECT s.state_name, AVG(d.donation_amount/s.state_population) as avg_donation_per_capita FROM donations d RIGHT JOIN states s ON d.donor_state = s.state_name GROUP BY s.state_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Museum_X (Artifact_ID INT, Material VARCHAR(255)); INSERT INTO Museum_X (Artifact_ID, Material) VALUES (1, 'Clay'); | Count the unique materials at 'Museum X'? | SELECT COUNT(DISTINCT Material) FROM Museum_X; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_vendors (vendor_id INT, name VARCHAR(255), city VARCHAR(255)); INSERT INTO local_vendors (vendor_id, name, city) VALUES (1, 'Tokyo Crafts', 'Tokyo'), (2, 'Seoul Souvenirs', 'Seoul'); | How many local vendors registered in the virtual marketplace are based in Tokyo and Seoul? | SELECT COUNT(*) FROM local_vendors WHERE city IN ('Tokyo', 'Seoul'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Location VARCHAR(20)); INSERT INTO Players (PlayerID, Age, Gender, Location) VALUES (1, 22, 'Female', 'Brazil'); INSERT INTO Players (PlayerID, Age, Gender, Location) VALUES (2, 35, 'Male', 'Argentina'); CREATE TABLE Games (GameID INT, GameName VARCHAR(20... | What's the average age of players who play sports games in South America? | SELECT AVG(Players.Age) FROM Players INNER JOIN Games ON Players.Location = Games.GameName WHERE Games.Genre = 'Sports' AND Players.Location IN ('Brazil', 'Argentina'); | 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.