context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE movies (id INT, title VARCHAR(255), genre VARCHAR(255), budget DECIMAL(10, 2)); INSERT INTO movies (id, title, genre, budget) VALUES (1, 'Movie A', 'Action', 8000000.00), (2, 'Movie B', 'Comedy', 4000000.00); | What is the total production budget for movies in the 'Comedy' genre? | SELECT SUM(budget) FROM movies WHERE genre = 'Comedy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (id INT, country VARCHAR(255), city VARCHAR(255), artist_name VARCHAR(255), tier VARCHAR(255), price DECIMAL(10,2), num_tickets INT); CREATE VIEW artist_cities AS SELECT artist_name, city FROM concerts; | Find the names of artists who have performed in both New York and London. | SELECT artist_name FROM artist_cities WHERE city IN ('New York', 'London') GROUP BY artist_name HAVING COUNT(DISTINCT city) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibits (exhibit_id INT, city VARCHAR(50), price DECIMAL(5,2)); INSERT INTO Exhibits (exhibit_id, city, price) VALUES (1, 'Paris', 45.99), (2, 'London', 32.49), (3, 'Berlin', 50.00); | What is the maximum ticket price for an art exhibit in Paris? | SELECT MAX(price) FROM Exhibits WHERE city = 'Paris'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSite (SiteID INT, SiteName VARCHAR(100), Country VARCHAR(50), StartDate DATE, EndDate DATE); INSERT INTO ExcavationSite (SiteID, SiteName, Country, StartDate, EndDate) VALUES (5, 'Saqqara', 'Egypt', '3200-01-01', '1964-07-01'); CREATE TABLE ResearchProject (ProjectID INT, ProjectName VARCHAR(100)... | What are the ongoing research projects and their funding sources for excavation sites in Egypt? | SELECT rp.ProjectName, e.SiteName, f.SourceName, f.Amount FROM ResearchProject rp JOIN ExcavationSite e ON rp.SiteID = e.SiteID JOIN FundingSource f ON rp.ProjectID = f.ProjectID WHERE e.Country = 'Egypt' AND rp.EndDate >= CURDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name TEXT);CREATE TABLE publication (id INT, faculty_id INT, year INT); | What is the minimum number of publications by a faculty member in the last 3 years? | SELECT MIN(p.count) FROM (SELECT faculty_id, COUNT(*) AS count FROM publication p WHERE p.year BETWEEN YEAR(CURRENT_DATE) - 3 AND YEAR(CURRENT_DATE) GROUP BY faculty_id) p; | gretelai_synthetic_text_to_sql |
CREATE TABLE DisasterAffected (DisasterType VARCHAR(20), AffectedID INT, NumAffected INT); INSERT INTO DisasterAffected (DisasterType, AffectedID, NumAffected) VALUES ('Earthquake', 1, 1000), ('Flood', 2, 1500), ('Hurricane', 3, 2000), ('Tornado', 4, 2500), ('Volcano', 5, 3000); | What is the average number of people affected by each type of disaster? | SELECT DisasterType, AVG(NumAffected) as AvgAffected FROM DisasterAffected GROUP BY DisasterType; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, category VARCHAR(20), billing_amount DECIMAL(5,2)); INSERT INTO cases (case_id, category, billing_amount) VALUES (1, 'Criminal Law', 1500.00), (2, 'Family Law', 2000.00), (3, 'Personal Injury', 4000.00); | What is the total billing amount for cases in the 'Personal Injury' category? | SELECT SUM(billing_amount) FROM cases WHERE category = 'Personal Injury'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (building_id INT, city VARCHAR(100), state VARCHAR(50)); INSERT INTO green_buildings (building_id, city, state) VALUES (1, 'New York', 'New York'); | How many green buildings are there in each city in the United States? | SELECT city, COUNT(*) as green_buildings_count FROM green_buildings WHERE state = 'United States' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, state VARCHAR(2), workers INT, issue VARCHAR(14)); | What is the total number of workers in unions advocating for labor rights in California and Illinois? | SELECT SUM(workers) FROM unions WHERE state IN ('CA', 'IL') AND issue = 'labor_rights'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (concert_id INT, city VARCHAR(50), sales INT); INSERT INTO Concerts (concert_id, city, sales) VALUES (1, 'Los Angeles', 5000), (2, 'New York', 7000), (3, 'Chicago', 6000), (4, 'Los Angeles', 5000), (5, 'New York', 7000); | Which city has the most concerts in the Concerts table? | SELECT city, COUNT(*) as num_concerts FROM Concerts GROUP BY city ORDER BY num_concerts DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE JapaneseLandfillData (landfill VARCHAR(50), capacity_m3 FLOAT); INSERT INTO JapaneseLandfillData (landfill, capacity_m3) VALUES ('Kansai Landfill', 8500000), ('Tokyo Bay Landfill', 12000000), ('Hiroshima Landfill', 7000000), ('Sendai Landfill', 9000000), ('Osaka Landfill', 8000000); | What is the maximum landfill capacity available in Japan? | SELECT MAX(capacity_m3) FROM JapaneseLandfillData; | gretelai_synthetic_text_to_sql |
CREATE TABLE BudgetAllocation (Id INT, CityId INT, Category VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO BudgetAllocation (Id, CityId, Category, Amount) VALUES (1, 1, 'Education', 3000000), (2, 1, 'Healthcare', 4000000), (3, 2, 'Education', 6000000), (4, 2, 'Healthcare', 5000000); | What is the total budget allocated for education and healthcare in each city? | SELECT CityId, Category, SUM(Amount) AS TotalBudget FROM BudgetAllocation WHERE Category IN ('Education', 'Healthcare') GROUP BY CityId, Category; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, type TEXT, cargo_capacity REAL); INSERT INTO vessels (id, name, type, cargo_capacity) VALUES (1, 'Cargo Ship 1', 'Cargo', 5000.5), (2, 'Tanker 1', 'Tanker', 7000.2); | What is the average cargo capacity of vessels in the 'vessels' table? | SELECT AVG(cargo_capacity) FROM vessels WHERE type = 'Cargo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_papers (id INT, publication_year INT, publication_month INT, topic VARCHAR(255)); INSERT INTO research_papers (id, publication_year, publication_month, topic) VALUES (1, 2021, 1, 'AI Safety'), (2, 2021, 2, 'AI Safety'), (3, 2021, 3, 'AI Safety'), (4, 2021, 4, 'AI Safety'), (5, 2021, 5, 'AI Safety'... | Calculate the average number of AI safety research papers published per month in the past year | SELECT AVG(COUNT(*)) FROM research_papers WHERE topic = 'AI Safety' AND publication_year = YEAR(NOW()) - 1 GROUP BY publication_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment_maintenance_schedule (id INT PRIMARY KEY, equipment_id INT, schedule_date DATE, schedule_type VARCHAR(50)); | Generate a table 'equipment_maintenance_schedule' to store scheduled maintenance for military equipment | CREATE TABLE equipment_maintenance_schedule (id INT PRIMARY KEY, equipment_id INT, schedule_date DATE, schedule_type VARCHAR(50)); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, industry TEXT, founders TEXT, funding FLOAT); INSERT INTO startups (id, name, industry, founders, funding) VALUES (1, 'EuroAI', 'AI', 'Europe', 10000000); | What is the total funding received by startups founded by individuals from Europe in the AI sector? | SELECT SUM(funding) FROM startups WHERE industry = 'AI' AND founders = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT PRIMARY KEY, name VARCHAR(255), age INT, gender VARCHAR(50), ethnicity VARCHAR(255), condition VARCHAR(255)); INSERT INTO patients (id, name, age, gender, ethnicity, condition) VALUES (1, 'Alex Johnson', 30, 'Male', 'Latinx', 'Anxiety'); | What is the average age of patients who identified as LGBTQ+ and have been diagnosed with anxiety? | SELECT AVG(age) as average_age FROM patients WHERE ethnicity LIKE '%LGBTQ+%' AND condition = 'Anxiety'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AI_Safety_Incidents (Incident_Type VARCHAR(50), Incidents INT); INSERT INTO AI_Safety_Incidents (Incident_Type, Incidents) VALUES ('Autonomous Vehicles', 100), ('Healthcare', 80), ('Finance', 60), ('Manufacturing', 50), ('Aerospace', 40); | What is the distribution of AI safety incidents by type? | SELECT Incident_Type, COUNT(*) OVER (PARTITION BY Incident_Type) as Count FROM AI_Safety_Incidents ORDER BY Count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE national_security_strategies (id INT, strategy_name VARCHAR(50), strategy_category VARCHAR(50)); INSERT INTO national_security_strategies (id, strategy_name, strategy_category) VALUES (1, 'Whole-of-Government Approach', 'Policy'), (2, 'Deterrence by Denial', 'Military Strategy'); | List the national security strategies and respective strategy categories in the 'national_security_strategies' table. | SELECT strategy_name, strategy_category FROM national_security_strategies; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (id INT, name VARCHAR(50), type VARCHAR(50)); CREATE TABLE CargoTransports (id INT, vessel_id INT, weight INT, transport_time TIMESTAMP); | Identify the total cargo weight transported by each vessel in the Mediterranean Sea in the last year, excluding liquefied gas carriers. | SELECT V.name, SUM(C.weight) as total_weight FROM Vessels V JOIN CargoTransports C ON V.id = C.vessel_id WHERE V.type != 'Liquefied Gas Carrier' AND C.transport_time > NOW() - INTERVAL '1 year' AND C.latitude BETWEEN 30 AND 45 AND C.longitude BETWEEN -20 AND 45 GROUP BY V.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryImpact (country VARCHAR(50), year INT, mineral VARCHAR(50), score INT); INSERT INTO CountryImpact (country, year, mineral, score) VALUES ('Canada', 2020, 'Gold', 90), ('Mexico', 2020, 'Silver', 120), ('Brazil', 2020, 'Iron', 150); | What is the total environmental impact score for each country, by mineral type, in 2020? | SELECT context.country, context.mineral, SUM(context.score) as total_score FROM context WHERE context.year = 2020 GROUP BY context.country, context.mineral; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_sightings (id INT, marine_life_type VARCHAR(255), sighting_date DATE); INSERT INTO marine_sightings (id, marine_life_type, sighting_date) VALUES (1, 'Coral', '2018-01-01'), (2, 'Anglerfish', '2020-01-01'); | Identify marine life species that have not been observed in the last 5 years in the marine_sightings table. | SELECT marine_life_type FROM marine_sightings WHERE sighting_date < (CURRENT_DATE - INTERVAL '5 years'); | gretelai_synthetic_text_to_sql |
CREATE TABLE complaints (id INT PRIMARY KEY, complaint_date DATE, complaint_type VARCHAR(50)); | Insert a new mental health parity complaint into the complaints table | INSERT INTO complaints (id, complaint_date, complaint_type) VALUES (123, '2022-09-20', 'Mental Health Parity'); | gretelai_synthetic_text_to_sql |
CREATE TABLE returns (return_id INT, return_quantity INT, return_half INT, return_year INT); INSERT INTO returns (return_id, return_quantity, return_half, return_year) VALUES (1, 200, 1, 2022), (2, 150, 1, 2022), (3, 100, 2, 2022); | How many packages were returned through reverse logistics in H1 2022? | SELECT SUM(return_quantity) as total_returns FROM returns WHERE return_half IN (1, 2) AND return_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, state VARCHAR(2), identifies_as_lgbtq BOOLEAN, received_training BOOLEAN); INSERT INTO community_health_workers (worker_id, state, identifies_as_lgbtq, received_training) VALUES (1, 'CA', TRUE, TRUE), (2, 'NY', FALSE, FALSE), (3, 'TX', TRUE, TRUE); | What is the percentage of community health workers who identify as LGBTQ+ and have received cultural competency training, by state? | SELECT c.state, (COUNT(*) FILTER (WHERE c.identifies_as_lgbtq = TRUE AND c.received_training = TRUE)) * 100.0 / COUNT(*) as pct_trained_lgbtq_workers FROM community_health_workers c GROUP BY c.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects(project_id INT, completion_year INT); INSERT INTO infrastructure_projects VALUES (1, 2018), (2, 2019), (3, 2020); | Which rural infrastructure projects in the 'rural_development' schema were completed before 2020? | SELECT project_id FROM infrastructure_projects WHERE completion_year < 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_sales (sale_date DATE, region VARCHAR(255), product VARCHAR(255), sales_quantity INT); INSERT INTO organic_sales (sale_date, region, product, sales_quantity) VALUES ('2022-01-01', 'North', 'Organic Moisturizer', 700), ('2022-02-01', 'South', 'Organic Lipstick', 400); | List the sales of organic beauty products by region | SELECT region, SUM(sales_quantity) FROM organic_sales GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResidentialWaterUse (household_id INT, consumption FLOAT, month DATE); | Find the number of households in 'ResidentialWaterUse' table that have a water consumption above 200 liters per month | SELECT COUNT(*) FROM ResidentialWaterUse WHERE consumption > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(255)); CREATE TABLE posts (id INT, user_id INT, comments INT, hashtags TEXT, post_date DATE); | What is the minimum number of comments on posts by users from Egypt, for posts containing the hashtag #food, in the last month? | SELECT MIN(comments) FROM posts INNER JOIN users ON posts.user_id = users.id WHERE users.country = 'Egypt' AND hashtags LIKE '%#food%' AND post_date >= DATE(NOW()) - INTERVAL 1 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (initiative_id INT, year INT, individuals_impacted INT); INSERT INTO initiatives (initiative_id, year, individuals_impacted) VALUES (1, 2018, 500), (2, 2020, 800); CREATE TABLE locations (initiative_id INT, region VARCHAR(20)); INSERT INTO locations (initiative_id, region) VALUES (1, 'North Ame... | How many individuals were impacted by access to justice initiatives in Latin America in 2020? | SELECT SUM(initiatives.individuals_impacted) FROM initiatives INNER JOIN locations ON initiatives.initiative_id = locations.initiative_id WHERE locations.region = 'Latin America' AND initiatives.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_show_budgets (id INT, title VARCHAR(255), genre VARCHAR(255), budget INT); INSERT INTO tv_show_budgets (id, title, genre, budget) VALUES (1, 'The Big Bang Theory', 'Comedy', 8000000), (2, 'Friends', 'Comedy', 10000000), (3, 'Breaking Bad', 'Drama', 3000000); | What's the average budget of TV shows in the 'Comedy' genre? | SELECT AVG(budget) FROM tv_show_budgets WHERE genre = 'Comedy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (department_id INT, department_name VARCHAR(255), plant_id INT); INSERT INTO departments (department_id, department_name, plant_id) VALUES (1, 'Production', 1), (2, 'Quality Control', 1), (3, 'Engineering', 1), (4, 'Administration', 1); CREATE TABLE workers (worker_id INT, worker_name VARCHAR(2... | Show the number of workers in each department for a specific manufacturing plant | SELECT d.department_name, COUNT(w.worker_id) as worker_count FROM departments d JOIN workers w ON d.department_id = w.department_id WHERE d.plant_id = 1 GROUP BY d.department_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), location VARCHAR(50)); INSERT INTO farmers (id, name, age, gender, location) VALUES (1, 'John Doe', 45, 'Male', 'Ruralville'); INSERT INTO farmers (id, name, age, gender, location) VALUES (2, 'Jane Smith', 50, 'Female', 'Farmingtown'); | What is the number of female farmers in 'Farmingtown'? | SELECT COUNT(*) FROM farmers WHERE gender = 'Female' AND location = 'Farmingtown'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Agricultural_Projects (id INT, project_name TEXT, lead_gender TEXT, country TEXT, funding_amount FLOAT); INSERT INTO Agricultural_Projects (id, project_name, lead_gender, country, funding_amount) VALUES (1, 'Green Innovations', 'Female', 'Mexico', 50000.00), (2, 'AgriTech Solutions', 'Male', 'Mexico', 7500... | What is the total funding (in USD) received by agricultural innovation projects in Mexico led by Indigenous people? | SELECT SUM(funding_amount) FROM Agricultural_Projects WHERE lead_gender = 'Indigenous' AND country = 'Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests_wa (id INT, name VARCHAR(50), state VARCHAR(50), is_private BOOLEAN, is_national_park BOOLEAN); INSERT INTO forests_wa (id, name, state, is_private, is_national_park) VALUES (1, 'Greenlake', 'Washington', true, false); CREATE TABLE carbon_sequestration_wa (id INT, forest_id INT, year INT, sequestra... | What is the total carbon sequestered in the year 2018 in private forests in the state of Washington? | SELECT SUM(cs.sequestration) FROM carbon_sequestration_wa cs JOIN forests_wa f ON cs.forest_id = f.id WHERE f.state = 'Washington' AND f.is_private = true AND cs.year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Gender VARCHAR(255)); INSERT INTO Attorneys (AttorneyID, Gender) VALUES (1, 'Female'), (2, 'Male'), (3, 'Female'), (4, 'Non-binary'); CREATE TABLE Cases (CaseID INT, AttorneyID INT, BillingAmount DECIMAL(10,2)); INSERT INTO Cases (CaseID, AttorneyID, BillingAmount) VALUES (1, 1, ... | What is the total billing amount for cases handled by attorneys who identify as female? | SELECT SUM(BillingAmount) FROM Cases JOIN Attorneys ON Cases.AttorneyID = Attorneys.AttorneyID WHERE Gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bridges (id INT, name VARCHAR(50), region VARCHAR(50), length FLOAT, year_built INT); INSERT INTO bridges (id, name, region, length, year_built) VALUES (1, 'Golden Gate Bridge', 'California', 2737, 1937); INSERT INTO bridges (id, name, region, length, year_built) VALUES (2, 'Chesapeake Bay Bridge', 'South'... | Show the maximum and minimum year of construction for bridges in the 'South' region | SELECT MAX(year_built), MIN(year_built) FROM bridges WHERE region = 'South'; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai (algorithm_name TEXT, technique TEXT, dataset TEXT, description TEXT); INSERT INTO explainable_ai (algorithm_name, technique, dataset, description) VALUES ('SHAP', 'TreeExplainer', 'German Credit', 'SHAP values for TreeExplainer on German Credit dataset'); | Delete records in the 'explainable_ai' table where the 'algorithm_name' column is 'SHAP' | DELETE FROM explainable_ai WHERE algorithm_name = 'SHAP'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_maintenance (vehicle_id VARCHAR(20), maintenance_date DATE, maintenance_type VARCHAR(30)); INSERT INTO vehicle_maintenance (vehicle_id, maintenance_date, maintenance_type) VALUES ('TRAIN-456', '2022-01-01', 'Oil Change'), ('TRAIN-789', '2022-02-15', 'Tire Rotation'); | Insert a new record into the 'vehicle_maintenance' table for a train with vehicle_id 'TRAIN-456' | INSERT INTO vehicle_maintenance (vehicle_id, maintenance_date, maintenance_type) VALUES ('TRAIN-456', '2022-04-01', 'Tire Rotation'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, labor_practices VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO sales (sale_id, labor_practices, revenue) VALUES (1, 'fair trade', 250.00), (2, 'living wage', 300.00), (3, 'fair trade', 400.00); | What is the total revenue generated from fair labor practices in the ethical fashion marketplace? | SELECT SUM(revenue) FROM sales WHERE labor_practices IN ('fair trade', 'living wage'); | gretelai_synthetic_text_to_sql |
CREATE TABLE contracts (contract_id INT, contract_value FLOAT, contract_date DATE, program_participant VARCHAR(20)); INSERT INTO contracts (contract_id, contract_value, contract_date, program_participant) VALUES (1, 1200000, '2021-04-10', '8(a)'), (2, 1100000, '2020-11-27', '8(a)'); | Determine the total value of contracts awarded to 8(a) Business Development Program participants in the past year | SELECT SUM(contract_value) FROM contracts WHERE program_participant = '8(a)' AND contract_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA GeneticResearch; CREATE TABLE project_budgets (project_name VARCHAR(50), budget DECIMAL(10, 2)); INSERT INTO project_budgets VALUES ('Project1', 600000), ('Project2', 900000); | Find the maximum and minimum budgets for genetic research projects in the 'GeneticResearch' schema? | SELECT MAX(budget) as max_budget, MIN(budget) as min_budget FROM GeneticResearch.project_budgets; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarterly_recycling_rates (quarter VARCHAR(10), year INT, material VARCHAR(20), recycling_rate DECIMAL(5,2)); INSERT INTO quarterly_recycling_rates (quarter, year, material, recycling_rate) VALUES ('Q1', 2020, 'Glass', 0.30), ('Q2', 2020, 'Glass', 0.32), ('Q3', 2020, 'Glass', 0.34), ('Q4', 2020, 'Glass', 0... | What is the recycling rate for the material 'Glass' by quarter in 2020? | SELECT STRFTIME('%m', quarter) as month, AVG(recycling_rate) as avg_recycling_rate FROM quarterly_recycling_rates WHERE year = 2020 AND material = 'Glass' GROUP BY STRFTIME('%m', quarter); | gretelai_synthetic_text_to_sql |
CREATE TABLE irrigation_system (field_id INT, system_type VARCHAR(20), activated BOOLEAN, timestamp TIMESTAMP); INSERT INTO irrigation_system (field_id, system_type, activated, timestamp) VALUES (9, 'irrigation', true, '2023-03-05 08:00:00'), (9, 'irrigation', false, '2023-03-05 12:00:00'); | Update the irrigation system activated status to 'false' in field 9 for records on weekends in March 2023. | UPDATE irrigation_system SET activated = false WHERE field_id = 9 AND system_type = 'irrigation' AND DAYOFWEEK(timestamp) IN (1, 7) AND MONTH(timestamp) = 3 AND YEAR(timestamp) = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE cause (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE donation (id INT PRIMARY KEY, cause_id INT, amount DECIMAL(10,2)); | Which causes have the lowest average donation? | SELECT c.name, AVG(d.amount) AS avg_donations FROM cause c JOIN donation d ON c.id = d.cause_id GROUP BY c.id ORDER BY avg_donations ASC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (incident_id INT, incident_date DATE, incident_type VARCHAR(30), description TEXT); INSERT INTO safety_incidents (incident_id, incident_date, incident_type, description) VALUES (1, '2021-03-01', 'landing gear failure', '...'); | Insert new flight safety incident | INSERT INTO safety_incidents (incident_id, incident_date, incident_type, description) VALUES (2, '2022-04-15', 'engine failure', '...'); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name TEXT, industry TEXT, founding_date DATE, raised_funding FLOAT, founder_race TEXT); INSERT INTO startups (id, name, industry, founding_date, raised_funding, founder_race) VALUES (1, 'Fintech Startup 1', 'Fintech', '2018-01-01', 12000000.00, 'Latinx'), (2, 'Fintech Startup 2', 'Fintech... | Delete the row for 'Fintech Startup 2' from the 'startups' table | DELETE FROM startups WHERE name = 'Fintech Startup 2'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, first_name VARCHAR(50), last_name VARCHAR(50), training_completion_date DATE); | List the employees who have not completed any training | SELECT id, first_name, last_name FROM Employees WHERE training_completion_date IS NULL AND (SELECT COUNT(*) FROM Training WHERE Employees.id = Training.employee_id) = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT, dish_name VARCHAR(255), cuisine VARCHAR(255)); INSERT INTO dishes (dish_id, dish_name, cuisine) VALUES (1, 'Quinoa Salad', 'Mediterranean'), (2, 'Chicken Caesar Wrap', 'Mediterranean'), (3, 'Tacos', 'Mexican'), (4, 'Enchiladas', 'Mexican'), (5, 'Falafel', 'Mediterranean'); | Count the number of dishes per cuisine | SELECT cuisine, COUNT(*) as dish_count FROM dishes GROUP BY cuisine; | gretelai_synthetic_text_to_sql |
CREATE TABLE field_3 (id INT PRIMARY KEY, x_coordinate INT, y_coordinate INT, crop_type TEXT, area_hectares FLOAT, last_irrigation_date DATE); INSERT INTO field_3 (id, x_coordinate, y_coordinate, crop_type, area_hectares, last_irrigation_date) VALUES (1, 450, 550, 'cotton', 5.1, '2021-12-24'), (2, 500, 600, 'sunflowers... | Add a new row to the 'field_3' table with the given details | INSERT INTO field_3 (id, x_coordinate, y_coordinate, crop_type, area_hectares, last_irrigation_date) VALUES (4, 600, 700, 'corn', 6.3, '2021-12-21'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Factories (factory_id INT, factory_name VARCHAR(50)); INSERT INTO Factories (factory_id, factory_name) VALUES (1, 'Factory A'), (2, 'Factory B'), (3, 'Factory C'); CREATE TABLE Production (production_id INT, factory_id INT, garment_type VARCHAR(50), production_date DATE, units_produced INT); INSERT INTO Pr... | How many units of garment type 'T-shirt' were produced in each factory in April 2022? | SELECT F.factory_name, SUM(P.units_produced) as total_units FROM Production P JOIN Factories F ON P.factory_id = F.factory_id WHERE P.garment_type = 'T-shirt' AND P.production_date BETWEEN '2022-04-01' AND '2022-04-30' GROUP BY F.factory_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50)); CREATE TABLE Revenues (RevenueID int, RestaurantID int, Revenue decimal(5,2), Date date); INSERT INTO Restaurants (RestaurantID, Name) VALUES (1, 'Big Burger'); INSERT INTO Revenues (RevenueID, RestaurantID, Revenue, Date) VALUES (1, 1, 15000.00, '2022-01-0... | Find the top 3 most profitable restaurants based on their revenue in the last month. | SELECT r.Name, SUM(rev.Revenue) as TotalRevenue FROM Restaurants r JOIN Revenues rev ON r.RestaurantID = rev.RestaurantID WHERE rev.Date >= DATEADD(month, -1, GETDATE()) GROUP BY r.Name ORDER BY TotalRevenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_sales (sale_id INT, year INT, volume_sold FLOAT); INSERT INTO timber_sales (sale_id, year, volume_sold) VALUES (1, 2010, 100.5), (2, 2010, 120.3), (3, 2011, 150.0), (4, 2011, 130.0), (5, 2012, 160.0); | What is the maximum timber production in each year? | SELECT year, MAX(volume_sold) FROM timber_sales GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (id INT, user_name TEXT, age INT); CREATE TABLE Workouts (id INT, user_id INT, workout_name TEXT, calories INT); INSERT INTO Users (id, user_name, age) VALUES (1, 'John Doe', 32); INSERT INTO Users (id, user_name, age) VALUES (2, 'Jane Smith', 37); INSERT INTO Workouts (id, user_id, workout_name, cal... | List all the unique workout names and their respective total calories burned for users aged 30-35. | SELECT DISTINCT workout_name, SUM(calories) FROM Workouts JOIN Users ON Workouts.user_id = Users.id WHERE Users.age BETWEEN 30 AND 35 GROUP BY workout_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_launches (country_id INT, launch_year INT); CREATE TABLE countries (id INT, name VARCHAR(50)); | Which countries have launched satellites before 2010? | SELECT c.name, cl.launch_year FROM countries c JOIN country_launches cl ON c.id = cl.country_id WHERE cl.launch_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE destinations (destination_id INT, name TEXT, type TEXT, continent TEXT); INSERT INTO destinations (destination_id, name, type, continent) VALUES (1, 'Parksville', 'Eco-friendly', 'North America'), (2, 'Tofino', 'Eco-friendly', 'North America'), (3, 'Vancouver', 'Urban', 'North America'), (4, 'Banff', 'Sust... | How many destinations are there for each type of tourism in Asia? | SELECT type, continent, COUNT(*) FROM destinations GROUP BY type, continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE red_list_data (id INT, species TEXT, conservation_status TEXT); | Show marine species and their conservation status from the Red List | SELECT species, conservation_status FROM red_list_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_demographics (fan_id INT, name VARCHAR(50), city VARCHAR(50), state VARCHAR(50)); INSERT INTO fan_demographics (fan_id, name, city, state) VALUES (1, 'Mike Johnson', 'Los Angeles', 'CA'); INSERT INTO fan_demographics (fan_id, name, city, state) VALUES (2, 'Sarah Lee', 'New York', 'NY'); INSERT INTO fan... | How many fans are from 'California' in the 'fan_demographics' table? | SELECT COUNT(*) FROM fan_demographics WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT PRIMARY KEY, site_name VARCHAR(100), state VARCHAR(50), num_workers INT); | Delete all mining sites in California | DELETE FROM mining_sites WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE polygon_smart_contracts (contract_address VARCHAR(255), creation_date DATE); CREATE TABLE polygon_contract_callers (contract_caller VARCHAR(255), contract_address VARCHAR(255), call_date DATE); CREATE VIEW polygon_monthly_contracts AS SELECT EXTRACT(MONTH FROM creation_date) as month, COUNT(DISTINCT contr... | What is the monthly trend of new smart contracts and unique contract callers on the Polygon network? | SELECT mc.month, mc.new_contracts, mc.unique_callers FROM polygon_monthly_contracts mc JOIN polygon_monthly_callers mc2 ON mc2.month = mc.month; | gretelai_synthetic_text_to_sql |
CREATE TABLE buses (id INT PRIMARY KEY, type VARCHAR(20), speed FLOAT, city VARCHAR(20)); | What is the average speed of electric buses in the city of Los Angeles? | SELECT AVG(speed) FROM buses WHERE type = 'Electric' AND city = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workouts (MemberID INT, State VARCHAR(20), WorkoutType VARCHAR(20)); INSERT INTO Workouts (MemberID, State, WorkoutType) VALUES (1, 'California', 'Yoga'), (2, 'Texas', 'Cardio'), (3, 'Texas', 'Yoga'); | How many 'Yoga' workouts were conducted by members from 'Texas'? | SELECT COUNT(*) FROM Workouts WHERE State = 'Texas' AND WorkoutType = 'Yoga'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseProjects (id INT, project_name VARCHAR(255), start_date DATE, end_date DATE, budget DECIMAL(10,2)); | List all defense projects with a start date after January 1st, 2018 and their respective budgets. | SELECT project_name, budget FROM DefenseProjects WHERE start_date > '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_vehicle_sales (state VARCHAR(20), year INT, sales INT); | What is the total number of electric vehicles sold in each state in 2020? | SELECT state, SUM(sales) as total_sales FROM electric_vehicle_sales WHERE year = 2020 GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Country TEXT); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'Canada'); | What is the total amount donated by donors from each country? | SELECT Donors.Country, SUM(Donations.DonationAmount) AS TotalDonated FROM Donors JOIN Donations ON Donors.DonorID = Donations.DonorID GROUP BY Donors.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE conditions (condition_id INT, condition VARCHAR(20)); INSERT INTO conditions (condition_id, condition) VALUES (1, 'depression'), (2, 'anxiety'); | Get the top 3 most common mental health conditions | SELECT condition, COUNT(*) AS count FROM conditions GROUP BY condition ORDER BY count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE ModelSafetyScores (ModelID INT, TeamID INT, SafetyScore INT); CREATE TABLE TeamLocations (TeamID INT, Continent VARCHAR(20)); | What is the distribution of safety scores for models developed by teams in different continents? | SELECT ModelSafetyScores.SafetyScore, TeamLocations.Continent, COUNT(ModelSafetyScores.ModelID) AS ModelCount FROM ModelSafetyScores INNER JOIN TeamLocations ON ModelSafetyScores.TeamID = TeamLocations.TeamID GROUP BY ModelSafetyScores.SafetyScore, TeamLocations.Continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, salesperson_id INT, garment_id INT, region TEXT, price INT); INSERT INTO sales (id, salesperson_id, garment_id, region, price) VALUES (1, 1, 1, 'Paris', 150), (2, 1, 2, 'London', 120), (3, 2, 3, 'Paris', 180), (4, 2, 4, 'London', 110), (5, 3, 5, 'Berlin', 200), (6, 3, 6, 'Berlin', 160); | How many garments were sold in each region with a price greater than '150'? | SELECT region, COUNT(*) AS garments_sold FROM sales WHERE price > 150 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_category_4 (sale_id INT, sale_date DATE, category VARCHAR(20), quantity INT); INSERT INTO sales_category_4 (sale_id, sale_date, category, quantity) VALUES (1, '2021-01-05', 'Tops', 8), (2, '2021-02-10', 'Trousers', 12), (3, '2021-03-20', 'Tops', 14); | How many garments of the 'Tops' category were sold in the first quarter of 2021? | SELECT SUM(quantity) FROM sales_category_4 WHERE category = 'Tops' AND sale_date BETWEEN '2021-01-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE geothermal_power_plants (id INT, country VARCHAR(255), name VARCHAR(255), installed_capacity FLOAT); INSERT INTO geothermal_power_plants (id, country, name, installed_capacity) VALUES (1, 'New Zealand', 'Plant A', 120.5), (2, 'New Zealand', 'Plant B', 150.9); | What is the minimum installed capacity of geothermal power plants in New Zealand? | SELECT MIN(installed_capacity) FROM geothermal_power_plants WHERE country = 'New Zealand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE visitors (id INT, location TEXT, date DATE); INSERT INTO visitors (id, location, date) VALUES (1, 'Kenya', '2022-01-15'), (2, 'Egypt', '2021-12-01'); | What is the total number of visitors to each continent in the last 6 months? | SELECT CONTINENT(location) AS continent, COUNT(*) FROM visitors WHERE date >= DATEADD(month, -6, GETDATE()) GROUP BY CONTINENT(location); | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (id INT, sale_date DATE, menu_item VARCHAR(50), quantity INT); | Which menu items have not been sold in 'Pizzeria Napoli' since January 2022? | SELECT menu_item FROM Sales JOIN Menus ON Sales.menu_item = Menus.item_name WHERE Menus.restaurant_name = 'Pizzeria Napoli' GROUP BY menu_item HAVING SUM(quantity) = 0 OR (SUM(quantity) IS NULL AND COUNT(sale_date) = 0) AND MONTH(sale_date) >= 1 AND YEAR(sale_date) >= 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_homes (id INT, size FLOAT, location VARCHAR(255)); INSERT INTO sustainable_homes (id, size, location) VALUES (5, 1100.0, 'San Francisco'), (6, 1300.0, 'San Francisco'), (7, 800.0, 'Los Angeles'), (8, 1600.0, 'San Francisco'); | What is the average size of sustainable homes in 'San Francisco'? | SELECT AVG(size) FROM sustainable_homes WHERE location = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR(50), age INT, ethnicity VARCHAR(50)); INSERT INTO community_health_workers (id, name, age, ethnicity) VALUES (1, 'Sophia Garcia', 35, 'Hispanic'), (2, 'Hamza Ahmed', 40, 'Asian'), (3, 'Patricia Brown', 30, 'African American'); | What is the average age of community health workers by ethnicity? | SELECT ethnicity, AVG(age) as avg_age FROM community_health_workers GROUP BY ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments_healthcare (id INT, sector VARCHAR(20), investment_amount FLOAT); INSERT INTO investments_healthcare (id, sector, investment_amount) VALUES (1, 'Healthcare', 50000.0), (2, 'Healthcare', 75000.0), (3, 'Healthcare', 60000.0); | Minimum investment amount in the healthcare sector? | SELECT MIN(investment_amount) FROM investments_healthcare WHERE sector = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourist_visits (id INT, country TEXT, visit_year INT, num_visitors INT); INSERT INTO tourist_visits (id, country, visit_year, num_visitors) VALUES (1, 'Malaysia', 2022, 12000000), (2, 'Malaysia', 2023, 8000000), (3, 'Indonesia', 2022, 15000000); | What is the total number of tourists who visited Malaysia in 2022 and 2023? | SELECT visit_year, SUM(num_visitors) AS total_visitors FROM tourist_visits WHERE country = 'Malaysia' AND visit_year IN (2022, 2023) GROUP BY visit_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals_southamerica (name TEXT, location TEXT, country TEXT, establishment_date DATE); INSERT INTO hospitals_southamerica (name, location, country, establishment_date) VALUES ('Hospital 1', 'Rural Peru', 'Peru', '1995-01-01'), ('Hospital 2', 'Rural Chile', 'Chile', '2002-01-01'), ('Clinic 3', 'Rural Bol... | Display the number of rural hospitals and clinics in Peru, Chile, and Bolivia that were established between 1990 and 2010. | SELECT country, COUNT(*) FROM hospitals_southamerica WHERE (country IN ('Peru', 'Chile', 'Bolivia') AND location LIKE 'Rural%' AND establishment_date BETWEEN '1990-01-01' AND '2010-12-31') GROUP BY country | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name VARCHAR(50), country VARCHAR(50), average_speed DECIMAL(5,2)); CREATE TABLE cargo_data(id INT, vessel_name VARCHAR(50), destination VARCHAR(50), cargo_weight DECIMAL(5,2)); INSERT INTO vessels(id, name, country, average_speed) VALUES (1, 'Vessel A', 'Philippines', 14.5), (2, 'Vessel B'... | What is the total cargo weight transported by vessels with an average speed above 15? | SELECT SUM(cargo_weight) FROM cargo_data JOIN vessels ON cargo_data.vessel_name = vessels.name WHERE average_speed > 15; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_virtual_tours (hotel_category VARCHAR(20), user_id INT, engagement_time INT, tour_date DATE); INSERT INTO hotel_virtual_tours (hotel_category, user_id, engagement_time, tour_date) VALUES ('5 Star', 1, 300, '2022-10-01'), ('5 Star', 2, 350, '2022-10-01'), ('4 Star', 3, 250, '2022-10-02'); | Which hotel categories have the highest virtual tour engagement time per user in Q4 2022? | SELECT hotel_category, AVG(engagement_time) as avg_engagement_time FROM hotel_virtual_tours WHERE tour_date BETWEEN '2022-10-01' AND '2022-12-31' GROUP BY hotel_category ORDER BY avg_engagement_time DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(50), email VARCHAR(50)); CREATE TABLE academic_publications (id INT, student_id INT, title VARCHAR(100), publication_year INT); INSERT INTO graduate_students VALUES (1, 'Fiona', 'fiona@cs.edu'), (2, 'George', 'george@math.edu'), (3, 'Hannah', 'hannah@physics.edu'), (... | Delete all graduate students from the graduate_students table who have not published any academic publications. | DELETE FROM graduate_students WHERE id NOT IN (SELECT student_id FROM academic_publications); | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodations (student_id INT, accommodation_type VARCHAR(50), state VARCHAR(50), request_date DATE); | What is the total number of students who received accommodations in each state in 2021? | SELECT state, COUNT(DISTINCT student_id) FROM Accommodations WHERE request_date >= '2021-01-01' AND request_date < '2022-01-01' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas_arctic (area_name VARCHAR(255), avg_depth DECIMAL(10,2)); INSERT INTO marine_protected_areas_arctic (area_name, avg_depth) VALUES ('Svalbard Nature Reserve', 200.50), ('Franz Josef Land Marine Park', 150.30), ('North Pole Sanctuary', 4000.00); | What is the average depth of all marine protected areas in the Arctic? | SELECT AVG(avg_depth) FROM marine_protected_areas_arctic; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (org_id INT, org_name VARCHAR(50)); CREATE TABLE impact_investments | What is the total impact investment in climate change? | SUM(i.investment_amount) AS total_investment | gretelai_synthetic_text_to_sql |
CREATE TABLE team_performances (team VARCHAR(20), sport VARCHAR(20), games_played INT, wins INT, losses INT, revenue DECIMAL(10,2)); | List the total revenue for the top 3 teams by revenue in the 'team_performances' table. | SELECT team, SUM(revenue) FROM (SELECT team, revenue FROM team_performances ORDER BY revenue DESC LIMIT 3) t GROUP BY team; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, PreferredGenre VARCHAR(20), LastVRGame DATETIME, HoursPlayedPerWeek DECIMAL(3,2)); CREATE TABLE Games (GameID INT, Genre VARCHAR(20)); CREATE VIEW Game_Library AS SELECT PlayerID, GameID FROM Player_Games; CREATE VIEW Game_Details AS SELECT GameID, Genre FROM Games; CREATE V... | What is the average number of hours played per week by players who have played a game using VR technology, grouped by their preferred gaming genre? | SELECT PreferredGenre, AVG(HoursPlayedPerWeek) FROM Players JOIN VR_Games ON Players.PlayerID = VR_Games.PlayerID JOIN Game_Details ON Game_Library.GameID = Games.GameID GROUP BY PreferredGenre; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists continents (continent_id INT, continent VARCHAR(255)); INSERT INTO continents (continent_id, continent) VALUES (1, 'Asia'), (2, 'Europe'), (3, 'America'); CREATE TABLE if not exists athletes (athlete_id INT, continent_id INT, medals INT, sport VARCHAR(255)); INSERT INTO athletes (athlete_id, ... | What is the total number of tennis medals won by athletes from Asia? | SELECT SUM(medals) FROM athletes WHERE continent_id = 1 AND sport = 'Tennis'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investors (id INT, gender VARCHAR(50), investments INT); INSERT INTO investors (id, gender, investments) VALUES (1, 'Female', 3), (2, 'Male', 2), (3, 'Female', 4); CREATE TABLE social_impact_investments (id INT, investor_id INT, amount FLOAT); INSERT INTO social_impact_investments (id, investor_id, amount)... | What is the average investment in social impact projects by female investors? | SELECT AVG(sii.amount) as avg_investment FROM social_impact_investments sii JOIN investors i ON sii.investor_id = i.id WHERE i.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE adaptation_projects (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), description TEXT, start_date DATE, end_date DATE, budget FLOAT); INSERT INTO adaptation_projects (id, name, location, description, start_date, end_date, budget) VALUES (1, 'Mangrove Restoration', 'India', 'Coastal protection... | Show all climate adaptation projects from 'Asia' in the 'adaptation_projects' table | SELECT * FROM adaptation_projects WHERE location LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (school_id INT, school_name VARCHAR(255)); CREATE TABLE students (student_id INT, school_id INT, has_access_to_oer BOOLEAN); | What is the percentage of students who have access to open educational resources? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM students)) AS percentage FROM students s JOIN schools sc ON s.school_id = sc.school_id WHERE s.has_access_to_oer = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE permit_data (permit_id INT, property_type VARCHAR(10), state VARCHAR(10)); INSERT INTO permit_data VALUES (1, 'Single-family', 'Florida'), (2, 'Multi-family', 'Florida'); | Determine the percentage of building permit data in Florida that is for single-family homes. | SELECT PERCENTAGE := (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM permit_data WHERE state = 'Florida')) FROM permit_data WHERE property_type = 'Single-family' AND state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE certifications_eur (certification_id INT, certification_date DATE, region VARCHAR(50)); INSERT INTO certifications_eur (certification_id, certification_date, region) VALUES (1, '2022-02-01', 'Europe'), (2, '2022-03-15', 'Europe'); | Insert new records of fair labor practice certifications in Europe for the last 3 months. | INSERT INTO certifications_eur (certification_id, certification_date, region) VALUES (3, '2022-04-05', 'Europe'), (4, '2022-04-10', 'Europe'), (5, '2022-05-01', 'Europe'); | gretelai_synthetic_text_to_sql |
CREATE TABLE visitor_stats (country VARCHAR(50), visitors INT, year INT); INSERT INTO visitor_stats (country, visitors, year) VALUES ('Japan', 50, 2019), ('France', 55, 2019), ('Japan', 53, 2020), ('France', 57, 2020); | Which countries had an increase in international tourists from 2019 to 2020? | SELECT year, country, SUM(visitors) - LAG(SUM(visitors)) OVER (PARTITION BY country ORDER BY year) as visitors_diff FROM visitor_stats GROUP BY year, country HAVING visitors_diff > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes_history (athlete_id INT, sport VARCHAR(50)); INSERT INTO athletes_history (athlete_id, sport) VALUES (1, 'Soccer'), (2, 'Basketball'), (3, 'Soccer'), (4, 'Baseball'), (5, 'Soccer'), (6, 'Basketball'); | List the athletes who have played more than one sport in the athletes_history table | SELECT athlete_id FROM athletes_history GROUP BY athlete_id HAVING COUNT(DISTINCT sport) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, user_name TEXT, user_country TEXT);CREATE TABLE posts (post_id INT, post_text TEXT, user_id INT);CREATE TABLE brands (brand_id INT, brand_name TEXT);CREATE TABLE mentions (mention_id INT, post_id INT, brand_id INT); | What are the top 5 most mentioned brands by users from the US, in the last month? | SELECT b.brand_name, COUNT(m.mention_id) as mention_count FROM mentions m JOIN posts p ON m.post_id = p.post_id JOIN users u ON p.user_id = u.user_id JOIN brands b ON m.brand_id = b.brand_id WHERE u.user_country = 'US' AND p.post_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY b.brand_name ORDER BY mention_co... | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (city VARCHAR(50), technology VARCHAR(50), capacity FLOAT); INSERT INTO renewable_energy_projects (city, technology, capacity) VALUES ('CityA', 'Solar', 500.0), ('CityA', 'Wind', 600.0), ('CityB', 'Solar', 750.0), ('CityB', 'Wind', 800.0); | What is the combined total installed capacity for 'Wind' and 'Solar' technologies in all cities? | SELECT SUM(capacity) FROM renewable_energy_projects WHERE technology IN ('Solar', 'Wind'); | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, animal_name VARCHAR(50), population INT, birth_rate DECIMAL(4,2), death_rate DECIMAL(4,2)); | Create view 'animal_population_summary' based on 'animal_population' table | CREATE VIEW animal_population_summary AS SELECT animal_name, population, (population * birth_rate) - (population * death_rate) AS net_change FROM animal_population; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_type VARCHAR(30), region VARCHAR(20), sale_date DATE); INSERT INTO sales (sale_id, product_type, region, sale_date) VALUES (1, 'Shariah-compliant Mortgage', 'East', '2021-03-21'), (2, 'Conventional Car Loan', 'West', '2022-05-14'); | What is the earliest sale date for a Shariah-compliant financial product? | SELECT MIN(sale_date) FROM sales WHERE product_type LIKE '%Shariah-compliant%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_production (country_code CHAR(3), year INT, volume INT); INSERT INTO timber_production (country_code, year, volume) VALUES ('BRA', 2015, 18000), ('BRA', 2014, 16000), ('PER', 2015, 12000), ('PER', 2014, 10000); | Delete records of timber production for Brazil before 2015 | DELETE FROM timber_production WHERE country_code = 'BRA' AND year < 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE location (location_id INT, location_name TEXT); INSERT INTO location (location_id, location_name) VALUES (1, 'Pacific Ocean'); CREATE TABLE salinity (salinity_id INT, location_id INT, salinity FLOAT); INSERT INTO salinity (salinity_id, location_id, salinity) VALUES (1, 1, 34.5), (2, 1, 34.6), (3, 1, 34.7),... | What is the minimum salinity in the Pacific Ocean? | SELECT MIN(salinity) FROM salinity WHERE location_id = (SELECT location_id FROM location WHERE location_name = 'Pacific Ocean'); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (company_id INT, company_name VARCHAR(255), sector VARCHAR(255), esg_score INT, year INT); INSERT INTO companies (company_id, company_name, sector, esg_score, year) VALUES (1, 'GreenTech Inc', 'Technology', 80, 2020), (2, 'EcoFarms Ltd', 'Agriculture', 70, 2020), (3, 'CleanEnergy Co', 'Energy', 8... | What is the average ESG score per sector for the years 2020 and 2021? | SELECT s.sector, AVG(c.esg_score) as avg_esg_score FROM companies c JOIN (SELECT * FROM (VALUES (2020), (2021)) AS years(year)) y ON c.year = y.year JOIN investment_strategies s ON c.sector = s.strategy_name GROUP BY s.sector, y.year; | 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.