context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE teacher_development (teacher_id INT, school VARCHAR(50), program_completed INT); INSERT INTO teacher_development (teacher_id, school, program_completed) VALUES (101, 'SchoolA', 3), (102, 'SchoolA', 1), (103, 'SchoolB', 2); | How many professional development programs were completed by teachers in 'SchoolA'? | SELECT COUNT(*) FROM teacher_development WHERE school = 'SchoolA' AND program_completed > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL(10,2), Country TEXT); | What is the total donation amount from donors in Brazil? | SELECT SUM(DonationAmount) FROM Donors WHERE Country = 'Brazil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Equipment_Sales(sale_id INT, sale_date DATE, equipment_type VARCHAR(50), supplier VARCHAR(50), region VARCHAR(50), sale_value DECIMAL(10,2)); | Who is the top supplier of military equipment to the Middle East in H1 of 2019? | SELECT supplier, SUM(sale_value) FROM Military_Equipment_Sales WHERE region = 'Middle East' AND sale_date BETWEEN '2019-01-01' AND '2019-06-30' GROUP BY supplier ORDER BY SUM(sale_value) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE StudentAccommodations (student_id INT, accommodation_type VARCHAR(255)); INSERT INTO StudentAccommodations (student_id, accommodation_type) VALUES (1, 'Sign Language Interpreter'), (2, 'Assistive Technology'), (3, 'Extended Testing Time'); | What is the total number of students who received accommodations in the 'StudentAccommodations' table? | SELECT COUNT(*) FROM StudentAccommodations; | gretelai_synthetic_text_to_sql |
CREATE TABLE mexico_tourism (destination VARCHAR(50), year INT, visitors INT); INSERT INTO mexico_tourism (destination, year, visitors) VALUES ('Cancun', 2019, 2000000), ('Cancun', 2022, 2500000), ('Puerto Vallarta', 2019, 1500000), ('Puerto Vallarta', 2022, 2000000); | Which destination in Mexico had the highest increase in visitors from 2019 to 2022? | SELECT destination, MAX(visitors) - MIN(visitors) AS increase FROM mexico_tourism WHERE year IN (2019, 2022) GROUP BY destination ORDER BY increase DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_donations_2021 (id INT, program TEXT, donation_date DATE, donation_amount DECIMAL); INSERT INTO program_donations_2021 (id, program, donation_date, donation_amount) VALUES (1, 'Arts Education', '2021-12-31', 1200.00); INSERT INTO program_donations_2021 (id, program, donation_date, donation_amount) ... | What is the total donation amount for each program in '2021' with HAVING clause? | SELECT program, SUM(donation_amount) as total_donations FROM program_donations_2021 GROUP BY program HAVING SUM(donation_amount) > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_brands (brand_id INT, brand_name TEXT); INSERT INTO ethical_brands (brand_id, brand_name) VALUES (1, 'BrandA'), (2, 'BrandB'), (3, 'BrandC'); CREATE TABLE sales (sale_id INT, brand_id INT, product_quantity INT, state TEXT); INSERT INTO sales (sale_id, brand_id, product_quantity, state) VALUES (1, 1... | What is the total quantity of products sold by ethical brands in New York and California? | SELECT SUM(product_quantity) FROM sales JOIN ethical_brands ON sales.brand_id = ethical_brands.brand_id WHERE state IN ('NY', 'CA') AND ethical_brands.brand_name IN ('BrandA', 'BrandB', 'BrandC'); | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_plants ( id INT, country_id INT, year INT, plant_type VARCHAR(20) ); INSERT INTO wastewater_plants (id, country_id, year, plant_type) VALUES (1, 1, 2017, 'industrial'), (2, 1, 2018, 'industrial'), (3, 1, 2019, 'industrial'), (4, 2, 2017, 'municipal'), (5, 2, 2018, 'municipal'), (6, 2, 2019, 'mun... | What is the number of wastewater treatment plants in India and China? | SELECT COUNT(*) FROM wastewater_plants WHERE country_id IN (1, 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE inspection_dates (id INT, restaurant_id INT, inspection_date DATE); INSERT INTO inspection_dates (id, restaurant_id, inspection_date) VALUES (1, 1, '2022-01-01'); INSERT INTO inspection_dates (id, restaurant_id, inspection_date) VALUES (2, 1, '2022-02-01'); INSERT INTO inspection_dates (id, restaurant_id, ... | Which restaurants have not had a food safety inspection in the last 30 days? | SELECT restaurant_id FROM inspection_dates WHERE inspection_date < CURRENT_DATE - INTERVAL '30 days' GROUP BY restaurant_id HAVING COUNT(*) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_tech (hotel_id INT, hotel_name TEXT, country TEXT, voice_assistant BOOLEAN); INSERT INTO hotel_tech (hotel_id, hotel_name, country, voice_assistant) VALUES (1, 'Hotel D', 'Brazil', TRUE), (2, 'Hotel E', 'Brazil', FALSE), (3, 'Hotel F', 'Brazil', TRUE); | How many hotels in Brazil have implemented voice-activated assistants? | SELECT COUNT(*) FROM hotel_tech WHERE country = 'Brazil' AND voice_assistant = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteName VARCHAR(50)); CREATE TABLE Artifacts (ArtifactType VARCHAR(50), SiteName VARCHAR(50), AnalysisResult VARCHAR(50)); INSERT INTO ExcavationSites (SiteName) VALUES ('Site7'), ('Site8'), ('Site9'); INSERT INTO Artifacts (ArtifactType, SiteName, AnalysisResult) VALUES ('Spear Head', 'S... | Which excavation sites have at least 2 different types of artifacts with analysis results indicating 'Presence of Metal'? | SELECT SiteName FROM ExcavationSites s WHERE (SELECT COUNT(DISTINCT AnalysisResult) FROM Artifacts a WHERE a.SiteName = s.SiteName AND a.AnalysisResult = 'Presence of Metal') >= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT PRIMARY KEY, location VARCHAR(100), type VARCHAR(100), passengers INT, year INT); | Insert records for bus and metro data in New York City | INSERT INTO public_transportation (id, location, type, passengers, year) VALUES (1, 'New York City', 'Bus', 500000, 2020), (2, 'New York City', 'Metro', 750000, 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE policyholders (id INT, age INT, gender VARCHAR(10), policy_type VARCHAR(20), premium FLOAT); INSERT INTO policyholders (id, age, gender, policy_type, premium) VALUES (1, 32, 'Female', 'Comprehensive', 1200.00), (2, 41, 'Male', 'Third-Party', 800.00); CREATE TABLE claims (id INT, policyholder_id INT, claim_... | What is the average claim amount for policyholders aged 30-40? | SELECT AVG(claim_amount) FROM claims JOIN policyholders ON claims.policyholder_id = policyholders.id WHERE policyholders.age BETWEEN 30 AND 40; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse_inventory (id INT, item_name VARCHAR(255), quantity INT, warehouse_location VARCHAR(50), restock_date DATE); | Update the warehouse_inventory table to reflect the arrival of 500 new smartphones in the Miami warehouse on 2022-02-15. | UPDATE warehouse_inventory SET quantity = quantity + 500 WHERE warehouse_location = 'Miami' AND restock_date = '2022-02-15' AND item_name = 'smartphone'; | gretelai_synthetic_text_to_sql |
CREATE TABLE multimodal_mobility (id INT, city_id INT, mode VARCHAR(50), users INT); INSERT INTO multimodal_mobility (id, city_id, mode, users) VALUES (4, 3, 'Car Sharing', 350000); INSERT INTO multimodal_mobility (id, city_id, mode, users) VALUES (5, 3, 'Microtransit', 100000); | What is the total number of users for each multimodal mobility mode in each city? | SELECT cities.name, multimodal_mobility.mode, SUM(multimodal_mobility.users) FROM cities JOIN multimodal_mobility ON cities.id = multimodal_mobility.city_id GROUP BY cities.name, multimodal_mobility.mode; | gretelai_synthetic_text_to_sql |
CREATE TABLE crimes (id INT, crime_time TIMESTAMP, location VARCHAR(20), involved_property BOOLEAN); INSERT INTO crimes (id, crime_time, location, involved_property) VALUES (1, '2021-12-31 23:59:00', 'willowbrook', true), (2, '2021-07-15 12:30:00', 'willowbrook', false), (3, '2021-11-01 09:45:00', 'downtown', true); | What is the total number of crimes reported in 'willowbrook' during 2021 that involved property damage? | SELECT COUNT(*) FROM crimes WHERE location = 'willowbrook' AND involved_property = true AND crime_time BETWEEN '2021-01-01 00:00:00' AND '2021-12-31 23:59:59'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (drug_name VARCHAR(50), approval_date DATE); INSERT INTO clinical_trials (drug_name, approval_date) VALUES ('DrugA', '2019-02-03'), ('DrugB', '2017-06-14'), ('DrugA', '2015-09-22'); | List the clinical trials for drug 'DrugA' that were approved after 2018? | SELECT drug_name FROM clinical_trials WHERE drug_name = 'DrugA' AND approval_date > '2018-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemicals (id INT, name TEXT, production_volume INT); INSERT INTO chemicals (id, name, production_volume) VALUES (1, 'Chemical A', 500), (2, 'Chemical B', 300), (3, 'Chemical C', 700); | What is the total production volume for all chemicals? | SELECT SUM(production_volume) FROM chemicals; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorID int, DonationAmount money, DonationDate date); | Identify the top 5 donors who made the largest single donations. | SELECT DonorID, MAX(DonationAmount) as LargestDonation FROM Donations GROUP BY DonorID ORDER BY LargestDonation DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitarySatellites (Id INT, Country VARCHAR(50), SatelliteName VARCHAR(50), LaunchYear INT, Function VARCHAR(50));INSERT INTO MilitarySatellites (Id, Country, SatelliteName, LaunchYear, Function) VALUES (1, 'USA', 'GPS Satellite 1', 2000, 'Navigation'), (2, 'Canada', 'RADARSAT-2', 2007, 'Earth Observation'... | What are the military satellite details for the countries in the North American region? | SELECT * FROM MilitarySatellites WHERE Country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO Exhibitions (exhibition_id, name, start_date, end_date) VALUES (1, 'Impressionist', '2020-05-01', '2021-01-01'), (2, 'Cubism', '2019-08-15', '2020-03-30'), (3, 'Surrealism', '2018-12-15', '2019-09-15'); CREATE TA... | What is the total number of visitors who attended exhibitions after 2019-01-01? | SELECT COUNT(*) FROM Visitors INNER JOIN Exhibitions ON Visitors.exhibition_id = Exhibitions.exhibition_id WHERE start_date > '2019-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (policy_id INT, claim_amount DECIMAL(10,2), policy_state VARCHAR(2)); | Find the average claim amount for car insurance policies in the state of California | SELECT AVG(claim_amount) FROM claims WHERE policy_state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, volunteer_name VARCHAR(255), city VARCHAR(255), state VARCHAR(255), country VARCHAR(255)); CREATE TABLE Volunteer_Hours (id INT, volunteer_id INT, hours INT, hour_date DATE); | How many volunteer hours were contributed by volunteers from the United States? | SELECT v.country, SUM(vh.hours) as total_hours FROM Volunteers v INNER JOIN Volunteer_Hours vh ON v.id = vh.volunteer_id WHERE v.country = 'United States' GROUP BY v.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, title VARCHAR(50), category VARCHAR(30), collection_id INT); INSERT INTO artworks (id, title, category, collection_id) VALUES (1, 'Artwork1', 'Painting', 1), (2, 'Artwork2', 'Sculpture', 1), (3, 'Artwork3', 'Painting', 2), (4, 'Artwork4', 'Print', 3), (5, 'Artwork5', 'Painting', 4); CREAT... | Find the total number of artworks in each category, along with the number of art collections that contain those categories. | SELECT a.category, COUNT(DISTINCT a.collection_id) as collection_count, COUNT(a.id) as artworks_count FROM artworks a GROUP BY a.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE FishSpecies (SpeciesID INT, SpeciesName VARCHAR(50), Quantity INT); INSERT INTO FishSpecies VALUES (1, 'Tilapia', 2000), (2, 'Salmon', 1500), (3, 'Trout', 1000); | How many fish are present in each species? | SELECT SpeciesName, SUM(Quantity) FROM FishSpecies GROUP BY SpeciesName; | gretelai_synthetic_text_to_sql |
CREATE TABLE basketball_games (id INT, game_date DATE, sport VARCHAR(50), average_points_per_player DECIMAL(5,2)); | What is the average number of points scored by basketball players in each game in the last month? | SELECT AVG(average_points_per_player) FROM basketball_games WHERE sport = 'basketball' AND game_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(50), price INT); CREATE TABLE co_owners (property_id INT, owner_name VARCHAR(50)); INSERT INTO properties (id, city, price) VALUES (1, 'Portland', 350000), (2, 'Seattle', 400000), (3, 'Portland', 250000); INSERT INTO co_owners (property_id, owner_name) VALUES (1, 'Alice'), ... | What is the minimum price of co-owned properties in each city? | SELECT city, MIN(price) FROM properties INNER JOIN co_owners ON properties.id = co_owners.property_id GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, habitat_type TEXT); INSERT INTO marine_species (id, name, habitat_type) VALUES (1, 'Shark', 'Ocean'); INSERT INTO marine_species (id, name, habitat_type) VALUES (2, 'Dolphin', 'Ocean'); INSERT INTO marine_species (id, name, habitat_type) VALUES (3, 'Sea Anemone', 'Coral R... | How many marine species are there in each habitat type? | SELECT habitat_type, COUNT(*) FROM marine_species GROUP BY habitat_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_subscribers (subscriber_id INT, state VARCHAR(50), subscription_type VARCHAR(50)); INSERT INTO broadband_subscribers (subscriber_id, state, subscription_type) VALUES (1, 'California', 'Residential'), (2, 'New York', 'Business'); | How many broadband subscribers are there in each state of the United States? | SELECT state, COUNT(*) FROM broadband_subscribers GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (agency TEXT, num_missions INTEGER); INSERT INTO space_missions (agency, num_missions) VALUES ('NASA', 135), ('ESA', 45), ('Russia', 126); | What is the total number of space missions by ESA? | SELECT SUM(num_missions) FROM space_missions WHERE agency = 'ESA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities (city_id INT, city_name VARCHAR(50), country VARCHAR(50), population INT, smart_tech_adoption_date DATE);CREATE TABLE green_transportation (transportation_id INT, city_id INT, type VARCHAR(50), capacity INT, adoption_date DATE);CREATE VIEW smart_cities_transportation AS SELECT smart_cities.cit... | Rank smart cities based on the number of smart transportation types adopted, using a SQL query with a window function. | SELECT city_name, city_rank FROM city_rank; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (id INT, license_plate TEXT, model_year INT, type TEXT); | Insert a new record into the 'vehicles' table for a train with license plate 'DEF456' and a model year of 2018 | INSERT INTO vehicles (license_plate, model_year, type) VALUES ('DEF456', 2018, 'train'); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_courts (id INT, name VARCHAR(50), state VARCHAR(50), cases_heard INT, year INT, is_indigenous BOOLEAN); INSERT INTO community_courts (id, name, state, cases_heard, year, is_indigenous) VALUES (1, 'Court 1', 'New South Wales', 500, 2019, 1); INSERT INTO community_courts (id, name, state, cases_hea... | What is the total number of community court cases heard in indigenous communities in Australia in the last 2 years? | SELECT SUM(cases_heard) FROM community_courts WHERE is_indigenous = 1 AND year >= (YEAR(CURRENT_DATE) - 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_incidents (region TEXT, incident_date DATE); INSERT INTO cybersecurity_incidents (region, incident_date) VALUES ('Middle East', '2023-01-01'); INSERT INTO cybersecurity_incidents (region, incident_date) VALUES ('Africa', '2023-02-01'); | What is the maximum number of cybersecurity incidents reported in the 'Middle East' region in the last 60 days? | SELECT COUNT(*) FROM cybersecurity_incidents WHERE region = 'Middle East' AND incident_date >= (CURRENT_DATE - INTERVAL '60 days') GROUP BY region HAVING COUNT(*) >= ALL (SELECT COUNT(*) FROM cybersecurity_incidents WHERE region = 'Middle East' AND incident_date >= (CURRENT_DATE - INTERVAL '60 days') GROUP BY region); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, language VARCHAR, publish_date DATE); INSERT INTO articles (id, language, publish_date) VALUES (1, 'Quechua', '2021-03-22'); INSERT INTO articles (id, language, publish_date) VALUES (2, 'Spanish', '2021-03-23'); | What is the total number of articles published in Indigenous languages since 2019? | SELECT SUM(CASE WHEN EXTRACT(YEAR FROM publish_date) >= 2019 AND language IN ('Quechua', 'Telugu', 'Yoruba') THEN 1 ELSE 0 END) as total_count FROM articles; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_response_times (id INT, borough_id INT, response_time FLOAT); | What is the difference in emergency response times between the fastest and slowest boroughs? | SELECT MAX(ert.response_time) - MIN(ert.response_time) FROM emergency_response_times ert JOIN borough b ON ert.borough_id = b.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE BeautyProducts (ProductID INT, ProductType VARCHAR(20), IsOrganic BOOLEAN, UnitsSold INT, SaleDate DATE); INSERT INTO BeautyProducts (ProductID, ProductType, IsOrganic, UnitsSold, SaleDate) VALUES (1, 'Facial Cleanser', TRUE, 500, '2022-06-15'); INSERT INTO BeautyProducts (ProductID, ProductType, IsOrganic... | What is the percentage of sales of organic beauty products in the last quarter? | SELECT ROUND(100.0 * SUM(CASE WHEN IsOrganic THEN UnitsSold END) / SUM(UnitsSold) OVER (), 2) AS OrganicSalesPercentage FROM BeautyProducts WHERE SaleDate >= DATEADD(QUARTER, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (id INT, title VARCHAR(255), creation_date DATE, artist_id INT); CREATE TABLE Artists (id INT, name VARCHAR(255), nationality VARCHAR(255)); INSERT INTO Artists (id, name, nationality) VALUES (1, 'Hokusai Katsushika', 'Japan'); INSERT INTO Artworks (id, title, creation_date, artist_id) VALUES (1, ... | How many artworks were created by artists from Japan in the 18th century? | SELECT COUNT(*) FROM Artworks INNER JOIN Artists ON Artworks.artist_id = Artists.id WHERE YEAR(creation_date) >= 1700 AND YEAR(creation_date) < 1800 AND Artists.nationality = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_vehicles (vehicle_id INT, make VARCHAR(50), model VARCHAR(50), mpg DECIMAL(5,2)); | What is the average miles per gallon (MPG) for electric vehicles in the 'green_vehicles' table? | SELECT AVG(mpg) FROM green_vehicles WHERE make = 'Tesla' AND model = 'Model 3'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (Id INT, Category VARCHAR(50), Amount DECIMAL(10, 2), Year INT); INSERT INTO Budget (Id, Category, Amount, Year) VALUES (1, 'Disability Services', 125000, 2021); | What was the total budget for disability services in 2021? | SELECT SUM(Amount) FROM Budget WHERE Category = 'Disability Services' AND Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage (year INT, region VARCHAR(255), num_projects INT); INSERT INTO energy_storage (year, region, num_projects) VALUES (2020, 'Asia', 12), (2020, 'Africa', 5), (2021, 'Asia', 15); | How many energy storage projects were initiated in Asia in 2020? | SELECT num_projects FROM energy_storage WHERE year = 2020 AND region = 'Asia' | gretelai_synthetic_text_to_sql |
CREATE TABLE community_dev (date DATE, region VARCHAR(255), funding_source VARCHAR(255), completed BOOLEAN); INSERT INTO community_dev (date, region, funding_source, completed) VALUES ('2022-01-01', 'Northeast', 'Government', TRUE), ('2022-01-05', 'Midwest', 'Non-profit', TRUE), ('2022-01-10', 'South', 'Corporate', TRU... | How many community development initiatives were completed in Q1 of 2022, broken down by region and funding source? | SELECT region, funding_source, COUNT(*) as num_initiatives FROM community_dev WHERE date >= '2022-01-01' AND date < '2022-04-01' GROUP BY region, funding_source; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, name VARCHAR(50), last_attendance DATETIME); | Add a new student record with the following details: student_id: 1001, name: Maria Garcia, last_attendance: 2023-01-15 | INSERT INTO students (student_id, name, last_attendance) VALUES (1001, 'Maria Garcia', '2023-01-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments_2 (id INT, item VARCHAR(50), shipped_date DATE, source_country VARCHAR(50), destination_country VARCHAR(50)); INSERT INTO Shipments_2 (id, item, shipped_date, source_country, destination_country) VALUES (1, 'Foo', '2022-01-01', 'Russia', 'Mexico'), (2, 'Bar', '2022-01-05', 'Mexico', 'Russia'); | What is the earliest date a package was shipped from Russia to Mexico? | SELECT MIN(shipped_date) FROM Shipments_2 WHERE source_country = 'Russia' AND destination_country = 'Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sourcing (country VARCHAR(10), material VARCHAR(10), quantity INT); INSERT INTO sourcing (country, material, quantity) VALUES ('Brazil', 'cotton', 2000), ('Argentina', 'wool', 1500); | What is the total quantity of textiles sourced from South America? | SELECT SUM(quantity) FROM sourcing WHERE country IN ('Brazil', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE productivity (productivity_id INT, employee_id INT, units_produced INT, hours_worked INT, industry VARCHAR(255), mine_id INT); INSERT INTO productivity (productivity_id, employee_id, units_produced, hours_worked, industry, mine_id) VALUES (1, 1, 100, 10, 'Mining', 1), (2, 2, 150, 12, 'Mining', 1), (3, 3, 2... | What is the average labor productivity by mine? | SELECT mine_id, AVG(units_produced/hours_worked) FROM productivity WHERE industry = 'Mining' GROUP BY mine_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_projects (id INT PRIMARY KEY, state VARCHAR(255), project_end_date DATE); | How many sustainable building projects were completed in Texas between 2018 and 2020? | SELECT COUNT(*) FROM sustainable_projects WHERE state = 'Texas' AND YEAR(project_end_date) BETWEEN 2018 AND 2020 AND sustainable = 'yes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurant (id INT, dish_name VARCHAR(255), dish_type VARCHAR(255), price DECIMAL(10,2), sale_date DATE); INSERT INTO Restaurant (id, dish_name, dish_type, price, sale_date) VALUES (1, 'Quinoa Salad', 'Vegetarian', 12.99, '2022-01-02'), (2, 'Pizza Margherita', 'Vegetarian', 9.99, '2022-01-05'), (3, 'Chicke... | What is the total revenue generated from vegetarian dishes in the last six months? | SELECT SUM(price) FROM Restaurant WHERE dish_type = 'Vegetarian' AND sale_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND CURDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists countries (id INT PRIMARY KEY, name VARCHAR(50), continent VARCHAR(50)); INSERT INTO countries (id, name, continent) VALUES (1, 'Afghanistan', 'Asia'); INSERT INTO countries (id, name, continent) VALUES (2, 'Albania', 'Europe'); CREATE TABLE if not exists refugee_camps (id INT PRIMARY KEY, na... | How many refugees are there in total for each country in Europe? | SELECT c.name, SUM(rc.num_refugees) FROM countries c JOIN refugee_camps rc ON c.id = rc.country_id WHERE c.continent = 'Europe' GROUP BY rc.country_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE IntelligenceOperations (Id INT PRIMARY KEY, Country VARCHAR(50), Operation VARCHAR(50)); | Identify the total number of intelligence operations from each country | SELECT Country, COUNT(*) FROM IntelligenceOperations GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE LanguagePrograms (ProgramID INT, Name VARCHAR(50), Country VARCHAR(50), StartYear INT, EndYear INT, EngagementScore INT); | Identify language preservation programs with the highest community engagement scores in the last 5 years. | SELECT * FROM LanguagePrograms WHERE Country IN ('Brazil', 'India', 'China') AND EndYear >= YEAR(CURRENT_DATE) - 5 AND EngagementScore = (SELECT MAX(EngagementScore) FROM LanguagePrograms WHERE EndYear >= YEAR(CURRENT_DATE) - 5) ORDER BY EngagementScore DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (EventName VARCHAR(50), Year INT, Region VARCHAR(20)); INSERT INTO DefenseDiplomacy (EventName, Year, Region) VALUES ('Event1', 2021, 'Asia-Pacific'), ('Event2', 2021, 'Europe'), ('Event3', 2021, 'Asia-Pacific'), ('Event4', 2021, 'Americas'), ('Event5', 2021, 'Europe'); | How many defense diplomacy events were held in 2021 in the Asia-Pacific region? | SELECT COUNT(*) FROM DefenseDiplomacy WHERE Year = 2021 AND Region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Service (id INT, department_id INT, name VARCHAR(50), cost DECIMAL(10,2)); INSERT INTO Service (id, department_id, name, cost) VALUES (1, 1, 'ServiceA', 25000.00); INSERT INTO Service (id, department_id, name, cost) VALUES (2, 1, 'ServiceB', 30000.00); INSERT INTO Service (id, department_id, name, cost) VA... | Which services have a rating above the average rating for their department? | SELECT Service.name, Service.department_id FROM Service INNER JOIN (SELECT department_id, AVG(rating) as avg_rating FROM CitizenFeedback GROUP BY department_id) AS dept_avg_rating ON Service.department_id = dept_avg_rating.department_id WHERE Service.cost > dept_avg_rating.avg_rating | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity_complaints (complaint_id INT, complaint_date DATE, race VARCHAR(20)); INSERT INTO mental_health_parity_complaints (complaint_id, complaint_date, race) VALUES (1, '2021-07-01', 'Asian'), (2, '2021-03-15', 'Black'), (3, '2021-01-01', 'Native Hawaiian or Other Pacific Islander'); | What is the maximum number of mental health parity complaints filed in the last 6 months for the Native Hawaiian or Other Pacific Islander race? | SELECT MAX(complaint_count) as max_complaints FROM (SELECT COUNT(*) as complaint_count FROM mental_health_parity_complaints WHERE complaint_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND race = 'Native Hawaiian or Other Pacific Islander' GROUP BY complaint_date) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_stats (hotel_id INT, name TEXT, country TEXT, year INT, rating INT); INSERT INTO hotel_stats (hotel_id, name, country, year, rating) VALUES (1, 'Petra Eco Lodge', 'Jordan', 2023, 8); | Delete the record for the 'Petra Eco Lodge' in Jordan for 2023. | DELETE FROM hotel_stats WHERE name = 'Petra Eco Lodge' AND country = 'Jordan' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, date DATE); | What is the average number of security incidents per day in the last month? | SELECT AVG(frequency) FROM (SELECT date, COUNT(*) as frequency FROM security_incidents WHERE date >= ADD_MONTHS(TRUNC(SYSDATE, 'MM'), -1) AND date < TRUNC(SYSDATE, 'MM') GROUP BY date); | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (MetricID INT, MetricName VARCHAR(50), Description VARCHAR(255)); INSERT INTO HealthEquityMetrics (MetricID, MetricName, Description) VALUES (1, 'Mental Health Access', 'Access to mental health services'); | Which HealthEquityMetrics are present in HealthEquityMetrics table? | SELECT DISTINCT MetricName FROM HealthEquityMetrics; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_categories (category_id INT, category_name VARCHAR(50), food_item_id INT); CREATE TABLE food_items (food_item_id INT, name VARCHAR(50), category_id INT, calories INT); INSERT INTO food_categories (category_id, category_name) VALUES (1, 'Fruits'), (2, 'Vegetables'), (3, 'Grains'), (4, 'Meats'), (5, 'De... | List the top 3 food categories with the highest average calorie count. | SELECT category_name, AVG(calories) AS avg_calories FROM food_categories JOIN food_items ON food_categories.category_id = food_items.category_id GROUP BY category_name ORDER BY avg_calories DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Violations (id INT PRIMARY KEY, violation_type VARCHAR(255), offender_name VARCHAR(255), fine INT); | Display the total fine amounts for each violation type in the 'Violations' table | SELECT violation_type, SUM(fine) FROM Violations GROUP BY violation_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(255), country VARCHAR(255));CREATE TABLE extraction (company_id INT, mineral VARCHAR(255), amount INT); | List the names and extraction amounts of minerals that are extracted by companies operating in Africa. | SELECT DISTINCT e.mineral, SUM(e.amount) as total_extraction FROM extraction e JOIN company c ON e.company_id = c.id WHERE c.country LIKE '%Africa%' GROUP BY e.mineral; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, founding_year INT, founder_gender TEXT); INSERT INTO company (id, name, industry, founding_year, founder_gender) VALUES (1, 'HealtHero', 'Healthcare', 2018, 'Female'); | Calculate the average funding amount (in USD) for companies founded by women in the healthcare sector. | SELECT AVG(funding_amount) FROM company WHERE industry = 'Healthcare' AND founder_gender = 'Female' | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor VARCHAR(50), cause VARCHAR(50), amount DECIMAL(10, 2), donation_date DATE); INSERT INTO donations (id, donor, cause, amount, donation_date) VALUES (1, 'Sophia Garcia', 'Arts & Culture', 250, '2023-02-14'), (2, 'Ali Hussein', 'Education', 500, '2023-03-20'), (3, 'Leila Kim', 'Health... | What is the total donation amount by cause in H1 2023? | SELECT cause, SUM(amount) as total_donation FROM donations WHERE donation_date BETWEEN '2023-01-01' AND '2023-06-30' GROUP BY cause; | gretelai_synthetic_text_to_sql |
CREATE TABLE copper_mine (company_id INT, quantity_mined INT);CREATE TABLE zinc_mine (company_id INT, quantity_mined INT); | What is the total quantity of copper and zinc mined by each company? | SELECT m.company_name, SUM(cm.quantity_mined) AS total_copper_mined, SUM(zm.quantity_mined) AS total_zinc_mined FROM mining_companies m JOIN copper_mine cm ON m.company_id = cm.company_id JOIN zinc_mine zm ON m.company_id = zm.company_id GROUP BY m.company_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_id INT, country VARCHAR(50), annual_visitors INT); INSERT INTO cultural_sites (site_id, country, annual_visitors) VALUES (1, 'Spain', 600000), (2, 'France', 750000), (3, 'Italy', 800000), (4, 'Spain', 450000); | Find the number of cultural heritage sites in Spain with more than 500,000 annual visitors. | SELECT COUNT(*) FROM cultural_sites cs WHERE cs.country = 'Spain' AND cs.annual_visitors > 500000; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, size FLOAT, coowners INT, PRIMARY KEY (id)); INSERT INTO properties (id, size, coowners) VALUES (1, 1200.0, 2), (2, 800.0, 1), (3, 500.0, 3); | What is the minimum size of co-owned properties in the 'properties' table? | SELECT MIN(size) FROM properties WHERE coowners > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (student_id INT, name VARCHAR(50), community VARCHAR(50), department VARCHAR(50)); | What is the percentage of graduate students from underrepresented communities in each department? | SELECT gs.department, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM graduate_students) AS pct_underrepresented FROM graduate_students gs WHERE gs.community = 'Underrepresented' GROUP BY gs.department; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_manufacturers (manufacturer VARCHAR(100), make VARCHAR(100)); | What is the average safety score for vehicles produced by each manufacturer? | SELECT manufacturer, AVG(avg_safety_score) FROM vehicle_safety_summary INNER JOIN vehicle_manufacturers ON vehicle_safety_summary.make = vehicle_manufacturers.make GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name TEXT, location TEXT, efficiency_score INT); | What is the average energy efficiency score for projects in NY? | SELECT AVG(efficiency_score) FROM projects WHERE location = 'NY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements_2019 (id INT, union_name VARCHAR(255), agreement_number INT, sign_date DATE); INSERT INTO cb_agreements_2019 (id, union_name, agreement_number, sign_date) VALUES (1, 'UAW', 9876, '2019-12-31'), (2, 'Ironworkers', 1111, '2018-12-15'); | Which unions have signed collective bargaining agreements in '2019'? | SELECT DISTINCT union_name FROM cb_agreements_2019 WHERE YEAR(sign_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patents (PatentID INT, PatentName TEXT, GrantYear INT, Accessibility BOOLEAN, TeamGender TEXT); INSERT INTO Patents (PatentID, PatentName, GrantYear, Accessibility, TeamGender) VALUES (1, 'Patent A', 2019, TRUE, 'Female'); INSERT INTO Patents (PatentID, PatentName, GrantYear, Accessibility, TeamGender) VAL... | Identify the number of accessible technology patents granted to women-led teams in the last 2 years, grouped by year. | SELECT GrantYear, COUNT(*) FROM Patents WHERE Accessibility = TRUE AND TeamGender = 'Female' AND GrantYear >= (SELECT MAX(GrantYear) - 2 FROM Patents) GROUP BY GrantYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE platformA (song_year INT); CREATE TABLE platformB (song_year INT); CREATE TABLE platformC (song_year INT); | Find the total number of songs released before 2010 across all platforms. | SELECT SUM(song_year) FROM platformA WHERE song_year < 2010 UNION ALL SELECT SUM(song_year) FROM platformB WHERE song_year < 2010 UNION ALL SELECT SUM(song_year) FROM platformC WHERE song_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE category_donations (id INT, donation_category VARCHAR(50), donation_amount DECIMAL(10,2)); INSERT INTO category_donations (id, donation_category, donation_amount) VALUES (1, 'Education', 150), (2, 'Health', 200), (3, 'Education', 100); | What is the percentage of donations from each category as a proportion of total donations? | SELECT donation_category, donation_amount * 100.0 / SUM(donation_amount) OVER () as percentage FROM category_donations; | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_subscribers (subscriber_id INT, connection_speed FLOAT, city VARCHAR(20)); INSERT INTO broadband_subscribers (subscriber_id, connection_speed, city) VALUES (1, 200, 'Chicago'), (2, 150, 'New York'), (3, 180, 'Chicago'); | What is the average connection speed for broadband customers in the city of Chicago? | SELECT AVG(connection_speed) FROM broadband_subscribers WHERE city = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ancient_artifacts (id INT, artifact_name VARCHAR(50), age INT, excavation_site VARCHAR(50)); | What is the age difference between the oldest and youngest artifacts at each excavation site? | SELECT excavation_site, MAX(age) - MIN(age) as age_difference FROM ancient_artifacts GROUP BY excavation_site; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_equity_metrics (id INT, metric_name VARCHAR(50), metric_value INT, date DATE); INSERT INTO health_equity_metrics (id, metric_name, metric_value, date) VALUES (1, 'Accessibility Index', 85, '2021-01-01'), (2, 'Healthcare Quality Score', 78, '2021-01-01'); CREATE TABLE regions (id INT, name VARCHAR(50... | Show health equity metric trends in Florida for the past two years. | SELECT metric_name, date, metric_value FROM health_equity_metrics INNER JOIN regions ON health_equity_metrics.date >= DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR) WHERE regions.name = 'Florida'; | gretelai_synthetic_text_to_sql |
ARTWORK(artwork_id, title, date_created, period, artist_id); ARTIST(artist_id, name, gender, birth_date) | Find the number of artworks in the 'impressionist' period and their respective artist's age | SELECT COUNT(a.artwork_id), DATEDIFF(year, ar.birth_date, a.date_created) AS age FROM ARTWORK a INNER JOIN ARTIST ar ON a.artist_id = ar.artist_id WHERE a.period = 'impressionist' GROUP BY DATEDIFF(year, ar.birth_date, a.date_created); | gretelai_synthetic_text_to_sql |
CREATE TABLE event_attendance_3 (event VARCHAR(255), attendees INT); INSERT INTO event_attendance_3 (event, attendees) VALUES ('Art Exhibit', 500), ('Art Exhibit', 200), ('Dance Performance', 300); | What was the total number of attendees at the "Art Exhibit" event? | SELECT event, SUM(attendees) FROM event_attendance_3 GROUP BY event HAVING event = 'Art Exhibit'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryEquipmentSales (seller VARCHAR(255), buyer VARCHAR(255), equipment VARCHAR(255), sale_value FLOAT, sale_date DATE); INSERT INTO MilitaryEquipmentSales (seller, buyer, equipment, sale_value, sale_date) VALUES ('Lockheed Martin', 'United Kingdom', 'Type 26 Frigate', 300000000, '2018-04-12'); | Delete all records of military equipment sales to the United Kingdom in 2018. | DELETE FROM MilitaryEquipmentSales WHERE seller = 'Lockheed Martin' AND buyer = 'United Kingdom' AND sale_date BETWEEN '2018-01-01' AND '2018-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, city VARCHAR(255), age INT, gender VARCHAR(10)); INSERT INTO fans (fan_id, city, age, gender) VALUES (1, 'City A', 25, 'Male'), (2, 'City A', 35, 'Female'), (3, 'City B', 20, 'Male'), (4, 'City B', 40, 'Female'); | How many fans are from each city? | SELECT f.city, COUNT(*) as num_fans FROM fans f GROUP BY f.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Toronto_Neighborhoods (Neighborhood_Name TEXT, LGBTQ_Friendly BOOLEAN); INSERT INTO Toronto_Neighborhoods (Neighborhood_Name, LGBTQ_Friendly) VALUES ('Church-Wellesley', true), ('Queen West', true), ('Kensington Market', true), ('The Annex', false), ('Harbourfront', false); CREATE TABLE Toronto_Properties ... | What is the minimum property size in LGBTQ+ friendly neighborhoods in Toronto? | SELECT MIN(Toronto_Properties.Property_Size) FROM Toronto_Properties INNER JOIN Toronto_Neighborhoods ON Toronto_Properties.Neighborhood_Name = Toronto_Neighborhoods.Neighborhood_Name WHERE Toronto_Neighborhoods.LGBTQ_Friendly = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE sports (sport VARCHAR(255)); CREATE TABLE ticket_prices (sport VARCHAR(255), price DECIMAL(5,2)); CREATE TABLE ticket_sales (sport VARCHAR(255), tickets INT); INSERT INTO sports VALUES ('Basketball'), ('Football'), ('Hockey'), ('Soccer'); INSERT INTO ticket_prices VALUES ('Basketball', 80.50), ('Basketball... | What is the total number of tickets sold for each sport? | SELECT sport, SUM(tickets) as total_tickets FROM ticket_sales GROUP BY sport; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(100), content TEXT, category VARCHAR(50)); INSERT INTO articles (id, title, content, category) VALUES (1, 'Article 1', 'This is an investigative article...', 'investigative_journalism'), (2, 'Article 2', 'This is another article...', 'opinion'); | What is the total number of words in all articles related to 'investigative_journalism'? | SELECT SUM(LENGTH(content) - LENGTH(REPLACE(content, ' ', '')) + 1) FROM articles WHERE category = 'investigative_journalism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_initiatives (id INT, initiative VARCHAR(50), location VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO conservation_initiatives (id, initiative, location, start_date, end_date) VALUES (1, 'Polar Bear Protection', 'Arctic Ocean', '2020-01-01', '2025-12-31'); | What are the marine conservation initiatives in the Arctic Ocean? | SELECT initiative FROM conservation_initiatives WHERE location = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammal_strandings (stranding_id SERIAL, species TEXT, stranding_date DATE, region TEXT); | Reveal the number of marine mammal strandings in the Arctic region | SELECT region, COUNT(stranding_id) FROM marine_mammal_strandings WHERE region = 'Arctic' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety (restaurant_name VARCHAR(255), violations INT, year INT); INSERT INTO food_safety (restaurant_name, violations, year) VALUES ('Thai Cuisine', 2, 2019), ('Thai Cuisine', 1, 2018), ('Thai Cuisine', 0, 2017); | How many food safety violations did 'Thai Cuisine' have in 2019? | SELECT SUM(violations) FROM food_safety WHERE restaurant_name = 'Thai Cuisine' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (state VARCHAR(20), year INT, quantity INT); CREATE TABLE recycling_rates (state VARCHAR(20), year INT, recycling_rate DECIMAL(5,2)); INSERT INTO waste_generation VALUES ('Texas', 2020, 10000000); INSERT INTO recycling_rates VALUES ('Texas', 2020, 0.35); | What is the percentage of waste that is recycled in the state of Texas in 2020 compared to the national average?' | SELECT (recycling_rate / (SELECT AVG(recycling_rate) FROM recycling_rates WHERE year = 2020) * 100) AS recycling_percentage FROM recycling_rates WHERE state = 'Texas' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_sources (pollution_type TEXT, affected_ocean TEXT, frequency INTEGER); INSERT INTO pollution_sources (pollution_type, affected_ocean, frequency) VALUES ('Oil Spills', 'Indian Ocean', 42), ('Plastic Waste', 'Indian Ocean', 123), ('Chemical Pollution', 'Indian Ocean', 78); | Identify the most common type of pollution in the Indian Ocean | SELECT pollution_type, MAX(frequency) FROM pollution_sources WHERE affected_ocean = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE treatment_plants (id INT PRIMARY KEY, name VARCHAR(255), capacity INT, plant_type VARCHAR(255)); CREATE TABLE wastewater (id INT PRIMARY KEY, treatment_plant_id INT, volume_treated FLOAT, treatment_date DATE); CREATE TABLE contamination_removal (id INT PRIMARY KEY, wastewater_id INT, contamination_removed ... | What is the maximum contamination removal achieved by activated sludge treatment plants in 2021? | SELECT MAX(cr.contamination_removed) as max_contamination_removed FROM treatment_plants t JOIN wastewater w ON t.id = w.treatment_plant_id JOIN contamination_removal cr ON w.id = cr.wastewater_id WHERE t.plant_type = 'Activated Sludge' AND w.treatment_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_shuttles (id INT, name VARCHAR(50), manufacturer VARCHAR(50), flight_hours INT); | What is the average flight hours of all space shuttles manufactured by NASA? | SELECT AVG(flight_hours) FROM space_shuttles WHERE manufacturer = 'NASA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (id INT PRIMARY KEY, name VARCHAR(100), age INT, sport VARCHAR(50), team VARCHAR(50)); INSERT INTO athletes (id, name, age, sport, team) VALUES (100, 'John Doe', 25, 'Basketball', 'Chicago Bulls'); | insert a new athlete with the id 100 into the athletes table | INSERT INTO athletes (id, name, age, sport, team) VALUES (100, 'John Doe', 25, 'Basketball', 'Chicago Bulls'); | gretelai_synthetic_text_to_sql |
CREATE TABLE RocketEngine (EngineId INT, Name VARCHAR(50), Manufacturer VARCHAR(50), Thrust INT); INSERT INTO RocketEngine (EngineId, Name, Manufacturer, Thrust) VALUES (1, 'RS-25', 'Aerojet Rocketdyne', 1865000); INSERT INTO RocketEngine (EngineId, Name, Manufacturer, Thrust) VALUES (2, 'Merlin', 'SpaceX', 190000); IN... | What is the second highest engine thrust and its corresponding engine name and manufacturer? | SELECT Name, Manufacturer, Thrust FROM (SELECT Name, Manufacturer, Thrust, ROW_NUMBER() OVER (ORDER BY Thrust DESC) as Rank FROM RocketEngine) as RankedEngine WHERE Rank = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE department (dept_id INT, dept_name VARCHAR(50), worker_id INT); INSERT INTO department (dept_id, dept_name, worker_id) VALUES (1, 'Mining', 1), (1, 'Mining', 3), (2, 'Engineering', 2); CREATE TABLE worker_demographics (worker_id INT, worker_gender VARCHAR(10)); INSERT INTO worker_demographics (worker_id, w... | What is the percentage of workers who identify as female or male in each department? | SELECT dept_name, worker_gender, COUNT(*) as count, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM department d JOIN worker_demographics w ON d.worker_id = w.worker_id WHERE w.worker_gender IN ('Female', 'Male')) as percentage FROM department d JOIN worker_demographics w ON d.worker_id = w.worker_id WHERE worker_gender IN ('... | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftManufacturing (id INT, company VARCHAR(255), country VARCHAR(255), cost FLOAT); INSERT INTO SpacecraftManufacturing (id, company, country, cost) VALUES (1, 'SpaceX', 'USA', 50000000), (2, 'Blue Origin', 'USA', 70000000), (3, 'Roscosmos', 'Russia', 30000000); | What is the average manufacturing cost of spacecrafts produced in the US? | SELECT AVG(cost) FROM SpacecraftManufacturing WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, dish_name VARCHAR(50), dish_type VARCHAR(50), price DECIMAL(5,2), sales INT); | What is the average price of 'Desserts'? | SELECT AVG(price) FROM menus WHERE dish_type = 'Desserts'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_homes (id INT, size FLOAT, location VARCHAR(255)); INSERT INTO sustainable_homes (id, size, location) VALUES (1, 1200.0, 'San Francisco'), (2, 1500.0, 'New York'), (3, 900.0, 'Los Angeles'), (4, 1800.0, 'San Francisco'); | Get the average property size for each city in sustainable_homes table. | SELECT location, AVG(size) FROM sustainable_homes GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists fact_production (production_id INT PRIMARY KEY, well_id INT, date DATE, oil_volume DECIMAL(10,2), gas_volume DECIMAL(10,2)); CREATE TABLE if not exists dim_well (well_id INT PRIMARY KEY, well_name VARCHAR(255), location VARCHAR(255)); CREATE TABLE if not exists dim_date (date DATE PRIMARY KEY... | Design a star schema for analyzing production data | CREATE TABLE star_schema_production AS SELECT fact_production.production_id, fact_production.well_id, dim_well.well_name, dim_date.date, fact_production.oil_volume, fact_production.gas_volume FROM fact_production INNER JOIN dim_well ON fact_production.well_id = dim_well.well_id INNER JOIN dim_date ON fact_production.da... | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20), NumGamesPlayed INT); INSERT INTO Players (PlayerID, Age, Gender, Country, NumGamesPlayed) VALUES (1, 25, 'Male', 'USA', 5), (2, 30, 'Female', 'Canada', 3); | What is the average number of games played by players in each country? | SELECT Country, AVG(NumGamesPlayed) as AvgGames FROM Players GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE TV_shows (id INT, title VARCHAR(255), release_year INT, runtime INT, imdb_rating DECIMAL(2,1)); INSERT INTO TV_shows (id, title, release_year, runtime, imdb_rating) VALUES (1, 'Show1', 2018, 60, 7.2), (2, 'Show2', 2019, 45, 8.1), (3, 'Show3', 2020, 30, 6.5); | Delete the TV show with the lowest IMDb rating. | DELETE FROM TV_shows WHERE id = (SELECT id FROM TV_shows ORDER BY imdb_rating ASC LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE Timber_Production_3 (ID INT, Year INT, Volume FLOAT); INSERT INTO Timber_Production_3 (ID, Year, Volume) VALUES (1, 2005, 500), (2, 2010, 700), (3, 2015, 900); | What is the maximum volume of timber produced in a year? | SELECT MAX(Volume) FROM Timber_Production_3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ingredients (id INT, name VARCHAR(255), category VARCHAR(255), calories INT); | Which ingredients have the highest and lowest average calorie intake? | SELECT name, MAX(calories) AS max_calories, MIN(calories) AS min_calories FROM Ingredients GROUP BY name; | 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.