context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE mental_health_parity (violation_id INT, state VARCHAR(20), date DATE); INSERT INTO mental_health_parity (violation_id, state, date) VALUES (1, 'California', '2021-01-01'); INSERT INTO mental_health_parity (violation_id, state, date) VALUES (2, 'Texas', '2021-03-05'); | List the number of mental health parity violations per state in the past year. | SELECT state, COUNT(*) as num_violations FROM mental_health_parity WHERE date >= '2021-01-01' AND date < '2022-01-01' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (MetricID INT, Country VARCHAR(255), MetricValue INT, ReportDate DATE); INSERT INTO HealthEquityMetrics (MetricID, Country, MetricValue, ReportDate) VALUES (1, 'United States', 85, '2021-01-01'); INSERT INTO HealthEquityMetrics (MetricID, Country, MetricValue, ReportDate) VALUES (2, 'Br... | What is the total health equity metric for each country in 2021? | SELECT Country, SUM(MetricValue) FROM HealthEquityMetrics WHERE YEAR(ReportDate) = 2021 GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (1, 25, 'Male', 'Japan'); | What is the average age of players who use VR technology in Japan? | SELECT AVG(Age) FROM Players WHERE Country = 'Japan' AND Gender = 'Male' AND VR_User = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_service_hours (id INT, state VARCHAR(50), violation_type VARCHAR(50), hours INT); INSERT INTO community_service_hours (id, state, violation_type, hours) VALUES (1, 'Illinois', 'Speeding', 10), (2, 'Illinois', 'Running Red Light', 15), (3, 'Illinois', 'Reckless Driving', 20); | What is the minimum number of hours of community service required for traffic violations in Illinois? | SELECT MIN(hours) FROM community_service_hours WHERE state = 'Illinois' AND violation_type = 'Traffic Violation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergyProjects (id INT, project_name VARCHAR(50), city VARCHAR(50), project_type VARCHAR(50)); | How many renewable energy projects are there in 'CityY' in the 'RenewableEnergyProjects' table? | SELECT COUNT(*) FROM RenewableEnergyProjects WHERE city = 'CityY'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Genres (GenreID INT PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(50)); | Insert a new genre named 'Afrobeat' into the Genres table | INSERT INTO Genres (Name) VALUES ('Afrobeat'); | gretelai_synthetic_text_to_sql |
CREATE TABLE museums(museum_id INT, museum_name TEXT, country TEXT, revenue FLOAT); INSERT INTO museums(museum_id, museum_name, country, revenue) VALUES (1, 'Museo del Prado', 'Spain', 12000000), (2, 'Reina Sofia Museum', 'Spain', 8000000), (3, 'Guggenheim Bilbao', 'Spain', 9000000), (4, 'Picasso Museum', 'Spain', 7000... | What is the local economic impact (revenue) of the top 3 most visited museums in Spain? | SELECT SUM(revenue) FROM (SELECT museum_name, revenue FROM museums WHERE country = 'Spain' ORDER BY revenue DESC LIMIT 3) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE geopolitical_risks_3 (country varchar(255), year int, risk_level int); INSERT INTO geopolitical_risks_3 (country, year, risk_level) VALUES ('Country Z', 2022, 4), ('Country Z', 2023, 5); | What is the geopolitical risk level for 'Country Z' in 2022 and 2023? | SELECT year, risk_level FROM geopolitical_risks_3 WHERE country = 'Country Z'; | gretelai_synthetic_text_to_sql |
CREATE TABLE visitor_stats (id INT PRIMARY KEY, visitor_country VARCHAR(50), year INT, num_visitors INT); INSERT INTO visitor_stats (id, visitor_country, year, num_visitors) VALUES (1, 'Australia', 2015, 45000); INSERT INTO visitor_stats (id, visitor_country, year, num_visitors) VALUES (2, 'Australia', 2018, 50000); | What is the maximum number of visitors to New Zealand from Australia in any given year? | SELECT MAX(num_visitors) FROM visitor_stats WHERE visitor_country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE NorthAmericanForests (region VARCHAR(20), year INT, timber_volume FLOAT); INSERT INTO NorthAmericanForests (region, year, timber_volume) VALUES ('North American Forests', 2020, 56789.12); | What is the total volume of timber harvested in the 'North American Forests' region in 2020? | SELECT SUM(timber_volume) FROM NorthAmericanForests WHERE region = 'North American Forests' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name VARCHAR(50), handling_date DATE, total_containers INT); INSERT INTO ports VALUES (1, 'PortA', '2022-01-01', 500), (2, 'PortB', '2022-01-01', 700), (3, 'PortC', '2022-01-01', 800), (1, 'PortA', '2022-01-02', 600), (2, 'PortB', '2022-01-02', 800), (3, 'PortC', '2022-01-02', 900)... | What is the total number of containers handled by each port in January 2022? | SELECT port_name, EXTRACT(MONTH FROM handling_date) AS month, EXTRACT(YEAR FROM handling_date) AS year, SUM(total_containers) FROM ports GROUP BY port_name, month, year HAVING month = 1 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE fulltime_workers (id INT, industry VARCHAR(20), salary FLOAT, union_member BOOLEAN); INSERT INTO fulltime_workers (id, industry, salary, union_member) VALUES (1, 'manufacturing', 50000.0, true), (2, 'technology', 70000.0, false), (3, 'manufacturing', 55000.0, true); | What is the average salary of full-time workers in the 'manufacturing' industry who are union members, and how many such members are there? | SELECT AVG(salary), COUNT(*) FROM fulltime_workers WHERE industry = 'manufacturing' AND union_member = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (vehicle_id INT, city VARCHAR(20), is_electric BOOLEAN, is_autonomous BOOLEAN); INSERT INTO vehicles (vehicle_id, city, is_electric, is_autonomous) VALUES (1, 'San Francisco', false, false), (2, 'New York', true, false); | Insert a new record with is_electric=true, is_autonomous=false, and city='Los Angeles' into the vehicles table. | INSERT INTO vehicles (city, is_electric, is_autonomous) VALUES ('Los Angeles', true, false); | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, content TEXT, category VARCHAR(50)); INSERT INTO posts (id, user_id, content, category) VALUES (1, 1, 'I love coding', 'technology'), (2, 1, 'Data science is fascinating', 'technology'), (3, 2, 'Painting is my hobby', 'art'); | What is the total number of posts related to technology? | SELECT COUNT(*) FROM posts WHERE category = 'technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name TEXT, country TEXT, biomass FLOAT); INSERT INTO fish_farms (id, name, country) VALUES (1, 'Farm C', 'Italy'); INSERT INTO fish_farms (id, name, country) VALUES (2, 'Farm D', 'Spain'); CREATE TABLE biomass_data (farm_id INT, biomass FLOAT); INSERT INTO biomass_data (farm_id, biomass... | Identify the total biomass of fish in farms located in the Mediterranean sea? | SELECT SUM(bd.biomass) FROM fish_farms ff JOIN biomass_data bd ON ff.id = bd.farm_id WHERE ff.country LIKE '%Mediterranean%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_sizes (id INT, customer_id INT, size VARCHAR(10)); INSERT INTO customer_sizes (id, customer_id, size) VALUES (1, 10001, 'XS'); | How many customers prefer size XS in our fashion retailer? | SELECT COUNT(*) FROM customer_sizes WHERE size = 'XS'; | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (station_id INT, station_name VARCHAR(255), line VARCHAR(255));CREATE TABLE trips (trip_id INT, station_id INT, fare FLOAT); INSERT INTO stations (station_id, station_name, line) VALUES (1, 'Boston', 'Silver Line'), (2, 'Chelsea', 'Silver Line'); INSERT INTO trips (trip_id, station_id, fare) VALUE... | Find the total fare collected from each station on the Silver Line | SELECT s.station_name, SUM(t.fare) as total_fare FROM trips t JOIN stations s ON t.station_id = s.station_id WHERE s.line = 'Silver Line' GROUP BY s.station_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerID VARCHAR(20), CustomerName VARCHAR(20)); INSERT INTO Customers (CustomerID, CustomerName) VALUES ('A', 'CustomerA'), ('B', 'CustomerB'); CREATE TABLE FreightForwardingTransactions (TransactionID INT, CustomerID VARCHAR(20), TransactionStatus VARCHAR(20), TransactionDate DATE); INSERT I... | List all freight forwarding transactions for 'CustomerA' with their corresponding statuses and dates. | SELECT FreightForwardingTransactions.TransactionID, FreightForwardingTransactions.TransactionStatus, FreightForwardingTransactions.TransactionDate FROM Customers JOIN FreightForwardingTransactions ON Customers.CustomerID = FreightForwardingTransactions.CustomerID WHERE Customers.CustomerName = 'CustomerA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE refugee_support_projects (id INT, name VARCHAR(100), region VARCHAR(50), num_refugees INT); INSERT INTO refugee_support_projects (id, name, region, num_refugees) VALUES (1, 'Project A', 'Middle East', 50), (2, 'Project B', 'Middle East', 100), (3, 'Project C', 'Middle East', 75), (4, 'Project D', 'Asia', 2... | What is the average number of refugees supported per refugee support project in the Middle East? | SELECT AVG(num_refugees) FROM refugee_support_projects WHERE region = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (temperature DECIMAL(3,2), reading_date DATE, location TEXT); INSERT INTO temperature_data (temperature, reading_date, location) VALUES (32.5, '2021-07-01', 'Pakistan'), (33.1, '2021-07-02', 'Pakistan'), (30.9, '2021-04-01', 'Pakistan'); | What is the maximum temperature (°C) recorded in wheat farms in Pakistan in the past week? | SELECT MAX(temperature) FROM temperature_data WHERE location = 'Pakistan' AND reading_date > DATE_SUB(CURDATE(), INTERVAL 1 WEEK) AND location LIKE '%wheat%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (id INT, plant_location VARCHAR(50), incident_date DATE, incident_type VARCHAR(50)); | What is the total number of safety incidents recorded in the past quarter for the chemical manufacturing plant in New Delhi? | SELECT COUNT(*) FROM safety_incidents WHERE plant_location = 'New Delhi' AND incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) GROUP BY incident_type HAVING COUNT(*) > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, city TEXT, rating FLOAT); INSERT INTO hotels (hotel_id, hotel_name, city, rating) VALUES (1, 'The Plaza', 'New York', 4.5), (2, 'The Bowery Hotel', 'New York', 4.2); | What is the average rating of hotels in 'New York'? | SELECT AVG(rating) FROM hotels WHERE city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (region VARCHAR(255), year INT, avg_temp FLOAT);CREATE TABLE greenhouse_gas_emissions (region VARCHAR(255), year INT, emissions FLOAT); | What is the correlation between temperature change and greenhouse gas emissions in North America from 2010 to 2020? | SELECT CORR(t.avg_temp, g.emissions) AS correlation FROM temperature_data t INNER JOIN greenhouse_gas_emissions g ON t.region = g.region AND t.year = g.year WHERE t.region = 'North America' AND t.year BETWEEN 2010 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, name VARCHAR(50), type VARCHAR(20)); INSERT INTO events (id, name, type) VALUES (1, 'Play 1', 'Theater'), (2, 'Dance Show', 'Dance'), (3, 'Workshop 1', 'Workshop'), (4, 'Play 2', 'Theater'); CREATE TABLE attendance (event_id INT, attendee_count INT); INSERT INTO attendance (event_id, attend... | List the names of performing arts events with more than 50 attendees, excluding workshops. | SELECT e.name FROM events e JOIN attendance a ON e.id = a.event_id WHERE e.type NOT IN ('Workshop') AND a.attendee_count > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_scholarships (scholarship_location VARCHAR(255), is_accessible BOOLEAN, community VARCHAR(255)); INSERT INTO tech_scholarships (scholarship_location, is_accessible, community) VALUES ('Germany', true, 'Minority Women'), ('France', false, 'Persons with Disabilities'), ('UK', true, 'Refugees'); | What is the percentage of accessible technology scholarships for underrepresented communities in Europe? | SELECT scholarship_location, COUNT(*) * 100.0 / SUM(COUNT(*)) OVER () as percentage_accessible FROM tech_scholarships WHERE scholarship_location LIKE 'Europe%' AND is_accessible = true AND community IN ('Minority Women', 'Persons with Disabilities', 'Refugees') GROUP BY scholarship_location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Highways (id INT, name TEXT, location TEXT, state TEXT, cost FLOAT); INSERT INTO Highways (id, name, location, state, cost) VALUES (1, 'Highway A', 'Location A', 'California', 10000000), (2, 'Highway B', 'Location B', 'New York', 12000000); | What is the sum of construction costs for highways in California? | SELECT SUM(cost) FROM Highways WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_sessions (user_id INT, video_id INT, watch_time INT, video_type VARCHAR(50)); CREATE VIEW educational_videos AS SELECT DISTINCT video_id FROM videos WHERE video_type = 'educational'; CREATE VIEW users_from_africa AS SELECT DISTINCT user_id FROM users WHERE country IN ('Nigeria', 'South Africa', 'Egypt... | Get the total watch time of educational videos for users from Africa. | SELECT SUM(watch_time) FROM user_sessions JOIN educational_videos ON user_sessions.video_id = educational_videos.video_id JOIN users_from_africa ON user_sessions.user_id = users_from_africa.user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Gender VARCHAR(10), ProBonoHours INT); INSERT INTO Attorneys (AttorneyID, Gender, ProBonoHours) VALUES (1, 'Male', 100), (2, 'Female', 120), (3, 'Non-binary', 80); | What is the maximum pro-bono work hours for attorneys who identify as male? | SELECT MAX(ProBonoHours) FROM Attorneys WHERE Gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects_funding (id INT, name TEXT, focus TEXT, funding_date DATE); INSERT INTO projects_funding (id, name, focus, funding_date) VALUES (1, 'Diverse Leadership Program', 'Diversity and Inclusion', '2022-03-15'), (2, 'Accessibility Initiative', 'Diversity and Inclusion', '2021-12-28'); | Identify the number of projects with a focus on diversity and inclusion that were funded in the last year. | SELECT COUNT(*) FROM projects_funding WHERE focus = 'Diversity and Inclusion' AND funding_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(50), location VARCHAR(50), ethical_rating FLOAT); CREATE TABLE products (id INT, name VARCHAR(50), supplier_id INT, quantity_sold INT); INSERT INTO suppliers (id, name, location, ethical_rating) VALUES (1, 'Supplier A', 'USA', 4.2); INSERT INTO suppliers (id, name, location,... | Who are the suppliers for Product Z and their ethical ratings? | SELECT s.name, s.ethical_rating FROM suppliers s JOIN products p ON s.id = p.supplier_id WHERE p.name = 'Product Z'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clothing_materials (material_id INTEGER, material TEXT, sustainable BOOLEAN, popularity INTEGER); INSERT INTO clothing_materials (material_id, material, sustainable, popularity) VALUES (1, 'cotton', TRUE, 250), (2, 'silk', FALSE, 150), (3, 'polyester', TRUE, 200), (4, 'wool', FALSE, 100); | What is the most popular sustainable material used in clothing? | SELECT material, MAX(popularity) AS max_popularity FROM clothing_materials WHERE sustainable = TRUE GROUP BY material ORDER BY max_popularity DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, menu_item_id INT, sales DECIMAL(5,2)); INSERT INTO sales (id, menu_item_id, sales) VALUES (1, 1, 100.00), (2, 1, 200.00), (3, 2, 50.00), (4, 3, 150.00), (5, 3, 250.00); CREATE TABLE menus (id INT, menu_item_name TEXT); INSERT INTO menus (id, menu_item_name) VALUES (1, 'Cheese Burger'), (2, '... | What is the total sales of all menu items that contain 'cheese' in their name? | SELECT SUM(sales) FROM sales JOIN menus ON sales.menu_item_id = menus.id WHERE menu_item_name LIKE '%cheese%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists irrigation_data (id INT PRIMARY KEY, farm_id INT, water_usage FLOAT, usage_date DATE); INSERT INTO irrigation_data (id, farm_id, water_usage, usage_date) VALUES (1, 1, 50.3, '2022-09-01'), (2, 2, 45.8, '2022-09-01'), (3, 3, 40.2, '2022-09-01'); CREATE TABLE if not exists recycled_water_usage ... | What is the average water demand and recycled water usage by sector? | SELECT rwu.sector, AVG(id.water_usage) as avg_water_demand, rwu.water_volume as recycled_water_volume FROM irrigation_data id JOIN recycled_water_usage rwu ON 1=1 GROUP BY rwu.sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (city VARCHAR(20), year INT, total_waste_gen FLOAT); INSERT INTO waste_generation (city, year, total_waste_gen) VALUES ('Seattle', 2019, 240000), ('Portland', 2019, 260000), ('San Francisco', 2019, 270000); | Which city generated the most waste in the year 2019? | SELECT city, MAX(total_waste_gen) FROM waste_generation GROUP BY year HAVING year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(50)); INSERT INTO ports (id, name) VALUES (1, 'Oakland'), (2, 'Los Angeles'); CREATE TABLE vessels (id INT, name VARCHAR(50), port_id INT, arrival_date DATE, num_containers INT); INSERT INTO vessels (id, name, port_id, arrival_date, num_containers) VALUES (1, 'Vessel1', 1, '2021... | What was the average number of containers carried by vessels that arrived at the port of Oakland in July 2021? | SELECT AVG(num_containers) as avg_containers FROM vessels WHERE port_id = 1 AND MONTH(arrival_date) = 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_safety (id INT PRIMARY KEY, restaurant_id INT, inspection_date DATE, score INT); | Insert a new record into the food_safety table with the following data: restaurant_id = 102, inspection_date = '2022-09-15', score = 88 | INSERT INTO food_safety (restaurant_id, inspection_date, score) VALUES (102, '2022-09-15', 88); | gretelai_synthetic_text_to_sql |
CREATE TABLE PoetryEvents (eventID INT, attendeeCount INT, eventLocation VARCHAR(50), eventDate DATE); INSERT INTO PoetryEvents (eventID, attendeeCount, eventLocation, eventDate) VALUES (1, 30, 'New York', '2021-02-03'), (2, 45, 'Chicago', '2021-04-10'), (3, 25, 'New York', '2021-07-15'); | What is the average number of attendees for poetry events in New York in 2021? | SELECT AVG(attendeeCount) FROM PoetryEvents WHERE eventLocation = 'New York' AND YEAR(eventDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(50), industry VARCHAR(50), founder_gender VARCHAR(10)); INSERT INTO companies VALUES (1, 'Acme Corp', 'Technology', 'Female'); INSERT INTO companies VALUES (2, 'Beta Inc', 'Retail', 'Male'); | Find the average funding amount for companies founded by women in the technology sector | SELECT AVG(funding_amount) FROM funds INNER JOIN companies ON funds.company_id = companies.id WHERE companies.founder_gender = 'Female' AND companies.industry = 'Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_types (id INT, incident_type VARCHAR(50), incidents INT, timestamp TIMESTAMP); INSERT INTO incident_types (id, incident_type, incidents, timestamp) VALUES (1, 'Phishing', 50, '2022-01-01 10:00:00'), (2, 'Malware', 75, '2022-01-02 12:00:00'); | What is the distribution of security incidents by type in the past month? | SELECT incident_type, SUM(incidents) as total_incidents FROM incident_types WHERE timestamp >= '2022-02-01' GROUP BY incident_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE esports_teams (id INT PRIMARY KEY, name TEXT, organization TEXT); | Delete all records from the esports_teams table where the organization is not 'Genesis' or 'Titan' | DELETE FROM esports_teams WHERE organization NOT IN ('Genesis', 'Titan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cape_town_water_consumption (id INT, date DATE, district VARCHAR(20), water_consumption FLOAT); INSERT INTO cape_town_water_consumption (id, date, district, water_consumption) VALUES (1, '2021-01-01', 'Atlantis', 1200.0), (2, '2021-01-02', 'Bishop Lavis', 1500.0); | What is the change in water consumption between consecutive months for each district in Cape Town? | SELECT district, LAG(water_consumption) OVER (PARTITION BY district ORDER BY date) - water_consumption FROM cape_town_water_consumption; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, Name TEXT); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationDate DATE, DonationAmount DECIMAL); | What is the total amount donated by each donor in the last 6 months? | SELECT D.Name as DonorName, SUM(DonationAmount) as TotalDonationLast6Months FROM Donors D INNER JOIN Donations Don ON D.DonorID = Don.DonorID WHERE DonationDate >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) GROUP BY D.DonorID, D.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, HasHeartRateMonitor BOOLEAN); CREATE TABLE Workouts (WorkoutID INT, MemberID INT, WorkoutDate DATE, Duration INT, WorkoutType VARCHAR(10)); | What is the average duration of yoga workouts for members with a heart rate monitor? | SELECT AVG(Duration) FROM (SELECT MemberID, Duration FROM Workouts INNER JOIN Members ON Workouts.MemberID = Members.MemberID WHERE Members.HasHeartRateMonitor = TRUE AND WorkoutType = 'yoga') AS Subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (initiative_id INT, year INT, individuals_impacted INT); INSERT INTO initiatives (initiative_id, year, individuals_impacted) VALUES (1, 2018, 4000), (2, 2019, 5000); CREATE TABLE locations (initiative_id INT, region VARCHAR(20)); INSERT INTO locations (initiative_id, region) VALUES (1, 'Asia'),... | How many individuals have been impacted by access to justice initiatives in Asia since 2018? | SELECT SUM(initiatives.individuals_impacted) FROM initiatives INNER JOIN locations ON initiatives.initiative_id = locations.initiative_id WHERE locations.region = 'Asia' AND initiatives.year >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (StudentID int, Name varchar(50)); INSERT INTO Students (StudentID, Name) VALUES (1, 'John Smith'); INSERT INTO Students (StudentID, Name) VALUES (2, 'Jane Doe'); CREATE TABLE Grants (GrantID int, StudentID int); INSERT INTO Grants (GrantID, StudentID) VALUES (1, 1); INSERT INTO Grants (GrantID, S... | Show the names of graduate students who have received research grants. | SELECT Students.Name FROM Students INNER JOIN Grants ON Students.StudentID = Grants.StudentID; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT PRIMARY KEY, location VARCHAR(100), type VARCHAR(100), passengers INT, year INT); | Create a table for storing public transportation usage data | CREATE TABLE public_transportation (id INT PRIMARY KEY, location VARCHAR(100), type VARCHAR(100), passengers INT, year INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, sector VARCHAR(20), ESG_rating FLOAT); INSERT INTO organizations (id, sector, ESG_rating) VALUES (1, 'Healthcare', 7.5), (2, 'Technology', 8.2), (3, 'Healthcare', 8.0); CREATE TABLE investments (id INT, organization_id INT); INSERT INTO investments (id, organization_id) VALUES (1, 1)... | Insert a new investment with organization ID 4 in the renewable energy sector with an ESG rating of 9.0 | INSERT INTO investments (id, organization_id) VALUES (4, (SELECT id FROM organizations WHERE sector = 'Renewable Energy' AND ESG_rating = 9.0)); -- Note: There are currently no organizations in the 'Renewable Energy' sector with an ESG rating of 9.0. This command will fail if such an organization doesn't exist. | gretelai_synthetic_text_to_sql |
CREATE TABLE Operations (id INT, name VARCHAR(50), year INT, continent VARCHAR(50)); INSERT INTO Operations (id, name, year, continent) VALUES (1, 'Operation Red', 2005, 'Asia'); INSERT INTO Operations (id, name, year, continent) VALUES (2, 'Operation Blue', 2008, 'Europe'); | What is the total number of intelligence operations conducted in 'Asia' in the 'Operations' table? | SELECT COUNT(*) FROM Operations WHERE continent = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_creators (id INT, name VARCHAR(50), country VARCHAR(50), views BIGINT); INSERT INTO content_creators (id, name, country, views) VALUES (1, 'Creator1', 'China', 10000000), (2, 'Creator2', 'Japan', 15000000), (3, 'Creator3', 'South Korea', 20000000), (4, 'Creator4', 'India', 8000000), (5, 'Creator5',... | Who are the top 5 content creators in Asia in terms of video views? | SELECT name, country, views FROM content_creators WHERE country = 'Asia' ORDER BY views DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(50), category VARCHAR(20)); INSERT INTO articles (id, title, category) VALUES (1, 'Article One', 'freedom of speech'), (2, 'Article Two', 'interviews'); CREATE TABLE readers (id INT, name VARCHAR(20), age INT, favorite_category VARCHAR(20)); INSERT INTO readers (id, name, ag... | What is the total number of articles on 'freedom of speech' and 'interviews', and the average age of readers who prefer news on those categories? | SELECT SUM(total_articles) AS total_articles, AVG(average_age) AS average_age FROM (SELECT COUNT(*) AS total_articles FROM articles WHERE category IN ('freedom of speech', 'interviews') GROUP BY category) AS subquery1 CROSS JOIN (SELECT AVG(age) AS average_age FROM readers WHERE favorite_category IN ('freedom of speech... | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_accidents (id INT, location TEXT, timestamp TIMESTAMP); INSERT INTO mining_accidents (id, location, timestamp) VALUES (1, 'Witwatersrand Gold Fields', '2019-01-01 12:00:00'); | How many mining accidents were reported in the African continent in the last 3 years? | SELECT COUNT(*) FROM mining_accidents WHERE EXTRACT(YEAR FROM timestamp) >= EXTRACT(YEAR FROM CURRENT_DATE) - 3 AND location LIKE 'Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_materials (id INT, garment_type VARCHAR(255), production_cost DECIMAL(10,2)); | What is the average production cost of garments in the 'ethical_materials' table? | SELECT AVG(production_cost) FROM ethical_materials; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather (country VARCHAR(255), region VARCHAR(255), month INT, precipitation FLOAT); INSERT INTO weather (country, region, month, precipitation) VALUES ('India', 'Western Ghats', 9, 350.5), ('India', 'Western Ghats', 9, 360.2), ('India', 'Western Ghats', 9, 340.8), ('India', 'Western Ghats', 9, 355.9); | What is the average precipitation in India's Western Ghats in September? | SELECT AVG(precipitation) FROM weather WHERE country = 'India' AND region = 'Western Ghats' AND month = 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), nightly_rate FLOAT, num_nights INT); | What is the average revenue per night for sustainable accommodations? | SELECT AVG(nightly_rate * num_nights) FROM accommodations WHERE type = 'Sustainable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (production_id INT, well_id INT, production_date DATE, production_type TEXT, production_volume INT); INSERT INTO production (production_id, well_id, production_date, production_type, production_volume) VALUES (1, 1, '2018-01-01', 'Oil', 100), (2, 1, '2018-01-02', 'Gas', 50), (3, 2, '2019-05-03',... | Calculate the total production volume for each country, for the 'Gas' production type. | SELECT wells.country, SUM(production.production_volume) as total_gas_production FROM production INNER JOIN wells ON production.well_id = wells.well_id WHERE production.production_type = 'Gas' GROUP BY wells.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (id INT PRIMARY KEY, student_id INT, accommodation_type VARCHAR(255), university VARCHAR(255), date DATE); CREATE VIEW student_visual_impairment AS SELECT student_id FROM students WHERE disability = 'visual impairment'; | How many accommodations were made for students with visual impairments in the past year across all universities? | SELECT COUNT(*) FROM accommodations JOIN student_visual_impairment ON accommodations.student_id = student_visual_impairment.student_id WHERE date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE species (name VARCHAR(255), region VARCHAR(255), endangered BOOLEAN); INSERT INTO species (name, region, endangered) VALUES ('lion', 'africa', TRUE); INSERT INTO species (name, region, endangered) VALUES ('giraffe', 'africa', FALSE); | How many endangered species are there in 'africa'? | SELECT COUNT(*) FROM species WHERE region = 'africa' AND endangered = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_vehicles (id INT, vehicle_model VARCHAR(50), price FLOAT); INSERT INTO autonomous_vehicles (id, vehicle_model, price) VALUES (1, 'Wayve Pod', 150000), (2, 'Nuro R2', 120000), (3, 'Zoox', 180000), (4, 'Aptiv', 160000), (5, 'Baidu Apollo', 140000); | List the number of unique autonomous vehicle models and their average price in the vehicle_sales table. | SELECT COUNT(DISTINCT vehicle_model) AS unique_models, AVG(price) AS average_price FROM autonomous_vehicles; | gretelai_synthetic_text_to_sql |
CREATE TABLE cb_agreements (id INT, union_id INT, employer_id INT, sign_date DATE); INSERT INTO cb_agreements (id, union_id, employer_id, sign_date) VALUES (1, 1, 1, '2019-12-31'); INSERT INTO cb_agreements (id, union_id, employer_id, sign_date) VALUES (2, 2, 2, '2020-03-15'); INSERT INTO cb_agreements (id, union_id, e... | How many collective bargaining agreements were signed in the year 2020? | SELECT COUNT(*) FROM cb_agreements WHERE EXTRACT(YEAR FROM sign_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselTypes (id INT, vessel_type VARCHAR(50)); CREATE TABLE IncidentLog (id INT, vessel_id INT, incident_type VARCHAR(50), time TIMESTAMP); | Count the number of incidents for each vessel type | SELECT vt.vessel_type, COUNT(il.id) FROM VesselTypes vt JOIN IncidentLog il ON vt.id = il.vessel_id GROUP BY vt.vessel_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_data (id INT, company_id INT, num_employees INT); INSERT INTO company_data (id, company_id, num_employees) VALUES (1, 1, 100); INSERT INTO company_data (id, company_id, num_employees) VALUES (2, 2, 50); | What is the average number of employees for startups with a female founder in the biotech industry? | SELECT AVG(num_employees) FROM company_data INNER JOIN company ON company_data.company_id = company.id WHERE company.founder_gender = 'female' AND company.industry = 'biotech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE member_registration (member_id INT, registration_date DATE); INSERT INTO member_registration VALUES (5,'2022-02-01'); INSERT INTO member_registration VALUES (6,'2022-02-03'); CREATE TABLE workouts (workout_id INT, member_id INT, date DATE); INSERT INTO workouts VALUES (3,5,'2022-02-05'); | Which members have not attended any workout in the past month? | SELECT member_registration.member_id FROM member_registration LEFT JOIN workouts ON member_registration.member_id = workouts.member_id AND workouts.date >= DATEADD(month, -1, GETDATE()) WHERE workouts.workout_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE ForestCarbonSeq(forest_name TEXT, carbon_seq_rate REAL, region TEXT); INSERT INTO ForestCarbonSeq (forest_name, carbon_seq_rate, region) VALUES ('Forest 1', 5.6, 'Region C'), ('Forest 2', 6.3, 'Region D'), ('Forest 3', 4.8, 'Region C'); | List the carbon sequestration rates for all forests in 'Region C'. | SELECT carbon_seq_rate FROM ForestCarbonSeq WHERE region = 'Region C'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, city TEXT, ai_adoption BOOLEAN); INSERT INTO hotels (hotel_id, city, ai_adoption) VALUES (1, 'Paris', TRUE), (2, 'London', FALSE), (3, 'Paris', TRUE); | What is the number of hotels in each city that have adopted AI technology? | SELECT city, COUNT(CASE WHEN ai_adoption = TRUE THEN 1 END) AS num_ai_hotels FROM hotels GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE alaska_oklahoma_wells (state VARCHAR(2), num_wells INT); INSERT INTO alaska_oklahoma_wells (state, num_wells) VALUES ('AK', 500), ('OK', 900); | Show the number of wells drilled in Alaska and Oklahoma | SELECT state, num_wells FROM alaska_oklahoma_wells; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (faculty_id INT, faculty_name VARCHAR(255), faculty_gender VARCHAR(255), faculty_department VARCHAR(255), faculty_status VARCHAR(255)); CREATE TABLE research_grants (grant_id INT, faculty_id INT, grant_amount DECIMAL(10,2), grant_start_date DATE, grant_end_date DATE); | Identify the top 2 most productive departments in terms of research grants for LGBTQ+ and disabled faculty in the past 2 years. | SELECT f.faculty_department, COUNT(*) AS cnt FROM faculty f INNER JOIN research_grants rg ON f.faculty_id = rg.faculty_id WHERE (f.faculty_gender = 'Transgender' OR f.faculty_status = 'Disabled') AND rg.grant_start_date >= DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR) GROUP BY f.faculty_department ORDER BY cnt DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE researcher (id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(30), funding FLOAT); INSERT INTO researcher (id, name, gender, department, funding) VALUES (1, 'Alice', 'Female', 'Computer Science', 150000.00), (2, 'Bob', 'Male', 'Computer Science', 200000.00); | What is the total funding received by female researchers in the Computer Science department since 2018? | SELECT SUM(funding) FROM researcher WHERE gender = 'Female' AND department = 'Computer Science' AND YEAR(grant_date) >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name VARCHAR(50), sector VARCHAR(50), total_funding FLOAT, location VARCHAR(50));INSERT INTO startups (id, name, sector, total_funding, location) VALUES (1, 'StartupC', 'Genetics', 30000000, 'Singapore');INSERT INTO startups (id, name, sector, total_funding, location) VALUES (2, 'StartupD'... | What is the maximum funding received by a biotech startup in Asia? | SELECT MAX(total_funding) FROM startups WHERE sector = 'Bioprocess' AND location LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_transparency (product_id INT, product_name VARCHAR(50), circular_supply_chain BOOLEAN, recycled_content DECIMAL(4,2), COUNTRY VARCHAR(50)); | Get the 'product_name' and 'recycled_content' for 'product_transparency' records with the highest 'recycled_content'. | SELECT product_name, recycled_content FROM product_transparency WHERE recycled_content = (SELECT MAX(recycled_content) FROM product_transparency); | gretelai_synthetic_text_to_sql |
CREATE TABLE CircularEconomy (id INT, initiative VARCHAR(20), waste_generation_rate FLOAT); INSERT INTO CircularEconomy (id, initiative, waste_generation_rate) VALUES (1, 'Composting', 0.5), (2, 'Recycling', 0.8); | What is the total waste generation rate in the circular economy initiatives? | SELECT SUM(waste_generation_rate) FROM CircularEconomy; | gretelai_synthetic_text_to_sql |
CREATE TABLE contractors (id INT, name VARCHAR(255), region VARCHAR(255), training_hours INT); INSERT INTO contractors (id, name, region, training_hours) VALUES (1, 'John Doe', 'Middle East', 40), (2, 'Jane Smith', 'Europe', 30), (3, 'Alice Johnson', 'Middle East', 50); | What is the average number of training hours per contractor in the Middle East region? | SELECT AVG(training_hours) as avg_training_hours FROM contractors WHERE region = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Arctic_Ocean_Mammals (mammal_name TEXT, endangered BOOLEAN); INSERT INTO Arctic_Ocean_Mammals (mammal_name, endangered) VALUES ('Beluga Whale', TRUE), ('Narwhal', FALSE), ('Polar Bear', TRUE); | How many marine mammal species are endangered in the Arctic Ocean? | SELECT COUNT(*) FROM Arctic_Ocean_Mammals WHERE endangered = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, age INT, state VARCHAR(255), BMI DECIMAL(5,2), diabetes BOOLEAN); INSERT INTO patients VALUES (1, 35, 'Illinois', 25.5, TRUE); INSERT INTO patients VALUES (2, 42, 'Illinois', 22.2, FALSE); | What is the average BMI of patients with diabetes in Illinois? | SELECT AVG(patients.BMI) FROM patients WHERE patients.state = 'Illinois' AND patients.diabetes = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE defendants (id INT, name VARCHAR(50), case_id INT); CREATE TABLE cases (id INT, case_number VARCHAR(20), case_type VARCHAR(20), court_id INT); INSERT INTO cases (id, case_number, case_type, court_id) VALUES (1, '123456', 'civil', 1); INSERT INTO cases (id, case_number, case_type, court_id) VALUES (2, '6543... | Insert a new record in the "defendants" table with the name "John Smith" for the case with id 1 | INSERT INTO defendants (id, name, case_id) VALUES (1, 'John Smith', 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_scores (student_id INT, grade INT, mental_health_score INT); INSERT INTO mental_health_scores (student_id, grade, mental_health_score) VALUES (1, 5, 80), (2, 5, 85), (3, 6, 70), (4, 6, 75), (5, 7, 80), (6, 7, 85); | What is the difference in mental health scores between students in grade 5 and grade 7? | SELECT grade, mental_health_score, CASE WHEN grade = 5 THEN mental_health_score - LAG(mental_health_score, 2) OVER (ORDER BY grade) ELSE mental_health_score - LEAD(mental_health_score, -2) OVER (ORDER BY grade) END AS score_difference FROM mental_health_scores; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, Region VARCHAR(50)); CREATE TABLE Donations (DonationID INT, DonorID INT, Cause VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO Donors (DonorID, Region) VALUES (1, 'North America'), (2, 'South America'), (3, 'North America'), (4, 'Europe'), (5, 'Asia'); INSERT INTO Donations (DonationI... | Which causes received donations from donors in a specific region? | SELECT Cause FROM Donations D JOIN Donors R ON D.DonorID = R.DonorID WHERE R.Region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, name TEXT); INSERT INTO departments (id, name) VALUES (1, 'Computer Science'); CREATE TABLE grants (id INT, department_id INT, amount INT); INSERT INTO grants (id, department_id, amount) VALUES (1, 1, 500000); | What is the total research grant amount awarded to the 'Computer Science' department? | SELECT SUM(amount) FROM grants WHERE department_id = (SELECT id FROM departments WHERE name = 'Computer Science'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cyber_strategies_risk (id INT, strategy VARCHAR, risk VARCHAR); INSERT INTO cyber_strategies_risk (id, strategy, risk) VALUES (1, 'Operation Iron Curtain', 'Medium'), (2, 'Operation Glass Shield', 'High'), (3, 'Operation Cyber Guardian', 'Low'); | List the cybersecurity strategies and their corresponding risk levels, and determine the maximum risk level. | SELECT strategy, risk, MAX(CASE WHEN risk = 'High' THEN 1 ELSE 0 END) OVER () as max_risk FROM cyber_strategies_risk; | gretelai_synthetic_text_to_sql |
CREATE TABLE LandfillCapacity (year INT, capacity INT); INSERT INTO LandfillCapacity (year, capacity) VALUES (2018, 10000), (2019, 11000), (2020, 11500), (2021, 12000), (2022, NULL); | What is the landfill capacity in megatons for 2022? | SELECT capacity FROM LandfillCapacity WHERE year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure_projects (id INT, name TEXT, location TEXT); INSERT INTO infrastructure_projects (id, name, location) VALUES (1, 'Brooklyn Bridge', 'USA'); INSERT INTO infrastructure_projects (id, name, location) VALUES (2, 'Chunnel', 'UK'); INSERT INTO infrastructure_projects (id, name, location) VALUES (3... | Delete all projects in the USA | DELETE FROM infrastructure_projects WHERE location = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGameData (PlayerID INT, Age INT, Game VARCHAR(20), Playtime INT); INSERT INTO PlayerGameData (PlayerID, Age, Game, Playtime) VALUES (1, 22, 'Shooter', 30), (2, 25, 'Shooter', 50), (3, 28, 'Racing', 70), (4, 20, 'Racing', 60); | What is the maximum playtime for players who have played the game 'Racing' and are younger than 25? | SELECT MAX(Playtime) FROM PlayerGameData WHERE Game = 'Racing' AND Age < 25; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials(trial_name TEXT, status TEXT, start_date DATE); INSERT INTO clinical_trials(trial_name, status, start_date) VALUES('Trial1', 'Completed', '2018-05-01'), ('Trial2', 'Recruiting', '2019-07-15'), ('Trial3', 'Completed', '2020-12-20'), ('Trial4', 'Planned', '2021-04-05'); | List the clinical trials with a status of 'Completed' and their respective start dates. | SELECT trial_name, start_date FROM clinical_trials WHERE status = 'Completed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (id INT, site VARCHAR(50), year INT, co2_emission FLOAT); | What is the total CO2 emission in the 'emissions' table? | SELECT SUM(co2_emission) FROM emissions; | gretelai_synthetic_text_to_sql |
CREATE TABLE exploration_data (well_name VARCHAR(255), exploratory_method VARCHAR(255), discovery_date DATE); INSERT INTO exploration_data (well_name, exploratory_method, discovery_date) VALUES ('Well A', '2D Seismic', '2017-02-14'); INSERT INTO exploration_data (well_name, exploratory_method, discovery_date) VALUES ('... | Which exploratory methods were used the most in 2017? | SELECT exploratory_method, COUNT(*) as method_count FROM exploration_data WHERE EXTRACT(YEAR FROM discovery_date) = 2017 GROUP BY exploratory_method ORDER BY method_count DESC | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditure(trial_id TEXT, country TEXT, year INT, amount FLOAT); INSERT INTO rd_expenditure (trial_id, country, year, amount) VALUES ('Trial1', 'CountryX', 2021, 2500000), ('Trial2', 'CountryY', 2022, 3000000), ('Trial3', 'CountryZ', 2022, 3500000); | What is the maximum R&D expenditure for trials in 'CountryZ' in 2022? | SELECT MAX(amount) FROM rd_expenditure WHERE country = 'CountryZ' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, faculty_name TEXT, faculty_gender TEXT, faculty_field TEXT); INSERT INTO faculty (id, faculty_name, faculty_gender, faculty_field) VALUES (1, 'Eliot', 'M', 'Physics'); INSERT INTO faculty (id, faculty_name, faculty_gender, faculty_field) VALUES (2, 'Fiona', 'F', 'Math'); INSERT INTO facult... | How many female faculty members work in STEM fields? | SELECT faculty_gender, COUNT(*) FROM faculty WHERE faculty_field IN ('Physics', 'Math', 'Computer Science', 'Engineering') GROUP BY faculty_gender HAVING faculty_gender = 'F' | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_initiatives (initiative_id INT, state VARCHAR(20), launch_date DATE); INSERT INTO conservation_initiatives (initiative_id, state, launch_date) VALUES (1, 'Texas', '2021-05-01'), (2, 'Texas', '2021-06-01'), (3, 'California', '2021-04-01'); | How many water conservation initiatives were launched in the state of Texas in the past 6 months? | SELECT COUNT(*) FROM conservation_initiatives WHERE state = 'Texas' AND launch_date > DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (Year INT, Service VARCHAR(20), Region VARCHAR(20), Amount DECIMAL(10,2)); INSERT INTO Budget (Year, Service, Region, Amount) VALUES (2020, 'Healthcare', 'Northeast', 50000.00), (2020, 'Healthcare', 'Southeast', 60000.00), (2020, 'Education', 'Northeast', 45000.00); | What is the total budget allocated for education and healthcare services in 2020 across all regions? | SELECT SUM(Amount) FROM Budget WHERE Year = 2020 AND (Service = 'Healthcare' OR Service = 'Education'); | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT PRIMARY KEY, name VARCHAR(100), donation_date DATE, amount DECIMAL(10,2), country VARCHAR(50)); | Delete a donor from the "funding" table based in Germany | DELETE FROM funding WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, EventDate DATE, EventAttendance INT, Community VARCHAR(20)); INSERT INTO Events (EventID, EventDate, EventAttendance, Community) VALUES (1, '2022-03-12', 120, 'LGBTQ+'), (2, '2022-04-20', 80, 'Women'), (3, '2022-05-15', 150, 'LGBTQ+'), (4, '2022-01-01', 30, 'Men'), (5, '2022-06-10', 45... | How many events attracted over 100 attendees from the LGBTQ+ community in 2022? | SELECT COUNT(*) FROM Events WHERE EventAttendance > 100 AND Community = 'LGBTQ+'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.experiments (id INT, experiment_name VARCHAR(255), temperature_delta INT); INSERT INTO genetics.experiments (id, experiment_name, temperature_delta) VALUES (1, 'CRISPR-Cas9', 15), (2, 'Gene Editing', 22), (3, 'Genetic Fusion', 18); | What is the average temperature for each genetic research experiment? | SELECT experiment_name, AVG(temperature_delta) avg_temperature FROM genetics.experiments GROUP BY experiment_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinic_info (clinic_id INT, state VARCHAR(2), phone_number VARCHAR(15)); INSERT INTO clinic_info (clinic_id, state, phone_number) VALUES (1, 'Montana', '123-456-7890'), (2, 'Montana', '987-654-3210'), (3, 'Wyoming', '555-555-5555'); CREATE TABLE mental_health_services (service_id INT, clinic_id INT); INSER... | Update the phone number for clinics that provide mental health services in Montana. | UPDATE clinic_info SET phone_number = '000-000-0000' WHERE clinic_id IN (SELECT clinic_id FROM mental_health_services); | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, term VARCHAR(10), mental_health_score INT); INSERT INTO student_mental_health (student_id, term, mental_health_score) VALUES (1, 'Fall 2021', 75), (2, 'Fall 2021', 80); | What is the average mental health score of students in 'Fall 2021' term? | SELECT AVG(mental_health_score) FROM student_mental_health WHERE term = 'Fall 2021'; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS startups(id INT, name TEXT, founder_race TEXT, total_funding FLOAT); INSERT INTO startups (id, name, founder_race, total_funding) VALUES (1, 'Cladwell', 'Latinx', 5000000); INSERT INTO startups (id, name, founder_race, total_funding) VALUES (2, 'Propel', 'African American', 12000000); INSERT ... | What is the average total funding for startups founded by Latinx individuals in the fintech sector? | SELECT AVG(total_funding) FROM startups WHERE founder_race = 'Latinx' AND industry = 'Fintech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(20), hours_played INT); INSERT INTO players (id, name, hours_played) VALUES (1, 'David', 100), (2, 'Eve', 50), (3, 'Frank', 150), (4, 'Grace', 120), (5, 'Harrison', 80); CREATE TABLE game_genres (id INT, genre VARCHAR(20)); INSERT INTO game_genres (id, genre) VALUES (1, 'FPS')... | What is the total number of hours played by all players for each game genre, excluding strategy games? | SELECT game_genres.genre, SUM(players.hours_played) AS total_hours FROM players INNER JOIN game_sessions ON players.id = game_sessions.player_id INNER JOIN game_genres ON game_sessions.game_genre_id = game_genres.id WHERE game_genres.genre NOT IN ('Strategy') GROUP BY game_genres.genre; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS carbon_offsets; CREATE TABLE IF NOT EXISTS carbon_offsets.carbon_offsets ( offset_id INT NOT NULL, country_code VARCHAR(2) NOT NULL, co2_emissions_reduction FLOAT NOT NULL, PRIMARY KEY (offset_id)); | Calculate the average CO2 emissions reduction per carbon offset project in the carbon_offsets table. | SELECT AVG(co2_emissions_reduction) FROM carbon_offsets.carbon_offsets; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), salary DECIMAL(10,2), gender VARCHAR(10)); INSERT INTO employees (id, name, department, salary, gender) VALUES (1, 'John Doe', 'Software Engineer', 150000.00, 'Male'), (2, 'Jane Smith', 'Data Analyst', 120000.00, 'Female'), (3, 'Bob Brown', 'Soft... | What is the average salary of engineers in the "tech_company" database by gender? | SELECT department, AVG(salary), gender FROM employees WHERE department = 'Software Engineer' GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (building_id INT, location TEXT, certification_level TEXT); INSERT INTO green_buildings (building_id, location, certification_level) VALUES (1, 'Los Angeles', 'Gold'), (2, 'Chicago', 'Platinum'), (3, 'Houston', 'Silver'), (4, 'Dallas', 'Gold'), (5, 'Miami', 'Silver'); | How many green buildings in the 'green_buildings' table have a 'Silver' certification level? | SELECT COUNT(*) FROM green_buildings WHERE certification_level = 'Silver'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name TEXT, location TEXT); INSERT INTO factories (factory_id, name, location) VALUES (1, 'Factory A', 'New York'), (2, 'Factory B', 'Los Angeles'); CREATE TABLE productions (factory_id INT, chemical TEXT); INSERT INTO productions (factory_id, chemical) VALUES (1, 'Chemical A'), (... | What are the names and locations of all factories that produce chemical A? | SELECT f.name, f.location FROM factories f JOIN productions p ON f.factory_id = p.factory_id WHERE p.chemical = 'Chemical A'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensors;CREATE TABLE if not exists biosensors.patents (id INT, technology VARCHAR(50), company VARCHAR(100), filing_date DATE);INSERT INTO biosensors.patents (id, technology, company, filing_date) VALUES (1, 'Bioelectric', 'CompanyA', '2018-03-15'), (2, 'Optical', 'CompanyB', '2019-08-01'... | Which biosensor technology has the most patents filed in the last 5 years? | SELECT technology, COUNT(*) as patent_count FROM biosensors.patents WHERE filing_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) GROUP BY technology ORDER BY patent_count DESC LIMIT 1; | 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.