context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE CommunityTypes (id INT, community_type VARCHAR(30)); INSERT INTO CommunityTypes (id, community_type) VALUES (1, 'Indigenous'), (2, 'Settler'), (3, 'Immigrant'), (4, 'Asian'), (5, 'Latinx'), (6, 'LGBTQ+'); CREATE TABLE DigitalVisits (id INT, visitor_id INT, community_id INT, year INT, exhibit_count INT); IN... | What is the average number of digital exhibits visited per visitor from the LGBTQ+ community in 2020? | SELECT AVG(DigitalVisits.exhibit_count) FROM DigitalVisits INNER JOIN CommunityTypes ON DigitalVisits.community_id = CommunityTypes.id WHERE CommunityTypes.community_type = 'LGBTQ+' AND DigitalVisits.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE FestivalArtists (id INT, festival VARCHAR(20), year INT, artist VARCHAR(50)); INSERT INTO FestivalArtists (id, festival, year, artist) VALUES (1, 'Lollapalooza', 2022, 'Dua Lipa'), (2, 'Lollapalooza', 2022, 'Machine Gun Kelly'); | Who are the artists that performed at Lollapalooza in 2022? | SELECT DISTINCT artist FROM FestivalArtists WHERE festival = 'Lollapalooza' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA carbon_offset; CREATE TABLE carbon_offset_programs (id INT, name VARCHAR(100), carbon_offset FLOAT); INSERT INTO carbon_offset_programs (id, name, carbon_offset) VALUES (1, 'Program U', 16.5), (2, 'Program V', 17.5); | What is the minimum carbon offset of programs in the 'carbon_offset' schema? | SELECT MIN(carbon_offset) FROM carbon_offset.carbon_offset_programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_initiatives (id INT, country VARCHAR(50), category VARCHAR(50), year INT); INSERT INTO climate_initiatives (id, country, category, year) VALUES (1, 'Kenya', 'Climate Adaptation', 2010); INSERT INTO climate_initiatives (id, country, category, year) VALUES (2, 'Nigeria', 'Climate Mitigation', 2015); ... | How many climate adaptation initiatives were implemented in African countries? | SELECT COUNT(*) FROM climate_initiatives WHERE category = 'Climate Adaptation' AND country IN ('Kenya', 'Nigeria', 'South Africa', 'Egypt', 'Algeria', 'Morocco'); | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists transactions (id INT PRIMARY KEY, dapp_id INT, amount DECIMAL); CREATE TABLE if not exists dapps (id INT PRIMARY KEY, name TEXT, category TEXT, platform TEXT); INSERT INTO transactions (id, dapp_id, amount) VALUES (1, 1, 700), (2, 3, 40), (4, 4, 200); INSERT INTO dapps (id, name, category, pl... | Delete transactions related to NFT dapps that have an amount less than $50. | DELETE FROM transactions WHERE dapp_id IN (SELECT id FROM dapps WHERE category = 'NFT') AND amount < 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE Federal.agencies (name VARCHAR(50), budget INT); INSERT INTO Federal.agencies (name, budget) VALUES ('Department of Defense', 7000000000), ('Department of Education', 70000000), ('Department of Health and Human Services', 1200000000), ('Department of State', 50000000), ('Department of Transportation', 8000... | Find the names of all government agencies that have a budget lower than the average budget for all agencies in the 'Federal' schema. | SELECT name FROM Federal.agencies WHERE budget < (SELECT AVG(budget) FROM Federal.agencies); | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_models_explainability (model_id INT, model_type VARCHAR(50), explainability_score DECIMAL(5,2)); INSERT INTO ai_models_explainability (model_id, model_type, explainability_score) VALUES (1, 'Random Forest', 0.87), (2, 'Support Vector Machine', 0.75), (3, 'Convolutional Neural Network', 0.93), (4, 'Long ... | What is the explainability score for each AI model, partitioned by model type, ordered by score in ascending order? | SELECT model_type, AVG(explainability_score) as avg_explainability_score FROM ai_models_explainability GROUP BY model_type ORDER BY avg_explainability_score ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, HoursPlayed INT); INSERT INTO Players (PlayerID, HoursPlayed) VALUES (1, 150); INSERT INTO Players (PlayerID, HoursPlayed) VALUES (2, 50); | List all players who have played games for more than 100 hours | SELECT * FROM Players WHERE HoursPlayed > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_teotihuacan (artifact_id INTEGER, site_name TEXT, artifact_type TEXT, age INTEGER); INSERT INTO artifact_teotihuacan (artifact_id, site_name, artifact_type, age) VALUES (1, 'Teotihuacan', 'Stone', 1200), (2, 'Teotihuacan', 'Stone', 1100), (3, 'Teotihuacan', 'Pottery', 1300), (4, 'Teotihuacan', 'Bo... | List all 'Stone' artifacts from site 'Teotihuacan' with their age. | SELECT * FROM artifact_teotihuacan WHERE site_name = 'Teotihuacan' AND artifact_type = 'Stone'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (id INT, name VARCHAR(50), budget FLOAT); INSERT INTO research_projects VALUES (1, 'ProjectG', 1500000); INSERT INTO research_projects VALUES (2, 'ProjectH', 1000000); INSERT INTO research_projects VALUES (3, 'ProjectI', 2500000); | Delete all genetic research projects that have a budget over 2 million. | DELETE FROM research_projects WHERE budget > 2000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_data (contributor VARCHAR(20), recycling_rate FLOAT); INSERT INTO recycling_data (contributor, recycling_rate) VALUES ('Contributor A', 0.35), ('Contributor B', 0); | Insert new recycling data for 'Contributor B' in the 'recycling_data' table. | INSERT INTO recycling_data (contributor, recycling_rate) VALUES ('Contributor B', 0.27); | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft_flights (flight_id INT, model_id INT, date DATE); | What is the average number of flights per day for each aircraft model? | SELECT model_id, AVG(DATEDIFF('day', MIN(date), MAX(date))) as avg_flights_per_day FROM aircraft_flights GROUP BY model_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (id INT, title VARCHAR(100), publication_date DATE, category VARCHAR(50), author VARCHAR(50)); INSERT INTO news_articles (id, title, publication_date, category, author) VALUES (1, 'Article 1', '2022-01-01', 'Politics', 'John Doe'), (2, 'Article 2', '2022-01-02', 'Sports', 'Jane Smith'); | What is the distribution of articles by category and author in 'news_articles' table? | SELECT category, author, COUNT(*) as num_articles, ROW_NUMBER() OVER (PARTITION BY category ORDER BY COUNT(*) DESC) as rank FROM news_articles GROUP BY category, author; | gretelai_synthetic_text_to_sql |
CREATE TABLE finance.revenue (product_line VARCHAR(50), month INT, year INT, revenue DECIMAL(10,2)); INSERT INTO finance.revenue (product_line, month, year, revenue) VALUES ('Product Line A', 1, 2022, 12000.00), ('Product Line A', 2, 2022, 24000.00), ('Product Line B', 1, 2022, 18000.00), ('Product Line B', 2, 2022, 30... | What is the total revenue for each product line in the 'finance' schema? | SELECT product_line, SUM(revenue) as total_revenue FROM finance.revenue GROUP BY product_line; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10));CREATE TABLE EsportsEvents (EventID INT, PlayerID INT, EventType VARCHAR(20)); | What is the average age of players who have participated in esports events, and the number of events they have participated in? | SELECT AVG(Players.Age), COUNT(EsportsEvents.EventID) FROM Players INNER JOIN EsportsEvents ON Players.PlayerID = EsportsEvents.PlayerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtistRevenue (id INT, artist_name VARCHAR(50), revenue DECIMAL(10,2), year INT); INSERT INTO ArtistRevenue (id, artist_name, revenue, year) VALUES (1, 'Picasso', 15000, 2018), (2, 'Van Gogh', 12000, 2018), (3, 'Dali', 18000, 2018), (4, 'Matisse', 16000, 2018), (5, 'Monet', 17000, 2018); | What was the total revenue generated by all artists in 2018? | SELECT SUM(revenue) FROM ArtistRevenue WHERE year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE memberships (id INT, member_type VARCHAR(20)); INSERT INTO memberships (id, member_type) VALUES (1, 'Basic'), (2, 'Premium'), (3, 'Elite'), (4, 'Platinum'), (5, 'Essential'); | How many users have a membership type starting with 'E' or 'P'? | SELECT COUNT(*) as num_users FROM memberships WHERE member_type LIKE 'E%' OR member_type LIKE 'P%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(255), category VARCHAR(255)); INSERT INTO users (id, country, category) VALUES (1, 'Canada', 'entertainment'); CREATE TABLE posts (id INT, user_id INT, times INT); | How many users have posted more than 50 times in the entertainment category from Canada? | SELECT COUNT(DISTINCT users.id) FROM users INNER JOIN posts ON users.id = posts.user_id WHERE users.country = 'Canada' AND posts.times > 50 AND users.category = 'entertainment'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agroecology_initiatives (id INT, name VARCHAR(255), area FLOAT, continent VARCHAR(255)); INSERT INTO agroecology_initiatives (id, name, area, continent) VALUES (1, 'Initiative A', 12345.6, 'North America'), (2, 'Initiative B', 23456.7, 'Europe'), (3, 'Initiative C', 34567.8, 'Asia'); | How many agroecology initiatives have been implemented in North America, and what is the total area of land in square kilometers used for these initiatives? | SELECT COUNT(*), SUM(area * 0.0001) as total_area_sq_km FROM agroecology_initiatives WHERE continent = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodation_Data (Request_ID INT, Request_Date DATE, Accommodation_Type VARCHAR(50), Request_Status VARCHAR(10)); | What is the percentage of disability accommodations requested and approved by month? | SELECT DATE_PART('month', Request_Date) as Month, PERCENTAGE(COUNT(*) FILTER (WHERE Request_Status = 'Approved')) as Percentage_Approved FROM Accommodation_Data GROUP BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE gaming_players (player_id INT, name VARCHAR(50), join_date DATE); | Find players who joined after the player with the earliest join date in 'gaming_players' table | SELECT * FROM gaming_players WHERE join_date > (SELECT MIN(join_date) FROM gaming_players); | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE region (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE incident (id INT PRIMARY KEY, country_id INT, region_id INT, reported_date DATE, type VARCHAR(255)); INSERT INTO country (id, name) VALUES (1, 'Nigeria'), (2, 'South Africa'), (3, 'Egypt... | List all cybersecurity incidents reported in the African region in 2019, including the name of the country and the incident type. | SELECT c.name as country_name, i.type as incident_type FROM country c INNER JOIN incident i ON c.id = i.country_id INNER JOIN region r ON i.region_id = r.id WHERE r.name = 'Africa' AND YEAR(i.reported_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence_v2 (id INT, name VARCHAR(255), ip_address VARCHAR(50), threat_level VARCHAR(10)); INSERT INTO threat_intelligence_v2 (id, name, ip_address, threat_level) VALUES (4, 'APT35', '172.20.0.1', 'Low'), (5, 'APT36', '10.1.1.1', 'High'), (6, 'APT37', '192.168.2.1', 'Medium'); | What is the name and IP address of the threat with the lowest threat level in the 'threat_intelligence_v2' table? | SELECT name, ip_address FROM threat_intelligence_v2 WHERE threat_level = (SELECT MIN(threat_level) FROM threat_intelligence_v2); | gretelai_synthetic_text_to_sql |
CREATE TABLE employee_records (employee_id INT PRIMARY KEY, name TEXT, position TEXT, leaving_date DATE); INSERT INTO employee_records (employee_id, name, position, leaving_date) VALUES (1, 'John Doe', 'CTO', '2018-01-01'); INSERT INTO employee_records (employee_id, name, position, leaving_date) VALUES (2, 'Jane Smith'... | Get the number of employees who left in each month of 2020 from the "employee_records" table | SELECT EXTRACT(MONTH FROM leaving_date) AS month, COUNT(*) AS count FROM employee_records WHERE leaving_date >= '2020-01-01' AND leaving_date < '2021-01-01' GROUP BY month ORDER BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo (cargo_id INT, vessel_id INT, cargo_type VARCHAR(20), weight INT); | Insert a new record into the cargo table with the following data: cargo_id 302, vessel_id 201, cargo_type 'Containers', weight 5000 | INSERT INTO cargo (cargo_id, vessel_id, cargo_type, weight) VALUES (302, 201, 'Containers', 5000); | gretelai_synthetic_text_to_sql |
CREATE TABLE facilities (facility_id INT, facility_name VARCHAR(255), waste_generated INT, waste_collection_date DATE); INSERT INTO facilities (facility_id, facility_name, waste_generated, waste_collection_date) VALUES (1, 'Facility A', 100, '2022-01-01'), (2, 'Facility B', 200, '2022-01-15'); | What is the total waste generated by each facility, partitioned by quarter and ordered by total waste? | SELECT facility_name, DATE_TRUNC('quarter', waste_collection_date) AS quarter, SUM(waste_generated) AS total_waste, RANK() OVER (ORDER BY SUM(waste_generated) DESC) AS ranking FROM facilities GROUP BY facility_name, quarter ORDER BY total_waste DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier_ethics (supplier_id INT, country VARCHAR(50), labor_practices VARCHAR(50), sustainability_score INT); CREATE VIEW supplier_sustainability_scores AS SELECT country, AVG(sustainability_score) as avg_sustainability_score FROM supplier_ethics GROUP BY country; | Create a view to show the average sustainability score of suppliers from each country | CREATE VIEW supplier_sustainability_scores AS SELECT country, AVG(sustainability_score) as avg_sustainability_score FROM supplier_ethics GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sustainable_Projects_UT (project_id INT, project_name VARCHAR(50), state VARCHAR(2), timeline INT, is_sustainable BOOLEAN); INSERT INTO Sustainable_Projects_UT VALUES (2, 'SaltLakeCityGreenTower', 'UT', 36, true); | What is the maximum timeline for a sustainable construction project in Utah? | SELECT MAX(timeline) FROM Sustainable_Projects_UT WHERE state = 'UT' AND is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety_inspections (inspection_id INT, report TEXT); INSERT INTO food_safety_inspections (inspection_id, report) VALUES (1, 'The food was contaminated with bacteria.'), (2, 'The food was safe for consumption.'), (3, 'The food was not contaminated.'); | How many times has 'contaminated' appeared in the 'food_safety_inspections' table? | SELECT COUNT(*) as contamination_count FROM food_safety_inspections WHERE report LIKE '%contaminated%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE facilities (id INT, name TEXT, type TEXT); INSERT INTO facilities (id, name, type) VALUES (1, 'Rural Clinic', 'Primary Care'), (2, 'Urgent Care', 'Urgent Care'), (3, 'General Hospital', 'Hospital'); | Which facilities are not hospitals? | SELECT name FROM facilities WHERE type != 'Hospital'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cargo (Id INT, VesselId INT, Tonnage INT, Continent VARCHAR(50)); INSERT INTO Cargo (Id, VesselId, Tonnage, Continent) VALUES (1, 1, 5000, 'Africa'), (2, 1, 7000, 'Asia'), (3, 3, 8000, 'Africa'), (4, 2, 6000, 'Europe'); | What is the total tonnage of all cargos carried by vessels that have carried cargos from the African continent? | SELECT SUM(Tonnage) FROM Cargo WHERE Continent = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id VARCHAR(20), name VARCHAR(20)); INSERT INTO vessels (id, name) VALUES ('VES009', 'VESSEL009'), ('VES010', 'VESSEL010'); CREATE TABLE safety_incidents (vessel_id VARCHAR(20), incident_type VARCHAR(50)); INSERT INTO safety_incidents (vessel_id, incident_type) VALUES ('VES009', 'Collision'), ('VES... | List safety incidents for VESSEL009 | SELECT incident_type FROM safety_incidents WHERE vessel_id = 'VES009'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety (incident_id INT, incident_date DATE, organization_name TEXT, incident_description TEXT); INSERT INTO ai_safety (incident_id, incident_date, organization_name, incident_description) VALUES (1, '2021-01-01', 'TechCo', 'AI system caused harm to a user'); INSERT INTO ai_safety (incident_id, incident... | List the organizations that have not had any AI safety incidents, in alphabetical order. | SELECT DISTINCT organization_name FROM ai_safety WHERE organization_name NOT IN (SELECT organization_name FROM ai_safety GROUP BY organization_name HAVING COUNT(*) > 0) ORDER BY organization_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Quantum_Quests (player_id INT, player_name VARCHAR(50), score INT, join_date DATE); INSERT INTO Quantum_Quests (player_id, player_name, score, join_date) VALUES (1, 'Lucas Chen', 2000, '2020-08-08'), (2, 'Mia Lee', 1500, '2020-08-08'), (3, 'Jordan Park', 1800, '2020-08-08'); | What is the average score for players who joined on the same day as the player with the highest score in the game 'Quantum Quests'? | SELECT AVG(score) FROM Quantum_Quests WHERE join_date = (SELECT join_date FROM Quantum_Quests WHERE score = (SELECT MAX(score) FROM Quantum_Quests)); | gretelai_synthetic_text_to_sql |
CREATE TABLE causes (id INT, name VARCHAR(255)); INSERT INTO causes (id, name) VALUES (1, 'Education'), (2, 'Health'), (3, 'Environment'); CREATE TABLE donors (id INT, cause_id INT); INSERT INTO donors (id, cause_id) VALUES (1, 1), (2, 2), (3, 1), (4, 3), (5, 2), (6, 1), (7, 3), (8, 2), (9, 1), (10, 3); | How many unique donors supported each cause in H1 2022? | SELECT cause_id, COUNT(DISTINCT id) as unique_donors FROM donors WHERE id IN (SELECT id FROM donors WHERE donation_date BETWEEN '2022-01-01' AND '2022-06-30') GROUP BY cause_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE port (port_id INT, name TEXT);CREATE TABLE port_agent (port_agent_id INT, port_id INT, name TEXT);CREATE TABLE container (container_id INT, port_agent_id INT, handled_at DATETIME);INSERT INTO port VALUES (12, 'Casablanca'); | What is the average number of containers handled daily by each port agent in 'Casablanca'? | SELECT port_agent.name, AVG(COUNT(container.container_id)) FROM port_agent JOIN port ON port_agent.port_id = port.port_id JOIN container ON port_agent.port_agent_id = container.port_agent_id WHERE port.name = 'Casablanca' GROUP BY port_agent.name, DATE(container.handled_at); | gretelai_synthetic_text_to_sql |
CREATE TABLE tours (tour_id INT, name TEXT, country TEXT, rating DECIMAL, duration INT); INSERT INTO tours (tour_id, name, country, rating, duration) VALUES (1, 'Japan Odyssey', 'Japan', 5.0, 10), (2, 'Quick Japan Tour', 'Japan', 4.5, 5); | What is the maximum rating of tours in Japan with a duration of at least 7 days? | SELECT MAX(rating) FROM tours WHERE country = 'Japan' AND duration >= 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm (id INT, name VARCHAR(50), size FLOAT, PRIMARY KEY(id)); INSERT INTO farm (id, name, size) VALUES (1, 'Farm A', 50.3); INSERT INTO farm (id, name, size) VALUES (2, 'Farm B', 75.8); CREATE TABLE soil_moisture (id INT, farm_id INT, moisture FLOAT, PRIMARY KEY(id)); INSERT INTO soil_moisture (id, farm_id... | List the farms and their soil moisture levels, if available. | SELECT f.name, s.moisture FROM farm f LEFT JOIN soil_moisture s ON f.id = s.farm_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, condition VARCHAR(20)); INSERT INTO patients (patient_id, condition) VALUES (1, 'depression'), (2, 'anxiety'); | Find the percentage of patients treated for depression | SELECT (COUNT(CASE WHEN condition = 'depression' THEN 1 END) * 100.0 / COUNT(*)) AS depression_percentage FROM patients; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, name VARCHAR(50), location VARCHAR(50), type VARCHAR(50), PRIMARY KEY(id)); INSERT INTO heritage_sites (id, name, location, type) VALUES (1, 'Colosseum', 'Italy, Europe', 'Ancient Roman'), (2, 'Acropolis', 'Greece, Europe', 'Ancient Greek'), (3, 'Alhambra', 'Spain, Europe', 'Islamic... | How many community engagement programs are there for each heritage site in Europe? | SELECT hs.name, hs.location, hs.type, COUNT(cp.id) AS program_count FROM heritage_sites hs JOIN community_programs cp ON hs.id = cp.heritage_site_id GROUP BY hs.name, hs.location, hs.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE RestaurantSales (sale_id INT, restaurant_id INT, menu_item_id INT, revenue DECIMAL(10,2)); INSERT INTO RestaurantSales (sale_id, restaurant_id, menu_item_id, revenue) VALUES (1, 1, 1, 100), (2, 1, 1, 200), (3, 1, 2, 150), (4, 2, 1, 250), (5, 2, 3, 300); | Identify the most profitable menu item for each restaurant | SELECT r.restaurant_name, m.menu_item_name, MAX(rs.revenue) as max_revenue FROM Restaurants r INNER JOIN RestaurantMenu rm ON r.restaurant_id = rm.restaurant_id INNER JOIN RestaurantSales rs ON rm.menu_item_id = rs.menu_item_id INNER JOIN MenuItems m ON rs.menu_item_id = m.menu_item_id GROUP BY r.restaurant_name, m.men... | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_inspections (id INT, union_name VARCHAR(50), inspection_date DATE, passed BOOLEAN); | Insert new record into "safety_inspections" table | INSERT INTO safety_inspections (id, union_name, inspection_date, passed) VALUES (1, 'United Auto Workers', '2022-06-01', true); | gretelai_synthetic_text_to_sql |
CREATE TABLE schools(id INT, name VARCHAR(100), city VARCHAR(50));CREATE TABLE enrollment(id INT, school_id INT, enrollment_count INT); | Insert new records of public schools and their student enrollment data for the city of New York. | INSERT INTO schools (name, city) VALUES ('School 1', 'New York'), ('School 2', 'New York');INSERT INTO enrollment (school_id, enrollment_count) VALUES (1, 500), (2, 800); | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_ops (id INT, mission VARCHAR, country VARCHAR, start_date DATE, end_date DATE, PRIMARY KEY (id)); INSERT INTO peacekeeping_ops (id, mission, country, start_date, end_date) VALUES (1, 'ISAF', 'Afghanistan', '2001-09-12', '2014-12-31'); | Rank peacekeeping missions in Afghanistan by duration, in descending order? | SELECT mission, country, DATEDIFF(day, start_date, end_date) as mission_duration, RANK() OVER (ORDER BY DATEDIFF(day, start_date, end_date) DESC) as mission_rank FROM peacekeeping_ops WHERE country = 'Afghanistan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (id INT, country VARCHAR(255), city VARCHAR(255), number_of_packages INT); INSERT INTO Warehouse (id, country, city, number_of_packages) VALUES (1, 'Canada', 'Toronto', 500), (2, 'Canada', 'Vancouver', 300), (3, 'Canada', 'Montreal', 200); | What is the total number of packages received at each warehouse in Canada? | SELECT country, city, SUM(number_of_packages) FROM Warehouse WHERE country = 'Canada' GROUP BY country, city | gretelai_synthetic_text_to_sql |
CREATE TABLE Dysprosium_Production (id INT, year INT, country VARCHAR(20), production_volume INT); | How many Tb dysprosium were produced in China in total? | SELECT SUM(production_volume) FROM Dysprosium_Production WHERE country = 'China' AND element = 'Tb'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_attack_type (id INT, incident_count INT, attack_type VARCHAR(50), incident_date DATE); INSERT INTO incident_attack_type (id, incident_count, attack_type, incident_date) VALUES (1, 20, 'Malware', '2022-02-01'), (2, 15, 'Phishing', '2022-02-02'), (3, 30, 'SQL Injection', '2022-02-03'); | How many security incidents were associated with each type of attack in the last year? | SELECT attack_type, SUM(incident_count) as total_incidents FROM incident_attack_type WHERE incident_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY attack_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE asteroids (id INT, asteroid_name VARCHAR(50), discovery_date DATE, observatory VARCHAR(50)); | Find the number of asteroids discovered by each observatory in descending order? | SELECT observatory, COUNT(*) AS num_asteroids, RANK() OVER (ORDER BY COUNT(*) DESC) AS observatory_rank FROM asteroids GROUP BY observatory; | gretelai_synthetic_text_to_sql |
CREATE TABLE National_Security (id INT, name VARCHAR(50), location VARCHAR(20), type VARCHAR(20), budget INT); INSERT INTO National_Security (id, name, location, type, budget) VALUES (1, 'Operation Iron Wall', 'Middle East', 'Security', 4000000); | List all national security operations and their types from the 'National_Security' table. | SELECT * FROM National_Security; | gretelai_synthetic_text_to_sql |
CREATE TABLE audience (id INT, country VARCHAR(50), age INT, gender VARCHAR(10), topic VARCHAR(50)); INSERT INTO audience (id, country, age, gender, topic) VALUES (1, 'France', 35, 'Male', 'News'); INSERT INTO audience (id, country, age, gender, topic) VALUES (2, 'Germany', 42, 'Female', 'News'); | What is the distribution of audience demographics for news in France and Germany? | SELECT country, COUNT(*), age, gender FROM audience WHERE topic = 'News' AND (country = 'France' OR country = 'Germany') GROUP BY country, age, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnergyEfficiency (id INT, building_id INT, year INT, energy_star_rating INT, primary key (id)); INSERT INTO EnergyEfficiency (id, building_id, year, energy_star_rating) VALUES (1, 8001, 2019, 85); | What is the average energy efficiency rating for buildings in Germany in 2019? | SELECT AVG(energy_star_rating) FROM EnergyEfficiency WHERE country = 'Germany' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(50), posts_count INT, registration_date DATE); CREATE TABLE posts (id INT, user_id INT, post_text VARCHAR(255), post_date DATE); | What is the average number of posts per day for users in the social_media schema? | SELECT AVG(DATEDIFF(post_date, registration_date) / posts_count) FROM users JOIN posts ON users.id = posts.user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, mine_id INT, year INT, element TEXT, production_quantity INT); INSERT INTO production (id, mine_id, year, element, production_quantity) VALUES (1, 1, 2017, 'Terbium', 40), (2, 2, 2017, 'Terbium', 60), (3, 3, 2017, 'Terbium', 80), (4, 1, 2017, 'Dysprosium', 100), (5, 2, 2017, 'Dysprosium... | What is the minimum production quantity (in metric tons) of Terbium for the year 2017? | SELECT MIN(production_quantity) FROM production WHERE year = 2017 AND element = 'Terbium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clothing_brands (brand_id INT PRIMARY KEY, brand_name VARCHAR(100), sustainability_rating FLOAT); INSERT INTO clothing_brands (brand_id, brand_name, sustainability_rating) VALUES (1, 'EcoFriendlyBrand', 4.2), (2, 'GreenFashion', 4.6), (3, 'SustainableTextiles', 4.5); | Update the rating of the brand 'EcoFriendlyBrand' to 4.5? | UPDATE clothing_brands SET sustainability_rating = 4.5 WHERE brand_name = 'EcoFriendlyBrand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlasticWaste (country VARCHAR(50), population INT, plastic_waste_kg FLOAT); INSERT INTO PlasticWaste (country, population, plastic_waste_kg) VALUES ('Germany', 83019234, 17.36), ('France', 66990156, 15.2), ('Italy', 60317014, 13.9), ('Spain', 47351247, 10.5), ('United Kingdom', 67886011, 12.5); | What is the average plastic waste generation per capita in the European Union? | SELECT AVG(plastic_waste_kg/population) FROM PlasticWaste WHERE country IN ('Germany', 'France', 'Italy', 'Spain', 'United Kingdom'); | gretelai_synthetic_text_to_sql |
CREATE TABLE city_electric_vehicles (city_name VARCHAR(255), num_electric_vehicles INT); INSERT INTO city_electric_vehicles (city_name, num_electric_vehicles) VALUES ('San Francisco', 15000), ('Los Angeles', 20000), ('New York', 30000); | What is the average number of electric vehicles per city in the 'transportation' schema? | SELECT AVG(num_electric_vehicles) FROM city_electric_vehicles; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (location VARCHAR(50), current_capacity INT, projected_capacity INT, year INT); INSERT INTO landfill_capacity (location, current_capacity, projected_capacity, year) VALUES ('Beijing', 60000, 70000, 2040); | What is the current landfill capacity in Beijing and the projected capacity in 2040? | SELECT location, current_capacity, projected_capacity FROM landfill_capacity WHERE location = 'Beijing' AND year = 2040; | gretelai_synthetic_text_to_sql |
CREATE TABLE hockey_players (player_id INT, name VARCHAR(50), position VARCHAR(20), team VARCHAR(50), salary DECIMAL(10, 2)); INSERT INTO hockey_players (player_id, name, position, team, salary) VALUES (1, 'Alex Ovechkin', 'Left Wing', 'Washington Capitals', 10000000.00); INSERT INTO hockey_players (player_id, name, po... | What are the total salaries of players in each position for the hockey_players table? | SELECT position, SUM(salary) FROM hockey_players GROUP BY position; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue(restaurant_id INT, cuisine_type TEXT, revenue FLOAT), local_sourcing(restaurant_id INT, local_source BOOLEAN); INSERT INTO restaurant_revenue(restaurant_id, cuisine_type, revenue) VALUES (1, 'Italian', 5000.00), (2, 'Mexican', 6000.00), (3, 'Italian', 4000.00); INSERT INTO local_sourcing... | What is the total revenue for restaurants that source at least 50% of their ingredients locally? | SELECT SUM(revenue) FROM restaurant_revenue WHERE restaurant_id IN (SELECT restaurant_id FROM local_sourcing WHERE local_source = TRUE) AND cuisine_type IN (SELECT cuisine_type FROM local_sourcing WHERE local_source = TRUE) GROUP BY cuisine_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Research_Station (station_name VARCHAR(50), latitude NUMERIC(8,2), longitude NUMERIC(8,2), ocean_name VARCHAR(50)); INSERT INTO Research_Station (station_name, latitude, longitude, ocean_name) VALUES ('Station A', 90.0000, -135.0000, 'Arctic'), ('Station B', 90.0000, 135.0000, 'Antarctic'), ('Station C', 6... | How many marine research stations are located in the Arctic and Antarctic Oceans? | SELECT COUNT(*) FROM Research_Station WHERE ocean_name IN ('Arctic', 'Antarctic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, Name VARCHAR(50), Country VARCHAR(50)); CREATE TABLE Ingredients (IngredientID INT, Name VARCHAR(50), SupplierID INT, Cost DECIMAL(5,2)); | What is the total cost of ingredients for each supplier, grouped by country? | SELECT Suppliers.Country, SUM(Ingredients.Cost) as TotalCost FROM Suppliers JOIN Ingredients ON Suppliers.SupplierID = Ingredients.SupplierID GROUP BY Suppliers.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT PRIMARY KEY, name VARCHAR(255), gender VARCHAR(10)); INSERT INTO artists (id, name, gender) VALUES (1, 'Taylor Swift', 'Female'); INSERT INTO artists (id, name, gender) VALUES (2, 'Ed Sheeran', 'Male'); | What is the average rating of songs from female artists? | SELECT AVG(r.rating) as average_rating FROM ratings r INNER JOIN songs s ON r.song_id = s.id INNER JOIN artists a ON s.artist_id = a.id WHERE a.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE journeys (vessel VARCHAR(20), speed INT, distance INT); INSERT INTO journeys (vessel, speed, distance) VALUES ('Aurelia', 20, 100), ('Aurelia', 22, 120), ('Belfast', 25, 150), ('Belfast', 24, 140), ('Belfast', 26, 160), ('Caledonia', 21, 110), ('Caledonia', 23, 130); | What was the total number of journeys for each vessel? | SELECT vessel, COUNT(*) FROM journeys GROUP BY vessel; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Department VARCHAR(50), Age INT, Site VARCHAR(50)); INSERT INTO Employees (EmployeeID, Name, Department, Age, Site) VALUES (1, 'John Doe', 'Mining Operations', 35, 'Site A'); INSERT INTO Employees (EmployeeID, Name, Department, Age, Site) VALUES (2, 'Jane Smith'... | What is the average age of employees working in the 'Mining Operations' department across all sites? | SELECT AVG(Employees.Age) FROM Employees INNER JOIN Sites ON Employees.Site = Sites.Site WHERE Employees.Department = 'Mining Operations'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Funding (program TEXT, amount INT); INSERT INTO Funding (program, amount) VALUES ('Dance for Underrepresented Youth', 50000), ('Dance for Minorities', 75000); | What is the total funding received by dance programs for underrepresented communities? | SELECT SUM(amount) FROM Funding WHERE program LIKE '%Underrepresented%' OR program LIKE '%Minorities%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name TEXT, tags TEXT); CREATE TABLE orders (id INT, dish_id INT, quantity INT); INSERT INTO dishes (id, name, tags) VALUES (1, 'Quinoa Salad', 'vegan'), (2, 'Chickpea Curry', 'vegan'), (3, 'Beef Burger', 'none'), (4, 'Spicy Chicken Sandwich', 'none'); INSERT INTO orders (id, dish_id, quanti... | What is the total quantity of dishes with the 'vegan' tag? | SELECT SUM(quantity) FROM orders JOIN dishes ON dishes.id = orders.dish_id WHERE tags LIKE '%vegan%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Refugees (refugee_id INT, refugee_name VARCHAR(255), service_start_date DATE, service_end_date DATE); CREATE TABLE Programs (program_id INT, program_name VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO Refugees (refugee_id, refugee_name, service_start_date, service_end_date) VALUES (1, 'Ahmed', ... | How many refugees were served by 'Community Outreach Program' in '2019'? | SELECT COUNT(Refugees.refugee_id) FROM Refugees INNER JOIN Programs ON Refugees.service_start_date <= Programs.end_date AND Refugees.service_end_date >= Programs.start_date WHERE Programs.program_name = 'Community Outreach Program' AND YEAR(Programs.start_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtHistorians (HistorianID int, Name varchar(50), Specialization varchar(50)); INSERT INTO ArtHistorians (HistorianID, Name, Specialization) VALUES (1, 'Giorgio Vasari', 'Renaissance Art'); INSERT INTO ArtHistorians (HistorianID, Name, Specialization) VALUES (2, 'Jacob Burckhardt', 'Italian Renaissance'); ... | What art historians specialized in Baroque art? | SELECT Name FROM ArtHistorians WHERE Specialization = 'Baroque Art'; | gretelai_synthetic_text_to_sql |
CREATE TABLE purchases (purchase_date DATE, supplier VARCHAR(255), revenue DECIMAL(10,2)); | What is the total revenue for each supplier, by week? | SELECT supplier, DATE_TRUNC('week', purchase_date) AS purchase_week, SUM(revenue) AS total_revenue FROM purchases GROUP BY supplier, purchase_week; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, postal_code TEXT, donation_amount DECIMAL(10, 2), donation_date DATE); INSERT INTO donors (id, name, postal_code, donation_amount, donation_date) VALUES (1, 'John Doe', '90210', 500.00, '2022-01-01'), (2, 'Jane Smith', 'B7P 1A1', 350.00, '2022-02-15'); | What is the total amount donated by each donor's postal code, summed up quarterly? | SELECT postal_code, DATE_TRUNC('quarter', donation_date) AS donation_quarter, SUM(donation_amount) AS total_donation FROM donors GROUP BY postal_code, donation_quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, sale_date DATE, product_id INT, quantity INT, is_ethically_sourced BOOLEAN); INSERT INTO sales (sale_id, sale_date, product_id, quantity, is_ethically_sourced) VALUES (1, '2022-01-01', 1, 50, true); INSERT INTO sales (sale_id, sale_date, product_id, quantity, is_ethically_sourced) VALUE... | What is the average quantity of ethically sourced products sold per day? | SELECT AVG(quantity) FROM sales WHERE is_ethically_sourced = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation_projects (project_id INT, project_name TEXT, location TEXT, start_year INT); INSERT INTO climate_adaptation_projects (project_id, project_name, location, start_year) VALUES (1, 'Asian Coastal Protection', 'Asia', 2019), (2, 'Monsoon Resilience', 'Asia', 2018), (3, 'Asian Drought Response... | How many climate adaptation projects were initiated in Asia in 2019? | SELECT COUNT(*) FROM climate_adaptation_projects WHERE start_year = 2019 AND location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_species (species_id INT PRIMARY KEY, scientific_name VARCHAR(255), common_name VARCHAR(255), conservation_status VARCHAR(50)); INSERT INTO fish_species (species_id, scientific_name, common_name, conservation_status) VALUES (1, 'Oncorhynchus tshawytscha', 'Chinook salmon', 'Vulnerable'), (2, 'Salmo sal... | Create a view named "species_at_farms" with columns "farm_id", "species_id", and "species_common_name". Join "fish_farms" with "fish_species" to get the species common name. | CREATE VIEW species_at_farms AS SELECT ff.farm_id, ff.species_id, fs.common_name AS species_common_name FROM fish_farms ff JOIN fish_species fs ON ff.species_id = fs.species_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE vr_headsets (id INT, headset VARCHAR(255), gender VARCHAR(10)); INSERT INTO vr_headsets (id, headset, gender) VALUES (1, 'Oculus', 'Male'), (2, 'HTC Vive', 'Female'), (3, 'Oculus', 'Male'); | Which virtual reality headsets are most popular by gender? | SELECT headset, gender, PERCENT_RANK() OVER (PARTITION BY gender ORDER BY COUNT(*) DESC) AS popularity_percentile FROM vr_headsets GROUP BY headset, gender ORDER BY gender, popularity_percentile; | gretelai_synthetic_text_to_sql |
CREATE TABLE players_stats (player_id INT PRIMARY KEY, player_name VARCHAR(255), position VARCHAR(50), assists INT, FOREIGN KEY (player_id) REFERENCES players(player_id)); | What is the maximum number of assists for each player in the players table, grouped by their position, and only for players who have more than 20 assists in total? | SELECT position, MAX(assists) as max_assists FROM players_stats GROUP BY position HAVING SUM(assists) > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_size(id INT, union_name VARCHAR(50), members INT, location VARCHAR(14));INSERT INTO union_size(id, union_name, members, location) VALUES (1, 'Union E', 6000, 'Canada'), (2, 'Union F', 4000, 'United States'), (3, 'Union G', 8000, 'Mexico'); | Display the names of unions with more than 5000 members that are not located in the United States. | SELECT union_name FROM union_size WHERE members > 5000 AND location != 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE import_transactions (id INT, date DATE, item_description VARCHAR(100), quantity INT, unit_price DECIMAL(10, 2), country VARCHAR(50)); | Find the total value of agricultural machinery imported in the 'import_transactions' table for the years 2018 and 2019, separated by country? | SELECT country, SUM(quantity * unit_price) as total_value FROM import_transactions WHERE item_description LIKE '%agricultural machinery%' AND YEAR(date) IN (2018, 2019) GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE courses (institution VARCHAR(50), course_name VARCHAR(50), course_type VARCHAR(20)); INSERT INTO courses (institution, course_name, course_type) VALUES ('University A', 'Introduction to Programming', 'Open Pedagogy'), ('University B', 'Data Science Fundamentals', 'Traditional'), ('University A', 'Machine L... | How many open pedagogy courses are offered by institution? | SELECT institution, COUNT(*) as num_courses FROM courses WHERE course_type = 'Open Pedagogy' GROUP BY institution; | gretelai_synthetic_text_to_sql |
CREATE TABLE team_achievements (team VARCHAR(255), year INT, title VARCHAR(255)); INSERT INTO team_achievements (team, year, title) VALUES ('Los Angeles Kings', 2012, 'Stanley Cup'); | Who won the Stanley Cup in 2012? | SELECT team FROM team_achievements WHERE title = 'Stanley Cup' AND year = 2012; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO restaurants VALUES (1, 'Restaurant A', 'City A'); INSERT INTO restaurants VALUES (2, 'Restaurant B', 'City B'); CREATE TABLE revenue (restaurant_id INT, date DATE, revenue INT); INSERT INTO revenue VALUES (1, '2021-06-01', 2000); INS... | What is the average revenue per day for each restaurant in the last month? | SELECT r.name, AVG(revenue/DATEDIFF(LAST_DAY(date), date)) as avg_revenue_per_day FROM revenue JOIN restaurants r ON revenue.restaurant_id = r.id WHERE date BETWEEN DATE_SUB(LAST_DAY(CURRENT_DATE), INTERVAL 1 MONTH) AND LAST_DAY(CURRENT_DATE) GROUP BY r.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductQuantity (product VARCHAR(255), country VARCHAR(255), date DATE, quantity INT); | Which beauty products have been sold the most in Germany in the past year? | SELECT product, SUM(quantity) AS total_quantity FROM ProductQuantity WHERE country = 'Germany' AND date >= DATEADD(year, -1, GETDATE()) GROUP BY product ORDER BY total_quantity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Gender VARCHAR(10), WorkoutType VARCHAR(20)); INSERT INTO Members (MemberID, Gender, WorkoutType) VALUES (1, 'Female', 'Yoga'), (2, 'Male', 'Weightlifting'), (3, 'Female', 'Yoga'), (4, 'Male', 'Running'); | Which workout type is most popular among female members? | SELECT WorkoutType, COUNT(*) AS Count FROM Members WHERE Gender = 'Female' GROUP BY WorkoutType ORDER BY Count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT); INSERT INTO donors (id, name) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Brazil'), (4, 'Argentina'); CREATE TABLE donations (id INT, donor INT, country INT, amount FLOAT); INSERT INTO donations (id, donor, country, amount) VALUES (1, 1, 2, 1000), (2, 2, 3, 1500), (3, 1, 2, 750); CRE... | Identify the top 3 donor countries by total monetary aid to South American countries affected by natural disasters? | SELECT d.name, SUM(donation.amount) as total_aid FROM donations donation JOIN donors d ON donation.donor = d.id JOIN countries c ON donation.country = c.id WHERE c.region = 'South America' GROUP BY d.name ORDER BY total_aid DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganizationDonations (OrgID INT, DonationAmount INT, DonationDate DATE); | What's the avg. donation amount for each org in '2022'? | SELECT o.OrgName, AVG(od.DonationAmount) FROM OrganizationDonations od INNER JOIN Organizations o ON od.OrgID = o.OrgID WHERE YEAR(od.DonationDate) = 2022 GROUP BY o.OrgName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Position VARCHAR(50), HireDate DATETIME); CREATE TABLE Salaries (SalaryID INT, EmployeeID INT, Amount DECIMAL(5,2), StartDate DATETIME, EndDate DATETIME); | What is the average salary for each employee position, grouped by gender? | SELECT Employees.Position, Employees.Gender, AVG(Salaries.Amount) as AverageSalary FROM Employees JOIN Salaries ON Employees.EmployeeID = Salaries.EmployeeID GROUP BY Employees.Position, Employees.Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_data_europe(id INT, member_id INT, workout_type VARCHAR(20), workout_duration INT, country VARCHAR(20)); INSERT INTO workout_data_europe(id, member_id, workout_type, workout_duration, country) VALUES (1, 1, 'Running', 60, 'UK'), (2, 2, 'Cycling', 45, 'Germany'); | Identify the unique workout types for members who are younger than 30 and reside in European countries. | SELECT DISTINCT workout_type FROM workout_data_europe WHERE country IN ('UK', 'Germany', 'France', 'Italy') AND age < 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name TEXT, zip TEXT, consultations INT); INSERT INTO community_health_workers (id, name, zip, consultations) VALUES (1, 'Sophia Rodriguez', '32001', 5), (2, 'Daniel Nguyen', '33101', 12); CREATE VIEW fl_workers AS SELECT * FROM community_health_workers WHERE zip BETWEEN '3... | Who is the community health worker with the least mental health parity consultations in Florida? | SELECT name FROM fl_workers WHERE consultations = (SELECT MIN(consultations) FROM fl_workers); | gretelai_synthetic_text_to_sql |
CREATE TABLE cultivators (id INT, name TEXT, state TEXT); INSERT INTO cultivators (id, name, state) VALUES (1, 'Cultivator A', 'California'); INSERT INTO cultivators (id, name, state) VALUES (2, 'Cultivator B', 'California'); CREATE TABLE sales (cultivator_id INT, quantity INT, price DECIMAL(10,2), sale_date DATE); INS... | What was the total revenue for the top 3 California cultivators in Q1 2022? | SELECT c.name, SUM(s.quantity * s.price) as total_revenue FROM cultivators c JOIN sales s ON c.id = s.cultivator_id WHERE s.sale_date BETWEEN '2022-01-01' AND '2022-03-31' GROUP BY c.name ORDER BY total_revenue DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE car_sharing (id INT, city VARCHAR(255), country VARCHAR(255), car_type VARCHAR(255), quantity INT); INSERT INTO car_sharing (id, city, country, car_type, quantity) VALUES (1, 'Madrid', 'Spain', 'Electric Car', 500), (2, 'Madrid', 'Spain', 'Hybrid Car', 300); | What is the maximum number of vehicles in a car-sharing program in Madrid, Spain? | SELECT MAX(quantity) FROM car_sharing WHERE city = 'Madrid' AND country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE paris_metro (fare DECIMAL(5,2), fare_date DATE); INSERT INTO paris_metro (fare, fare_date) VALUES (4.50, '2022-01-01'), (4.50, '2022-01-02'), (4.50, '2022-02-01'); | What is the total revenue per month for the Paris metro system? | SELECT EXTRACT(MONTH FROM fare_date), SUM(fare) FROM paris_metro GROUP BY EXTRACT(MONTH FROM fare_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_stats (id INT PRIMARY KEY, year INT, country VARCHAR(255), destination VARCHAR(255)); INSERT INTO tourism_stats (id, year, country, destination) VALUES (1, 2021, 'Brazil', 'Japan'), (2, 2021, 'Brazil', 'Thailand'), (3, 2021, 'Brazil', 'China'); | What is the total number of tourists from Brazil visiting Asia in 2021? | SELECT SUM(1) FROM tourism_stats WHERE country = 'Brazil' AND destination LIKE 'Asia%' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE offenders (id INT, name TEXT, state TEXT, community_service_hours INT); INSERT INTO offenders (id, name, state, community_service_hours) VALUES (1, 'John Doe', 'Texas', 50); INSERT INTO offenders (id, name, state, community_service_hours) VALUES (2, 'Jane Smith', 'Texas', 75); INSERT INTO offenders (id, na... | What is the average number of community service hours per offender in Texas? | SELECT AVG(community_service_hours) FROM offenders WHERE state = 'Texas' | gretelai_synthetic_text_to_sql |
CREATE TABLE feed_manufacturers (id INT, name VARCHAR(255), country VARCHAR(255), establishment_date DATE); | Create a new table for storing information about aquatic feed manufacturers. | INSERT INTO feed_manufacturers (id, name, country, establishment_date) VALUES (1, 'Skretting', 'Netherlands', '1956-04-01'), (2, 'Cargill Aqua Nutrition', 'USA', '1989-12-12'), (3, 'BioMar', 'Denmark', '1962-09-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE VirtualReality (VRID INT PRIMARY KEY, VRName VARCHAR(50), PlayersUsing INT); INSERT INTO VirtualReality (VRID, VRName, PlayersUsing) VALUES (8, 'Samsung Gear VR', 45000); INSERT INTO VirtualReality (VRID, VRName, PlayersUsing) VALUES (9, 'Google Daydream', 30000); | Which virtual reality devices are used by at least 40,000 players? | SELECT VRName FROM VirtualReality WHERE PlayersUsing >= 40000; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name VARCHAR(50), type VARCHAR(50), capacity INT); INSERT INTO vessels (id, name, type, capacity) VALUES (1, 'VesselA', 'Container', 5000), (2, 'VesselB', 'Tanker', 7000); | What is the total capacity of all vessels in the fleet? | SELECT SUM(capacity) FROM vessels; | gretelai_synthetic_text_to_sql |
CREATE TABLE Green_Infrastructure (id INT, project_name VARCHAR(50), location VARCHAR(50), cost FLOAT); INSERT INTO Green_Infrastructure (id, project_name, location, cost) VALUES (1, 'Urban Farming', 'City O', 2000000); INSERT INTO Green_Infrastructure (id, project_name, location, cost) VALUES (2, 'Community Gardens', ... | What is the total number of Green_Infrastructure projects in 'City O' and 'City P'? | SELECT COUNT(*) FROM Green_Infrastructure WHERE location IN ('City O', 'City P'); | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouses (warehouse_id INT, location TEXT, capacity INT); INSERT INTO warehouses (warehouse_id, location, capacity) VALUES (1, 'NYC', 5000), (2, 'LAX', 6000), (3, 'ORD', 7000), (4, 'DFW', 4000), (5, 'SFO', 8000); | List all the unique warehouse locations and their corresponding capacities? | SELECT DISTINCT location, capacity FROM warehouses; | gretelai_synthetic_text_to_sql |
CREATE TABLE japan_samarium (id INT, year INT, price DECIMAL); INSERT INTO japan_samarium (id, year, price) VALUES (1, 2015, 250), (2, 2016, 260), (3, 2017, 270); | What is the average price of samarium in Japan in 2017? | SELECT AVG(price) FROM japan_samarium WHERE year = 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name TEXT, region TEXT, num_areas INT); INSERT INTO marine_protected_areas (name, region, num_areas) VALUES ('MPA1', 'Atlantic', 1); INSERT INTO marine_protected_areas (name, region, num_areas) VALUES ('MPA2', 'Pacific', 2); | What is the total number of marine protected areas in the Atlantic region? | SELECT SUM(num_areas) FROM marine_protected_areas WHERE region = 'Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (city VARCHAR(255), year INT, material_type VARCHAR(255), recycling_rate DECIMAL(5,2)); INSERT INTO recycling_rates (city, year, material_type, recycling_rate) VALUES ('London', 2018, 'Glass', 0.25), ('London', 2018, 'Plastic', 0.35), ('London', 2019, 'Glass', 0.30), ('London', 2019, 'Plast... | What is the average recycling rate for glass in the city of London for the years 2018 and 2019? | SELECT AVG(recycling_rate) FROM recycling_rates WHERE city = 'London' AND material_type = 'Glass' AND year IN (2018, 2019); | 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.