context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE RescuedAnimals(Year INT, Species VARCHAR(20), Number INT);INSERT INTO RescuedAnimals(Year, Species, Number) VALUES (2020, 'Tiger', 35), (2020, 'Lion', 42), (2020, 'Elephant', 50), (2021, 'Tiger', 38), (2021, 'Lion', 48), (2021, 'Elephant', 55); | What was the total number of animals rescued in 2020 and 2021, separated by species? | SELECT Year, Species, Number FROM RescuedAnimals PIVOT(SUM(Number) FOR Year IN ([2020], [2021])) AS PivotTable; | gretelai_synthetic_text_to_sql |
CREATE TABLE resource_depletion (id INT, mine_id INT, resource VARCHAR(50), quantity INT); | What is the total amount of resources depleted in the 'resource_depletion' table by mine and by resource? | SELECT mine_id, resource, SUM(quantity) FROM resource_depletion GROUP BY mine_id, resource; | gretelai_synthetic_text_to_sql |
CREATE TABLE Digital_Exhibitions (id INT, country VARCHAR(20), year INT, exhibition_count INT); | Find the total number of digital exhibitions held in India and Brazil in 2019 | SELECT SUM(exhibition_count) FROM Digital_Exhibitions WHERE country IN ('India', 'Brazil') AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE consumer_preferences (consumer_id INT, country VARCHAR(50), favorite_product VARCHAR(100)); INSERT INTO consumer_preferences (consumer_id, country, favorite_product) VALUES (1, 'United States', 'Nourishing Face Cream'), (2, 'Canada', 'Hydrating Body Lotion'); | Update consumer preferences with a new record for 'John Doe' from 'United Kingdom'? | INSERT INTO consumer_preferences (consumer_id, country, favorite_product) VALUES (3, 'United Kingdom', 'Anti-Aging Serum'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, VisitorID INT, Amount DECIMAL(10,2)); | What's the maximum donation amount from a visitor from 'Africa'? | SELECT MAX(d.Amount) FROM Donations d JOIN Visitors v ON d.VisitorID = v.VisitorID WHERE v.Country IN (SELECT CountryName FROM Countries WHERE Region = 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (virtual_tour_id INT, virtual_tour_location TEXT, engagement_date DATE, engagement_value INT); INSERT INTO virtual_tours (virtual_tour_id, virtual_tour_location, engagement_date, engagement_value) VALUES (1, 'Virtual Tour North America', '2022-02-01', 200), (2, 'Virtual Tour North America', '... | What is the total value of virtual tour engagement in 'North America' in the last month? | SELECT SUM(engagement_value) FROM virtual_tours WHERE engagement_date >= DATEADD(month, -1, GETDATE()) AND virtual_tour_location = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (id INT, name VARCHAR(255), affiliation VARCHAR(255), years_of_experience INT); INSERT INTO researchers (id, name, affiliation, years_of_experience) VALUES (1, 'Alice', 'University of Anchorage', 10); INSERT INTO researchers (id, name, affiliation, years_of_experience) VALUES (2, 'Bob', 'Norweg... | How many years of experience do researchers 'Kim' and 'David' have? | SELECT name, years_of_experience FROM researchers WHERE name IN ('Kim', 'David'); | gretelai_synthetic_text_to_sql |
CREATE TABLE recycled_textile_prices (region VARCHAR(50), price INT); INSERT INTO recycled_textile_prices (region, price) VALUES ('North America', 30), ('South America', 25), ('Asia', 28), ('Europe', 35), ('Africa', 22); | What is the average price of recycled textile products in different regions? | SELECT region, AVG(price) FROM recycled_textile_prices GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(50), launch_country VARCHAR(50), launch_date DATE); INSERT INTO satellites VALUES (1, 'Sputnik 1', 'Russia', '1957-10-04'); INSERT INTO satellites VALUES (2, 'Explorer 1', 'USA', '1958-01-31'); INSERT INTO satellites VALUES (3, 'Echo 1', 'USA', '1960-08-12'); INSERT INTO sa... | How many satellites were launched by each country in the satellites table, ordered by the number of satellites launched? | SELECT launch_country, COUNT(*) as num_satellites, ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) as rn FROM satellites GROUP BY launch_country; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, gender VARCHAR(10)); CREATE TABLE workouts (workout_id INT, member_id INT, date DATE); INSERT INTO members VALUES (1,'Female'),(2,'Male'),(3,'Female'); INSERT INTO workouts VALUES (1,1,'2022-01-01'),(2,1,'2022-01-02'),(3,2,'2022-01-03'),(4,3,'2022-01-04'),(5,3,'2022-01-05'); | List the top 3 members with the highest number of workouts. | SELECT members.member_id, COUNT(workouts.workout_id) AS num_workouts FROM members JOIN workouts ON members.member_id = workouts.member_id GROUP BY members.member_id ORDER BY num_workouts DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_statistics (id INT, industry VARCHAR(255), category VARCHAR(255), title VARCHAR(255), hourly_wage DECIMAL(5,2)); | What is the minimum, maximum, and average hourly wage for labor statistics records in the construction industry? | SELECT industry, MIN(hourly_wage) as min_hourly_wage, MAX(hourly_wage) as max_hourly_wage, AVG(hourly_wage) as avg_hourly_wage FROM labor_statistics WHERE industry = 'construction'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (ID INT, Satellite_Name VARCHAR(255), Country VARCHAR(255), Launch_Date DATE); INSERT INTO Satellites (ID, Satellite_Name, Country, Launch_Date) VALUES (1, 'Starlink-1', 'USA', '2019-05-23'), (2, 'Galileo-1', 'France', '2015-01-01'); CREATE VIEW Country_Earliest_Launch AS SELECT Country, MIN(Lau... | What is the earliest launch date of any satellite for each country with satellites in the Satellites table? | SELECT Country, Earliest_Launch FROM Country_Earliest_Launch; | gretelai_synthetic_text_to_sql |
CREATE TABLE covid (covid_id INT, patient_id INT, city VARCHAR(20), test_date DATE); INSERT INTO covid (covid_id, patient_id, city, test_date) VALUES (1, 3, 'New York City', '2022-01-01'); INSERT INTO covid (covid_id, patient_id, city, test_date) VALUES (2, 4, 'New York City', '2022-01-03'); | How many new COVID-19 cases were reported in New York City in the last week? | SELECT COUNT(*) FROM (SELECT patient_id, city FROM covid WHERE city = 'New York City' AND test_date >= DATEADD(day, -7, GETDATE())) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_production (id INT, facility_name VARCHAR(255), province VARCHAR(255), violation_flag BOOLEAN); | List all timber production facilities in the province of British Columbia that have a recorded violation in the past 5 years. | SELECT facility_name FROM timber_production WHERE province = 'British Columbia' AND violation_flag = TRUE AND violation_date > DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_innovation (id INT, project_name VARCHAR(255), sector VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO rural_innovation (id, project_name, sector, location, start_date, end_date) VALUES (1, 'Precision Agriculture', 'Agriculture', 'Village A, Country X', '2020-01-01', ... | What is the total number of agricultural innovation projects in the 'rural_innovation' table? | SELECT COUNT(*) FROM rural_innovation WHERE sector = 'Agriculture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Articles (id INT, author TEXT, gender TEXT, publish_date DATE); INSERT INTO Articles (id, author, gender, publish_date) VALUES (1, 'Author 1', 'Female', '2023-01-01'); | Which gender has published the most articles per month? | SELECT gender, DATE_TRUNC('month', publish_date) as month, COUNT(*) as articles_per_month FROM Articles GROUP BY gender, month ORDER BY month, articles_per_month DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE canada_products (product_id INT, product_category VARCHAR(50), launch_date DATE); INSERT INTO canada_products (product_id, product_category, launch_date) VALUES (1001, 'Skincare', '2022-07-12'), (1002, 'Haircare', '2021-11-28'), (1003, 'Skincare', '2022-03-05'), (1004, 'Makeup', '2020-05-17'), (1005, 'Hair... | How many skincare and haircare products have been launched in the last year in Canada? | SELECT COUNT(*) FROM canada_products WHERE product_category IN ('Skincare', 'Haircare') AND launch_date >= DATEADD(year, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name varchar(255), biodiversity_index float); INSERT INTO marine_protected_areas (name, biodiversity_index) VALUES ('Galapagos Marine Reserve', 9.3), ('Great Barrier Reef', 8.7), ('Palau National Marine Sanctuary', 9.1); | Which marine protected areas have the highest biodiversity? | SELECT name FROM marine_protected_areas ORDER BY biodiversity_index DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(255), num_patents INT); INSERT INTO companies (id, name, num_patents) VALUES (1, 'Acme Inc', 15), (2, 'Beta Corp', 22), (3, 'Gamma Inc', 7), (4, 'Delta Ltd', 18); | List the number of patents granted to each company | SELECT name, num_patents FROM companies; | gretelai_synthetic_text_to_sql |
CREATE TABLE seoul_subway (route_id INT, fare DECIMAL(5,2)); INSERT INTO seoul_subway (route_id, fare) VALUES (1, 1.30), (2, 1.50), (3, 1.70), (4, 2.10); | What is the minimum fare for each route in the Seoul subway? | SELECT route_id, MIN(fare) as min_fare FROM seoul_subway GROUP BY route_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (id INT, state VARCHAR(20)); CREATE TABLE Claims (claim_id INT, policyholder_id INT); | What is the highest claim count for policyholders residing in 'New York'? | SELECT COUNT(*) FROM (SELECT Claims.policyholder_id FROM Claims INNER JOIN Policyholders ON Claims.policyholder_id = Policyholders.id WHERE state = 'New York' GROUP BY Claims.policyholder_id HAVING COUNT(*) > 1) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE armory (id INT, equipment VARCHAR(255)); INSERT INTO armory VALUES (1, 'Tank'), (2, 'Artillery'); CREATE TABLE naval_base (id INT, equipment VARCHAR(255)); INSERT INTO naval_base VALUES (1, 'Submarine'), (2, 'Carrier'); | What is the total number of military equipment in the armory and naval_base tables? | SELECT COUNT(*) FROM armory UNION ALL SELECT COUNT(*) FROM naval_base; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (date DATE, revenue DECIMAL(10,2)); INSERT INTO restaurant_revenue (date, revenue) VALUES ('2022-01-01', 1500.00), ('2022-01-02', 1700.00), ('2022-01-03', 2000.00), ('2022-01-04', 2200.00), ('2022-01-05', 2500.00); | What is the daily revenue trend for the past 30 days? | SELECT date, revenue, LAG(revenue) OVER (ORDER BY date) as previous_day_revenue FROM restaurant_revenue; | gretelai_synthetic_text_to_sql |
CREATE TABLE tennis_matches (match_id INT, player1 VARCHAR(50), player2 VARCHAR(50), player1_score INT, player2_score INT, match_date DATE); | Insert new records for a tennis match in the 'tennis_matches' table between Novak Djokovic and Rafael Nadal? | INSERT INTO tennis_matches (match_id, player1, player2, player1_score, player2_score, match_date) VALUES (1, 'Novak Djokovic', 'Rafael Nadal', 6, 4, '2023-07-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (author VARCHAR(50), article_text TEXT); INSERT INTO articles (author, article_text) VALUES ('John Doe', 'Article 1 text...'); INSERT INTO articles (author, article_text) VALUES ('Jane Smith', 'Article 2 text...'); | What is the average word count for articles by each author in the 'articles' table? | SELECT author, AVG(LENGTH(article_text) - LENGTH(REPLACE(article_text, ' ', '')) + 1) as avg_word_count FROM articles GROUP BY author; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, country TEXT); CREATE TABLE fundings (id INT, company_id INT, round TEXT, country TEXT); INSERT INTO companies (id, name, country) VALUES (1, 'Techshark', 'UK'), (2, 'Ecoline', 'Germany'), (3, 'GlobalFusion', 'UK'), (4, 'QuantumLabs', 'Germany'), (5, 'Oceanic', 'UK'); INSERT I... | List the companies that have received funding in both the UK and Germany. | SELECT companies.name FROM companies INNER JOIN fundings AS uk_fundings ON companies.id = uk_fundings.company_id AND uk_fundings.country = 'UK' INNER JOIN fundings AS germany_fundings ON companies.id = germany_fundings.company_id AND germany_fundings.country = 'Germany' GROUP BY companies.name HAVING COUNT(DISTINCT com... | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_change_adaptation_projects (project_name VARCHAR(255), description TEXT, funding_source VARCHAR(100)); INSERT INTO climate_change_adaptation_projects (project_name, description, funding_source) VALUES ('Coastal Restoration Project', 'Restore wetlands to protect against storm surges', 'National Ocea... | List all climate change adaptation projects, their descriptions, and their funding sources, ordered alphabetically by project name | SELECT project_name, description, funding_source FROM climate_change_adaptation_projects ORDER BY project_name ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonationAmount DECIMAL, Recurring BOOLEAN, Country TEXT); INSERT INTO Donors (DonorID, DonorName, DonationAmount, Recurring, Country) VALUES (1, 'Jean Dupont', 10.00, TRUE, 'France'), (2, 'Marie Dupont', 20.00, FALSE, 'France'); | What is the minimum donation amount for recurring donors in France? | SELECT MIN(DonationAmount) FROM Donors WHERE Country = 'France' AND Recurring = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, department VARCHAR(255), worker_count INT, average_salary DECIMAL(10,2)); INSERT INTO factories VALUES (1, 'textiles', 50, 2500.00), (2, 'metalwork', 30, 3000.00); | Delete the record for the 'textiles' department in the 'factory2'. | DELETE FROM factories WHERE factory_id = 2 AND department = 'textiles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE engineering_standards.tunnels (tunnel_id INT, name VARCHAR(255), length FLOAT); INSERT INTO engineering_standards.tunnels (tunnel_id, name, length) VALUES (1, 'Channel Tunnel', 50492), (2, 'Seikan Tunnel', 53881), (3, 'Gotthard Base Tunnel', 57090); | List the tunnels that are longer than the average tunnel length in the 'engineering_standards' schema. | SELECT * FROM engineering_standards.tunnels WHERE length > (SELECT AVG(length) FROM engineering_standards.tunnels); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), category VARCHAR(50), revenue DECIMAL(10, 2)); INSERT INTO products VALUES (1, 'Product A', 'Electronics', 5000), (2, 'Product B', 'Fashion', 3000), (3, 'Product C', 'Electronics', 7000); | What is the total revenue per product category for the year 2021? | SELECT category, SUM(revenue) as total_revenue FROM products WHERE YEAR(order_date) = 2021 GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameSessions (GameID INT, SessionStart TIME); | Display the number of games played per hour for each game in the 'GameSessions' table | SELECT GameID, HOUR(SessionStart) as Hour, COUNT(*) as GamesPlayedPerHour FROM GameSessions GROUP BY GameID, Hour; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, age INT, platform VARCHAR(20), region VARCHAR(50)); INSERT INTO players (player_id, age, platform, region) VALUES (1, 25, 'PC', 'North America'), (2, 30, 'PSVR', 'Europe'), (3, 22, 'Oculus', 'Asia'), (4, 28, 'PC', 'Asia'), (5, 34, 'PSVR', 'Europe'), (6, 32, 'Oculus', 'Asia'); CREATE... | How many players have adopted VR technology in each region? | SELECT region, COUNT(DISTINCT p.player_id) AS num_players FROM players p JOIN vr_tech v ON p.player_id = v.player_id GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammals (id INT, species VARCHAR(255), biomass FLOAT); | What is the total biomass of all marine mammals in the Arctic ocean? | SELECT SUM(m.biomass) FROM marine_mammals m WHERE m.species IN ('Walrus', 'Beluga Whale', 'Narwhal', 'Ringed Seal', 'Bearded Seal') | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEngagement (id INT, city VARCHAR(50), engagement_date DATE, engagement_score INT); | Which city had the highest community engagement last month? | SELECT city, MAX(engagement_score) FROM CommunityEngagement WHERE engagement_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY city ORDER BY MAX(engagement_score) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT PRIMARY KEY, event_name TEXT, category TEXT, attendees INT, attendee_age INT); | Get the top 3 categories with the highest average attendee age. | SELECT category, AVG(attendee_age) AS avg_age FROM Events GROUP BY category ORDER BY avg_age DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, depth_m FLOAT); INSERT INTO marine_protected_areas (area_name, depth_m) VALUES ('Galapagos Islands', 2000.0), ('Great Barrier Reef', 1000.0), ('Palau', 2500.0); | List all marine protected areas with a depth greater than the average depth of all marine protected areas. | SELECT area_name FROM marine_protected_areas WHERE depth_m > (SELECT AVG(depth_m) FROM marine_protected_areas); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.research_data(id INT, study_name TEXT, category TEXT, sub_category TEXT, description TEXT);INSERT INTO genetics.research_data(id, study_name, category, sub_category, description) VALUES (1, 'Genome Mapping of Wheat', 'Plant Genomics', 'Wheat Genom... | List all genetic research data entries related to plant genomics. | SELECT * FROM genetics.research_data WHERE category = 'Plant Genomics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, species TEXT, population INT); INSERT INTO animals (id, species, population) VALUES (1, 'Tiger', 1200), (2, 'Elephant', 1500), (3, 'Rhinoceros', 800); | What is the total population of each animal species? | SELECT species, SUM(population) as total_population FROM animals GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE brand_materials (brand VARCHAR(50), material VARCHAR(50)); INSERT INTO brand_materials (brand, material) VALUES ('Brand X', 'organic cotton'), ('Brand X', 'recycled polyester'), ('Brand Y', 'hemp'), ('Brand Y', 'tencel'), ('Brand Z', 'organic cotton'), ('Brand Z', 'recycled polyester'), ('Brand Z', 'linen'... | Find the number of unique materials used by each brand in the ethical fashion database. | SELECT brand, COUNT(DISTINCT material) FROM brand_materials GROUP BY brand; | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_agency (agency_id INT PRIMARY KEY, agency_name VARCHAR(30), commanding_officer VARCHAR(30), agency_location VARCHAR(20)); | Update the 'commanding_officer' field in the 'intelligence_agency' table to 'L. Brown' where 'agency_location' is 'Los Angeles' | UPDATE intelligence_agency SET commanding_officer = 'L. Brown' WHERE agency_location = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmer_skills (farmer_id INT, skill_name VARCHAR(255), years_of_experience INT); | Insert new data for the 'farmer_skills' table, including the farmer_id, skill_name, and years_of_experience. | INSERT INTO farmer_skills (farmer_id, skill_name, years_of_experience) VALUES (3, 'Irrigation Management', 5), (4, 'Soil Conservation', 7), (5, 'Agroforestry', 8); | gretelai_synthetic_text_to_sql |
CREATE TABLE TrafficViolations (ID INT, Date DATE, Department VARCHAR(255), Complaint VARCHAR(255)); INSERT INTO TrafficViolations (ID, Date, Department, Complaint) VALUES (1, '2022-02-15', 'Transportation', 'Violation'), (2, '2022-03-01', 'Transportation', 'Violation'), (3, '2022-03-10', 'Transportation', 'Complaint')... | How many traffic violation complaints were submitted in the last month in the transportation department? | SELECT COUNT(*) FROM TrafficViolations WHERE Department = 'Transportation' AND Date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND Complaint = 'Violation' | gretelai_synthetic_text_to_sql |
CREATE TABLE language_preservation (id INT, language TEXT, status TEXT, region TEXT); INSERT INTO language_preservation (id, language, status, region) VALUES (1, 'Quechua', 'Vulnerable', 'South America'); | What is the language preservation status in South America? | SELECT status FROM language_preservation WHERE region = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_providers (id INT, name VARCHAR(50), state VARCHAR(50), mental_health_parity BOOLEAN); | List states with no mental health providers | SELECT mental_health_providers.state FROM mental_health_providers GROUP BY mental_health_providers.state HAVING COUNT(*) = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_manufacturing (id INT PRIMARY KEY, certification VARCHAR(100), certification_date DATE); | Update the 'certification_date' to '2021-12-31' for the record with id 3 in the 'ethical_manufacturing' table | UPDATE ethical_manufacturing SET certification_date = '2021-12-31' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(50), location VARCHAR(50), production_rate FLOAT); INSERT INTO wells (well_id, well_name, location, production_rate) VALUES (6, 'Well D', 'Amazon Basin', 2200), (7, 'Well E', 'Amazon Basin', 2300), (8, 'Well F', 'Brazil Coast', 2100); | What is the average production rate for wells in the Amazon Basin? | SELECT AVG(production_rate) FROM wells WHERE location = 'Amazon Basin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AssetTransactionCounts (AssetID int, TransactionID int); INSERT INTO AssetTransactionCounts (AssetID, TransactionID) VALUES (1, 1), (1, 2), (2, 3), (3, 4), (3, 5), (4, 6), (4, 7), (5, 8); | What is the total number of smart contract transactions per digital asset? | SELECT AssetID, COUNT(*) as TransactionCount FROM AssetTransactionCounts GROUP BY AssetID; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (id INT, name VARCHAR(255), department VARCHAR(255), publications INT, graduation_year INT); | List the top 5 graduate students with the highest number of research publications in the Computer Science department, including their names, total publications, and graduation year. | SELECT name, SUM(publications) as total_publications, graduation_year FROM Students WHERE department = 'Computer Science' GROUP BY name, graduation_year ORDER BY total_publications DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE port_of_new_york (vessel_name VARCHAR(255), dock_month INT); CREATE TABLE port_of_boston (vessel_name VARCHAR(255), dock_month INT); CREATE TABLE port_of_philadelphia (vessel_name VARCHAR(255), dock_month INT); INSERT INTO port_of_new_york (vessel_name, dock_month) VALUES ('Vessel PP', 7), ('Vessel QQ', 7)... | Which vessels docked in the Port of New York in July 2022 but have not docked in any other port since then? | SELECT vessel_name FROM port_of_new_york WHERE dock_month = 7 EXCEPT (SELECT vessel_name FROM port_of_boston WHERE dock_month >= 7 UNION SELECT vessel_name FROM port_of_philadelphia WHERE dock_month >= 7); | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_prices (game_type VARCHAR(20), ticket_price DECIMAL(5,2)); INSERT INTO ticket_prices (game_type, ticket_price) VALUES ('Football', 80.50), ('Football', 90.00), ('Basketball', 60.00), ('Basketball', 65.00), ('Hockey', 50.00), ('Hockey', 55.00); | What is the minimum ticket price for each game type? | SELECT game_type, MIN(ticket_price) FROM ticket_prices GROUP BY game_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, country VARCHAR(255), launch_date DATE); | What is the earliest launch date of a satellite by any country? | SELECT MIN(launch_date) FROM satellites; | gretelai_synthetic_text_to_sql |
CREATE TABLE MakeupProducts(productID INT, isCrueltyFree BOOLEAN, country VARCHAR(50)); INSERT INTO MakeupProducts(productID, isCrueltyFree, country) VALUES (1, TRUE, 'Australia'), (2, FALSE, 'US'), (3, TRUE, 'Canada'); | What is the total number of cruelty-free makeup products sold in Australia? | SELECT COUNT(*) FROM MakeupProducts WHERE country = 'Australia' AND isCrueltyFree = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, investment_amount INT, investment_date DATE); | What is the total investment in network infrastructure? | SELECT SUM(investment_amount) FROM investments; | gretelai_synthetic_text_to_sql |
CREATE TABLE diplomacy_meetings (meeting_id INT, country_name VARCHAR(50), meeting_date DATE, meeting_outcome VARCHAR(20)); | Delete diplomacy meeting records with meeting_id 10, 11, and 12 | DELETE FROM diplomacy_meetings WHERE meeting_id IN (10, 11, 12); | gretelai_synthetic_text_to_sql |
CREATE TABLE emergencies (type VARCHAR(255), response_time INT); INSERT INTO emergencies (type, response_time) VALUES ('Fire', 5), ('Medical', 8), ('Medical', 9), ('Medical', 7); | What is the difference in response time between the fastest and slowest medical emergencies? | SELECT type, MAX(response_time) OVER (PARTITION BY type) - MIN(response_time) OVER (PARTITION BY type) AS response_time_difference FROM emergencies WHERE type = 'Medical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_vehicles_2 (vehicle_id INT, vehicle_name VARCHAR(255), price_per_mile DECIMAL(5,2), model_year INT); | List the autonomous vehicles with the most significant increase in price per mile compared to their previous model | SELECT t1.vehicle_name, t1.price_per_mile, t1.model_year, t1.price_per_mile - t2.price_per_mile as price_increase FROM autonomous_vehicles_2 t1 JOIN autonomous_vehicles_2 t2 ON t1.vehicle_name = t2.vehicle_name AND t1.model_year = t2.model_year + 1 WHERE t1.price_per_mile > t2.price_per_mile ORDER BY price_increase DES... | gretelai_synthetic_text_to_sql |
CREATE TABLE Departments (id INT, department_name VARCHAR(50), employee_id INT); CREATE TABLE Employees (id INT, salary DECIMAL(10, 2)); | Find the average salary of employees in each department | SELECT Departments.department_name, AVG(Employees.salary) AS avg_salary FROM Departments JOIN Employees ON Departments.employee_id = Employees.id GROUP BY department_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (program_id INT, program_name VARCHAR(50), start_date DATE); CREATE TABLE Attendance (attendance_id INT, program_id INT, attendee_count INT); INSERT INTO Programs (program_id, program_name, start_date) VALUES (1, 'Art Education', '2021-01-01'), (2, 'Music Lessons', '2021-04-01'); INSERT INTO Atten... | Which programs had the highest attendance in the last quarter? | SELECT p.program_name, a.attendee_count FROM Programs p JOIN Attendance a ON p.program_id = a.program_id WHERE p.start_date >= '2021-04-01' GROUP BY p.program_name, a.attendee_count ORDER BY a.attendee_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (ID INT, Name VARCHAR(50), Type VARCHAR(50), Engine_Capacity INT); INSERT INTO Vessels (ID, Name, Type, Engine_Capacity) VALUES (1, 'MV Horizon', 'Cargo Ship', 6000); | Display the vessel names and their engine capacities for cargo ships with an engine capacity greater than 5000? | SELECT Name, Engine_Capacity FROM Vessels WHERE Type = 'Cargo Ship' AND Engine_Capacity > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties_inclusive (id INT, property_id INT); INSERT INTO properties_inclusive (id, property_id) VALUES (1, 1001), (2, 1002), (3, 1003); | Calculate the total number of properties with inclusive housing policies. | SELECT COUNT(*) FROM properties_inclusive; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, transaction_type VARCHAR(20), transaction_amount DECIMAL(10,2), transaction_date DATE); INSERT INTO transactions (transaction_id, transaction_type, transaction_amount, transaction_date) VALUES (1, 'Withdrawal', 500.00, '2022-06-01'); | What is the average daily transaction amount for each transaction type for the month of June 2022? | SELECT transaction_type, AVG(transaction_amount) as avg_daily_transaction_amount FROM transactions WHERE transaction_date BETWEEN '2022-06-01' AND '2022-06-30' GROUP BY transaction_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE hiring (id INT, employee_id INT, hire_date DATE, department VARCHAR(255)); INSERT INTO hiring (id, employee_id, hire_date, department) VALUES (1, 101, '2020-01-02', 'HR'); INSERT INTO hiring (id, employee_id, hire_date, department) VALUES (2, 102, '2019-12-20', 'IT'); | List all employees who joined 'Marketing' department in 2019 | SELECT * FROM hiring WHERE department = 'Marketing' AND YEAR(hire_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE reo_production (id INT PRIMARY KEY, reo_type VARCHAR(50), impurity_level FLOAT, production_year INT); | Update the impurity level for Lanthanum Oxide to 0.5 in the reo_production table for record with ID 12 | UPDATE reo_production SET impurity_level = 0.5 WHERE id = 12 AND reo_type = 'Lanthanum Oxide'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales(store VARCHAR(20), sale_date DATE, garment_id INT); INSERT INTO Sales(store, sale_date, garment_id) VALUES ('Eco_Friendly', '2021-10-01', 1), ('Eco_Friendly', '2021-10-02', 2); | How many garments were sold in the 'Eco_Friendly' store during the month of October 2021? | SELECT COUNT(*) FROM Sales WHERE store = 'Eco_Friendly' AND MONTH(sale_date) = 10 AND YEAR(sale_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), category VARCHAR(255), price DECIMAL(10, 2), country VARCHAR(255)); INSERT INTO products (product_id, product_name, category, price, country) VALUES (1, 'Rose Hip Oil', 'Skincare', 25.99, 'USA'), (2, 'Aloe Vera Gel', 'Skincare', 12.99, 'Mexico'); | Calculate the average price of organic skincare products sold in the USA | SELECT AVG(price) FROM products WHERE category = 'Skincare' AND country = 'USA' AND product_name LIKE '%organic%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_wellbeing_scores (score_date DATE, score INTEGER); INSERT INTO financial_wellbeing_scores (score_date, score) VALUES ('2021-10-01', 70), ('2021-11-01', 72), ('2021-12-01', 74); | What was the total financial wellbeing score for the country in the last quarter of 2021? | SELECT SUM(score) FROM financial_wellbeing_scores WHERE score_date BETWEEN '2021-10-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE applications (id INT, application_id INT, submission_date DATE); CREATE TABLE applicant (id INT, application_id INT, veteran_status TEXT); | List the number of job applications submitted by veterans from the "applications" and "applicant" tables | SELECT veteran_status, COUNT(*) as count FROM applications JOIN applicant ON applications.application_id = applicant.application_id GROUP BY veteran_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainable_ai (record_id INT, algorithm_name TEXT, interpretability_score REAL); INSERT INTO explainable_ai VALUES (1, 'SHAP', 0.85), (2, 'LIME', 0.7), (3, 'Anchors', 0.9); | Find the top 2 algorithms in the explainable_ai table based on the interpretability score. | SELECT algorithm_name, interpretability_score FROM (SELECT algorithm_name, interpretability_score, ROW_NUMBER() OVER (ORDER BY interpretability_score DESC) as row_num FROM explainable_ai) subquery WHERE row_num <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_actors (id INT, actor_name VARCHAR(255), intrusion_attempts INT, detection_date DATE); INSERT INTO threat_actors (id, actor_name, intrusion_attempts, detection_date) VALUES (1, 'Actor1', 100, '2022-05-01'), (2, 'Actor2', 150, '2022-05-02'); | Identify the top 5 most active threat actors, ranked by the total number of intrusion attempts, in the past month. | SELECT actor_name, SUM(intrusion_attempts) as total_intrusion_attempts, RANK() OVER (ORDER BY SUM(intrusion_attempts) DESC) as rank FROM threat_actors WHERE detection_date >= DATE(NOW()) - INTERVAL '1 month' GROUP BY actor_name HAVING rank <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE TeamLocations (TeamID INT, Continent VARCHAR(20)); CREATE TABLE ModelSafetyScores (ModelID INT, TeamID INT, SafetyScore INT); | What is the average safety score of models developed by different teams, grouped by continent? | SELECT AVG(ModelSafetyScores.SafetyScore) AS AverageSafetyScore, TeamLocations.Continent FROM ModelSafetyScores INNER JOIN TeamLocations ON ModelSafetyScores.TeamID = TeamLocations.TeamID GROUP BY TeamLocations.Continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE road_construction (id INT, project_name TEXT, location TEXT, cost INT, completion_date DATE); INSERT INTO road_construction (id, project_name, location, cost, completion_date) VALUES (1, 'LA Freeway Expansion', 'Los Angeles', 22000000, '2016-11-18'); INSERT INTO road_construction (id, project_name, locatio... | What is the minimum cost of road construction projects in 'Los Angeles' since 2016? | SELECT MIN(cost) FROM road_construction WHERE location = 'Los Angeles' AND YEAR(completion_date) >= 2016; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_name VARCHAR(50), jersey_number INT, country_name VARCHAR(50)); | Insert new records for two baseball players, 'Luis' from 'Dominican Republic' with jersey_number 17 and 'Hideki' from 'Japan' with jersey_number 55. | INSERT INTO players (player_name, jersey_number, country_name) VALUES ('Luis', 17, 'Dominican Republic'), ('Hideki', 55, 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Revenue (revenue_id INT PRIMARY KEY, artist_id INT, month VARCHAR(7), revenue FLOAT, FOREIGN KEY (artist_id) REFERENCES Artists(artist_id)); CREATE TABLE Artists (artist_id INT PRIMARY KEY, artist_name VARCHAR(255), birth_date DATE, country VARCHAR(100)); | Create a view to show monthly revenue by artist | CREATE VIEW MonthlyArtistRevenue AS SELECT artist_id, artist_name, DATE_TRUNC('month', revenue_month) AS month, SUM(revenue) AS revenue FROM (SELECT r.artist_id, a.artist_name, r.revenue, TO_CHAR(r.timestamp, 'YYYY-MM') AS revenue_month FROM Revenue r, Artists a WHERE r.artist_id = a.artist_id) subquery GROUP BY artist... | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (ArtworkID INT, Title VARCHAR(50), CreationYear INT, ArtistID INT); CREATE TABLE Exhibitions (ExhibitionID INT, ArtworkID INT); INSERT INTO Artworks VALUES (1, 'Starry Night', 1889, 2); INSERT INTO Exhibitions VALUES (1, 1); INSERT INTO Artworks VALUES (2, 'Sunflowers', 1888, 2); INSERT INTO Exhib... | Find artworks that were exhibited in the same exhibition as any artwork by Vincent van Gogh, excluding the exhibitions where only van Gogh's works were displayed. | SELECT a.Title FROM Artworks a INNER JOIN Exhibitions e1 ON a.ArtworkID = e1.ArtworkID INNER JOIN Artworks v ON v.ArtistID = (SELECT ArtistID FROM Artworks WHERE Title = 'Sunflowers') AND e1.ExhibitionID = e2.ExhibitionID AND a.ArtworkID != v.ArtworkID GROUP BY a.Title; | gretelai_synthetic_text_to_sql |
CREATE TABLE InfrastructureProjects (ProjectID INT, ProjectName VARCHAR(100), Location VARCHAR(50), Cost DECIMAL(10,2), CompletionDate DATE); INSERT INTO InfrastructureProjects (ProjectID, ProjectName, Location, Cost, CompletionDate) VALUES (1, 'Highway Expansion', 'Urban', 15000000, '2016-05-01'), (2, 'Water Treatment... | Find the total cost of all infrastructure projects in the 'Urban' area, only considering projects with a completion date on or after 2015-01-01. | SELECT SUM(Cost) as TotalCost FROM InfrastructureProjects WHERE Location = 'Urban' AND CompletionDate >= '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contract_dates (contract_date DATE, contractor VARCHAR(255), contract_value NUMERIC); | Find the number of defense contracts signed per month in 2020 | SELECT EXTRACT(MONTH FROM contract_date) AS month, COUNT(*) OVER (PARTITION BY EXTRACT(MONTH FROM contract_date)) AS contracts_per_month | gretelai_synthetic_text_to_sql |
CREATE TABLE algorithms (algorithm_id INT, name TEXT, category TEXT, added_date DATE); | How many algorithms were added to the database in the month of July 2021? | SELECT COUNT(*) FROM algorithms WHERE added_date BETWEEN '2021-07-01' AND '2021-07-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, age INT, country VARCHAR(50), vr_owner BOOLEAN); CREATE TABLE esports_participants (participant_id INT, player_id INT); CREATE TABLE esports_events (event_id INT, location VARCHAR(50)); | What is the average age of players who have participated in esports events in the United States and own a VR headset? | SELECT AVG(players.age) FROM players INNER JOIN esports_participants ON players.player_id = esports_participants.player_id INNER JOIN (SELECT event_id FROM esports_events WHERE location = 'United States') AS us_events ON esports_participants.player_id = us_events.event_id WHERE players.vr_owner = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE ships (name VARCHAR(255), year_decommissioned INT, type VARCHAR(255)); INSERT INTO ships (name, year_decommissioned, type) VALUES ('Ship 1', 2005, 'Cargo'), ('Ship 2', 2015, 'Passenger'), ('Ship 3', 2012, 'Fishing'); | What is the total number of ships in the Ships table that were decommissioned after 2010? | SELECT COUNT(*) FROM ships WHERE year_decommissioned > 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai_research_papers (id INT, company_name VARCHAR(255), paper_title VARCHAR(255), publication_date DATE); | What is the average number of ethical AI research papers published per year by each company? | SELECT company_name, AVG(YEAR(publication_date)) - MIN(YEAR(publication_date)) AS avg_years_between_publications FROM ethical_ai_research_papers GROUP BY company_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE cannabis_production (id INT, strain VARCHAR(50), yield INT); INSERT INTO cannabis_production (id, strain, yield) VALUES (1, 'Blue Dream', 400); INSERT INTO cannabis_production (id, strain, yield) VALUES (2, 'Gelato', 500); INSERT INTO cannabis_production (id, strain, yield) VALUES (3, 'OG Kush', 600); | Insert a new record into the 'cannabis_production' table for strain 'Purple Haze' with a yield of 550 grams | INSERT INTO cannabis_production (strain, yield) VALUES ('Purple Haze', 550); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, name TEXT, state TEXT, gender TEXT, mental_health_service DATE); INSERT INTO patients (patient_id, name, state, gender, mental_health_service) VALUES (1, 'Dan', 'New York', 'Male', '2022-01-01'), (2, 'Ella', 'Texas', 'Female', '2022-02-01'), (3, 'Finn', 'New York', 'Male', '2021-1... | How many patients in New York have received mental health services in the last year, broken down by gender? | SELECT gender, COUNT(*) FROM patients WHERE state = 'New York' AND mental_health_service >= DATEADD(year, -1, GETDATE()) GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (farmer_id INT PRIMARY KEY, name VARCHAR(255), age INT, location VARCHAR(255)); | Add a column 'gender' to the 'farmers' table | ALTER TABLE farmers ADD COLUMN gender VARCHAR(10); | gretelai_synthetic_text_to_sql |
CREATE TABLE art_patrons (donor_id INT, donation_amount FLOAT, donation_date DATE); INSERT INTO art_patrons (donor_id, donation_amount, donation_date) VALUES (1, 500.00, '2021-01-01'), (2, 350.00, '2021-02-01'), (3, 700.00, '2021-03-01'); | What is the average donation amount by individual donors in the "art_patrons" table? | SELECT AVG(donation_amount) FROM art_patrons WHERE donor_id NOT IN (SELECT DISTINCT donor_id FROM organizations); | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure (id INT, technology VARCHAR(10), region VARCHAR(10), state VARCHAR(10), power_consumption INT); INSERT INTO infrastructure (id, technology, region, state, power_consumption) VALUES (1, '5G', 'desert', 'AZ', 100), (2, '5G', 'desert', 'NM', 120), (3, '4G', 'desert', 'NV', 150), (4, '4G', 'dese... | Find the total number of 4G and 5G base stations in the "desert" region, grouped by state, and their average power consumption. | SELECT state, COUNT(*), AVG(power_consumption) FROM infrastructure WHERE (technology = '5G' OR technology = '4G') AND region = 'desert' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE taxi_rides (id INT, ride_date DATE, is_wheelchair_accessible BOOLEAN, revenue DECIMAL(5,2)); INSERT INTO taxi_rides (id, ride_date, is_wheelchair_accessible, revenue) VALUES (1, '2021-01-01', TRUE, 25.00), (2, '2021-01-02', FALSE, 30.00); | What is the total revenue generated from wheelchair accessible taxi rides in New York City? | SELECT SUM(revenue) FROM taxi_rides WHERE is_wheelchair_accessible = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Country) VALUES (1, 22, 'Brazil'), (2, 30, 'USA'), (3, 25, 'United Kingdom'), (4, 19, 'India'); CREATE TABLE GameLibrary (GameID INT, GameName VARCHAR(50), GameType VARCHAR(50), Category VARCHAR(50)); INSERT INTO Game... | How many players from the United Kingdom play games in the 'Action' category? | SELECT COUNT(Players.PlayerID) FROM Players JOIN PlayerGameLibrary ON Players.PlayerID = PlayerGameLibrary.PlayerID JOIN GameLibrary ON PlayerGameLibrary.GameID = GameLibrary.GameID WHERE Players.Country = 'United Kingdom' AND GameLibrary.Category = 'Action'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mine (MineID int, MineName varchar(50), Location varchar(50)); CREATE TABLE Employee (EmployeeID int, EmployeeName varchar(50), JobType varchar(50), MineID int, Nationality varchar(50)); INSERT INTO Mine VALUES (1, 'ABC Mine', 'Colorado'), (2, 'DEF Mine', 'Wyoming'), (3, 'GHI Mine', 'West Virginia'); INSER... | What is the number of employees of each nationality working at each mine? | SELECT MineName, Nationality, COUNT(*) as EmployeeCount FROM Employee INNER JOIN Mine ON Employee.MineID = Mine.MineID GROUP BY MineName, Nationality; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation_schedule (schedule_id INT, route_id INT, stop_id INT, scheduled_arrival TIMESTAMP, actual_arrival TIMESTAMP, city TEXT); | What is the average waiting time for public transportation in Sydney, Australia? | SELECT AVG(EXTRACT(MINUTE FROM actual_arrival - scheduled_arrival)) FROM public_transportation_schedule WHERE city = 'Sydney'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_health (date DATE, location VARCHAR(255), dissolved_oxygen FLOAT); | What is the average dissolved oxygen level for each month in 2021? | SELECT EXTRACT(MONTH FROM date) AS month, AVG(dissolved_oxygen) AS avg_dissolved_oxygen FROM ocean_health WHERE date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY EXTRACT(MONTH FROM date); | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (line VARCHAR(10), start_date DATE); INSERT INTO routes (line, start_date) VALUES ('Silver', '2015-01-01'); CREATE TABLE fares (route VARCHAR(10), revenue DECIMAL(10, 2)); INSERT INTO fares (route, revenue) VALUES ('Silver', 8500), ('Silver', 9500), ('Silver', 11000); | What is the total revenue for the 'Silver' line since its inception? | SELECT SUM(revenue) FROM fares WHERE route = (SELECT line FROM routes WHERE start_date <= '2015-01-01' AND line = 'Silver' LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicles (Vehicle_ID INT, Type VARCHAR(50), Seats INT, Autonomous BOOLEAN); INSERT INTO Vehicles (Vehicle_ID, Type, Seats, Autonomous) VALUES (1, 'Minivan', 7, TRUE), (2, 'Sedan', 4, FALSE), (3, 'Minivan', 8, FALSE), (4, 'SUV', 5, TRUE); | What is the maximum number of seats in an autonomous minivan? | SELECT MAX(Seats) FROM Vehicles WHERE Type = 'Minivan' AND Autonomous = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, program_name TEXT, region TEXT); INSERT INTO programs (id, program_name, region) VALUES (1, 'Arts Education', 'Northwest'), (2, 'Science Education', 'Southeast'), (3, 'Literacy Program', 'Northeast'); | Delete all records from the 'programs' table where the 'program_name' is 'Arts Education' and the 'region' is 'Northwest' | DELETE FROM programs WHERE program_name = 'Arts Education' AND region = 'Northwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_initiatives (id INT, visitor_id INT, visit_date DATE); INSERT INTO digital_initiatives (id, visitor_id, visit_date) VALUES (1, 1001, '2022-01-01'), (2, 1002, '2022-02-15'), (3, 1003, '2022-03-30'); CREATE TABLE visitor_demographics (visitor_id INT, community VARCHAR(255)); INSERT INTO visitor_demog... | How many visitors from historically underrepresented communities engaged with the museum's digital initiatives in the last year? | SELECT COUNT(*) FROM digital_initiatives JOIN visitor_demographics ON digital_initiatives.visitor_id = visitor_demographics.visitor_id WHERE community = 'Underrepresented Community' AND visit_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE ambulance_calls (id INT, neighborhood VARCHAR(20), month INT, year INT, calls INT); INSERT INTO ambulance_calls (id, neighborhood, month, year, calls) VALUES (1, 'Compton', 7, 2022, 70); INSERT INTO ambulance_calls (id, neighborhood, month, year, calls) VALUES (2, 'Compton', 7, 2022, 75); | What is the total number of ambulance calls in the neighborhood of Compton in the month of July 2022? | SELECT SUM(calls) FROM ambulance_calls WHERE neighborhood = 'Compton' AND month = 7 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_customers (customer_id INT, city VARCHAR(20), data_usage FLOAT); INSERT INTO mobile_customers (customer_id, city, data_usage) VALUES (1, 'London', 3000), (2, 'Paris', 4000), (3, 'London', 2500); | What is the total data usage for mobile customers in the city of London in the past week? | SELECT SUM(data_usage) FROM mobile_customers WHERE city = 'London' AND last_usage_date >= DATEADD(week, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE athlete_info (athlete_id INT, name VARCHAR(50), sport VARCHAR(20), age INT, country VARCHAR(50)); INSERT INTO athlete_info (athlete_id, name, sport, age, country) VALUES (1, 'John Doe', 'Basketball', 25, 'USA'); INSERT INTO athlete_info (athlete_id, name, sport, age, country) VALUES (2, 'Jane Smith', 'Socc... | Find the number of athletes in each sport in the athlete_info table, grouped by the sport column. | SELECT sport, COUNT(*) FROM athlete_info GROUP BY sport; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpeciesCountOverTime (ID INT, Species VARCHAR(50), Count INT, TimeStamp DATETIME); INSERT INTO SpeciesCountOverTime (ID, Species, Count, TimeStamp) VALUES (1, 'Starfish', 300, '2020-01-01 10:00:00'), (2, 'Dolphin', 250, '2020-01-02 10:00:00'), (3, 'Shark', 400, '2020-01-03 10:00:00'), (4, 'Starfish', 350, ... | Detect changes in marine species count over time. | SELECT Species, Count, TimeStamp, LAG(Count) OVER (PARTITION BY Species ORDER BY TimeStamp) as PreviousCount FROM SpeciesCountOverTime; | gretelai_synthetic_text_to_sql |
CREATE TABLE asia_tourism (country VARCHAR(255), year INT, visitors INT); INSERT INTO asia_tourism (country, year, visitors) VALUES ('Japan', 2018, 20000), ('China', 2018, 30000), ('Thailand', 2018, 25000), ('Japan', 2019, 22000), ('China', 2019, 32000), ('Thailand', 2019, 28000); | What is the average annual number of tourists visiting destinations in Asia, grouped by country? | SELECT country, AVG(visitors) as avg_visitors FROM asia_tourism GROUP BY country; | 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.