context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE products (product_id INT, product_name TEXT, supplier_id INT, certified TEXT); INSERT INTO products (product_id, product_name, supplier_id, certified) VALUES (1, 'Lipstick A', 1001, 'organic'), (2, 'Eye Shadow B', 1002, 'vegan'), (3, 'Mascara C', 1001, 'organic'), (4, 'Foundation D', 1003, 'cruelty-free'),... | Who are the top 5 suppliers for cosmetic products that are certified organic? | SELECT s.supplier_name, COUNT(p.product_id) AS product_count FROM suppliers s JOIN products p ON s.supplier_id = p.supplier_id WHERE p.certified = 'organic' GROUP BY s.supplier_name ORDER BY product_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_research_missions (id INT, mission_name TEXT, mission_depth FLOAT); INSERT INTO marine_research_missions (id, mission_name, mission_depth) VALUES (1, 'Mission Alpha', 4000.1), (2, 'Mission Bravo', 3500.5), (3, 'Mission Charlie', 5000.7); | What is the maximum depth reached by a marine research mission? | SELECT MAX(mission_depth) FROM marine_research_missions; | gretelai_synthetic_text_to_sql |
CREATE TABLE offshore_platforms (platform_id INT, platform_name VARCHAR(50), location VARCHAR(50), operational_status VARCHAR(15)); INSERT INTO offshore_platforms VALUES (1, 'Gulfstar', 'Gulf of Mexico', 'Active'); INSERT INTO offshore_platforms VALUES (2, 'Atlantis', 'Gulf of Mexico', 'Active'); CREATE TABLE oil_produ... | What is the total oil production for offshore platforms in the Gulf of Mexico? | SELECT SUM(production) FROM oil_production JOIN offshore_platforms ON oil_production.platform_id = offshore_platforms.platform_id WHERE offshore_platforms.location = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cricket_world_cup (year INT, winner VARCHAR(50)); INSERT INTO cricket_world_cup (year, winner) VALUES (1975, 'West Indies'); INSERT INTO cricket_world_cup (year, winner) VALUES (1979, 'West Indies'); | Which cricket team has the most World Cup titles? | SELECT winner FROM cricket_world_cup WHERE (SELECT COUNT(*) FROM cricket_world_cup WHERE winner = (SELECT winner FROM cricket_world_cup WHERE year = 1975)) > (SELECT COUNT(*) FROM cricket_world_cup WHERE winner = (SELECT winner FROM cricket_world_cup WHERE year = 1992)); | gretelai_synthetic_text_to_sql |
CREATE TABLE CarbonOffsetProjects (id INT, name VARCHAR(50), co2_offset FLOAT); INSERT INTO CarbonOffsetProjects (id, name, co2_offset) VALUES (1, 'ProjectA', 1000), (2, 'ProjectB', 2000), (3, 'ProjectC', 3000); | What is the total CO2 offset for each carbon offset project? | SELECT name, SUM(co2_offset) FROM CarbonOffsetProjects GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_prices (ticket_id INT, team_id INT, sport_id INT, avg_ticket_price DECIMAL(10,2)); CREATE TABLE teams (team_id INT, team_name VARCHAR(255), sport_id INT); CREATE TABLE sports (sport_id INT, sport_name VARCHAR(255)); INSERT INTO ticket_prices VALUES (1, 101, 1, 75.00), (2, 102, 2, 100.00), (3, 101, 1... | What is the average ticket price for each team, split by sport? | SELECT sp.sport_name, t.team_name, tp.avg_ticket_price FROM ticket_prices tp JOIN teams t ON tp.team_id = t.team_id JOIN sports sp ON t.sport_id = sp.sport_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE reserves_summary (id INT, metal VARCHAR(10), max_quantity INT); INSERT INTO reserves_summary (id, metal, max_quantity) VALUES (1, 'gold', 1000), (2, 'silver', 750), (3, 'copper', 900); | What is the maximum number of 'silver' reserves? | SELECT MAX(max_quantity) FROM reserves_summary WHERE metal = 'silver'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SnowfallData (id INT, year INT, month INT, snowfall FLOAT); INSERT INTO SnowfallData (id, year, month, snowfall) VALUES (1, 2017, 1, 15.2), (2, 2017, 2, 13.5), (3, 2017, 3, 16.3); | What is the total snowfall per year for the past 5 years? | SELECT year, SUM(snowfall) FROM SnowfallData WHERE year IN (2017, 2018, 2019, 2020, 2021) GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (location VARCHAR(255), temperature INT, time DATETIME); INSERT INTO WeatherData (location, temperature, time) VALUES ('Canadian Arctic', 10, '2021-01-01 00:00:00'); INSERT INTO WeatherData (location, temperature, time) VALUES ('Canadian Arctic', 12, '2021-01-02 00:00:00'); | Find the maximum and minimum temperature in the Canadian Arctic in the year 2021 | SELECT MAX(temperature) as max_temp, MIN(temperature) as min_temp FROM WeatherData WHERE location = 'Canadian Arctic' AND YEAR(time) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, Name VARCHAR(50), Country VARCHAR(50), StartDate DATE, EndDate DATE); INSERT INTO Events (EventID, Name, Country, StartDate, EndDate) VALUES (1, 'Evo', 'USA', '2023-08-04', '2023-08-06'); INSERT INTO Events (EventID, Name, Country, StartDate, EndDate) VALUES (2, 'DreamHack', 'Sweden', ... | Which country hosted the most eSports events in 2023? | SELECT Country, COUNT(*) as NumEvents FROM Events WHERE YEAR(StartDate) = 2023 GROUP BY Country ORDER BY NumEvents DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Investments (InvestmentID INT, StrategyID INT); INSERT INTO Investments (InvestmentID, StrategyID) VALUES (1, 1), (2, 1), (3, 2), (4, 2), (5, 3), (6, 3), (7, 4), (8, 4), (9, 1), (10, 2); CREATE TABLE InvestmentStrategies (StrategyID INT, StrategyName VARCHAR(20)); INSERT INTO InvestmentStrategies (Strategy... | How many investments were made using each investment strategy? | SELECT StrategyName, COUNT(*) as NumberOfInvestments FROM Investments JOIN InvestmentStrategies ON Investments.StrategyID = InvestmentStrategies.StrategyID GROUP BY StrategyName; | gretelai_synthetic_text_to_sql |
CREATE TABLE accounts_4 (id INT, customer_id INT, type VARCHAR(255), balance DECIMAL(10,2)); INSERT INTO accounts_4 (id, customer_id, type, balance) VALUES (1, 1, 'Checking', 5000.00), (2, 1, 'Credit Card', 2000.00), (3, 2, 'Checking', 2000.00), (4, 3, 'Credit Card', 8000.00); | Identify customers who have both checking and credit card accounts, and determine the total balance for each customer's checking and credit card accounts. | SELECT a1.customer_id, SUM(a1.balance + a2.balance) as total_balance FROM accounts_4 a1 JOIN accounts_4 a2 ON a1.customer_id = a2.customer_id WHERE a1.type = 'Checking' AND a2.type = 'Credit Card' GROUP BY a1.customer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (donation_id INT, donation_type VARCHAR(20), amount INT, year INT, month INT); INSERT INTO Donations (donation_id, donation_type, amount, year, month) VALUES (1, 'Individual', 50, 2019, 1), (2, 'Corporate', 1000, 2019, 1), (3, 'Individual', 75, 2019, 2), (4, 'Corporate', 1200, 2019, 2), (5, 'Foun... | What was the total amount of donations received in 2019, categorized by donation type and month? | SELECT donation_type, month, SUM(amount) FROM Donations WHERE year = 2019 GROUP BY donation_type, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Songs (SongID INT, SongName VARCHAR(100), Genre VARCHAR(50), Country VARCHAR(50)); INSERT INTO Songs VALUES (1, 'Song1', 'Pop', 'USA'); INSERT INTO Songs VALUES (2, 'Song2', 'Pop', 'Canada'); INSERT INTO Songs VALUES (3, 'Song3', 'Rock', 'USA'); | How many unique genres of music are there in the database? | SELECT COUNT(DISTINCT Genre) FROM Songs; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact_categories (category_id INT, category_name TEXT); CREATE TABLE investments (investment_id INT, category_id INT); | List the impact categories and the number of investments made in each category. | SELECT category_name, COUNT(*) FROM impact_categories i JOIN investments j ON i.category_id = j.category_id GROUP BY category_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (item_id INT, item_name VARCHAR(50), quantity INT, warehouse_id INT); | Show all records from the Inventory table where the item_name is 'Apples' or 'Bananas' | SELECT * FROM Inventory WHERE item_name IN ('Apples', 'Bananas'); | gretelai_synthetic_text_to_sql |
CREATE TABLE music_platforms (id INT, platform_name VARCHAR(50)); | Delete music platform with id 2 from the music_platforms table | DELETE FROM music_platforms WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name VARCHAR(255), num_beds INT, rural BOOLEAN, state VARCHAR(255)); INSERT INTO hospitals (id, name, num_beds, rural, state) VALUES (1, 'Hospital A', 40, true, 'California'); INSERT INTO hospitals (id, name, num_beds, rural, state) VALUES (2, 'Hospital B', 75, false, 'California'); | How many hospitals are there in rural California with fewer than 50 beds? | SELECT COUNT(*) FROM hospitals WHERE num_beds < 50 AND rural = true AND state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (id INT, customer_id INT, transaction_date DATE, amount DECIMAL(10,2)); INSERT INTO transactions (id, customer_id, transaction_date, amount) VALUES (1, 1, '2023-02-14', 100.00), (2, 2, '2023-02-15', 200.00), (3, 1, '2022-12-31', 150.00); | How many transactions were made in each month for the last year? | SELECT MONTH(transaction_date), COUNT(*) FROM transactions WHERE transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY MONTH(transaction_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_site_employment (id INT PRIMARY KEY, site_id INT, local_employment INT); | Update the number of local employees for a cultural heritage site | UPDATE heritage_site_employment SET local_employment = 25 WHERE site_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(100), department VARCHAR(50), publication_count INT); INSERT INTO students VALUES (1, 'Taylor Brown', 'Art', 1); | What is the publication rate of graduate students in the Art department? | SELECT department, AVG(publication_count) FROM students WHERE department = 'Art' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Genre VARCHAR(50)); INSERT INTO Artists (ArtistID, ArtistName, Genre) VALUES (1, 'Taylor Swift', 'Pop'); INSERT INTO Artists (ArtistID, ArtistName, Genre) VALUES (2, 'Green Day', 'Rock'); | Which artists have released songs both in the Pop and Rock genres? | SELECT ArtistName FROM Artists WHERE Genre = 'Pop' INTERSECT SELECT ArtistName FROM Artists WHERE Genre = 'Rock'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, donor_id, donation_amount, donation_date) VALUES (1, 1, 500.00, '2022-01-01'), (2, 2, 300.00, '2022-01-15'), (3, 1, 200.00, '2022-02-01'); | Find the number of unique donors who made a donation in each month of 2022. | SELECT EXTRACT(MONTH FROM donation_date) as month, COUNT(DISTINCT donor_id) as num_donors FROM donations WHERE donation_date >= '2022-01-01' AND donation_date <= '2022-12-31' GROUP BY month ORDER BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (ProductionID INT, WellID INT, ProductionDate DATE, ProductionRate FLOAT, Country VARCHAR(50)); INSERT INTO Production (ProductionID, WellID, ProductionDate, ProductionRate, Country) VALUES (1, 1, '2022-01-01', 500, 'USA'), (2, 2, '2022-01-15', 600, 'Canada'), (3, 3, '2022-02-01', 700, 'Mexico')... | What is the production rate trend for each well over the past month? | SELECT WellID, ProductionDate, ProductionRate, ROW_NUMBER() OVER (PARTITION BY WellID ORDER BY ProductionDate DESC) AS RowNumber FROM Production WHERE ProductionDate >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (id INT, event_name VARCHAR(100), event_type VARCHAR(50), location VARCHAR(100), start_time TIMESTAMP, end_time TIMESTAMP); CREATE TABLE Attendees (id INT, attendee_age INT, event_id INT); | What is the total attendance by age group, for music events in Berlin, in the last 3 months? | SELECT attendee_age_group, SUM(attendance) as total_attendance FROM (SELECT attendee_age AS attendee_age_group, COUNT(*) AS attendance FROM Attendees JOIN Events ON Attendees.event_id = Events.id WHERE Events.event_type = 'music' AND Events.location LIKE '%Berlin%' AND start_time >= NOW() - INTERVAL '3 months' GROUP BY... | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_hours (employee_id INT, state VARCHAR(2), year INT, hours INT); INSERT INTO labor_hours (employee_id, state, year, hours) VALUES (1, 'MI', 2019, 2000); CREATE TABLE employment (employee_id INT, industry VARCHAR(20), state VARCHAR(2), year INT, employed INT); INSERT INTO employment (employee_id, indus... | What is the average number of construction labor hours worked per worker in Michigan in 2019? | SELECT AVG(hours/employed) FROM labor_hours, employment WHERE labor_hours.employee_id = employment.employee_id AND state = 'MI' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturers (id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(255)); INSERT INTO manufacturers (id, name, country) VALUES (1, 'ABC Garments', 'India'), (2, 'XYZ Fashion', 'Bangladesh'), (3, 'MNO Clothing', 'Vietnam'); CREATE TABLE garments (id INT PRIMARY KEY, manufacturer_id INT, quantity_manufact... | What is the total quantity of unsold garments for each country where the manufacturer is based, grouped by country and ordered by total quantity in descending order? | SELECT country, SUM(quantity_manufactured - quantity_sold) as total_unsold_quantity FROM garments JOIN manufacturers ON garments.manufacturer_id = manufacturers.id GROUP BY country ORDER BY total_unsold_quantity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_impact_australia(id INT, location VARCHAR(50), impact FLOAT, year INT); INSERT INTO drought_impact_australia(id, location, impact, year) VALUES (1, 'Melbourne', 22.3, 2019); | Which locations in Australia had the highest drought impact in the last 5 years? | SELECT location, MAX(impact) as max_impact FROM drought_impact_australia WHERE year BETWEEN (SELECT MAX(year) - 5 FROM drought_impact_australia) AND MAX(year) GROUP BY location ORDER BY max_impact DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (country VARCHAR(50), mineral VARCHAR(50), tons FLOAT, date DATE); INSERT INTO mines (country, mineral, tons, date) VALUES ('Mexico', 'Silver', 120, '2021-01-01'), ('Peru', 'Silver', 150, '2021-01-01'), ('Chile', 'Silver', 90, '2021-01-01'), ('Mexico', 'Silver', 130, '2021-02-01'), ('Peru', 'Silver',... | What are the total tons of silver mined by each country in Q1 2021? | SELECT country, SUM(tons) as total_tons FROM mines WHERE mineral = 'Silver' AND YEAR(date) = 2021 AND QUARTER(date) = 1 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, Name varchar(50), Department varchar(50)); CREATE TABLE Training (TrainingID int, EmployeeID int, TrainingName varchar(50), CompletedDate date); CREATE TABLE TrainingCategories (TrainingID int, Category varchar(50)); INSERT INTO Employees (EmployeeID, Name, Department) VALUES (1,... | How many employees have completed diversity and inclusion training in the Marketing department? | SELECT COUNT(*) FROM Employees e JOIN Training t ON e.EmployeeID = t.EmployeeID JOIN TrainingCategories tc ON t.TrainingID = tc.TrainingID WHERE e.Department = 'Marketing' AND tc.Category = 'Diversity and Inclusion'; | gretelai_synthetic_text_to_sql |
CREATE TABLE reimbursement_rates (drug_name VARCHAR(255), reimbursement_status VARCHAR(255)); | Show market access strategies | SELECT * FROM market_access_strategies; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (country VARCHAR(50), year INT, total_waste FLOAT, recyclable_waste FLOAT, recycled_waste FLOAT); INSERT INTO waste_generation (country, year, total_waste, recyclable_waste, recycled_waste) VALUES ('Australia', 2020, 150, 75, 60); | What is the percentage of recyclable waste that was actually recycled in Australia in 2020? | SELECT recycled_waste / recyclable_waste * 100 AS percentage_recycled FROM waste_generation WHERE country = 'Australia' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (id INT, equipment_name VARCHAR(50), quantity INT); INSERT INTO military_equipment (id, equipment_name, quantity) VALUES (1, 'tank', 20), (2, 'fighter_jet', 12), (3, 'humvee', 8); | Add a new record to the "military_equipment" table with the following information: (4, 'artillery', 18) | INSERT INTO military_equipment (id, equipment_name, quantity) VALUES (4, 'artillery', 18); | gretelai_synthetic_text_to_sql |
CREATE TABLE PrecisionAgriculture.HarvestYield (FieldID INT, Yield FLOAT, HarvestDate DATE); CREATE TABLE PrecisionAgriculture.FieldDetails (FieldID INT, FieldSize FLOAT, Location VARCHAR(255)); | Select the location and average yield of the fields with a size greater than 5000 square meters | SELECT fd.Location, AVG(hy.Yield) FROM PrecisionAgriculture.FieldDetails fd INNER JOIN PrecisionAgriculture.HarvestYield hy ON fd.FieldID = hy.FieldID WHERE fd.FieldSize > 5000 GROUP BY fd.Location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, Name varchar(50), TotalDonation numeric); INSERT INTO Donors (DonorID, Name, TotalDonation) VALUES (1, 'John Doe', 500), (2, 'Jane Smith', 800), (3, 'Michael Lee', 300), (4, 'Sophia Chen', 600); | List the names of all donors who have donated more than $500 in total from the 'Donors' table. | SELECT Name FROM Donors WHERE TotalDonation > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE europe_users (id INT, name VARCHAR(255), city VARCHAR(255), country VARCHAR(255)); INSERT INTO europe_users (id, name, city, country) VALUES (1, 'Jan Kowalski', 'Warsaw', 'Poland'), (2, 'Marie Dubois', 'Paris', 'France'); | Identify the top 5 cities with the most registered users in Europe, returning city name, country, and number of users. | SELECT city, country, COUNT(*) as num_users FROM europe_users GROUP BY city, country ORDER BY num_users DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Region_VR_Adoption (Region VARCHAR(20), VR_Users INT, Total_Users INT); INSERT INTO Region_VR_Adoption (Region, VR_Users, Total_Users) VALUES ('North America', 5000, 10000), ('Europe', 7000, 15000), ('Asia', 8000, 20000), ('South America', 3000, 12000), ('Africa', 1000, 5000); | Which regions have the highest VR set adoption rates? | SELECT Region, (VR_Users * 100.0 / Total_Users) AS Adoption_Rate FROM Region_VR_Adoption; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, stars FLOAT, is_eco_friendly BOOLEAN); | What is the average hotel star rating for eco-friendly hotels in Australia? | SELECT AVG(stars) FROM hotels WHERE country = 'Australia' AND is_eco_friendly = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE transparency_sales (sale_id INT, product_id INT, supplier_id INT, sale_quantity INT); INSERT INTO transparency_sales (sale_id, product_id, supplier_id, sale_quantity) VALUES (1, 1, 101, 30), (2, 2, 102, 50), (3, 3, 103, 25); CREATE TABLE suppliers (supplier_id INT, supplier_name TEXT, country TEXT); INSERT... | What is the total quantity of items sold in the transparency_sales table where the supplier is based in Africa? | SELECT SUM(sale_quantity) FROM transparency_sales JOIN suppliers ON transparency_sales.supplier_id = suppliers.supplier_id WHERE suppliers.country = 'Kenya'; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, name VARCHAR(50), location VARCHAR(50), language VARCHAR(50)); INSERT INTO heritage_sites (id, name, location, language) VALUES (1, 'Giza Pyramids', 'Egypt', 'Ancient Egyptian'); | What are the names and languages of all heritage sites in the 'Africa' region? | SELECT name, language FROM heritage_sites WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, name VARCHAR(255), contact_info VARCHAR(255)); CREATE TABLE Volunteer_Hours (id INT, volunteer_id INT, program VARCHAR(255), hours INT); INSERT INTO Volunteers (id, name, contact_info) VALUES (1, 'Alice Johnson', 'alicejohnson@example.com'), (2, 'Brian Lee', 'brianlee@example.com'), (3,... | How many unique volunteers have contributed to the education program? | SELECT COUNT(DISTINCT volunteer_id) as num_unique_volunteers FROM Volunteer_Hours WHERE program = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT); CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, user_id INT, timestamp TIMESTAMP); | How many virtual tours have been taken for hotels in France and Germany? | SELECT COUNT(*) FROM virtual_tours WHERE hotels.country IN ('France', 'Germany'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Glaciers (location VARCHAR(50), num_glaciers INT); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Svalbard', 2100); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Greenland', 2500); INSERT INTO Glaciers (location, num_glaciers) VALUES ('Russian Arctic', 4500); | What is the total number of glaciers in the Arctic region? | SELECT SUM(num_glaciers) FROM Glaciers; | gretelai_synthetic_text_to_sql |
CREATE TABLE refugee_support (id INT, project VARCHAR(50), location VARCHAR(50)); INSERT INTO refugee_support (id, project, location) VALUES (1, 'Food Distribution', 'Syria'), (2, 'Medical Aid', 'Lebanon'), (3, 'Clothing Donation', 'Jordan'); | List all unique types of 'refugee_support' projects and their locations. | SELECT DISTINCT project, location FROM refugee_support; | gretelai_synthetic_text_to_sql |
CREATE TABLE Project_Timelines (ProjectID INT, City VARCHAR(50), ProjectType VARCHAR(50), Timeline INT); | What is the minimum timeline for completing construction projects in Chicago, categorized by project type? | SELECT ProjectType, MIN(Timeline) FROM Project_Timelines WHERE City = 'Chicago' GROUP BY ProjectType; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS military_innovations (id INT PRIMARY KEY, project_name VARCHAR(255), budget INT); | What are military innovation projects with budgets over 10 million? | SELECT * FROM military_innovations WHERE budget > 10000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE training_times (id INT, model_name VARCHAR(50), hardware_platform VARCHAR(50), training_time FLOAT); INSERT INTO training_times (id, model_name, hardware_platform, training_time) VALUES (1, 'ModelA', 'GPU', 2.1), (2, 'ModelB', 'CPU', 1.5), (3, 'ModelC', 'TPU', 2.9); | What is the minimum, maximum, and average training time for AI models using different hardware platforms? | SELECT hardware_platform, MIN(training_time) as min_training_time, MAX(training_time) as max_training_time, AVG(training_time) as avg_training_time FROM training_times GROUP BY hardware_platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, first_name VARCHAR(50), last_name VARCHAR(50), job_title VARCHAR(50), department VARCHAR(50), age INT, salary DECIMAL(10,2), PRIMARY KEY (id)); INSERT INTO employees (id, first_name, last_name, job_title, department, age, salary) VALUES (1, 'John', 'Doe', 'Engineer', 'Mining', 35, 80000.... | What is the average salary for employees in the 'employees' table, grouped by their department, for employees with an age greater than 35? | SELECT department, AVG(salary) FROM employees WHERE age > 35 GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_data (policy_name VARCHAR(255), category VARCHAR(255)); INSERT INTO policy_data VALUES ('Policy A', 'Category 1'), ('Policy B', 'Category 2'), ('Policy C', 'Category 3'), ('Policy D', 'Category 1'), ('Policy E', 'Category 2'); | What is the total number of evidence-based policies implemented in each category? | SELECT category, COUNT(DISTINCT policy_name) FROM policy_data GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA fitness; CREATE TABLE memberships (id INT, member_name VARCHAR(50), region VARCHAR(50), membership_type VARCHAR(50), price DECIMAL(5,2), start_date DATE, end_date DATE); INSERT INTO memberships (id, member_name, region, membership_type, price, start_date, end_date) VALUES (1, 'Jane Doe', 'East Coast', 'Ba... | How many users in the 'East Coast' region have a membership type of 'Basic'? | SELECT COUNT(*) FROM fitness.memberships WHERE region = 'East Coast' AND membership_type = 'Basic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (asset_name TEXT, total_transactions INT, total_value FLOAT); INSERT INTO digital_assets (asset_name, total_transactions, total_value) VALUES ('Avalanche', 15000, 2000000), ('Aave', 12000, 3000000); | What is the total number of transactions and their corresponding value for the digital asset 'Aave'? | SELECT total_transactions, total_value FROM digital_assets WHERE asset_name = 'Aave'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, student_name TEXT); INSERT INTO students (student_id, student_name) VALUES (123, 'John Doe'), (456, 'Jane Smith'), (789, 'Alice Johnson'); CREATE TABLE enrollments (student_id INT, course_name TEXT); INSERT INTO enrollments (student_id, course_name) VALUES (123, 'Intro to Psycholo... | What are the names of the students who have enrolled in 'English Composition'? | SELECT student_name FROM students JOIN enrollments ON students.student_id = enrollments.student_id WHERE course_name = 'English Composition'; | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (id INT, name TEXT, launch_year INT, is_accessible BOOLEAN); INSERT INTO initiatives (id, name, launch_year, is_accessible) VALUES (1, 'InitA', 2021, true), (2, 'InitB', 2019, false), (3, 'InitC', 2021, true), (4, 'InitD', 2020, true); | How many accessible technology initiatives were launched in 2021? | SELECT COUNT(*) FROM initiatives WHERE launch_year = 2021 AND is_accessible = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE GeothermalEnergyProjects (id INT, region VARCHAR(20), installed_capacity INT, project_start_date DATE); INSERT INTO GeothermalEnergyProjects (id, region, installed_capacity, project_start_date) VALUES (1, 'North America', 1000, '2015-01-01'), (2, 'North America', 1500, '2017-05-05'), (3, 'Asia-Pacific', 20... | What is the total installed capacity of geothermal energy projects in North America, implemented before 2018? | SELECT SUM(installed_capacity) FROM GeothermalEnergyProjects WHERE region = 'North America' AND project_start_date < '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProfessionalDevelopment (TeacherID int, Date date, ProfessionalDevelopmentScore int); | Insert a new professional development record into the 'ProfessionalDevelopment' table | INSERT INTO ProfessionalDevelopment (TeacherID, Date, ProfessionalDevelopmentScore) VALUES (5678, '2022-10-01', 90); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainability (id INT, brand VARCHAR(50), score INT, category VARCHAR(50)); | Delete records from sustainability table where score is less than 5 | DELETE FROM sustainability WHERE score < 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergyProjects (id INT, project_status VARCHAR(50), installed_capacity FLOAT); INSERT INTO RenewableEnergyProjects (id, project_status, installed_capacity) VALUES (1, 'Completed', 1000.0), (2, 'In Progress', 1500.0), (3, 'Completed', 1200.0); | What is the minimum installed capacity of renewable energy projects in the 'RenewableEnergyProjects' table, grouped by project_status? | SELECT project_status, MIN(installed_capacity) FROM RenewableEnergyProjects GROUP BY project_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerEvents (EventID INT, EventName VARCHAR(255), Location VARCHAR(255), EventDate DATE); | Create a table named 'VolunteerEvents' | CREATE TABLE VolunteerEvents (EventID INT, EventName VARCHAR(255), Location VARCHAR(255), EventDate DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE regional_newspapers (article_id INT, publication_date DATE, region VARCHAR(50)); | Which regions published the most articles in 'regional_newspapers' table in 2020? | SELECT region, COUNT(*) FROM regional_newspapers WHERE YEAR(publication_date) = 2020 GROUP BY region ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_project (id INT, name VARCHAR(50), country VARCHAR(20), budget FLOAT); INSERT INTO renewable_project (id, name, country, budget) VALUES (1, 'Project 1', 'Canada', 150.0), (2, 'Project 2', 'Canada', 75.5), (3, 'Project 3', 'Canada', 120.0); | List renewable energy projects in Canada with a budget over $100 million. | SELECT name FROM renewable_project WHERE country = 'Canada' AND budget > 100.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE UNESCO_Heritage_Sites (id INT, country VARCHAR(50), site VARCHAR(100)); INSERT INTO UNESCO_Heritage_Sites (id, country, site) VALUES (1, 'China', 'Great Wall'), (2, 'India', 'Taj Mahal'), (3, 'Japan', 'Mount Fuji'); | Show the number of heritage sites in each country in Asia, ordered from the most to the least, along with their respective percentage in relation to the total number of heritage sites in Asia. | SELECT country, COUNT(site) as num_sites, ROUND(COUNT(site) * 100.0 / (SELECT COUNT(*) FROM UNESCO_Heritage_Sites WHERE country = 'Asia'), 2) as percentage FROM UNESCO_Heritage_Sites WHERE country = 'Asia' GROUP BY country ORDER BY num_sites DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_budget (region TEXT, disaster_type TEXT, budget INTEGER); INSERT INTO disaster_budget (region, disaster_type, budget) VALUES ('Asia', 'Flood', 50000), ('Americas', 'Earthquake', 75000), ('Africa', 'Fire', 30000), ('Asia', 'Tsunami', 60000), ('Americas', 'Hurricane', 80000), ('Africa', 'Drought', 4... | What is the maximum budget allocated for a disaster response in each region? | SELECT d.region, MAX(d.budget) FROM disaster_budget d GROUP BY d.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, Name TEXT, Nationality TEXT);CREATE TABLE Artworks (ArtworkID INT, Title TEXT, ArtistID INT);CREATE TABLE GalleryLocations (GalleryID INT, Location TEXT);CREATE TABLE GalleryArtworks (GalleryID INT, ArtworkID INT); | Which artists from Asia have their artwork displayed in galleries located in New York? | SELECT Artists.Name FROM Artists INNER JOIN Artworks ON Artists.ArtistID = Artworks.ArtistID INNER JOIN GalleryArtworks ON Artworks.ArtworkID = GalleryArtworks.ArtworkID INNER JOIN GalleryLocations ON GalleryArtworks.GalleryID = GalleryLocations.GalleryID WHERE Artists.Nationality = 'Asia' AND GalleryLocations.Location... | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_ethics_training (id INT PRIMARY KEY, employee_name VARCHAR(50), training_date DATE); INSERT INTO ai_ethics_training (id, employee_name, training_date) VALUES (1, 'Alice Johnson', '2021-02-01'); INSERT INTO ai_ethics_training (id, employee_name, training_date) VALUES (2, 'Bob Williams', '2020-12-15'); | Delete all records from the "ai_ethics_training" table where the "training_date" is before 2021-01-01 | DELETE FROM ai_ethics_training WHERE training_date < '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtInThePark (event_id INT, region VARCHAR(20), attendee_age INT); INSERT INTO ArtInThePark (event_id, region, attendee_age) VALUES (1, 'Northeast', 34), (2, 'Southeast', 45), (3, 'Midwest', 30); | What is the average age of attendees who have participated in 'Art in the Park' events across all regions? | SELECT AVG(attendee_age) FROM ArtInThePark | gretelai_synthetic_text_to_sql |
CREATE TABLE product_sales (product_id INT, material VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO product_sales (product_id, material, revenue) VALUES (1, 'recycled cotton', 100.00), (2, 'recycled polyester', 150.00), (3, 'recycled cotton', 200.00); | What is the total revenue generated from products made from recycled materials in the ethical fashion industry? | SELECT SUM(revenue) FROM product_sales WHERE material LIKE '%recycled%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (id INT, name VARCHAR(100), company VARCHAR(100), cost FLOAT); INSERT INTO Satellites (id, name, company, cost) VALUES (1, 'New Glenn', 'Blue Origin', 100000000); INSERT INTO Satellites (id, name, company, cost) VALUES (2, 'Blue Moon', 'Blue Origin', 50000000); | What is the average cost of satellites launched by Blue Origin? | SELECT AVG(cost) FROM Satellites WHERE company = 'Blue Origin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_loans (id INT, bank VARCHAR(20), amount DECIMAL(10,2), is_shariah_compliant BOOLEAN); INSERT INTO shariah_compliant_loans (id, bank, amount, is_shariah_compliant) VALUES (1, 'IslamicBank', 3000.00, true), (2, 'IslamicBank', 6000.00, true), (3, 'IslamicBank', 8000.00, true); | Delete records of Shariah-compliant loans with an amount greater than 5000 from the 'shariah_compliant_loans' table. | DELETE FROM shariah_compliant_loans WHERE is_shariah_compliant = true AND amount > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, industry TEXT, founder_community TEXT, funding FLOAT); INSERT INTO startups (id, name, industry, founder_community, funding) VALUES (1, 'TechUnderrepresented', 'Technology', 'Underrepresented', 12000000); | What is the maximum funding received by a startup founded by a person from an underrepresented community in the technology sector? | SELECT MAX(funding) FROM startups WHERE industry = 'Technology' AND founder_community = 'Underrepresented'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_events (id INT, event_name VARCHAR(50), location VARCHAR(50), date DATE, attendees INT); INSERT INTO conservation_events (id, event_name, location, date, attendees) VALUES (7, 'Tree Planting', 'Park', '2022-03-20', 60); INSERT INTO conservation_events (id, event_name, location, date, attendees... | How many conservation events were held in the park habitat in the first half of the year? | SELECT COUNT(*) FROM conservation_events WHERE location = 'Park' AND date BETWEEN '2022-01-01' AND '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE matches (id INT, game VARCHAR(10), player VARCHAR(50), kills INT, deaths INT, season VARCHAR(10), match_date DATE); INSERT INTO matches (id, game, player, kills, deaths, season, match_date) VALUES (1, 'Apex Legends', 'Mia', 20, 5, 'Season 1', '2022-06-15'); | Show the top 3 'Apex Legends' players with the highest kill-death ratio in the current season. | SELECT player, AVG(kills / NULLIF(deaths, 0)) AS kill_death_ratio FROM matches WHERE game = 'Apex Legends' AND season = (SELECT season FROM matches WHERE match_date = (SELECT MAX(match_date) FROM matches WHERE game = 'Apex Legends')) GROUP BY player ORDER BY kill_death_ratio DESC, player DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE TreatmentRegions (TreatmentID int, ConditionID int, Region varchar(50)); INSERT INTO TreatmentRegions (TreatmentID, ConditionID, Region) VALUES (1, 1, 'Northeast'), (2, 1, 'South'), (3, 2, 'Northeast'), (4, 3, 'South'); | What is the number of patients who have not started treatment for each condition by region? | SELECT TreatmentRegions.ConditionID, TreatmentRegions.Region, COUNT(TreatmentRegions.TreatmentID) FROM TreatmentRegions LEFT JOIN TreatmentOutcomes ON TreatmentRegions.TreatmentID = TreatmentOutcomes.TreatmentID WHERE TreatmentOutcomes.Completed IS NULL GROUP BY TreatmentRegions.ConditionID, TreatmentRegions.Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityBudget (CityName VARCHAR(50), Service VARCHAR(50), Allocation INT, Year INT); INSERT INTO CityBudget (CityName, Service, Allocation, Year) VALUES ('CityA', 'Healthcare', 1050000, 2021), ('CityA', 'Education', 850000, 2021), ('CityB', 'Healthcare', 1250000, 2021), ('CityB', 'Education', 950000, 2021), (... | Which city received the highest budget allocation for education in 2021? | SELECT CityName, MAX(Allocation) FROM CityBudget WHERE Service = 'Education' AND Year = 2021 GROUP BY CityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE tokyo_train_maintenance (incident_id INT, incident_date DATE); | What is the maximum number of train maintenance incidents reported in Tokyo in a single day in the past year? | SELECT DATE_FORMAT(incident_date, '%Y-%m-%d') AS date, COUNT(*) AS num_incidents FROM tokyo_train_maintenance WHERE incident_date >= DATE_SUB(NOW(), INTERVAL 1 YEAR) GROUP BY date ORDER BY num_incidents DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_name TEXT, city TEXT, year INT); INSERT INTO Events (event_name, city, year) VALUES ('Theater Performance', 'Chicago', 2021); CREATE TABLE Visitors (visitor_id INT, event_name TEXT, age INT); INSERT INTO Visitors (visitor_id, event_name, age) VALUES (1, 'Theater Performance', 30), (2, 'Theate... | What is the average age of visitors who attended theater performances in Chicago last year? | SELECT AVG(age) FROM Visitors v INNER JOIN Events e ON v.event_name = e.event_name WHERE city = 'Chicago' AND year = 2021 AND event_name = 'Theater Performance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_panels (id INT, installation_year INT, panel_type VARCHAR(20)); INSERT INTO solar_panels (id, installation_year, panel_type) VALUES (1, 2008, 'monocrystalline'), (2, 2011, 'polycrystalline'), (3, 2013, 'thin-film'), (4, 2016, 'bifacial'); CREATE TABLE installations (id INT, solar_panel_id INT, countr... | How many solar panels were installed in Germany between 2010 and 2015? | SELECT COUNT(*) FROM solar_panels JOIN installations ON solar_panels.id = installations.solar_panel_id WHERE installations.country = 'Germany' AND solar_panels.installation_year BETWEEN 2010 AND 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS blockchain_developers (developer_id INT PRIMARY KEY, name VARCHAR(100), gender VARCHAR(10), age INT, country VARCHAR(100), language VARCHAR(50), blockchain VARCHAR(50), contributions INT); CREATE TABLE IF NOT EXISTS decentralized_application_code (code_id INT PRIMARY KEY, developer_id INT, FO... | Who are the top 5 blockchain developers who have contributed the most code to the development of decentralized applications in the Ethereum blockchain, and what is their total number of contributions? | SELECT bd.name, SUM(bd.contributions) FROM blockchain_developers bd JOIN decentralized_application_code dac ON bd.developer_id = dac.developer_id WHERE bd.blockchain = 'Ethereum' GROUP BY bd.name ORDER BY SUM(bd.contributions) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE CaseDates (CaseID INT, Date DATE); INSERT INTO CaseDates (CaseID, Date) VALUES (1, '2021-01-01'), (2, '2021-02-01'), (3, '2021-03-01'), (4, '2021-04-01'), (5, '2021-05-01'); | What is the total billing amount for cases in the 'First' quarter? | SELECT SUM(BillingAmount) FROM CaseBilling INNER JOIN CaseDates ON CaseBilling.CaseID = CaseDates.CaseID WHERE MONTH(Date) BETWEEN 1 AND 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (id INT, city VARCHAR(20), country VARCHAR(20)); INSERT INTO Events (id, city, country) VALUES (1, 'Berlin', 'Germany'), (2, 'Munich', 'Germany'), (3, 'Frankfurt', 'Germany'); | Find the top 3 cities with the most events in Germany. | SELECT city, COUNT(*) as event_count FROM Events WHERE country = 'Germany' GROUP BY city ORDER BY event_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT PRIMARY KEY, name VARCHAR(50), yield INT, year INT, farmer_id INT, FOREIGN KEY (farmer_id) REFERENCES farmers(id)); INSERT INTO crops (id, name, yield, year, farmer_id) VALUES (2, 'Soybeans', 150, 2021, 2); | Which crops were planted in 'Toronto' and their yields? | SELECT c.name, c.yield FROM crops c JOIN farmers f ON c.farmer_id = f.id WHERE f.location = 'Toronto'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EventAttendance (event_id INT, attendance INT, free_admission BOOLEAN); INSERT INTO EventAttendance (event_id, attendance, free_admission) VALUES (1, 100, true), (2, 150, false), (3, 200, true), (4, 250, false), (5, 300, true), (6, 350, false), (7, 400, true), (8, 450, false); | What was the total attendance for events with free admission in H1 2022? | SELECT SUM(attendance) AS total_attendance FROM EventAttendance WHERE free_admission = true AND event_id IN (SELECT event_id FROM Events WHERE event_date BETWEEN '2022-01-01' AND '2022-06-30'); | gretelai_synthetic_text_to_sql |
CREATE TABLE electronics_workers (id INT, name VARCHAR(50), industry VARCHAR(50), ethical_manufacturing VARCHAR(50)); INSERT INTO electronics_workers (id, name, industry, ethical_manufacturing) VALUES (1, 'Alice Johnson', 'Electronics', 'Fair Trade'); INSERT INTO electronics_workers (id, name, industry, ethical_manufac... | How many workers in the electronics industry are part of ethical manufacturing initiatives? | SELECT COUNT(*) FROM electronics_workers WHERE industry = 'Electronics' AND ethical_manufacturing IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE matches (match_id INT, year INT, home_team VARCHAR(255), away_team VARCHAR(255), home_team_score INT, away_team_score INT);CREATE TABLE teams (team_id INT, team_name VARCHAR(255), continent VARCHAR(255)); | How many matches were won by teams from Asia in the FIFA World Cup, by year? | SELECT m.year, COUNT(*) as asian_wins FROM matches m JOIN teams t ON (m.home_team = t.team_name OR m.away_team = t.team_name) WHERE t.continent = 'Asia' AND (m.home_team_score > m.away_team_score OR m.home_team_score = m.away_team_score AND m.home_team = t.team_name) GROUP BY m.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (negotiation_date DATE, parties TEXT); INSERT INTO ContractNegotiations (negotiation_date, parties) VALUES ('2021-07-01', 'PQR Corp - Military'), ('2021-11-15', 'STU Inc - Government'), ('2021-09-20', 'VWX Ltd - Defense Agency'); | How many defense contract negotiations occurred in Q3 and Q4 2021? | SELECT COUNT(*) FROM ContractNegotiations WHERE negotiation_date BETWEEN '2021-07-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity_initiatives (id INT PRIMARY KEY, name VARCHAR(255), sector VARCHAR(255), diversity_score DECIMAL(3, 2)); INSERT INTO diversity_initiatives (id, name, sector, diversity_score) VALUES (8, 'Automotive Diversity Network', 'Automotive', 4.5); | Get records on workforce diversity initiatives in the automotive sector | SELECT * FROM diversity_initiatives WHERE sector = 'Automotive'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Program TEXT, DonationDate DATE); INSERT INTO Donors (DonorID, DonorName, Program, DonationDate) VALUES (1, 'John Doe', 'Education', '2021-12-25'), (2, 'Jane Smith', 'Healthcare', '2022-01-05'), (3, 'John Doe', 'Environment', '2022-02-14'); | List the number of unique donors who have donated to at least two different programs in the last year. | SELECT COUNT(DISTINCT DonorID) FROM (SELECT DonorID, Program FROM Donors WHERE DonationDate >= DATEADD(year, -1, GETDATE()) GROUP BY DonorID, Program HAVING COUNT(DISTINCT Program) > 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (farmer_id INT, province VARCHAR(50), innovation_score INT);CREATE TABLE Provinces (province_id INT, name VARCHAR(50));INSERT INTO Farmers (farmer_id, province, innovation_score) VALUES (1, 'Province A', 75), (2, 'Province B', 85), (3, 'Province C', 90), (4, 'Province A', 70), (5, 'Province B', 80)... | Find the agricultural innovation metrics for farmers in the specified provinces. | SELECT Farmers.province, AVG(Farmers.innovation_score) FROM Farmers WHERE Farmers.province IN ('Province A', 'Province B') GROUP BY Farmers.province; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approval (approval_id INT, drug_name TEXT, approval_date DATE); INSERT INTO drug_approval (approval_id, drug_name, approval_date) VALUES (1, 'DrugM', '2020-01-01'), (2, 'DrugN', '2019-01-01'); | Count of drugs approved in 2020 | SELECT COUNT(*) FROM drug_approval WHERE YEAR(approval_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_tech_adoption (hotel_id INT, hotel_name TEXT, region TEXT, cloud_adoption BOOLEAN); INSERT INTO hotel_tech_adoption (hotel_id, hotel_name, region, cloud_adoption) VALUES (1, 'Hotel A', 'EMEA', true), (2, 'Hotel B', 'EMEA', true), (3, 'Hotel C', 'APAC', false), (4, 'Hotel D', 'APAC', true); | How many hotels have adopted cloud-based systems in 'EMEA' region? | SELECT COUNT(*) FROM hotel_tech_adoption WHERE region = 'EMEA' AND cloud_adoption = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtistsDemographics (ArtistID INT, Age INT, Gender VARCHAR(10), Nationality VARCHAR(50)); INSERT INTO ArtistsDemographics (ArtistID, Age, Gender, Nationality) VALUES (1, 45, 'Male', 'American'), (2, 34, 'Female', 'Canadian'), (3, 50, 'Male', 'British'), (4, 35, 'Female', 'Mexican'), (5, 40, 'Non-binary', '... | Calculate the average age of artists in the 'ArtistsDemographics' table, partitioned by gender. | SELECT Gender, AVG(Age) AS AvgAge FROM ArtistsDemographics GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE CentralAmericanForests (region VARCHAR(20), year INT, timber_volume FLOAT); INSERT INTO CentralAmericanForests (region, year, timber_volume) VALUES ('Central American Forests', 2015, 123.45), ('Central American Forests', 2016, 234.56), ('Central American Forests', 2017, 345.67), ('Central American Forests'... | What is the timber volume harvested in 'Central American Forests' in 2019? | SELECT timber_volume FROM CentralAmericanForests WHERE region = 'Central American Forests' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE disease_prevalence (disease_id INT, name VARCHAR(50), location VARCHAR(20), prevalence INT); INSERT INTO disease_prevalence (disease_id, name, location, prevalence) VALUES (1, 'Diabetes', 'Rural Mississippi', 1200); INSERT INTO disease_prevalence (disease_id, name, location, prevalence) VALUES (2, 'Heart D... | What is the most common disease prevalence in rural areas of Mississippi? | SELECT name, MAX(prevalence) FROM disease_prevalence WHERE location = 'Rural Mississippi' GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy_Advocacy (advocacy_id INT, region VARCHAR(20), budget DECIMAL(10, 2), year INT); INSERT INTO Policy_Advocacy (advocacy_id, region, budget, year) VALUES (1, 'Southeast', 5000, 2020), (2, 'Northwest', 6000, 2019), (3, 'East Coast', 7000, 2020), (4, 'East Coast', 6000, 2019), (5, 'Northeast', 8000, 201... | What is the maximum budget for policy advocacy in "West Coast" region in 2019? | SELECT MAX(budget) FROM Policy_Advocacy WHERE region = 'West Coast' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INT, name VARCHAR(255)); INSERT INTO country (id, name) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); CREATE TABLE incident (id INT, country_id INT, timestamp TIMESTAMP); INSERT INTO incident (id, country_id) VALUES (1, 1), (2, 1), (3, 2), (4, 3), (5, 1); | What is the number of cybersecurity incidents per country in the last quarter? | SELECT c.name, COUNT(i.id) as num_incidents FROM incident i JOIN country c ON i.country_id = c.id WHERE i.timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 MONTH) GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, name VARCHAR(50), law_firm VARCHAR(50), joined_date DATE, win_rate DECIMAL(5, 2)); INSERT INTO attorneys (attorney_id, name, law_firm, joined_date, win_rate) VALUES (1, 'Mohammad Khan', 'Khan & Associates', '2020-01-01', 0.75), (2, 'Sophia Kim', 'Smith & Lee', '2018-06-15', 0.55... | What is the total billing amount for cases handled by attorneys who have been with their law firm for less than 3 years and have a win rate of at least 50%? | SELECT SUM(billing_amount) FROM cases JOIN attorneys ON cases.attorney_id = attorneys.attorney_id WHERE attorneys.joined_date > DATE_SUB(CURDATE(), INTERVAL 3 YEAR) AND attorneys.win_rate >= 0.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE facility_production (name VARCHAR(50), product VARCHAR(20), quantity INT); INSERT INTO facility_production VALUES ('facility A', 'chemical A', 350); INSERT INTO facility_production VALUES ('facility B', 'chemical B', 400); | List unique chemical types used in the top 3 facilities by production volume. | SELECT DISTINCT product FROM (SELECT facility, product, ROW_NUMBER() OVER (PARTITION BY facility ORDER BY quantity DESC) AS rn FROM facility_production) tmp WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donation_amount DECIMAL(10,2), donation_category VARCHAR(255)); INSERT INTO donations (donation_id, donation_amount, donation_category) VALUES (1, 50.00, 'Food'), (2, 100.00, 'Clothing'), (3, 250.00, 'Education'), (4, 300.00, 'Food'), (5, 800.00, 'Health'); | Calculate the total donation amount for each category, pivoted to display categories as columns | SELECT SUM(CASE WHEN donation_category = 'Food' THEN donation_amount ELSE 0 END) as food, SUM(CASE WHEN donation_category = 'Clothing' THEN donation_amount ELSE 0 END) as clothing, SUM(CASE WHEN donation_category = 'Education' THEN donation_amount ELSE 0 END) as education, SUM(CASE WHEN donation_category = 'Health' THE... | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_id INT, state_name VARCHAR(20)); INSERT INTO states (state_id, state_name) VALUES (1, 'New York'), (2, 'California'), (3, 'Texas'); CREATE TABLE mobile_revenue (state_id INT, monthly_revenue DECIMAL(10,2)); INSERT INTO mobile_revenue (state_id, monthly_revenue) VALUES (1, 50000.00), (2, 75000... | What is the average monthly revenue generated from mobile and broadband services in each state? | SELECT s.state_name, AVG(m.monthly_revenue + b.monthly_revenue) as avg_monthly_revenue FROM states s JOIN mobile_revenue m ON s.state_id = m.state_id JOIN broadband_revenue b ON s.state_id = b.state_id GROUP BY s.state_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_economic (economic_id INT, country TEXT, impact FLOAT); INSERT INTO local_economic (economic_id, country, impact) VALUES (1, 'Japan', 2000), (2, 'Germany', 1500), (3, 'Brazil', 1000); | Rank the top 2 countries with the highest local economic impact? | SELECT country, RANK() OVER (ORDER BY impact DESC) as rank FROM local_economic WHERE rank <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE police_officers (officer_id INT, name VARCHAR(255), rank VARCHAR(255)); INSERT INTO police_officers (officer_id, name, rank) VALUES (1, 'John Doe', 'Sergeant'), (2, 'Jane Smith', 'Officer'), (3, 'Mike Johnson', 'Lieutenant'); CREATE TABLE traffic_stops (stop_id INT, officer_id INT, date DATE); INSERT INTO ... | Who are the top 3 community police officers with the highest number of traffic stops? | SELECT officer_id, name, COUNT(*) as total_stops FROM traffic_stops ts JOIN police_officers po ON ts.officer_id = po.officer_id GROUP BY officer_id, name ORDER BY total_stops DESC LIMIT 3; | 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.