context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Expeditions(ExpeditionID INT, AvgDepth DECIMAL(5,2)); INSERT INTO Expeditions(ExpeditionID, AvgDepth) VALUES (1, 3500.50), (2, 4200.30), (3, 2100.75), (4, 5100.90), (5, 2900.40); | Update the average depth of expedition 1 to be the average of expeditions 2 and 3? | UPDATE Expeditions SET AvgDepth = (SELECT AVG(AvgDepth) FROM Expeditions WHERE ExpeditionID IN (2, 3)) WHERE ExpeditionID = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_warehouses (id INT, warehouse_location VARCHAR(255), quantity INT); INSERT INTO chemical_warehouses (id, warehouse_location, quantity) VALUES (1, 'Warehouse A, France', 150), (2, 'Warehouse B, Germany', 200), (3, 'Warehouse C, Poland', 120); CREATE TABLE regions (id INT, region_name VARCHAR(255), ... | What is the average quantity of chemical weapons stored in European warehouses? | SELECT AVG(quantity) AS avg_quantity FROM chemical_warehouses cw JOIN regions r ON cw.warehouse_location LIKE CONCAT('%', r.region_name, '%') WHERE r.continent = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (menu_name VARCHAR(20), item_name VARCHAR(30), price DECIMAL(5,2)); | Add a new menu category 'Vegan' with a new menu item 'Tofu Stir Fry' priced at 15.50 | INSERT INTO Menu (menu_name, item_name, price) VALUES ('Vegan', 'Tofu Stir Fry', 15.50); | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (id INT, dispensary TEXT, strain TEXT); INSERT INTO inventory (id, dispensary, strain) VALUES (1, 'Eaze', 'Purple Haze'), (2, 'MedMen', 'Green Crack'), (3, 'Harborside', 'OG Kush'), (4, 'LivWell', 'Purple Haze'), (5, 'Eaze', 'Blue Dream'); | How many unique strains are available at the 'Eaze' dispensary? | SELECT COUNT(DISTINCT strain) FROM inventory WHERE dispensary = 'Eaze'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (project_id INT PRIMARY KEY, project_name VARCHAR(50), project_type VARCHAR(50)); | Insert a new record into the 'research_projects' table for a bioinformatics project with an ID of 456 | INSERT INTO research_projects (project_id, project_name, project_type) VALUES (456, 'Bioinformatics Project', 'Bioinformatics'); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists salaries (worker_id INT, industry TEXT, region TEXT, salary REAL);INSERT INTO salaries (worker_id, industry, region, salary) VALUES (1, 'manufacturing', 'east', 50000), (2, 'retail', 'west', 40000); | What is the average salary of 'manufacturing' workers in the 'east' region? | SELECT AVG(salary) FROM salaries WHERE industry = 'manufacturing' AND region = 'east'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country TEXT, year INT, gold_production INT); INSERT INTO production (country, year, gold_production) VALUES ('Canada', 2020, 170); INSERT INTO production (country, year, gold_production) VALUES ('Australia', 2020, 330); | List the top five countries with the highest gold production in 2020. | SELECT country, gold_production FROM (SELECT country, gold_production, ROW_NUMBER() OVER (ORDER BY gold_production DESC) AS rank FROM production WHERE year = 2020) subquery WHERE rank <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerGroup VARCHAR(20), Hours INT); INSERT INTO Volunteers (VolunteerGroup, Hours) VALUES ('Youth Group', 500), ('Senior Group', 300); | What is the total number of volunteer hours contributed by volunteers from the 'Youth Group'? | SELECT SUM(Hours) FROM Volunteers WHERE VolunteerGroup = 'Youth Group'; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (id INT, region VARCHAR(50), budget DECIMAL(10,2)); | Show the total budget for habitat preservation in 'habitat_preservation' table | SELECT SUM(budget) FROM habitat_preservation; | gretelai_synthetic_text_to_sql |
CREATE TABLE desserts (id INT, name VARCHAR(255), vegan BOOLEAN, sugar_grams DECIMAL(5,2)); INSERT INTO desserts (id, name, vegan, sugar_grams) VALUES (1, 'Chocolate Mousse', FALSE, 35), (2, 'Vegan Cheesecake', TRUE, 28), (3, 'Fruit Salad', TRUE, 15); | What is the maximum sugar content in grams for vegan desserts? | SELECT MAX(sugar_grams) FROM desserts WHERE vegan = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID int, Age int, Gender varchar(10), GamePreference varchar(20)); INSERT INTO Players (PlayerID, Age, Gender, GamePreference) VALUES (5, 22, 'Male', 'VR'); INSERT INTO Players (PlayerID, Age, Gender, GamePreference) VALUES (6, 33, 'Female', 'Non-VR'); INSERT INTO Players (PlayerID, Age, Gend... | What is the percentage of players who prefer VR games, and what is the percentage of players who prefer Non-VR games, grouped by gender? | SELECT Gender, CASE WHEN GamePreference = 'VR' THEN 'VR' ELSE 'Non-VR' END AS GamePreference, ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Players WHERE Gender = P.Gender), 1) AS Percentage FROM Players P GROUP BY Gender, GamePreference; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_steps (step VARCHAR(255), time_taken FLOAT); | What is the average time taken for each step in the production_steps table? | SELECT step, AVG(time_taken) FROM production_steps GROUP BY step; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (id INT PRIMARY KEY, project_type VARCHAR(50), country VARCHAR(50), year INT, budget DECIMAL(10,2)); | What's the total investment in renewable energy projects in the US and Canada? | SELECT SUM(re.budget) AS total_investment FROM renewable_energy_projects re WHERE re.country IN ('US', 'Canada') AND re.project_type = 'Wind Power'; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_response (id INT, disaster_type TEXT, location TEXT, response INT, year INT); | List all the unique disaster types that occurred in 'asia' region from the 'disaster_response' table? | SELECT DISTINCT disaster_type FROM disaster_response WHERE location = 'asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE courts (id INT PRIMARY KEY, name VARCHAR(255), state VARCHAR(2)); | Add a new table with information about court cases | CREATE TABLE court_cases (id INT PRIMARY KEY, case_number VARCHAR(50), court_id INT, FOREIGN KEY (court_id) REFERENCES courts(id)); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (id INT, name TEXT, country TEXT, ai_adoption BOOLEAN, signup_date DATE); | What is the average number of hotels that adopt hospitality AI per month in Canada? | SELECT AVG(EXTRACT(MONTH FROM signup_date)) FROM hotels WHERE country = 'Canada' AND ai_adoption = true GROUP BY EXTRACT(MONTH FROM signup_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_discharge (location VARCHAR(50), year INT, month INT, daily_discharge FLOAT); INSERT INTO wastewater_discharge (location, year, month, daily_discharge) VALUES ('New York', 2020, 1, 1.2), ('New York', 2020, 2, 1.3), ('New York', 2020, 3, 1.4); | What is the average daily wastewater discharge from municipal sources in New York in 2020? | SELECT AVG(w.daily_discharge) AS avg_daily_discharge FROM wastewater_discharge w WHERE w.location = 'New York' AND w.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks(id INT, artist VARCHAR(30), created_date DATE); INSERT INTO artworks VALUES (1, 'Georgia O''Keeffe', '2011-05-15'); INSERT INTO artworks VALUES (2, 'Frida Kahlo', '2012-10-01'); | What is the number of artworks created by female artists in the last 10 years? | SELECT COUNT(*) FROM artworks WHERE artist IN (SELECT artist FROM artworks WHERE created_date BETWEEN DATE_SUB(NOW(), INTERVAL 10 YEAR) AND NOW() AND artist LIKE '% female %') AND created_date BETWEEN DATE_SUB(NOW(), INTERVAL 10 YEAR) AND NOW(); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, region TEXT, rating FLOAT); INSERT INTO hotels (hotel_id, hotel_name, region, rating) VALUES (1, 'Hotel A', 'Americas', 4.3), (2, 'Hotel B', 'Asia', 4.6), (3, 'Hotel C', 'Americas', 4.1); | What is the average rating of hotels in 'Americas' region? | SELECT AVG(rating) FROM hotels WHERE region = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offsets_india (project_name TEXT, country TEXT, carbon_offset INTEGER); INSERT INTO carbon_offsets_india (project_name, country, carbon_offset) VALUES ('Carbon Capture Project 2', 'India', 5000); | What is the total carbon offset per project for carbon offset initiatives in the country of India? | SELECT AVG(carbon_offset) FROM carbon_offsets_india; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, EmployeeName VARCHAR(50), Department VARCHAR(50), Salary INT); INSERT INTO Employees (EmployeeID, EmployeeName, Department, Salary) VALUES (1, 'John Doe', 'Ethical AI Data Scientist', 80000); INSERT INTO Employees (EmployeeID, EmployeeName, Department, Salary) VALUES (2, 'Jane Sm... | Calculate the average salary of data scientists and engineers working in ethical AI projects. | SELECT AVG(Salary) FROM Employees WHERE Department LIKE '%Ethical AI%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INT, name VARCHAR(50), type VARCHAR(50), year_built INT); | Create a view named "vessels_summary" that displays the average year of construction for each vessel type. | CREATE VIEW vessels_summary AS SELECT type, AVG(year_built) AS avg_year_built FROM vessels GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements (id INT, union_id INT, industry VARCHAR(255), cb_agreements INT); INSERT INTO cb_agreements (id, union_id, industry, cb_agreements) VALUES (1, 1, 'finance', 2); | What is the total number of collective bargaining agreements in the 'finance' industry? | SELECT SUM(cb_agreements) FROM cb_agreements WHERE industry = 'finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (date DATE, menu_category VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO restaurant_revenue (date, menu_category, revenue) VALUES ('2022-01-01', 'Appetizers', 500.00), ('2022-01-01', 'Entrees', 1000.00), ('2022-01-01', 'Desserts', 600.00), ('2022-01-02', 'Appetizers', 550.00), ('2022-... | What is the maximum and minimum revenue for each menu category in the past month? | SELECT menu_category, MAX(revenue) as max_revenue, MIN(revenue) as min_revenue FROM restaurant_revenue WHERE date BETWEEN DATEADD(month, -1, GETDATE()) AND GETDATE() GROUP BY menu_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_revenue (sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO daily_revenue (sale_date, revenue) VALUES ('2022-01-01', 5000.00), ('2022-01-02', 6000.00), ('2022-01-03', 4000.00), ('2022-01-04', 7000.00), ('2022-01-05', 8000.00), ('2022-01-06', 3000.00), ('2022-01-07', 9000.00); | Find the average daily revenue for the month of January 2022. | SELECT AVG(revenue) FROM daily_revenue WHERE sale_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (metric_id INT, metric_date DATE, region VARCHAR(255)); INSERT INTO threat_intelligence (metric_id, metric_date, region) VALUES (4, '2021-08-01', 'Middle East'), (5, '2021-06-15', 'Europe'), (6, '2021-02-14', 'Africa'); | Count the number of threat intelligence metrics reported in Africa in the last 9 months. | SELECT COUNT(*) FROM threat_intelligence WHERE region = 'Africa' AND metric_date >= DATE_SUB(CURRENT_DATE, INTERVAL 9 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (production_id INT, material_id INT, production_quantity INT); INSERT INTO Production (production_id, material_id, production_quantity) VALUES (1, 1, 500), (2, 2, 800), (3, 1, 600), (4, 2, 700); | What is the percentage of recycled materials used in production? | SELECT (SUM(CASE WHEN material_id = 2 THEN production_quantity ELSE 0 END) / SUM(production_quantity)) * 100 FROM Production; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (id INT, company VARCHAR(50), tech_name VARCHAR(50), description TEXT, country VARCHAR(50)); | What are the details of military technology developed by private companies? | SELECT * FROM military_tech WHERE company IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), international_designator VARCHAR(20), country VARCHAR(50)); | List all satellites with missing country information | SELECT * FROM satellites WHERE country IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE retailers (retailer_id INT, retailer_name VARCHAR(255), category VARCHAR(255), recycled_materials_quantity INT); INSERT INTO retailers (retailer_id, retailer_name, category, recycled_materials_quantity) VALUES (1, 'Eco-Friendly Goods', 'Furniture', 500); INSERT INTO retailers (retailer_id, retailer_name, c... | What is the total quantity of recycled materials used by retailers in the 'Furniture' category? | SELECT SUM(recycled_materials_quantity) FROM retailers WHERE category = 'Furniture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName VARCHAR(50), JoinDate DATE); INSERT INTO Volunteers (VolunteerID, VolunteerName, JoinDate) VALUES (1, 'Sophia Garcia', '2021-05-01'), (2, 'Ali Hassan', '2022-01-15'), (3, 'Lea Kim', '2021-12-31'), (4, 'Han Mehta', '2022-02-28'); | What is the total number of volunteers who have joined in each year in the 'Volunteers' table? | SELECT YEAR(JoinDate) as Year, COUNT(*) as TotalVolunteers FROM Volunteers GROUP BY Year; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name TEXT, state TEXT, success_rate DECIMAL); INSERT INTO campaigns (id, name, state, success_rate) VALUES (1, 'Campaign A', 'TX', 0.75), (2, 'Campaign B', 'CA', 0.85); | What is the success rate of the public awareness campaigns in California? | SELECT success_rate FROM campaigns WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE football_teams (team_name TEXT, league TEXT, wins INT); INSERT INTO football_teams (team_name, league, wins) VALUES ('Arsenal', 'Premier League', 21), ('Barcelona', 'La Liga', 25), ('Juventus', 'Serie A', 27); | Which football teams have the highest number of wins in their respective leagues? | SELECT team_name, league, wins FROM football_teams WHERE wins = (SELECT MAX(wins) FROM football_teams GROUP BY league); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, region TEXT, conservation_score FLOAT); INSERT INTO marine_protected_areas (area_name, region, conservation_score) VALUES ('Bonaire National Marine Park', 'Caribbean', 85.0), ('Buck Island Reef National Monument', 'Caribbean', 88.5), ('Cozumel Reefs National Park', '... | What is the minimum marine conservation score for areas in the Caribbean? | SELECT MIN(conservation_score) FROM marine_protected_areas WHERE region = 'Caribbean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (grant_id INT, pi_name VARCHAR(255), grant_amount INT, year INT);CREATE TABLE principal_investigators (pi_id INT, name VARCHAR(255)); | Identify the top 3 research grants with the highest total grant amounts, partitioned by principal investigator, in descending order of total grant amounts. | SELECT pi_name, SUM(grant_amount) AS total_grant_amounts FROM grants g JOIN principal_investigators p ON g.pi_name = p.name GROUP BY pi_name ORDER BY total_grant_amounts DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech;USE biotech;CREATE TABLE if not exists startups(id INT, name VARCHAR(255), location VARCHAR(255), funding FLOAT);INSERT INTO startups(id, name, location, funding) VALUES (1, 'StartupA', 'US', 15000000.00), (2, 'StartupB', 'CA', 20000000.00), (3, 'StartupC', 'MX', 12000000.00), (4, 'S... | What is the minimum funding amount for biotech startups located in each country? | SELECT location, MIN(funding) FROM biotech.startups GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO customers (id, name, country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'Canada'), (3, 'Jim Brown', 'UK'), (4, 'Luigi Verdi', 'Italy'); CREATE TABLE transactions (id INT, customer_id INT, amount DECIMAL(10, 2)); INSERT INTO tra... | What is the average transaction amount for customers from Italy? | SELECT AVG(t.amount) FROM transactions t JOIN customers c ON t.customer_id = c.id WHERE c.country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE worker_patient_data_min (worker_id INT, patients_served INT); INSERT INTO worker_patient_data_min (worker_id, patients_served) VALUES (1, 50); INSERT INTO worker_patient_data_min (worker_id, patients_served) VALUES (2, 75); | What is the minimum number of patients served by a community health worker? | SELECT MIN(patients_served) FROM worker_patient_data_min; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_streaming (stream_id INT, user_id INT, song_id INT, streams INT, date DATE, song_release_year INT); | What is the total number of streams for songs released before 2010 in the 'music_streaming' table? | SELECT SUM(streams) FROM music_streaming WHERE song_release_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (sale_id INT PRIMARY KEY, sale_date DATE, item_sold VARCHAR(255), quantity INT, sale_price DECIMAL(5,2)); | What are the top 5 most sold items on a given day? | SELECT item_sold, SUM(quantity) as total_quantity FROM Sales WHERE sale_date = '2022-01-01' GROUP BY item_sold ORDER BY total_quantity DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, product_category VARCHAR(255), sales FLOAT, sale_date DATE); INSERT INTO sales (sale_id, product_id, product_category, sales, sale_date) VALUES (1, 1, 'Electronics', 100, '2022-01-01'), (2, 2, 'Clothing', 200, '2022-01-02'), (3, 3, 'Electronics', 150, '2022-01-03'); | Find the top 5 products by sales in the last month | SELECT product_id, product_category, sales FROM sales WHERE sale_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) ORDER BY sales DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai (id INT, algorithm VARCHAR, explainability FLOAT); | What is the maximum explainability score for each AI algorithm in the explainable AI dataset? | SELECT algorithm, MAX(explainability) OVER (PARTITION BY algorithm) FROM explainable_ai; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (route_name VARCHAR(20), fare FLOAT); INSERT INTO routes (route_name, fare) VALUES ('Red Line', 2.50), ('Blue Line', 3.25), ('Green Line', 1.75); | What was the total fare collected from the 'Green Line' on March 8, 2021? | SELECT SUM(fare) FROM routes WHERE route_name = 'Green Line' AND fare_date = '2021-03-08'; | gretelai_synthetic_text_to_sql |
CREATE TABLE machines (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), status VARCHAR(255)); INSERT INTO machines (id, name, type, status) VALUES (1, 'Machine A', 'CNC', 'Operational'), (2, 'Machine B', 'Robotic Arm', 'Under Maintenance'); | Retrieve all machines with type 'CNC' | SELECT * FROM machines WHERE type = 'CNC'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_harvest (farm_id INT, harvest_date DATE, quantity INT); INSERT INTO farm_harvest (farm_id, harvest_date, quantity) VALUES (1, '2021-01-01', 5000), (1, '2021-02-01', 5500), (2, '2021-01-01', 7000), (2, '2021-02-01', 7500); | How many fish were harvested from each aquatic farm in the past 12 months? | SELECT farm_id, YEAR(harvest_date) AS year, SUM(quantity) AS total_harvested FROM farm_harvest GROUP BY farm_id, year HAVING year = YEAR(CURDATE()) - 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE isl_stats (player TEXT, goals INT, season TEXT); INSERT INTO isl_stats (player, goals, season) VALUES ('Bartholomew Ogbeche', 32, '2018-2019'); INSERT INTO isl_stats (player, goals, season) VALUES ('Ferrán Corominas', 26, '2017-2018'); | What is the highest number of goals scored by a player in a single season of the Indian Super League? | SELECT player, SUM(goals) FROM isl_stats ORDER BY SUM(goals) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE artist (id INT, name VARCHAR(100)); CREATE TABLE song (id INT, title VARCHAR(100), artist_id INT, collaboration VARCHAR(100)); INSERT INTO artist (id, name) VALUES (1, 'BTS'); INSERT INTO song (id, title, artist_id, collaboration) VALUES (1, 'Song1', 1, 'Artist2'); | Which music artists have collaborated with 'BTS' on a song? | SELECT DISTINCT collaboration FROM song WHERE artist_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Forests (id INT, name VARCHAR(50), hectares FLOAT, country VARCHAR(50)); INSERT INTO Forests (id, name, hectares, country) VALUES (1, 'Boreal Forest', 60000000.0, 'Canada'); CREATE TABLE Timber_Production (id INT, forest_id INT, year INT, production_cubic_meters INT); INSERT INTO Timber_Production (id, for... | What is the total timber production for forests in Canada between 1990 and 1999? | SELECT SUM(production_cubic_meters) FROM Timber_Production tp JOIN Forests f ON tp.forest_id = f.id WHERE f.country = 'Canada' AND tp.year BETWEEN 1990 AND 1999; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, FirstName VARCHAR(50), LastName VARCHAR(50), DateJoined DATE); INSERT INTO Members (MemberID, FirstName, LastName, DateJoined) VALUES (1, 'John', 'Doe', '2022-01-10'); INSERT INTO Members (MemberID, FirstName, LastName, DateJoined) VALUES (2, 'Jane', 'Doe', '2022-02-15'); CREATE TABL... | Identify members who joined the gym in the last 30 days and have not attended any workout sessions yet. | SELECT m.MemberID, m.FirstName, m.LastName FROM Members m LEFT JOIN Workouts w ON m.MemberID = w.MemberID WHERE m.DateJoined >= (CURRENT_DATE - INTERVAL '30' DAY) AND m.DateJoined < CURRENT_DATE AND w.MemberID IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, build_year INT, gross_tonnage INT); | Insert a new record in the "vessels" table for a vessel named "Pacific Princess" with id 105, built in 2010, and a gross tonnage of 2500 | INSERT INTO vessels (id, name, build_year, gross_tonnage) VALUES (105, 'Pacific Princess', 2010, 2500); | gretelai_synthetic_text_to_sql |
CREATE TABLE baltic_sea_salmon_farms (id INT, farm_id INT, biomass FLOAT); | What is the total biomass (in kg) of farmed salmon in the Baltic Sea? | SELECT SUM(biomass) FROM baltic_sea_salmon_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_buildings (project_id INT, project_name TEXT, workers INT, timeline_days INT); | What is the average project timeline for sustainable building projects in the 'sustainable_buildings' table with more than 1000 workers? | SELECT AVG(timeline_days) FROM sustainable_buildings WHERE workers > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE protocols (year INT, site VARCHAR(20), protocol VARCHAR(50)); INSERT INTO protocols (year, site, protocol) VALUES (2020, 'Texas', 'Safety Gear Inspection'), (2020, 'Ohio', 'Emergency Drills'), (2021, 'Texas', 'Hazardous Material Training'), (2021, 'Ohio', 'Safety Equipment Upgrade'); | Which chemical safety protocols were implemented in 2020 and 2021 at the Texas and Ohio manufacturing sites? | SELECT protocol FROM protocols WHERE year IN (2020, 2021) AND site IN ('Texas', 'Ohio') ORDER BY year, site; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_locations (id INT, user_id INT, location VARCHAR(20)); INSERT INTO user_locations (id, user_id, location) VALUES (1, 1, 'Urban'), (2, 2, 'Rural'), (3, 3, 'Suburban'); CREATE TABLE daily_steps (id INT, user_id INT, steps INT, date DATE); INSERT INTO daily_steps (id, user_id, steps, date) VALUES (1, 1, ... | What is the earliest date a user from a rural area logged at least 15,000 steps in a day? | SELECT MIN(date) FROM daily_steps d JOIN user_locations u ON d.user_id = u.user_id WHERE u.location = 'Rural' AND steps >= 15000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety_incidents_date (incident_id INT, incident_type VARCHAR(50), occurrence_date DATE); INSERT INTO ai_safety_incidents_date (incident_id, incident_type, occurrence_date) VALUES (1, 'Cybersecurity', '2021-01-01'), (2, 'Data Privacy', '2021-02-15'), (3, 'Algorithmic Bias', '2021-03-05'), (4, 'Ethical C... | Find the number of AI safety incidents and their occurrence date, partitioned by incident type, ordered by date in ascending order? | SELECT incident_type, COUNT(*) as num_incidents, MIN(occurrence_date) as first_occurrence_date FROM ai_safety_incidents_date GROUP BY incident_type ORDER BY first_occurrence_date ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE internet_access (region VARCHAR(20), population INT, internet_users INT); INSERT INTO internet_access (region, population, internet_users) VALUES ('Africa', 1000000, 600000), ('North America', 350000, 320000), ('Europe', 700000, 650000); | How many people have access to the internet in Africa? | SELECT SUM(internet_users) as total_internet_users FROM internet_access WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_sessions (id INT, user_id INT, region VARCHAR(20), calories INT, workout_type VARCHAR(20)); INSERT INTO workout_sessions (id, user_id, region, calories, workout_type) VALUES (1, 1, 'Asia-Pacific', 300, 'Yoga'), (2, 2, 'North America', 400, 'Cycling'); | List all the distinct workout types that were performed by users from the Asia-Pacific region, along with their total calories burned, in descending order of calories burned, for workouts that occurred after January 2022. | SELECT DISTINCT workout_type, SUM(calories) AS total_calories FROM workout_sessions WHERE region = 'Asia-Pacific' AND joined > '2022-01-01' GROUP BY workout_type ORDER BY total_calories DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_scores (id INT, company VARCHAR(255), esg_score FLOAT, year INT); INSERT INTO company_scores (id, company, esg_score, year) VALUES (1, 'Renewable Horizons', 82, 2022); INSERT INTO company_scores (id, company, esg_score, year) VALUES (2, 'Renewable Horizons', 85, 2021); | Find the average ESG score for 'Renewable Horizons' in 2022. | SELECT AVG(esg_score) FROM company_scores WHERE company = 'Renewable Horizons' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_professional_development (student_id INT, hours INT); INSERT INTO teacher_professional_development (student_id, hours) VALUES (1, 20), (2, 30), (3, 40), (4, 50), (5, 60), (6, 70); | Who are the top 3 students in terms of professional development hours? | SELECT student_id, hours, ROW_NUMBER() OVER (ORDER BY hours DESC) as rank FROM teacher_professional_development WHERE rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_prices (id INT, date DATE, region TEXT, price FLOAT); INSERT INTO carbon_prices (id, date, region, price) VALUES (1, '2022-01-01', 'European Union', 30.0), (2, '2022-02-01', 'European Union', 35.0); | What is the average carbon price in the European Union Emissions Trading System? | SELECT AVG(price) FROM carbon_prices WHERE region = 'European Union'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, SpacecraftName VARCHAR(50), Manufacturer VARCHAR(50), LaunchDate DATE, NumberOfPeople INT, FuelType VARCHAR(50)); INSERT INTO Spacecraft (SpacecraftID, SpacecraftName, Manufacturer, LaunchDate, NumberOfPeople, FuelType) VALUES (1, 'Soyuz', 'Roscosmos', '2020-01-01', 3, 'Liquid... | Find the average number of people on board spacecraft built by NASA | SELECT AVG(NumberOfPeople) FROM Spacecraft WHERE Manufacturer = 'NASA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE flights (flight_id INT, departure_date DATE, arrival_country TEXT, departure_continent TEXT); INSERT INTO flights (flight_id, departure_date, arrival_country, departure_continent) VALUES (1, '2021-05-01', 'India', 'Asia'), (2, '2021-04-15', 'India', 'Europe'), (3, '2021-06-28', 'India', 'Asia'), (4, '2021-... | What is the maximum number of daily international flights to India from each continent? | SELECT departure_continent, MAX(COUNT(*)) AS max_flights FROM flights WHERE arrival_country = 'India' GROUP BY departure_continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchLab_ClinicalTrials(company VARCHAR(20), year INT, trials INT);INSERT INTO ResearchLab_ClinicalTrials VALUES('ResearchLab', 2017, 10);INSERT INTO ResearchLab_ClinicalTrials VALUES('ResearchLab', 2018, 15); | How many clinical trials did 'ResearchLab' conduct in 2017 and 2018? | SELECT SUM(trials) FROM ResearchLab_ClinicalTrials WHERE company = 'ResearchLab' AND year IN (2017, 2018); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (Id INT, Name VARCHAR(50), Type VARCHAR(50), MaxSpeed DECIMAL(5,2)); CREATE TABLE SafetyIncidents (Id INT, VesselId INT, IncidentDate DATE, Description VARCHAR(255)); INSERT INTO SafetyIncidents VALUES (1, 1, '2022-01-10', 'Collision'), (2, 2, '2022-02-05', 'Fire on board'); | Delete the safety incident of 'VesselA' on 2022-01-10. | DELETE FROM SafetyIncidents WHERE VesselId = (SELECT Id FROM Vessels WHERE Name = 'VesselA') AND IncidentDate = '2022-01-10'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, patient_name VARCHAR(50), condition VARCHAR(50), country VARCHAR(50)); INSERT INTO patients (patient_id, patient_name, condition, country) VALUES (1, 'John Doe', 'Anxiety', 'USA'); CREATE TABLE therapy_sessions (session_id INT, patient_id INT, session_type VARCHAR(50)); INSERT INT... | Count the number of anxiety patients who have participated in online therapy sessions in the US. | SELECT COUNT(patients.patient_id) FROM patients JOIN therapy_sessions ON patients.patient_id = therapy_sessions.patient_id WHERE patients.condition = 'Anxiety' AND patients.country = 'USA' AND therapy_sessions.session_type = 'Online'; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_info (id INT, name VARCHAR(50), category VARCHAR(50), cost INT); INSERT INTO project_info (id, name, category, cost) VALUES (1, 'Test1', 'Water Supply', 3000000); | What was the total cost of projects in the 'Water Supply' category? | SELECT SUM(cost) FROM project_info WHERE category = 'Water Supply'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_housing (id INT, address VARCHAR(255), city VARCHAR(255), state VARCHAR(255), square_footage INT, sustainable_features VARCHAR(255)); INSERT INTO sustainable_housing (id, address, city, state, square_footage, sustainable_features) VALUES (1, '123 Maple St', 'San Francisco', 'CA', 1200, 'solar p... | What is the average square footage of properties in the 'sustainable_housing' table? | SELECT AVG(square_footage) FROM sustainable_housing; | gretelai_synthetic_text_to_sql |
CREATE TABLE member_workouts (id INT, member_id INT, workout_month DATE); INSERT INTO member_workouts (id, member_id, workout_month) VALUES (1, 1, '2021-01-01'), (2, 1, '2021-02-01'), (3, 2, '2021-01-01'); | List the members who have performed a workout in every month of 2021. | SELECT members.member_name, members.age, members.region FROM members INNER JOIN (SELECT member_id FROM member_workouts GROUP BY member_id HAVING COUNT(DISTINCT DATE_FORMAT(workout_month, '%Y-%m')) = 12) AS monthly_workouts ON members.id = monthly_workouts.member_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_name VARCHAR(255), sport VARCHAR(255)); INSERT INTO teams (team_name, sport) VALUES ('Warriors', 'Basketball'); CREATE TABLE games (home_team VARCHAR(255), away_team VARCHAR(255), sport VARCHAR(255)); INSERT INTO games (home_team, away_team, sport) VALUES ('Bulls', 'Warriors', 'Basketball'); IN... | Find the total number of basketball games played by the 'Warriors' | SELECT COUNT(*) FROM games WHERE ('Warriors' = home_team OR 'Warriors' = away_team) AND sport = 'Basketball'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_bases (id INT, country VARCHAR(255), num_bases INT); INSERT INTO military_bases (id, country, num_bases) VALUES (1, 'United States', 800), (2, 'China', 600), (3, 'Russia', 500), (4, 'United Kingdom', 300); | Who are the top 3 countries with the most military bases? | SELECT country, num_bases FROM military_bases ORDER BY num_bases DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE genetic_research (id INT, project_name VARCHAR(255), country VARCHAR(255), temperature_min FLOAT, temperature_max FLOAT); INSERT INTO genetic_research (id, project_name, country, temperature_min, temperature_max) VALUES (1, 'ProjectA', 'USA', 15, 25); INSERT INTO genetic_research (id, project_name, country... | What is the distribution of genetic research projects by temperature range and country? | SELECT country, CONCAT(temperature_min, '-', temperature_max) AS temp_range, COUNT(*) FROM genetic_research GROUP BY country, temp_range; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_channels (channel_name VARCHAR(50), country VARCHAR(50), genre VARCHAR(50)); INSERT INTO news_channels (channel_name, country, genre) VALUES ('CNN', 'USA', 'News'); INSERT INTO news_channels (channel_name, country, genre) VALUES ('BBC', 'UK', 'News'); INSERT INTO news_channels (channel_name, country, ... | Which countries have the most diverse representation of news channels by genre? | SELECT country, COUNT(DISTINCT genre) as genre_count FROM news_channels GROUP BY country ORDER BY genre_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE NetworkDevices (id INT, device_name VARCHAR(50), severity VARCHAR(10), discovered_date DATE); INSERT INTO NetworkDevices (id, device_name, severity, discovered_date) VALUES (1, 'Router1', 'High', '2021-08-01'), (2, 'Switch1', 'Medium', '2021-07-15'), (3, 'Firewall1', 'Low', '2021-06-01'), (4, 'Router2', 'H... | What is the earliest date a vulnerability was discovered in the 'NetworkDevices' table? | SELECT MIN(discovered_date) as earliest_date FROM NetworkDevices; | gretelai_synthetic_text_to_sql |
CREATE TABLE machines (id INT, name VARCHAR(50), status VARCHAR(20), last_maintenance_date DATE); INSERT INTO machines (id, name, status, last_maintenance_date) VALUES (1, 'Machine A', 'Operational', '2023-02-01'); INSERT INTO machines (id, name, status, last_maintenance_date) VALUES (2, 'Machine B', 'Down', '2023-02-1... | Which machines have been down for more than 3 days in the last month? | SELECT name, status, last_maintenance_date FROM machines WHERE status = 'Down' AND last_maintenance_date < DATE_SUB(CURDATE(), INTERVAL 3 DAY); | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (id INT, well_name VARCHAR(50), drill_year INT, location VARCHAR(50)); CREATE TABLE production (id INT, well_name VARCHAR(50), year INT, production_volume INT); INSERT INTO wells (id, well_name, drill_year, location) VALUES (1, 'Well A', 2020, 'Region A'); INSERT INTO wells (id, well_name, drill_year... | List all the wells drilled in 2020 that produced more than 1000 units | SELECT wells.well_name FROM wells INNER JOIN production ON wells.well_name = production.well_name WHERE wells.drill_year = 2020 AND production.production_volume > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE RouteMinFares (RouteID int, MinFare decimal(5,2)); INSERT INTO RouteMinFares (RouteID, MinFare) VALUES (1, 3.50), (2, 2.75), (3, 4.00); CREATE TABLE RouteRidership (RouteID int, AnnualPassengers int); INSERT INTO RouteRidership (RouteID, AnnualPassengers) VALUES (1, 80000), (2, 60000), (3, 40000); | What is the minimum fare for routes that have less than 50,000 annual passengers? | SELECT MIN(MinFare) FROM RouteMinFares INNER JOIN RouteRidership ON RouteMinFares.RouteID = RouteRidership.RouteID WHERE RouteRidership.AnnualPassengers < 50000; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists bioprocess;CREATE TABLE if not exists bioprocess.patents (id INT, patent_name VARCHAR(255), country VARCHAR(255)); INSERT INTO bioprocess.patents (id, patent_name, country) VALUES (1, 'Nano-Bioprocess', 'USA'), (2, 'Bio-Reactor', 'Germany'), (3, 'Cell-Culturing', 'USA'), (4, 'Protein-Folding... | List the top 2 countries with the most bioprocess engineering patents. | SELECT country, COUNT(*) patent_count FROM bioprocess.patents GROUP BY country ORDER BY patent_count DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_name VARCHAR(50), city VARCHAR(30), event_type VARCHAR(30), attendance INT); INSERT INTO events (event_id, event_name, city, event_type, attendance) VALUES (1, 'Theater Play', 'Chicago', 'Play', 200), (2, 'Art Exhibit', 'Chicago', 'Exhibit', 300); | Identify the most popular event type in "Chicago" and its attendance | SELECT event_type, MAX(attendance) as max_attendance FROM events WHERE city = 'Chicago' GROUP BY event_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers(id INT, name TEXT, location TEXT);CREATE TABLE support_programs(id INT, program TEXT, year INT, participant_id INT); INSERT INTO farmers (id, name, location) VALUES (1, 'John Doe', 'Ruralville'); INSERT INTO support_programs (id, program, year, participant_id) VALUES (1, 'Agricultural Innovation Pr... | What is the total number of farmers who received support from the 'Agricultural Innovation Program' in '2021'? | SELECT COUNT(*) FROM farmers JOIN support_programs ON farmers.id = support_programs.participant_id WHERE program = 'Agricultural Innovation Program' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE traffic_violations (city VARCHAR(255), year INT, month INT, violations INT); INSERT INTO traffic_violations (city, year, month, violations) VALUES ('Chicago', 2021, 1, 1500), ('Chicago', 2021, 2, 1600), ('Chicago', 2021, 3, 1700), ('Chicago', 2021, 4, 1800), ('Chicago', 2021, 5, 1900), ('Chicago', 2021, 6,... | How many traffic violations were issued in the city of Chicago in each month of 2021? | SELECT month, SUM(violations) AS total_violations FROM traffic_violations WHERE city = 'Chicago' AND year = 2021 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (region VARCHAR(20), tour_date DATE); INSERT INTO virtual_tours (region, tour_date) VALUES ('Asia', '2021-06-01'), ('Asia', '2021-06-03'), ('Europe', '2021-06-02'); | How many virtual tours were engaged in the 'Asia' region for 'June 2021'? | SELECT COUNT(*) FROM virtual_tours WHERE region = 'Asia' AND EXTRACT(MONTH FROM tour_date) = 6 AND EXTRACT(YEAR FROM tour_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fans (FanID INT, Age INT, LastVisit DATE); INSERT INTO Fans (FanID, Age, LastVisit) VALUES (1, 35, '2022-01-15'), (2, 22, '2022-02-20'), (3, 40, '2022-03-05'), (4, 28, '2022-04-10'), (5, 31, '2022-05-12'); | What is the average age of fans who attended games in the last 6 months? | SELECT AVG(Age) AS AvgAge FROM Fans WHERE LastVisit >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (id INT, team VARCHAR(50), revenue INT); INSERT INTO ticket_sales (id, team, revenue) VALUES (1, 'TeamA', 50000), (2, 'TeamB', 75000), (3, 'TeamC', 60000); | Which team has the highest ticket sales revenue? | SELECT team, MAX(revenue) as max_revenue FROM ticket_sales GROUP BY team; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL, Program TEXT, Country TEXT); INSERT INTO Donors (DonorID, DonorName, DonationAmount, Program, Country) VALUES (3, 'Carlos Rodriguez', 75.00, 'Education', 'Mexico'), (4, 'Maria Rodriguez', 125.00, 'Health', 'Mexico'); | What is the average donation amount per program for donors from Mexico? | SELECT Program, AVG(DonationAmount) FROM Donors WHERE Country = 'Mexico' GROUP BY Program; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (order_date DATE, dish_type VARCHAR(10)); INSERT INTO sales (order_date, dish_type) VALUES ('2021-01-01', 'vegetarian'), ('2021-01-02', 'non_veg'), ('2021-01-03', 'vegan'); | What is the total revenue generated from vegetarian dishes in the last quarter? | SELECT SUM(revenue) FROM (SELECT price * quantity AS revenue FROM orders JOIN menu ON orders.item_id = menu.item_id JOIN sales ON menu.dish_type = sales.dish_type WHERE sales.dish_type = 'vegetarian' AND order_date BETWEEN '2021-01-01' AND '2021-03-31') AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (worker_id INT, name VARCHAR(20), state VARCHAR(10)); CREATE TABLE states (state_id INT, state VARCHAR(10)); INSERT INTO community_health_workers (worker_id, name, state) VALUES (1, 'Ada', 'Alabama'), (2, 'Beto', 'Alaska'), (3, 'Carla', 'Arizona'), (4, 'Diego', 'California'), (5, '... | What is the average number of community health workers trained in cultural competency per state? | SELECT states.state, AVG(CASE WHEN community_health_workers.cultural_competency_training = 'Yes' THEN 1 ELSE 0 END) AS avg_trained FROM community_health_workers JOIN states ON community_health_workers.state = states.state GROUP BY states.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tan_Investments (id INT, sector VARCHAR(20), impact_investment FLOAT); INSERT INTO Tan_Investments (id, sector, impact_investment) VALUES (1, 'Technology', 200000), (2, 'Healthcare', 150000); | What is the total number of impact investments made by Tan Investments in the technology sector? | SELECT SUM(impact_investment) FROM Tan_Investments WHERE sector = 'Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Provinces (ProvinceName VARCHAR(50), HealthcareBudget FLOAT); INSERT INTO Provinces (ProvinceName, HealthcareBudget) VALUES ('Ontario', 60000), ('Quebec', 55000), ('British Columbia', 45000), ('Alberta', 40000), ('Manitoba', 30000), ('Nova Scotia', 25000); | What are the top 5 provinces with the highest total budget for healthcare in Canada? | SELECT ProvinceName, SUM(HealthcareBudget) as TotalBudget FROM Provinces GROUP BY ProvinceName ORDER BY TotalBudget DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_digital_divide (continent VARCHAR(255), score NUMERIC(10,2)); INSERT INTO global_digital_divide (continent, score) VALUES ('Africa', 65.5), ('Americas', 78.2), ('Asia', 72.1); | What is the total digital divide score for each continent? | SELECT continent, SUM(score) OVER (PARTITION BY 1) as total_score FROM global_digital_divide; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_packages (package_id INT, package_name TEXT, location TEXT, sustainability_score INT); INSERT INTO tourism_packages (package_id, package_name, location, sustainability_score) VALUES (1, 'Canadian Wilderness Adventure', 'Canada', 90), (2, 'Mediterranean Cruise', 'Europe', 50); | How many sustainable tourism packages are available in Canada? | SELECT COUNT(*) FROM tourism_packages WHERE location = 'Canada' AND sustainability_score >= 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, age INT, treatment TEXT); INSERT INTO patients (id, name, age, treatment) VALUES (1, 'Alice', 30, 'CBT'), (2, 'Bob', 45, 'DBT'), (3, 'Charlie', 60, 'CBT'); | Delete the record of the patient with ID 3 | DELETE FROM patients WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE SiteE (id INT PRIMARY KEY, artifact_name VARCHAR(50), date_found DATE); INSERT INTO SiteE (id, artifact_name, date_found) VALUES (1, 'Bone Needle', '2020-06-15'); | Delete an artifact record from 'SiteE' | DELETE FROM SiteE WHERE artifact_name = 'Bone Needle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), price DECIMAL(5,2)); CREATE VIEW lipsticks AS SELECT * FROM products WHERE product_name LIKE '%lipstick%'; CREATE TABLE sales (sale_id INT, product_id INT, sale_quantity INT, sale_price DECIMAL(5,2), country VARCHAR(255)); | What is the total revenue generated from lipsticks in the European Union? | SELECT SUM(sale_price * sale_quantity) FROM sales JOIN lipsticks ON sales.product_id = lipsticks.product_id WHERE country IN ('Germany', 'France', 'United Kingdom', 'Italy', 'Spain'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(50), ocean_name VARCHAR(50), sighting_date DATE); | Delete all records with the ocean_name 'Southern Ocean' and return the number of deleted records. | WITH deleted_species AS (DELETE FROM marine_species WHERE ocean_name = 'Southern Ocean' RETURNING species_id) SELECT COUNT(*) FROM deleted_species; | gretelai_synthetic_text_to_sql |
CREATE TABLE RecycledMaterialsCost (id INT, garment_type VARCHAR(255), cost DECIMAL(10,2)); INSERT INTO RecycledMaterialsCost (id, garment_type, cost) VALUES (1, 'Blazer', 80.00), (2, 'Skirt', 45.00), (3, 'Hat', 22.50); | What is the total production cost for each garment type made from recycled materials? | SELECT garment_type, SUM(cost) FROM RecycledMaterialsCost GROUP BY garment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE author (id INT, name VARCHAR(255), field VARCHAR(255)); CREATE TABLE publication (id INT, author_id INT, title VARCHAR(255), year INT); | List the top 5 authors with the highest number of publications in the field of Computer Science, along with their total publication count. | SELECT a.name, COUNT(p.id) as total_publications FROM author a JOIN publication p ON a.id = p.author_id WHERE a.field = 'Computer Science' GROUP BY a.name ORDER BY total_publications DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE shifts (shift_id INT, mine_id INT, date DATE, country VARCHAR(20), workers_per_shift INT); INSERT INTO shifts (shift_id, mine_id, date, country, workers_per_shift) VALUES (1, 1, '2021-01-01', 'Mexico', 100), (2, 1, '2021-01-02', 'Mexico', 120), (3, 2, '2021-01-01', 'Canada', 150), (4, 2, '2021-01-02', 'Can... | What is the maximum number of workers per shift in the mining industry, per country, for operations with more than 50 employees? | SELECT country, MAX(workers_per_shift) as max_workers_per_shift FROM shifts WHERE (SELECT COUNT(*) FROM shifts s WHERE s.mine_id = shifts.mine_id) > 50 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Training (training_id INT, training_name VARCHAR(255), duration INT, start_date DATE, end_date DATE, program_area VARCHAR(255)); INSERT INTO Training (training_id, training_name, duration, start_date, end_date, program_area) VALUES (4, 'Emergency Skills', 12, '2019-02-01', '2019-02-03', 'Emergency Response... | What is the average duration of 'Emergency Response' training sessions in '2019'? | SELECT AVG(Training.duration) FROM Training WHERE Training.program_area = 'Emergency Response' AND YEAR(Training.start_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_streaming (artist_id INT, artist_name VARCHAR(100), genre VARCHAR(50)); CREATE TABLE concert_ticket_sales (concert_id INT, artist_id INT, concert_date DATE, venue VARCHAR(100)); | Find the number of unique genres represented in the 'music_streaming' table and the number of unique artists who have held concerts in the 'concert_ticket_sales' table. | SELECT COUNT(DISTINCT genre) AS unique_genres, COUNT(DISTINCT artist_id) AS unique_concert_artists FROM music_streaming; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(50), rating INT, genre VARCHAR(50), country VARCHAR(50)); INSERT INTO movies (id, title, rating, genre, country) VALUES (1, 'Movie1', 8, 'Action', 'Spain'), (2, 'Movie2', 7, 'Comedy', 'Italy'), (3, 'Movie3', 9, 'Drama', 'Spain'), (4, 'Movie4', 6, 'Action', 'Italy'); | What is the average rating of movies produced in Spain and Italy, grouped by genre? | SELECT genre, AVG(rating) as avg_rating FROM movies WHERE country IN ('Spain', 'Italy') GROUP BY genre; | 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.