context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE EventTypes (EventTypeID INT, EventTypeName VARCHAR(50)); CREATE TABLE EventAttendance (EventID INT, EventTypeID INT, Attendees INT); INSERT INTO EventTypes (EventTypeID, EventTypeName) VALUES (1, 'Concert'), (2, 'Play'), (3, 'Workshop'); INSERT INTO EventAttendance (EventID, EventTypeID, Attendees) VALUES ... | What is the average attendance at events for each event type? | SELECT et.EventTypeName, AVG(ea.Attendees) as AvgAttendance FROM EventTypes et INNER JOIN EventAttendance ea ON et.EventTypeID = ea.EventTypeID GROUP BY et.EventTypeName; | gretelai_synthetic_text_to_sql |
CREATE TABLE agriculture_sector (id INT, country VARCHAR(20), water_consumption FLOAT); INSERT INTO agriculture_sector (id, country, water_consumption) VALUES (1, 'Canada', 1200), (2, 'Canada', 1500), (3, 'Canada', 1800); | What is the total water consumption in the agriculture sector in Canada? | SELECT SUM(water_consumption) FROM agriculture_sector WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation_speeds (city VARCHAR(30), country VARCHAR(30), speed_limit DECIMAL(5,2)); INSERT INTO public_transportation_speeds VALUES ('Sydney', 'Australia', 60.00); | What is the average speed limit for public transportation in Sydney, Australia? | SELECT AVG(speed_limit) FROM public_transportation_speeds WHERE city = 'Sydney' AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE exoplanets (id INT, name VARCHAR(50), distance_from_earth FLOAT); | What is the maximum distance from Earth for any exoplanet? | SELECT MAX(distance_from_earth) FROM exoplanets; | gretelai_synthetic_text_to_sql |
CREATE TABLE whale_sightings (sighting_id INT, species TEXT, location TEXT, year INT); | How many whale sightings have been reported in the Arctic? | SELECT COUNT(*) FROM whale_sightings WHERE location LIKE '%Arctic%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipment (id INT, source_country VARCHAR(255), destination_continent VARCHAR(255), quantity INT); INSERT INTO Shipment (id, source_country, destination_continent, quantity) VALUES (1, 'Egypt', 'Africa', 500), (2, 'South Africa', 'Africa', 300), (3, 'Nigeria', 'Africa', 200), (4, 'Kenya', 'Africa', 100); | What is the total quantity of items shipped from each country to Africa? | SELECT source_country, SUM(quantity) FROM Shipment WHERE destination_continent = 'Africa' GROUP BY source_country | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (id INT, site_name VARCHAR(50), country VARCHAR(50), start_date DATE, end_date DATE); | Delete all excavation sites that started after '2010-01-01' from the 'excavation_sites' table. | DELETE FROM excavation_sites WHERE start_date > '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, sale_date DATE, revenue INT); INSERT INTO sales (sale_id, product_id, sale_date, revenue) VALUES (1, 1, '2022-01-01', 1000), (2, 2, '2022-01-02', 500), (3, 1, '2022-01-03', 1500); | What is the total revenue for each product category in the last month? | SELECT p.category, SUM(s.revenue) FROM sales s INNER JOIN products p ON s.product_id = p.product_id WHERE s.sale_date >= DATEADD(month, -1, GETDATE()) GROUP BY p.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE mitigation_projects (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), description TEXT, start_date DATE, end_date DATE, budget FLOAT); INSERT INTO mitigation_projects (id, name, location, description, start_date, end_date, budget) VALUES (1, 'Solar Farm Installation', 'Kenya', 'Installation of... | Show all climate mitigation projects from 'Africa' in the 'mitigation_projects' table | SELECT * FROM mitigation_projects WHERE location LIKE 'Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_ebikes (ebike_id INT, ride_id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, start_location TEXT, end_location TEXT, city TEXT, max_speed DECIMAL); | What is the maximum speed recorded for a shared electric bicycle in Berlin, Germany? | SELECT MAX(max_speed) FROM shared_ebikes WHERE city = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseContracts (contract_id INT, date DATE, value FLOAT); INSERT INTO DefenseContracts (contract_id, date, value) VALUES (1, '2022-01-01', 15000000), (2, '2022-02-01', 5000000), (3, '2022-03-01', 20000000); | Which defense contracts were awarded in the last 6 months and have a value greater than $10 million? | SELECT contract_id, date, value FROM DefenseContracts WHERE date >= NOW() - INTERVAL 6 MONTH AND value > 10000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, team_name VARCHAR(50), game_date DATE); CREATE TABLE teams (team_name VARCHAR(50), team_city VARCHAR(50)); INSERT INTO fans (fan_id, team_name, game_date) VALUES (1, 'Red Sox', '2022-06-01'), (2, 'Yankees', '2022-06-02'); INSERT INTO teams (team_name, team_city) VALUES ('Red Sox', 'Boston... | Find the number of fans who attended games for each team in the last month? | SELECT team_name, COUNT(*) as game_attendance FROM fans INNER JOIN teams ON fans.team_name = teams.team_name WHERE game_date >= DATEADD(month, -1, GETDATE()) GROUP BY team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(100)); INSERT INTO suppliers (id, name) VALUES (1, 'Ethical Supplies'); CREATE TABLE sustainability_reports (id INT PRIMARY KEY, company_id INT, year INT, water_usage INT); INSERT INTO sustainability_reports (id, company_id, year, water_usage) VALUES (1, 1, 2021,... | What is the water usage of 'Ethical Supplies'? | SELECT sr.water_usage FROM suppliers s INNER JOIN sustainability_reports sr ON s.id = sr.company_id WHERE s.name = 'Ethical Supplies'; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name VARCHAR(50), department VARCHAR(20)); CREATE TABLE research_grants (faculty_id INT, grant_amount DECIMAL(10,2)); CREATE TABLE publications (id INT, faculty_id INT, title VARCHAR(50)); INSERT INTO faculty (id, name, department) VALUES (1, 'Alex Brown', 'Computer Science'), (2, 'Rachel ... | List the number of publications for faculty members in the 'Computer Science' department who have received research grants. | SELECT COUNT(*) as num_publications FROM faculty f JOIN research_grants rg ON f.id = rg.faculty_id JOIN publications p ON f.id = p.faculty_id WHERE f.department = 'Computer Science'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, donor_country TEXT, donation_date DATE, donation_amount DECIMAL); INSERT INTO donations (id, donor_id, donor_country, donation_date, donation_amount) VALUES (1, 1, 'India', '2018-01-01', 50.00), (2, 2, 'India', '2018-01-01', 25.00), (3, 3, 'India', '2018-12-31', 75.00), (4,... | What is the average amount of donations made per donor from India in the year 2018? | SELECT AVG(donation_amount) FROM donations WHERE donor_country = 'India' AND YEAR(donation_date) = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE life_expectancy (country VARCHAR(50), year INT, expectancy DECIMAL(3,1)); | What is the average life expectancy in Canada? | SELECT AVG(expectancy) FROM life_expectancy WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_credits (company_name VARCHAR(30), country VARCHAR(20), credits NUMERIC(10,2)); INSERT INTO carbon_credits (company_name, country, credits) VALUES ('CompanyA', 'France', 1200.5), ('CompanyB', 'France', 950.0), ('CompanyC', 'France', 800.2), ('CompanyD', 'France', 700.0); | Find the total carbon credits earned by renewable energy companies in France. | SELECT SUM(credits) FROM carbon_credits WHERE country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), num_employees INT, environmental_impact_score INT); | Find the mining operations that have a high environmental impact score and also a high number of employees. | SELECT name FROM mining_operations WHERE num_employees > (SELECT AVG(num_employees) FROM mining_operations) AND environmental_impact_score > (SELECT AVG(environmental_impact_score) FROM mining_operations); | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_procedures(id INT, name TEXT, location TEXT, category TEXT); INSERT INTO medical_procedures(id, name, location, category) VALUES (1, 'Procedure A', 'Mississippi Low-Income', 'Preventative'), (2, 'Procedure B', 'Mississippi Low-Income', 'Diagnostic'), (3, 'Procedure C', 'Mississippi High-Income', 'S... | What is the total number of medical procedures and their respective categories in low-income areas of Mississippi? | SELECT COUNT(*) as procedure_count, category FROM medical_procedures WHERE location = 'Mississippi Low-Income' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_soil_moisture (farm_id INTEGER, date DATE, moisture INTEGER); | What is the minimum soil moisture level recorded for each farm in the past year? | SELECT farm_id, MIN(moisture) as min_moisture FROM farm_soil_moisture WHERE date >= DATEADD(year, -1, GETDATE()) GROUP BY farm_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Retail (product_id INT, product_name TEXT, packaging_weight DECIMAL); INSERT INTO Retail (product_id, product_name, packaging_weight) VALUES (201, 'Shampoo', 0.12); INSERT INTO Retail (product_id, product_name, packaging_weight) VALUES (202, 'Lotion', 0.05); INSERT INTO Retail (product_id, product_name, pa... | What is the sum of plastic packaging weights for products in the Retail table? | SELECT SUM(packaging_weight) FROM Retail WHERE packaging_material = 'plastic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_devices (device_id INT, country VARCHAR(50)); | How many network devices were installed per country? | SELECT country, COUNT(device_id) FROM network_devices GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtWorkSales (artworkID INT, artistID INT, saleDate DATE); CREATE TABLE Artists (artistID INT, artistName VARCHAR(50)); | How many artworks were sold by each artist in 2020? | SELECT a.artistName, COUNT(*) as artwork_count FROM ArtWorkSales aws JOIN Artists a ON aws.artistID = a.artistID WHERE YEAR(aws.saleDate) = 2020 GROUP BY a.artistName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales (supplier VARCHAR(255), region VARCHAR(255), equipment VARCHAR(255), quantity INT, sale_year INT); | What is the total number of military vehicles sold by ACME Corp to the African region in the year 2022? | SELECT SUM(quantity) FROM Military_Equipment_Sales WHERE supplier = 'ACME Corp' AND region = 'Africa' AND sale_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (city_name VARCHAR(50), region VARCHAR(50), waste_generation INT, recycling_rate FLOAT); INSERT INTO cities (city_name, region, waste_generation, recycling_rate) VALUES ('CityA', 'North East', 5000, 0.3), ('CityB', 'North East', 3000, 0.25), ('CityC', 'North East', 7000, 0.4); | What are the total waste generation metrics for each city in the region 'North East', including the recycling rates, in descending order of waste generation? | SELECT city_name, waste_generation, recycling_rate FROM cities WHERE region = 'North East' ORDER BY waste_generation DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Articles (id INT, publication_date DATE, word_count INT); INSERT INTO Articles (id, publication_date, word_count) VALUES (1, '2020-01-01', 500), (2, '2020-02-02', 700), (3, '2019-12-31', 300), (4, '2020-05-05', 600); | What is the average word count of articles that were published in 2020? | SELECT AVG(word_count) as avg_word_count FROM Articles WHERE YEAR(publication_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name VARCHAR(255), region VARCHAR(255), avg_depth FLOAT, conservation_status VARCHAR(255)); INSERT INTO marine_protected_areas (area_name, region, avg_depth, conservation_status) VALUES ('Galapagos Marine Reserve', 'Pacific', 200, 'Fully Protected'), ('Great Barrier Reef', 'Pac... | What is the average depth of all marine protected areas in the Pacific region, grouped by conservation status?" | SELECT conservation_status, AVG(avg_depth) as avg_depth FROM marine_protected_areas WHERE region = 'Pacific' GROUP BY conservation_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE gas_production (year INT, region VARCHAR(255), gas_quantity INT); INSERT INTO gas_production (year, region, gas_quantity) VALUES (2015, 'Gulf of Mexico', 1230000), (2016, 'Gulf of Mexico', 1500000), (2017, 'Gulf of Mexico', 1750000), (2018, 'Gulf of Mexico', 1900000), (2019, 'Gulf of Mexico', 2100000); | What is the total gas production in the Gulf of Mexico for each year? | SELECT year, SUM(gas_quantity) FROM gas_production WHERE region = 'Gulf of Mexico' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (incident_id INT PRIMARY KEY, incident_date TIMESTAMP, region VARCHAR(50)); | What are the top 3 countries with the highest number of security incidents in the past year? | SELECT region, COUNT(*) as incident_count FROM incidents WHERE incident_date >= NOW() - INTERVAL 1 YEAR GROUP BY region ORDER BY incident_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contractors (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO defense_contractors (id, name, region) VALUES (1, 'Lockheed Martin', 'Asia-Pacific'), (2, 'Boeing', 'Asia-Pacific'), (3, 'Raytheon', 'North America'); CREATE TABLE military_equipment_sales (id INT, defense_contractor_id INT, ... | What is the total number of military equipment sales for each defense contractor in the Asia-Pacific region, grouped by country and displayed in descending order of sales volume? | SELECT m.country, d.name, SUM(m.sales) as total_sales FROM military_equipment_sales m JOIN defense_contractors d ON m.defense_contractor_id = d.id WHERE d.region = 'Asia-Pacific' GROUP BY m.country, d.name ORDER BY total_sales DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (id INT, name VARCHAR(50), gender VARCHAR(10), dob DATE); INSERT INTO patient (id, name, gender, dob) VALUES (1, 'John Doe', 'Male', '1980-01-01'); INSERT INTO patient (id, name, gender, dob) VALUES (2, 'Jane Smith', 'Female', '1990-02-02'); | Find the number of male and female patients in the patient table. | SELECT gender, COUNT(*) FROM patient GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_health_centers (center_id INT, center_name VARCHAR(100), state VARCHAR(50), num_staff INT); INSERT INTO rural_health_centers (center_id, center_name, state, num_staff) VALUES (1, 'Center A', 'California', 75), (2, 'Center B', 'California', 90), (3, 'Center C', 'Texas', 120), (4, 'Center D', 'Texas', ... | What is the minimum and maximum number of rural health centers in each state in the USA, and how many of these centers are located in states with more than 500 rural health centers? | SELECT MIN(num_staff) AS min_staff, MAX(num_staff) AS max_staff, COUNT(*) FILTER (WHERE num_staff > 500) AS centers_with_more_than_500_staff FROM ( SELECT state, COUNT(*) AS num_staff FROM rural_health_centers GROUP BY state ) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, engineer_id INT, department VARCHAR(20), cost DECIMAL(10,2)); INSERT INTO projects (id, engineer_id, department, cost) VALUES (1, 1001, 'civil', 5000), (2, 1002, 'civil', 6000), (3, 1003, 'structural', 4000), (4, 1001, 'civil', 7000), (5, 1002, 'civil', 3000), (6, 1003, 'structural', 6000... | List all unique departments, ordered from the fewest projects to the most. | SELECT department FROM projects GROUP BY department ORDER BY COUNT(*) ASC; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA renewables;CREATE TABLE hydro_power (name VARCHAR(50), capacity INT);INSERT INTO renewables.hydro_power (name, capacity) VALUES ('PowerPlant1', 300); | Find the difference in capacity between hydro and wind power in the 'renewables' schema? | SELECT SUM(renewables.wind_farms.capacity) - SUM(renewables.hydro_power.capacity) FROM renewables.wind_farms, renewables.hydro_power; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_sales (sale_id INT, fan_id INT, team VARCHAR(50), event_date DATE, tickets_sold INT, revenue DECIMAL(6,2)); INSERT INTO ticket_sales (sale_id, fan_id, team, event_date, tickets_sold, revenue) VALUES (1, 1, 'Sky High Flyers', '2022-07-25', 2, 150.00), (2, 2, 'Bouncing Bears', '2022-07-26', 1, 75.00); | Insert a new record for a ticket sale in the ticket_sales table | INSERT INTO ticket_sales (sale_id, fan_id, team, event_date, tickets_sold, revenue) VALUES (3, 4, 'Bouncing Bears', '2022-07-27', 3, 225.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT, name VARCHAR(50), region VARCHAR(50)); CREATE TABLE regions (id INT, name VARCHAR(50)); INSERT INTO regions (id, name) VALUES (1, 'North America'), (2, 'Europe'), (3, 'Asia'), (4, 'Antarctica'); INSERT INTO countries (id, name, region) VALUES (1, 'USA', 'North America'), (2, 'Russia', 'E... | Delete all regions with no countries from the regions table | DELETE FROM regions WHERE id NOT IN (SELECT region FROM countries); | gretelai_synthetic_text_to_sql |
CREATE TABLE CarbonOffsets (id INT, project_name VARCHAR(50), country VARCHAR(50), co2_reduction INT, year INT); INSERT INTO CarbonOffsets (id, project_name, country, co2_reduction, year) VALUES (2, 'Reef Renewal', 'Australia', 6000, 2021); | What carbon offset projects and green buildings are in Australia? | SELECT c.project_name, g.name FROM CarbonOffsets c INNER JOIN GreenBuildings g ON c.country = g.country WHERE c.country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MitigationProjects (Id INT, Name VARCHAR(50), Cost DECIMAL(10,2), Location VARCHAR(20)); | What is the average cost of climate change mitigation projects in Europe? | SELECT AVG(Cost) FROM MitigationProjects WHERE Location = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Subscribers (subscriber_id INT, service VARCHAR(20), region VARCHAR(20), revenue FLOAT, payment_date DATE); INSERT INTO Subscribers (subscriber_id, service, region, revenue, payment_date) VALUES (1, 'Broadband', 'Metro', 50.00, '2023-01-01'), (2, 'Mobile', 'Urban', 35.00, '2023-01-15'), (3, 'Mobile', 'Rura... | Update the revenue by 10% for the 'Mobile' service in the 'Urban' region in Q1 of 2023. | UPDATE Subscribers SET revenue = revenue * 1.10 WHERE service = 'Mobile' AND region = 'Urban' AND QUARTER(payment_date) = 1 AND YEAR(payment_date) = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_creators (id INT, gender VARCHAR, region VARCHAR); INSERT INTO content_creators (id, gender, region) VALUES (1, 'Female', 'Pacific'); INSERT INTO content_creators (id, gender, region) VALUES (2, 'Male', 'Atlantic'); | What is the percentage of female content creators in the Pacific region? | SELECT region, gender, COUNT(*) as count, ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM content_creators WHERE region = 'Pacific'), 2) as percentage FROM content_creators WHERE region = 'Pacific' GROUP BY region, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accessible_Tech_Projects (ID INT, Project_Name VARCHAR(100), Location VARCHAR(50), Budget DECIMAL(10,2)); INSERT INTO Accessible_Tech_Projects (ID, Project_Name, Location, Budget) VALUES (1, 'Tech4All', 'Asia', 150000.00), (2, 'AI4Good', 'Asia', 200000.00), (3, 'EqualWeb', 'Europe', 120000.00); | What is the minimum budget for accessible technology projects in Asia? | SELECT MIN(Budget) FROM Accessible_Tech_Projects WHERE Location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_containers (container_id INT, container_name TEXT, last_inspection_date DATE, in_use BOOLEAN); INSERT INTO chemical_containers (container_id, container_name, last_inspection_date, in_use) VALUES (1, 'Container A', '2021-01-01', TRUE), (2, 'Container B', '2021-04-15', FALSE), (3, 'Container C', '20... | Delete all records of chemical containers that have not been inspected in the past 6 months and are not in use. | DELETE FROM chemical_containers WHERE last_inspection_date IS NULL OR last_inspection_date < NOW() - INTERVAL 6 MONTH AND in_use = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE public.vehicles (id INT, type VARCHAR(20), city VARCHAR(20)); INSERT INTO public.vehicles (id, type, city) VALUES (1, 'electric_car', 'Paris'), (2, 'conventional_car', 'Paris'), (3, 'autonomous_bus', 'Paris'), (4, 'conventional_car', 'Berlin'), (5, 'electric_bus', 'Berlin'); | List all cities with their respective counts of conventional vehicles | SELECT city, COUNT(*) FROM public.vehicles WHERE type NOT LIKE 'electric%' AND type NOT LIKE 'autonomous%' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE people (id INT, gender VARCHAR(50), technology_id INT); | What is the distribution of accessible technology costs by gender? | SELECT gender, AVG(cost) as avg_cost FROM people p INNER JOIN technology t ON p.technology_id = t.id WHERE t.accessibility_rating > 6 GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditure (drug_name TEXT, amount INTEGER, year INTEGER); | What was the average R&D expenditure for drugs in 2020? | SELECT AVG(amount) FROM rd_expenditure WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, debris_name VARCHAR(50), orbit_type VARCHAR(50), launch_year INT, weight FLOAT); INSERT INTO space_debris (id, debris_name, orbit_type, launch_year, weight) VALUES (1, 'DEBRISSAT-1', 'LEO', 1973, 800.0); INSERT INTO space_debris (id, debris_name, orbit_type, launch_year, weight) VALUE... | What is the total weight of space debris in orbit around Earth? | SELECT SUM(weight) FROM space_debris WHERE orbit_type IN ('LEO', 'GEO'); | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (id INT, name VARCHAR(50), age INT, last_pd_course DATE); | What is the average age of teachers who have completed a professional development course in the past year? | SELECT AVG(age) FROM teachers WHERE last_pd_course >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT PRIMARY KEY, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'Europe'); INSERT INTO regions (id, name) VALUES (2, 'North America'); CREATE TABLE population_by_region (region_id INT, species_id INT, population INT); INSERT INTO population_by_region (region_id, species_id, popul... | Update the 'Spruce' species population in Europe to 5,200,000. | UPDATE population_by_region SET population = 5200000 WHERE region_id = 1 AND species_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_stats (game_name VARCHAR(255), players_online INT, peak_players INT, average_session_length TIME); | Update the "average_session_length" column for the "RPG Quest" game | UPDATE game_stats SET average_session_length = '02:00:00' WHERE game_name = 'RPG Quest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE internet_access (id INT, country VARCHAR(50), urban_population FLOAT, rural_population FLOAT, total_population FLOAT, internet_users FLOAT); INSERT INTO internet_access (id, country, urban_population, rural_population, total_population, internet_users) VALUES (3, 'Nigeria', 71.4, 57.1, 200.96, 112.03); | What is the internet penetration in African countries with a total population greater than 20 million? | SELECT country, (internet_users / total_population) * 100 as internet_penetration FROM internet_access WHERE total_population > 20000000 AND country IN ('Nigeria', 'South Africa', 'Egypt', 'Ethiopia', 'Kenya') ORDER BY internet_penetration DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Multimodal_Data (Id INT, City VARCHAR(50), Mode VARCHAR(50), Month VARCHAR(10)); INSERT INTO Multimodal_Data (Id, City, Mode, Month) VALUES (1, 'Vancouver', 'Skytrain', 'September'); INSERT INTO Multimodal_Data (Id, City, Mode, Month) VALUES (2, 'Vancouver', 'Bus', 'September'); | What is the percentage of multimodal trips in the city of Vancouver in the month of September? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Multimodal_Data WHERE City = 'Vancouver' AND Month = 'September')) FROM Multimodal_Data WHERE City = 'Vancouver' AND Month = 'September' AND Mode IN ('Skytrain', 'Bus'); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_initiatives (id INT, initiative_type VARCHAR(20), ESG_rating FLOAT); INSERT INTO climate_initiatives (id, initiative_type, ESG_rating) VALUES (1, 'climate_change_mitigation', 8.5), (2, 'climate_change_mitigation', 7.6), (3, 'climate_change_mitigation', 8.8); | Delete all records with an ESG rating above 8 for 'climate_change_mitigation' initiatives. | DELETE FROM climate_initiatives WHERE initiative_type = 'climate_change_mitigation' AND ESG_rating > 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE life_expectancy_data (county VARCHAR(255), life_expectancy FLOAT); INSERT INTO life_expectancy_data (county, life_expectancy) VALUES ('Los Angeles County', 81.7), ('Orange County', 83.2); | What is the average life expectancy in 'Los Angeles County'? | SELECT life_expectancy FROM life_expectancy_data WHERE county = 'Los Angeles County'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, title TEXT, genre TEXT); | Add a new TV show 'The Mandalorian' with a genre 'Sci-fi' | INSERT INTO tv_shows (id, title, genre) VALUES (1, 'The Mandalorian', 'Sci-fi'); | gretelai_synthetic_text_to_sql |
CREATE TABLE company_founding(id INT PRIMARY KEY, company_name VARCHAR(100), founder_country VARCHAR(50), funding_amount INT); INSERT INTO company_founding VALUES (1, 'Acme Inc', 'USA', 1000000); INSERT INTO company_founding VALUES (2, 'Beta Corp', 'USA', 2000000); INSERT INTO company_founding VALUES (3, 'Charlie LLC',... | Find the maximum and minimum funding amounts for companies founded by individuals from the same country | SELECT MAX(funding_amount), MIN(funding_amount) FROM company_founding WHERE founder_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (id INT, name VARCHAR(255), contact_info VARCHAR(255)); CREATE TABLE Donations (id INT, donor_id INT, program VARCHAR(255), amount DECIMAL(10, 2)); INSERT INTO Donors (id, name, contact_info) VALUES (1, 'John Doe', 'johndoe@example.com'), (2, 'Jane Smith', 'janesmith@example.com'); INSERT INTO Donat... | How many unique donors have contributed to the health program? | SELECT COUNT(DISTINCT donor_id) as num_unique_donors FROM Donations WHERE program = 'Health'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TribalSchoolY (studentID INT, mentalHealthScore INT); INSERT INTO TribalSchoolY (studentID, mentalHealthScore) VALUES (1, 75), (2, 78), (3, 81); | What is the minimum mental health score of students in 'Tribal School Y'? | SELECT MIN(mentalHealthScore) FROM TribalSchoolY WHERE schoolName = 'Tribal School Y'; | gretelai_synthetic_text_to_sql |
CREATE TABLE disasters (id INT, country TEXT, year INT, num_disasters INT); INSERT INTO disasters | How many disasters were responded to in Haiti from 2010 to 2020? | SELECT COUNT(*) FROM disasters WHERE country = 'Haiti' AND year BETWEEN 2010 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteer (VolunteerID int, VolunteerName varchar(50), Country varchar(50)); CREATE TABLE VolunteerProgram (ProgramID int, VolunteerID int, ProgramDate date); | List all volunteers who have participated in programs in the last week? | SELECT VolunteerName FROM Volunteer JOIN VolunteerProgram ON Volunteer.VolunteerID = VolunteerProgram.VolunteerID WHERE ProgramDate >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE sensors (id INT, sensor_id INT, crop VARCHAR(10)); INSERT INTO sensors (id, sensor_id, crop) VALUES (1, 101, 'corn'), (2, 102, 'soybean'), (3, 103, 'corn'), (4, 104, 'wheat'); | How many IoT sensors are there in the 'sensors' table for crop type 'corn'? | SELECT COUNT(*) FROM sensors WHERE crop = 'corn'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication_campaigns (id INT, campaign VARCHAR(50), location VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO climate_communication_campaigns (id, campaign, location, start_date, end_date) VALUES (1, 'Permafrost Thaw Awareness', 'Arctic', '2010-01-01', '2011-01-01'), (2, 'Polar Bear Con... | List all climate communication campaigns in the Arctic and their end dates | SELECT campaign, end_date FROM climate_communication_campaigns WHERE location = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage (id INT, location VARCHAR(255), capacity INT); INSERT INTO energy_storage (id, location, capacity) VALUES (1, 'Texas', 500), (2, 'Ontario', 600), (3, 'California', 400); | What is the maximum energy storage capacity in Texas and Ontario? | SELECT MAX(capacity) FROM energy_storage WHERE location IN ('Texas', 'Ontario'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_features (hotel_id INT, country TEXT, rating FLOAT, ai_guest_comm INT); INSERT INTO hotel_features (hotel_id, country, rating, ai_guest_comm) VALUES (1, 'Japan', 4.5, 1), (2, 'Japan', 4.7, 0), (3, 'Canada', 4.2, 1); | What is the minimum rating of hotels in Japan that have adopted AI-powered guest communication? | SELECT MIN(rating) FROM hotel_features WHERE country = 'Japan' AND ai_guest_comm = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendees (id INT PRIMARY KEY, name VARCHAR(100), event_date DATE, country VARCHAR(50)); | Delete a record from the "attendees" table where the attendee is from Japan | DELETE FROM attendees WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(20), account_balance DECIMAL(10, 2)); | Show the average account balance for customers in each region, and the total number of customers in each region. | SELECT region, AVG(account_balance) as avg_account_balance, COUNT(*) as num_customers FROM customers GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE festival_revenue (festival_id INT, festival_name VARCHAR(100), ticket_price DECIMAL(5,2), total_tickets_sold INT); INSERT INTO festival_revenue (festival_id, festival_name, ticket_price, total_tickets_sold) VALUES (1, 'Summer Fest', 100.00, 50000); INSERT INTO festival_revenue (festival_id, festival_name, ... | What is the total revenue for the 'Summer Fest' and 'Rock N Roll Festival'? | SELECT festival_name, ticket_price * total_tickets_sold AS total_revenue FROM festival_revenue WHERE festival_name IN ('Summer Fest', 'Rock N Roll Festival'); | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, name VARCHAR(100), game VARCHAR(50)); CREATE TABLE played_games (player_id INT, game VARCHAR(50)); | Find players who have never played a specific game | SELECT p.name, p.game FROM players p LEFT JOIN played_games pg ON p.player_id = pg.player_id WHERE pg.game IS NULL AND p.game = 'GameY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Art_Inventory (art_id INT, art_name VARCHAR(255), category VARCHAR(255), year INT); INSERT INTO Art_Inventory (art_id, art_name, category, year) VALUES (1, 'Composition VIII', 'Abstract Art', 1916), (2, 'The Scream', 'Expressionism', 1893), (3, 'Black Square', 'Suprematism', 1915); | Who are the artists that have created art pieces in both the 'Impressionism' and 'Cubism' categories? | SELECT artist_name FROM (SELECT artist_name, category, COUNT(DISTINCT category) OVER (PARTITION BY artist_name) AS num_categories FROM Art_Inventory) tmp WHERE num_categories = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_production (prod_id INT, manufacturer VARCHAR(50), production_month DATE, cost FLOAT); INSERT INTO biosensor_production (prod_id, manufacturer, production_month, cost) VALUES (1, 'BioSys', '2021-01-01', 3500), (2, 'NanoSensors', '2021-02-01', 4000), (3, 'BioSys', '2021-03-01', 3700), (4, 'NanoSen... | What is the average biosensor production cost per month for the last year, per manufacturer? | SELECT manufacturer, AVG(cost) as avg_monthly_cost FROM biosensor_production WHERE production_month BETWEEN DATEADD(year, -1, CURRENT_DATE) AND CURRENT_DATE GROUP BY manufacturer, YEAR(production_month), MONTH(production_month); | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_workers (id INT, name VARCHAR(50), salary FLOAT, program VARCHAR(50), gender VARCHAR(50)); INSERT INTO textile_workers (id, name, salary, program, gender) VALUES (1, 'John Doe', 40000.0, 'Workforce Development', 'Male'); INSERT INTO textile_workers (id, name, salary, program, gender) VALUES (2, 'Ja... | What is the average salary of workers in the textile industry who are part of a workforce development program, grouped by gender? | SELECT AVG(salary), gender FROM textile_workers WHERE program IN ('Workforce Development', 'Apprenticeship') GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE GovernmentRecycling (id INT, sector VARCHAR(20), recycling_rate FLOAT); INSERT INTO GovernmentRecycling (id, sector, recycling_rate) VALUES (1, 'Government', 0.6), (2, 'Government', 0.4); | What is the minimum recycling rate in the 'Government' sector? | SELECT MIN(recycling_rate) FROM GovernmentRecycling WHERE sector = 'Government'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (Id INT, Name VARCHAR(50), City VARCHAR(50), StartDate DATE, EndDate DATE, Sustainable BOOLEAN); | How many sustainable projects were completed in Texas in 2021? | SELECT COUNT(p.Id) FROM Projects p WHERE p.City = 'Texas' AND p.EndDate <= '2021-12-31' AND p.Sustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, gender VARCHAR(10), sport_preference VARCHAR(20)); INSERT INTO fans (fan_id, gender, sport_preference) VALUES (1, 'Male', 'Basketball'), (2, 'Female', 'Football'), (3, 'Male', 'Soccer'), (4, 'Female', 'Basketball'), (5, 'Male', 'Football'), (6, 'Female', 'Soccer'); | Show the total number of fans for each sport | SELECT sport_preference, COUNT(*) as num_fans FROM fans GROUP BY sport_preference; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_port_visits ( id INT, vessel_id INT, port_id INT, visit_date DATE ); INSERT INTO vessel_port_visits (id, vessel_id, port_id, visit_date) VALUES (1, 12, 20, '2021-02-03'); INSERT INTO vessel_port_visits (id, vessel_id, port_id, visit_date) VALUES (2, 13, 21, '2021-01-15'); | How many times did each vessel visit ports in the Caribbean region in the last year? | SELECT vessel_id, COUNT(DISTINCT visit_date) as visits_to_caribbean_ports FROM vessel_port_visits WHERE port_id BETWEEN 1 AND 50 GROUP BY vessel_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Garments (id INT, name VARCHAR(255), category VARCHAR(255), color VARCHAR(255), size VARCHAR(10)); | Delete all records from the Garments table where the size is 'XL' | DELETE FROM Garments WHERE size = 'XL'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicleChargingStationsByRegion(Country VARCHAR(50), State VARCHAR(50), Stations INT); | What is the total number of electric vehicle charging stations by country and state? | SELECT Country, State, SUM(Stations) FROM ElectricVehicleChargingStationsByRegion GROUP BY Country, State; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication_campaigns (year INT, region VARCHAR(255), campaign VARCHAR(255)); INSERT INTO climate_communication_campaigns (year, region, campaign) VALUES (2019, 'North America', 'Climate Action Day A'), (2019, 'Europe', 'Green Living B'), (2019, 'South America', 'Climate Change Education C'), (20... | What are the top 3 regions with the most climate communication campaigns in 2019? | SELECT region, COUNT(*) as campaign_count FROM climate_communication_campaigns WHERE year = 2019 GROUP BY region ORDER BY campaign_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_production (id INT, country VARCHAR(50), rate FLOAT); | Find the average production rate (bpd) of wells in Brazil. | SELECT AVG(rate) FROM well_production WHERE country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE australian_garments (id INT PRIMARY KEY, garment VARCHAR(50), type VARCHAR(50), fair_trade_certified BOOLEAN); INSERT INTO australian_garments (id, garment, type, fair_trade_certified) VALUES (1, 'T-Shirt', 'Cotton', true), (2, 'Sweater', 'Wool', false), (3, 'Pants', 'Hemp', true), (4, 'Jacket', 'Polyester... | What is the percentage of fair trade certified garments, by type, in the Australian ethical fashion market? | SELECT type, 100.0 * SUM(fair_trade_certified) / COUNT(*) as percentage FROM australian_garments GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, city VARCHAR(20), response_time INT); | What is the average response time for emergency calls in the city of Oakland? | SELECT AVG(response_time) FROM emergency_calls WHERE city = 'Oakland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_species (name VARCHAR(255), habitat VARCHAR(255)); CREATE TABLE ocean_acidification (location VARCHAR(255), level FLOAT); | How many deep-sea species have been found in areas with low ocean acidification? | SELECT COUNT(*) FROM deep_sea_species dss INNER JOIN ocean_acidification oa ON dss.habitat = oa.location WHERE oa.level < 7.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE DispensaryLicense (LicenseID INT PRIMARY KEY, BusinessName VARCHAR(255), Location VARCHAR(255), LicenseType VARCHAR(255), IssueDate DATE); | Insert new records for a dispensary license in Oakland, CA. | INSERT INTO DispensaryLicense (LicenseID, BusinessName, Location, LicenseType, IssueDate) VALUES (123, 'Emerald City', 'Oakland, CA', 'Medical', '2022-05-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (project_id INT, project_name VARCHAR(255), country VARCHAR(255), capacity DECIMAL(10,2)); INSERT INTO renewable_projects (project_id, project_name, country, capacity) VALUES (1, 'Solar Farm 1', 'USA', 1000.00), (2, 'Wind Farm 1', 'Canada', 1500.00), (3, 'Hydro Plant 1', 'Brazil', 2000.0... | What is the total installed capacity (in kW) of renewable energy projects for each country, sorted by the highest capacity? | SELECT country, SUM(capacity) as total_capacity FROM renewable_projects GROUP BY country ORDER BY total_capacity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(255), type VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO projects (id, name, type, start_date, end_date) VALUES (1, 'Solar Farm', 'Renewable Energy', '2018-01-01', '2019-12-31'), (2, 'Geothermal Plant', 'Renewable Energy', '2019-01-01', '2020-12-31'); | What is the total number of solar and geothermal power projects, and their average duration? | SELECT type, COUNT(*) as total, AVG(DATEDIFF(end_date, start_date)) as avg_duration FROM projects WHERE type IN ('Solar Farm', 'Geothermal Plant') GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (subscriber_id INT, data_usage FLOAT, region VARCHAR(20)); INSERT INTO subscribers (subscriber_id, data_usage, region) VALUES (1, 15.5, 'Rural'), (2, 200.0, 'Africa'), (3, 30.0, 'Metro'), (4, 10.0, 'Rural'), (5, 250.0, 'Africa'); | List the top 2 subscribers with the highest data usage in 'Africa'. | SELECT subscriber_id, data_usage FROM subscribers WHERE region = 'Africa' ORDER BY data_usage DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE RussianMeetings (Department VARCHAR(50), MeetingDate DATE); INSERT INTO RussianMeetings (Department, MeetingDate) VALUES ('Defense', '2020-01-01'), ('Defense', '2020-02-03'), ('Interior', '2020-01-15'); | Which department in the Russian government had the least number of public meetings in 2020? | SELECT Department, MIN(COUNT(*)) OVER (PARTITION BY Department) FROM RussianMeetings WHERE MeetingDate >= '2020-01-01' AND MeetingDate < '2021-01-01' GROUP BY Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergencies (id INT, emergency_type VARCHAR(20), neighborhood VARCHAR(20), response_time FLOAT); INSERT INTO emergencies (id, emergency_type, neighborhood, response_time) VALUES (1, 'medical', 'Northside', 12.5), (2, 'fire', 'Hillside', 6.3), (3, 'fire', 'Downtown', 8.1), (4, 'medical', 'Hillside', 6.8), (... | What is the minimum response time for medical emergencies in 'Hillside'? | SELECT MIN(response_time) FROM emergencies WHERE emergency_type = 'medical' AND neighborhood = 'Hillside'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tree_inventory (id INT, species VARCHAR(50), diameter FLOAT); INSERT INTO tree_inventory (id, species, diameter) VALUES (1, 'Oak', 35.2), (2, 'Cedar', 28.9), (3, 'Oak', 22.1), (4, 'Pine', 31.6), (5, 'Maple', 29.4); | Show the number of unique tree species in the tree_inventory table that have a diameter at breast height less than 30 inches | SELECT COUNT(DISTINCT species) FROM tree_inventory WHERE diameter < 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_projects (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), funding_source VARCHAR(50), start_date DATE, end_date DATE); | Insert data into 'agricultural_projects' table | INSERT INTO agricultural_projects (id, name, location, funding_source, start_date, end_date) VALUES (1, 'Solar Powered Irrigation', 'Rural Kenya', 'World Bank', '2022-01-01', '2023-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE offenders (offender_id INT, age INT, state VARCHAR(20)); INSERT INTO offenders (offender_id, age, state) VALUES (1, 34, 'California'), (2, 28, 'California'); CREATE TABLE restorative_justice (offender_id INT, program_id INT); INSERT INTO restorative_justice (offender_id, program_id) VALUES (1, 101), (2, 10... | What is the average age of offenders who participated in restorative justice programs in California? | SELECT AVG(offenders.age) FROM offenders INNER JOIN restorative_justice ON offenders.offender_id = restorative_justice.offender_id WHERE offenders.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, region VARCHAR(50), volunteer_type VARCHAR(50), registration_date DATE); INSERT INTO volunteers (id, region, volunteer_type, registration_date) VALUES (1, 'North', 'Disaster Response', '2019-12-20'), (2, 'South', 'Disaster Response', '2019-11-15'), (3, 'East', 'Disaster Response', '2020... | How many disaster response volunteers were there in total as of January 1, 2020? | SELECT COUNT(*) as total_volunteers FROM volunteers WHERE volunteer_type = 'Disaster Response' AND registration_date <= '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (district_id INT, district_name VARCHAR(255)); CREATE TABLE student_mental_health (student_id INT, district_id INT, mental_health_score INT); CREATE TABLE workshops (workshop_id INT, district_id INT, workshop_topic VARCHAR(255), participant_id INT); INSERT INTO districts (district_id, district_na... | What is the average mental health score of students who participated in lifelong learning workshops, by school district? | SELECT sd.district_name, AVG(smh.mental_health_score) as avg_score FROM districts sd JOIN student_mental_health smh ON sd.district_id = smh.district_id JOIN workshops w ON smh.student_id = w.participant_id WHERE w.workshop_topic = 'Lifelong Learning' GROUP BY sd.district_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE BridgeYears ( BridgeID INT, Year INT, MaintenanceCost DECIMAL(10, 2)); | Determine the difference in maintenance costs between consecutive years for each bridge, and return the bridge with the largest difference. | SELECT BridgeID, MAX(Diff) as LargestDifference FROM ( SELECT BridgeID, Year, MaintenanceCost, MaintenanceCost - LAG(MaintenanceCost) OVER (PARTITION BY BridgeID ORDER BY Year) as Diff FROM BridgeYears) sub WHERE Diff IS NOT NULL GROUP BY BridgeID; | gretelai_synthetic_text_to_sql |
CREATE TABLE Neighborhood (neighborhood_id INT, neighborhood_name VARCHAR(50)); CREATE TABLE Building (building_id INT, building_name VARCHAR(50), building_type VARCHAR(50), carbon_offset INT, neighborhood_id INT); | What is the average carbon offset of buildings in a given neighborhood? | SELECT Neighborhood.neighborhood_name, AVG(Building.carbon_offset) as avg_carbon_offset FROM Neighborhood JOIN Building ON Neighborhood.neighborhood_id = Building.neighborhood_id GROUP BY Neighborhood.neighborhood_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, veteran BOOLEAN, department VARCHAR(255)); INSERT INTO employees (id, veteran, department) VALUES (1, true, 'Engineering'), (2, false, 'Marketing'), (3, true, 'Human Resources'), (4, false, 'Finance'), (5, true, 'Engineering'), (6, true, 'Engineering'), (7, false, 'Marketing'), (8, true,... | Which departments have more than 5 veteran employees? | SELECT department, COUNT(*) as veteran_count FROM employees WHERE veteran = true GROUP BY department HAVING veteran_count > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name TEXT, area_size FLOAT, avg_depth FLOAT, ocean TEXT); INSERT INTO marine_protected_areas (id, name, area_size, avg_depth, ocean) VALUES (1, 'Galapagos Marine Reserve', 133000, 200, 'Pacific'); | What is the average depth of all marine protected areas in the Pacific Ocean?" | SELECT AVG(avg_depth) FROM marine_protected_areas WHERE ocean = 'Pacific'; | gretelai_synthetic_text_to_sql |
vessel_emissions(emission_id, vessel_id, emission_type, emission_amount) | Insert a new record into the vessel_emissions table with the following details: vessel_id = V008, emission_type = 'CO2', emission_amount = 100 | INSERT INTO vessel_emissions (emission_id, vessel_id, emission_type, emission_amount) VALUES (1008, 'V008', 'CO2', 100); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName VARCHAR(50)); INSERT INTO Donors (DonorID, DonorName) VALUES (1, 'John Smith'), (2, 'Jane Doe'), (3, 'Bob Johnson'), (4, 'Alice Williams'), (5, 'Charlie Brown'); CREATE TABLE Donations (DonationID INT, DonorID INT, ProgramID INT); INSERT INTO Donations (DonationID, DonorID, P... | Which donors did not donate to the 'Health' program? | SELECT D.DonorID, D.DonorName FROM Donors D LEFT JOIN Donations DON ON D.DonorID = DON.DonorID WHERE DON.ProgramID IS NULL AND D.DonorID NOT IN (SELECT DON2.DonorID FROM Donations DON2 JOIN Programs P ON DON2.ProgramID = P.ProgramID WHERE P.ProgramName = 'Health'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (id INT, name VARCHAR(255), size VARCHAR(10), region VARCHAR(50)); INSERT INTO Customers (id, name, size, region) VALUES (1, 'Alice', 'S', 'US'), (2, 'Bob', 'M', 'US'), (3, 'Charlie', 'L', 'CA'), (4, 'David', 'M', 'US'), (5, 'Eve', 'S', 'US'); | List the top 5 most common sizes for customers in the 'US' region. | SELECT size, COUNT(*) FROM Customers WHERE region = 'US' GROUP BY size ORDER BY COUNT(*) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(255), sustainability_rating INT); INSERT INTO properties (id, city, sustainability_rating) VALUES (1, 'Austin', 3), (2, 'Austin', 4), (3, 'Austin', 5), (4, 'Houston', 2); | What is the average sustainability rating of properties in the city of Austin? | SELECT AVG(sustainability_rating) FROM properties WHERE city = 'Austin'; | 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.