context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE VIEW hotel_revenue_by_month AS SELECT h.hotel_id, h.hotel_name, DATE_TRUNC('month', r.date) AS month, SUM(r.revenue) AS total_revenue FROM hotels h JOIN revenue r ON h.hotel_id = r.hotel_id GROUP BY h.hotel_id, month; | What is the total revenue for each hotel in the hotel_revenue_by_month view for January? | SELECT hotel_name, SUM(total_revenue) FROM hotel_revenue_by_month WHERE month = '2023-01-01'::DATE GROUP BY hotel_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (id INT, dye VARCHAR(20), co2_reduction INT); INSERT INTO emissions (id, dye, co2_reduction) VALUES (1, 'Eco-Friendly Dye', 15), (2, 'Natural Dye', 20), (3, 'Eco-Friendly Dye', 10); | What is the average CO2 emission reduction for products made with eco-friendly dyes? | SELECT AVG(co2_reduction) FROM emissions WHERE dye = 'Eco-Friendly Dye'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FemaleStartups(id INT, name TEXT, country TEXT, founding_year INT, funding_amount INT); INSERT INTO FemaleStartups VALUES (1, 'FemTech', 'USA', 2018, 8000000), (2, 'GreenCity', 'Canada', 2019, 9000000), (3, 'AI-Health', 'UK', 2020, 7000000), (4, 'SolarEnergy', 'Australia', 2017, 6000000), (5, 'DataAnalyt... | List the top 5 countries with the highest total funding for female-led startups in the past 5 years. | SELECT country, SUM(funding_amount) AS total_funding FROM FemaleStartups WHERE founding_year >= YEAR(CURRENT_DATE) - 5 GROUP BY country ORDER BY total_funding DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, country VARCHAR(50), standard VARCHAR(50)); INSERT INTO projects (id, country, standard) VALUES (1, 'Germany', 'DIN 18008'), (2, 'Germany', 'DIN EN 1992-1-1'); | Which engineering design standards were used in projects located in Germany? | SELECT DISTINCT standard FROM projects WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_development (project VARCHAR(255), location VARCHAR(255), year INT, budget FLOAT); INSERT INTO rural_development (project, location, year, budget) VALUES ('RICE FOR PROGRESS', 'Niger', 2018, 2000000), ('RICE FOR PROGRESS', 'Niger', 2019, 2200000), ('AGRI-INNOVATE 1.0', 'Niger', 2020, 2500000); | Delete all records from the 'rural_development' table related to the 'RICE FOR PROGRESS' project. | DELETE FROM rural_development WHERE project = 'RICE FOR PROGRESS'; | gretelai_synthetic_text_to_sql |
CREATE TABLE IndigoCorpSales(id INT, contractor VARCHAR(255), region VARCHAR(255), equipment VARCHAR(255), quantity INT);INSERT INTO IndigoCorpSales(id, contractor, region, equipment, quantity) VALUES (1, 'Indigo Corp', 'South America', 'Communication Systems', 120); | Delete the record for the sale of 'Communication Systems' by 'Indigo Corp' to 'South America' if the sale quantity is greater than 150. | DELETE FROM IndigoCorpSales WHERE contractor = 'Indigo Corp' AND region = 'South America' AND equipment = 'Communication Systems' AND quantity > 150; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_platform (id INT, artist VARCHAR(100), genre VARCHAR(50), streams INT); | Who are the top 3 artists by number of streams in the hip-hop genre on the music streaming platform? | SELECT artist, SUM(streams) as total_streams FROM music_platform WHERE genre = 'hip-hop' GROUP BY artist ORDER BY total_streams DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE colombian_departments (id INT, name VARCHAR(50)); CREATE TABLE bolivian_departments (id INT, name VARCHAR(50)); CREATE TABLE mining_operations (id INT, country_id INT, region VARCHAR(20)); CREATE TABLE employees (id INT, operation_id INT, gender VARCHAR(10), ethnicity VARCHAR(20)); INSERT INTO colombian_de... | List all mining operations in Colombia and Bolivia, along with their workforce diversity data? | SELECT m.id, m.region, e.gender, e.ethnicity FROM mining_operations m INNER JOIN employees e ON m.id = e.operation_id INNER JOIN (SELECT * FROM colombian_departments WHERE name IN ('Antioquia', 'Cundinamarca') UNION ALL SELECT * FROM bolivian_departments WHERE name IN ('La Paz', 'Potosí')) c ON m.country_id = c.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_speeds ( id INT, vessel_id INT, vessel_type VARCHAR(255), speed FLOAT, latitude FLOAT, longitude FLOAT ); INSERT INTO vessel_speeds (id, vessel_id, vessel_type, speed, latitude, longitude) VALUES (1, 6, 'Icebreaker', 12.5, 80.45, -40.33); INSERT INTO vessel_speeds (id, vessel_id, vessel_type, speed,... | What is the maximum speed recorded for each vessel type in the Arctic region? | SELECT vessel_type, MAX(speed) as max_speed FROM vessel_speeds WHERE latitude BETWEEN 60 AND 90 AND (longitude BETWEEN -180 AND -60 OR longitude BETWEEN 0 AND 180) GROUP BY vessel_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50));CREATE TABLE games (game_id INT, home_team_id INT, away_team_id INT, price DECIMAL(5,2)); INSERT INTO teams (team_id, team_name) VALUES (1, 'TeamA'), (2, 'TeamB'); INSERT INTO games (game_id, home_team_id, away_team_id, price) VALUES (1, 1, 2, 50.00), (2, 2, 1, 45... | What was the average ticket price for each team's home games in the last season? | SELECT ht.team_name, AVG(g.price) as avg_price FROM games g JOIN teams ht ON g.home_team_id = ht.team_id GROUP BY ht.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop_yields (id INT, farmer_name VARCHAR(255), crop_name VARCHAR(255), yield INT, region VARCHAR(255)); INSERT INTO crop_yields (id, farmer_name, crop_name, yield, region) VALUES (1, 'Moses Owino', 'Cassava', 800, 'Africa'); INSERT INTO crop_yields (id, farmer_name, crop_name, yield, region) VALUES (2, 'Gr... | Who are the farmers in Asia with the highest yield of rice? | SELECT farmer_name, SUM(yield) as total_rice_yield FROM crop_yields WHERE crop_name = 'Rice' AND region = 'Asia' GROUP BY farmer_name ORDER BY total_rice_yield DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (id INT, name VARCHAR(50), sector VARCHAR(10));CREATE TABLE Households (id INT, program_id INT, energy_savings FLOAT); | Identify energy efficiency programs and the number of participating households from the Programs and Households tables | SELECT p.name, COUNT(h.id) as num_households FROM Programs p INNER JOIN Households h ON p.id = h.program_id WHERE p.sector = 'efficiency' GROUP BY p.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Faculty (FacultyID INT, Name VARCHAR(50), Department VARCHAR(50), Gender VARCHAR(10)); INSERT INTO Faculty (FacultyID, Name, Department, Gender) VALUES (1, 'Eve', 'Biology', 'Female'); INSERT INTO Faculty (FacultyID, Name, Department, Gender) VALUES (2, 'Frank', 'Physics', 'Male'); INSERT INTO Faculty (Fac... | Which departments have more than one female faculty member? | SELECT Department FROM Faculty WHERE Gender = 'Female' GROUP BY Department HAVING COUNT(*) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_scores (player_id INT, game_id INT, score INT, PRIMARY KEY (player_id, game_id)); INSERT INTO player_scores VALUES (1, 1, 1000), (1, 2, 800), (2, 1, 1200), (2, 2, 900), (3, 1, 700), (3, 2, 1100); CREATE TABLE game_titles (game_id INT, title VARCHAR(50), PRIMARY KEY (game_id)); INSERT INTO game_title... | Retrieve all the players who achieved a higher score in 'Rocket League' than in 'Mario Kart 8' | SELECT p.player_id FROM player_scores p1 INNER JOIN player_scores p2 ON p1.player_id = p2.player_id INNER JOIN game_titles g1 ON p1.game_id = g1.game_id INNER JOIN game_titles g2 ON p2.game_id = g2.game_id WHERE g1.title = 'Rocket League' AND g2.title = 'Mario Kart 8' AND p1.score > p2.score; | gretelai_synthetic_text_to_sql |
CREATE TABLE WorkoutTypes (Id INT PRIMARY KEY, WorkoutType VARCHAR(50)); | Insert new records of 2 workout types into the "WorkoutTypes" table | INSERT INTO WorkoutTypes (Id, WorkoutType) VALUES (7, 'Yoga'), (8, 'Zumba'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_sales (sale_id INT, vehicle_make VARCHAR(20), sale_quarter DATE); INSERT INTO vehicle_sales (sale_id, vehicle_make, sale_quarter) VALUES (1, 'Tesla', '2022-01-01'), (2, 'Tesla', '2022-04-01'), (3, 'Rivian', '2022-02-01'), (4, 'Fisker', '2022-03-01'), (5, 'Fisker', '2022-06-01'), (6, 'Lucid', '2022-... | What is the total number of electric vehicles sold by each manufacturer, ordered by the total sales? | SELECT vehicle_make, COUNT(*) total_sales FROM vehicle_sales GROUP BY vehicle_make ORDER BY total_sales DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transport_systems (system_name VARCHAR(255), num_vehicles INT); INSERT INTO public_transport_systems (system_name, num_vehicles) VALUES ('NYC Subway', 6000), ('London Tube', 4000), ('Tokyo Metro', 3500), ('Paris Metro', 2500), ('Berlin U-Bahn', 1800); | List all public transportation systems with more than 1000 vehicles in the 'public_transport' schema. | SELECT system_name FROM public_transport_systems WHERE num_vehicles > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers(worker_id INT, name TEXT, salary DECIMAL, program TEXT); | What is the average salary of workers in the workforce development program? | SELECT AVG(salary) as avg_salary FROM workers WHERE program = 'workforce development'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_name TEXT, sales_q1 INT, sales_q2 INT, sales_q3 INT, sales_q4 INT); INSERT INTO drugs (drug_name, sales_q1, sales_q2, sales_q3, sales_q4) VALUES ('DrugA', 1200, 1500, 1700, 2000), ('DrugB', 1800, 2000, 2200, 2500); | What are the total sales figures for each drug in the 'drugs' table? | SELECT drug_name, SUM(sales_q1 + sales_q2 + sales_q3 + sales_q4) as total_sales FROM drugs GROUP BY drug_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, site_name TEXT, num_employees INT);CREATE TABLE employees (id INT, site_id INT, gender TEXT); | How many employees of each gender work at each mining site? | SELECT s.site_name, e.gender, COUNT(*) as total FROM employees e JOIN mining_sites s ON e.site_id = s.id GROUP BY s.site_name, e.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_initiatives (id INT, city VARCHAR(20), launch_year INT); INSERT INTO carbon_offset_initiatives (id, city, launch_year) VALUES (1, 'Toronto', 2018), (2, 'Toronto', 2019), (3, 'Montreal', 2020), (4, 'Toronto', 2020); | How many carbon offset initiatives were launched in the city of Toronto in the year 2020? | SELECT COUNT(*) FROM carbon_offset_initiatives WHERE city = 'Toronto' AND launch_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidification (location TEXT, acidity FLOAT); INSERT INTO ocean_acidification (location, acidity) VALUES ('Caribbean Sea', 8.2), ('Pacific Ocean', 8.1), ('Atlantic Ocean', 8.0), ('Arctic Ocean', 8.4); | Delete all records in the ocean_acidification table where the acidity level is greater than 8.3 | DELETE FROM ocean_acidification WHERE acidity > 8.3; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensor; USE biosensor; CREATE TABLE if not exists genes_analyzed (gene_name VARCHAR(255)); INSERT INTO genes_analyzed (gene_name) VALUES ('ABC'), ('DEF'), ('GHI'), ('JKL'), ('MNO'), ('PQR'), ('STU'), ('ABC'), ('VWX'), ('YZ'); | How many unique genes have been analyzed in the biosensor project? | SELECT COUNT(DISTINCT gene_name) FROM biosensor.genes_analyzed; | 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, 'Hotel A', 'San Francisco', 4.5), (2, 'Hotel B', 'San Francisco', 3.9); | What is the average rating of hotels in the city of 'San Francisco'? | SELECT AVG(rating) FROM hotels WHERE city = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriptions (id INT, customer_id INT, service VARCHAR(10), region VARCHAR(10)); INSERT INTO subscriptions (id, customer_id, service, region) VALUES (1, 1, 'landline', 'South-East'), (2, 1, 'postpaid', 'South-East'); | How many customers have both a landline and a postpaid mobile subscription in the 'South-East' region? | SELECT COUNT(DISTINCT customer_id) FROM subscriptions WHERE service IN ('landline', 'postpaid') GROUP BY customer_id HAVING COUNT(DISTINCT service) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_type VARCHAR(50)); INSERT INTO events (event_id, event_type) VALUES (1, 'Dance'), (2, 'Theater'); CREATE TABLE attendees (attendee_id INT, event_id INT, age INT); INSERT INTO attendees (attendee_id, event_id, age) VALUES (1, 1, 25), (2, 1, 30), (3, 2, 45), (4, 2, 50), (5, 2, 55)... | What is the average age of attendees for theater performances? | SELECT AVG(age) FROM attendees WHERE event_id IN (SELECT event_id FROM events WHERE event_type = 'Theater'); | gretelai_synthetic_text_to_sql |
CREATE TABLE attendance (id INT, event VARCHAR(50), country VARCHAR(50), year INT, attendees INT); INSERT INTO attendance (id, event, country, year, attendees) VALUES (1, 'Music Festival', 'Australia', 2019, 1000), (2, 'Music Festival', 'Australia', 2020, 1200), (3, 'Music Festival', 'Australia', 2021, 1500); | How many unique attendees have attended music festivals in Australia in the last 3 years? | SELECT COUNT(DISTINCT attendee) FROM (SELECT attendee FROM attendance WHERE event = 'Music Festival' AND country = 'Australia' AND year BETWEEN 2019 AND 2021) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (customerID INT, customerName VARCHAR(50), loyalty_score INT); INSERT INTO Customers (customerID, customerName, loyalty_score) VALUES (1, 'Alice Johnson', 75), (2, 'Bob Smith', 85), (3, 'Carla Jones', 65), (4, 'Daniel Kim', 90); | Insert a new record for a customer 'Jane Doe' with a loyalty_score of 80 into the Customers table. | INSERT INTO Customers (customerName, loyalty_score) VALUES ('Jane Doe', 80); | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, views INT, country VARCHAR(50)); INSERT INTO movies (id, title, release_year, views, country) VALUES (1, 'Movie1', 2010, 10000, 'Spain'), (2, 'Movie2', 2015, 15000, 'Spain'), (3, 'Movie3', 2020, 20000, 'Spain'); CREATE TABLE tv_shows (id INT, title VARC... | What is the total number of movies and TV shows in Spain and Italy? | SELECT COUNT(*) FROM movies WHERE country = 'Spain' UNION SELECT COUNT(*) FROM tv_shows WHERE country = 'Spain' UNION SELECT COUNT(*) FROM tv_shows WHERE country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE technology (id INT, employee_name TEXT, hours_worked INT, salary REAL); INSERT INTO technology (id, employee_name, hours_worked, salary) VALUES (1, 'Alice Davis', 20, 45000.00), (2, 'Bob Brown', 25, 50000.00), (3, 'Charlie Green', 30, 55000.00); | How many part-time workers are there in the 'technology' sector? | SELECT COUNT(*) FROM technology WHERE hours_worked < 30 AND sector = 'technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency (name TEXT, location TEXT, type TEXT); INSERT INTO energy_efficiency (name, location, type) VALUES ('Project X', 'Country I', 'Lighting'), ('Project Y', 'Country J', 'Insulation'), ('Project Z', 'Country I', 'HVAC'); | Which energy efficiency projects are located in Country I? | SELECT * FROM energy_efficiency WHERE location = 'Country I'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, state VARCHAR(50), year INT, purchase INT); INSERT INTO customers (id, state, year, purchase) VALUES (1, 'Washington', 2020, 1); | How many unique customers made purchases in the state of Washington in the year 2020? | SELECT COUNT(DISTINCT customer_id) FROM (SELECT customer_id FROM purchases WHERE state = 'Washington' AND year = 2020) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT PRIMARY KEY, worker_name VARCHAR(255), certification_date DATE, zip_code VARCHAR(10), rural_area VARCHAR(5)); CREATE VIEW worker_cert_dates AS SELECT worker_name, MIN(certification_date) as min_cert_date FROM community_health_workers GROUP BY worker_name; | List uncertified community health workers in a specific rural area. | SELECT worker_name FROM community_health_workers WHERE rural_area = 'yes' AND certification_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA GreenBuildings; CREATE TABLE Buildings (building_id INT, name VARCHAR(50), location VARCHAR(50), leed_certification VARCHAR(10)); INSERT INTO Buildings (building_id, name, location, leed_certification) VALUES (1, 'Green Building 1', 'City 1', 'Platinum'), (2, 'Green Building 2', 'City 2', 'Gold'), (3, 'Gr... | What are the names and locations of buildings in the 'GreenBuildings' schema with a LEED certification level of 'Gold' or 'Platinum'? | SELECT name, location FROM GreenBuildings.Buildings WHERE leed_certification IN ('Gold', 'Platinum'); | gretelai_synthetic_text_to_sql |
CREATE TABLE citizen_feedback (citizen_id INT, feedback TEXT, feedback_date DATE); | Delete records of citizens who have not provided feedback in the last 2 years from the 'citizen_feedback' table | DELETE FROM citizen_feedback WHERE feedback_date < DATE_SUB(CURRENT_DATE, INTERVAL 2 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE Dances (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO Dances (id, name, region) VALUES (1, 'Bharatanatyam', 'Asia'), (2, 'Odissi', 'Asia'), (3, 'Kathak', 'Asia'), (4, 'Kuchipudi', 'Asia'), (5, 'Mohiniyattam', 'Asia'); CREATE TABLE DanceParticipants (id INT, dance_id INT, name VARCHAR(50), annu... | What is the minimum number of annual participants for each traditional dance in Asia? | SELECT dance, MIN(annual_participants) as min_participants FROM Dances d JOIN DanceParticipants dp ON d.id = dp.dance_id GROUP BY dance; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(50), size FLOAT, country VARCHAR(50)); | Update the size of the record with id 4 in the table "marine_protected_areas" to 120000 | UPDATE marine_protected_areas SET size = 120000 WHERE id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE tournament_2022 (player_id INT, player_name TEXT, score INT, country TEXT); | What was the total score of players from South America in the 'tournament_2022' table? | SELECT SUM(score) FROM tournament_2022 WHERE country = 'South America'; | 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... | Update the location of the Sydney Opera House to Australia | UPDATE infrastructure_projects SET location = 'Australia' WHERE name = 'Sydney Opera House'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (CityID INT, CityName VARCHAR(50));CREATE TABLE RenewableEnergyProjects (ProjectID INT, CityID INT, InstalledCapacity INT); | What is the total installed capacity of renewable energy projects for each city? | SELECT Cities.CityName, SUM(RenewableEnergyProjects.InstalledCapacity) FROM Cities INNER JOIN RenewableEnergyProjects ON Cities.CityID = RenewableEnergyProjects.CityID GROUP BY Cities.CityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_routes (id INT, route_id INT, trip_date DATE); INSERT INTO bus_routes (id, route_id, trip_date) VALUES (1, 1, '2022-01-01'), (2, 2, '2022-01-01'), (3, 1, '2022-01-02'); | Find the number of unique bus routes used per day, ordered by the most used day? | SELECT COUNT(DISTINCT route_id) OVER (ORDER BY trip_date DESC) as unique_routes, trip_date FROM bus_routes WHERE trip_date >= DATEADD(day, -365, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (country VARCHAR(50), artist_name VARCHAR(50), ticket_price DECIMAL(5,2)); INSERT INTO concerts (country, artist_name, ticket_price) VALUES ('US', 'Beyoncé', 200.00), ('Canada', 'Drake', 150.00), ('Mexico', 'Taylor Swift', 220.00), ('US', 'Kendrick Lamar', 120.00); | Identify the top 3 countries with the highest average concert ticket prices. | SELECT country, AVG(ticket_price) AS avg_ticket_price, ROW_NUMBER() OVER(ORDER BY AVG(ticket_price) DESC) AS rank FROM concerts GROUP BY country ORDER BY rank ASC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, production_budget DECIMAL(10,2), country VARCHAR(100)); | What's the average budget for movies produced in the UK? | SELECT AVG(production_budget) FROM movies WHERE country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerHours (VolunteerID INT, Country VARCHAR(50), Activity VARCHAR(50), Hours INT); INSERT INTO VolunteerHours (VolunteerID, Country, Activity, Hours) VALUES (1, 'Canada', 'Sports', 60), (2, 'USA', 'Education', 30), (3, 'Mexico', 'Sports', 75), (4, 'Brazil', 'Education', 40); | Which countries have more than 50 volunteer hours in sports-related activities? | SELECT Country FROM VolunteerHours WHERE Activity = 'Sports' GROUP BY Country HAVING SUM(Hours) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE plans (id INT, name VARCHAR(255), type VARCHAR(255), price DECIMAL(10, 2)); CREATE TABLE subscribers (id INT, name VARCHAR(255), plan_id INT, data_used INT); INSERT INTO plans (id, name, type, price) VALUES (1, 'Basic', 'Data', 29.99), (2, 'Premium', 'Data', 49.99), (3, 'Family', 'Data', 69.99); INSERT INT... | What is the average data usage for each data plan in the 'plans' and 'subscribers' tables? | SELECT p.type, AVG(s.data_used) FROM plans p JOIN subscribers s ON p.id = s.plan_id GROUP BY p.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_revenue(date DATE, revenue INT); INSERT INTO daily_revenue VALUES ('2022-01-01', 1000), ('2022-01-02', 1200), ('2022-01-03', 1100), ('2022-01-04', 1300), ('2022-01-05', 1500), ('2022-01-06', 1600), ('2022-01-07', 1700); | What is the daily revenue trend for the last quarter? | SELECT date, revenue, ROW_NUMBER() OVER (ORDER BY revenue DESC) as ranking FROM daily_revenue WHERE date >= CURRENT_DATE - INTERVAL '3 months' ORDER BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE LanguagePreservation (id INT, program VARCHAR(255), funding_source VARCHAR(255), amount FLOAT); INSERT INTO LanguagePreservation (id, program, funding_source, amount) VALUES (1, 'Bilingual Education', 'Government Grant', 20000), (2, 'Language Immersion', 'Corporate Sponsorship', 15000), (3, 'Community Work... | Which language preservation programs received the most funding and from which sources? | SELECT funding_source, program, SUM(amount) FROM LanguagePreservation GROUP BY funding_source, program; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS contract_data (contract_id int, cost float, company varchar(30), region varchar(30)); INSERT INTO contract_data (contract_id, cost, company, region) VALUES (1, 15000, 'GuardianDefense', 'Africa'), (2, 17000, 'GuardianDefense', 'Africa'), (3, 13000, 'GuardianDefense', 'Africa'); | What is the average cost of military equipment maintenance contracts signed by GuardianDefense in Africa? | SELECT AVG(cost) FROM contract_data WHERE company = 'GuardianDefense' AND region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DigitalTrends (id INT, region VARCHAR(20), trend VARCHAR(50)); INSERT INTO DigitalTrends (id, region, trend) VALUES (1, 'Asia-Pacific', 'Virtual Reality Adoption'), (2, 'North America', 'Augmented Reality Engagement'); | List all digital trends for underrepresented communities in the Asia-Pacific region. | SELECT trend FROM DigitalTrends WHERE region = 'Asia-Pacific' AND community = 'Underrepresented'; | gretelai_synthetic_text_to_sql |
CREATE TABLE recall (id INT, product VARCHAR(50), date DATE); INSERT INTO recall (id, product, date) VALUES (1, 'Chicken nuggets', '2022-05-01'), (2, 'Almond milk', '2022-03-15'), (3, 'Frozen berries', '2022-01-20'), (4, 'Tuna', '2022-06-10'), (5, 'Lettuce', '2022-05-15'); | List all food recalls in the last 60 days, partitioned by week? | SELECT datepart(ww, date) as week, COUNT(*) as recall_count FROM recall WHERE date >= DATEADD(day, -60, GETDATE()) GROUP BY datepart(ww, date); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_cargo_weight_2 (vessel_name VARCHAR(50), cargo_weight INT); INSERT INTO vessel_cargo_weight_2 (vessel_name, cargo_weight) VALUES ('Sea Titan', 12000), ('Harbor Master', 15000), ('Ocean Breeze', 5000), ('Ocean Liner', 7000); | What is the average cargo weight for vessels with 'Ocean' in their name? | SELECT AVG(cargo_weight) FROM vessel_cargo_weight_2 WHERE vessel_name LIKE '%Ocean%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE film_festivals (festival_id INT, country VARCHAR(255), num_attendees INT); INSERT INTO film_festivals (festival_id, country, num_attendees) VALUES (1, 'USA', 500), (2, 'Canada', 600), (3, 'Mexico', 400); | What is the average attendance at the "film_festivals" table grouped by country? | SELECT country, AVG(num_attendees) FROM film_festivals GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE lifelong_learning (student_id INT, age_group INT, learning_score INT); INSERT INTO lifelong_learning (student_id, age_group, learning_score) VALUES (1, 18, 85), (2, 22, 90), (3, 25, 80), (4, 19, 95), (5, 21, 75); | What is the distribution of lifelong learning scores by age group? | SELECT age_group, AVG(learning_score) as avg_score, STDDEV(learning_score) as std_dev FROM lifelong_learning GROUP BY age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE CosmeticProducts (ProductID int, ProductName varchar(50), ConsumerRating float, Country varchar(50)); CREATE TABLE IngredientSources (IngredientSourceID int, ProductID int, SupplierID int, IsOrganic bit); | Identify the cosmetic products that have a higher than average consumer rating in the 'Asia' region, and their ingredient sourcing information? | SELECT c.ProductName, c.Country, i.SupplierID, i.IsOrganic FROM CosmeticProducts c INNER JOIN (SELECT ProductID, AVG(ConsumerRating) as AvgRating FROM CosmeticProducts WHERE Country LIKE 'Asia%' GROUP BY ProductID) sub ON c.ProductID = sub.ProductID INNER JOIN IngredientSources i ON c.ProductID = i.ProductID WHERE sub.... | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyIncidents (model_name VARCHAR(255), incident_region VARCHAR(255), incident_count INT); INSERT INTO SafetyIncidents (model_name, incident_region, incident_count) VALUES ('Model1', 'Asia', 5), ('Model2', 'Europe', 3), ('Model3', 'Asia', 7); | Which AI models have faced the most safety incidents in Asia? | SELECT model_name, SUM(incident_count) as total_incidents FROM SafetyIncidents WHERE incident_region = 'Asia' GROUP BY model_name ORDER BY total_incidents DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE If Not Exists historical_contexts (context_id INT, context_age INT, site_id INT); INSERT INTO historical_contexts (context_id, context_age, site_id) VALUES (1, 3500, 1), (2, 2500, 1), (3, 5000, 3), (4, 1500, 2), (5, 4000, 3); | What is the average historical context age for artifacts from the 'Egyptian Digs' site? | SELECT AVG(context_age) FROM historical_contexts JOIN excavation_sites ON historical_contexts.site_id = excavation_sites.site_id WHERE excavation_sites.site_name = 'Egyptian Digs'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (element VARCHAR(10), year INT, month INT, quantity INT); INSERT INTO production (element, year, month, quantity) VALUES ('Terbium', 2015, 1, 50), ('Terbium', 2015, 2, 55), ('Terbium', 2016, 1, 60), ('Terbium', 2016, 2, 65), ('Holmium', 2015, 1, 70), ('Holmium', 2015, 2, 75), ('Holmium', 2016, 1... | Compare the annual production quantities of Terbium and Holmium in 2015 and 2016 | SELECT element, SUM(quantity) FROM production WHERE (year = 2015 OR year = 2016) AND element IN ('Terbium', 'Holmium') GROUP BY element, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (artwork_id INT, title VARCHAR(50), year INT, artist_id INT, value INT, country VARCHAR(50)); INSERT INTO artworks (artwork_id, title, year, artist_id, value, country) VALUES (1, 'Guernica', 1937, 1, 20000000, 'Spain'); INSERT INTO artworks (artwork_id, title, year, artist_id, value, country) VALU... | What is the minimum value of artwork in the 'artworks' table? | SELECT MIN(value) FROM artworks; | gretelai_synthetic_text_to_sql |
CREATE TABLE CentralAmericaProjects (region TEXT, year INTEGER, project_status TEXT); INSERT INTO CentralAmericaProjects (region, year, project_status) VALUES ('Central America', 2019, 'completed'), ('Central America', 2020, 'completed'), ('Central America', 2021, 'completed'), ('Central America', 2019, 'in progress'),... | What is the average number of rural infrastructure projects completed per year in Central America? | SELECT AVG(COUNT(*)) OVER (PARTITION BY year) FROM CentralAmericaProjects WHERE region = 'Central America' AND project_status = 'completed' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_sequestration (region VARCHAR(255), amount INT); INSERT INTO carbon_sequestration (region, amount) VALUES ('Amazon', 2000), ('Congo', 1500), ('Boreal', 1800), ('Temperate', 1200); | What is the total carbon sequestration for the region 'Amazon'? | SELECT SUM(amount) FROM carbon_sequestration WHERE region = 'Amazon'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Organizations (OrgID INT, OrgName TEXT, Sector TEXT); CREATE TABLE Grants (GrantID INT, GrantName TEXT, OrgID INT, Sector TEXT, Amount DECIMAL); | List all organizations that have received grants in the Climate Change sector, in alphabetical order? | SELECT OrgName FROM Organizations JOIN Grants ON Organizations.OrgID = Grants.OrgID WHERE Sector = 'Climate Change' ORDER BY OrgName; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(255), location VARCHAR(255), type VARCHAR(255), status VARCHAR(255)); INSERT INTO projects (id, name, location, type, status) VALUES (1, 'East Side Access', 'New York, NY', 'Transportation', 'In Progress'); | How many transportation projects are currently underway in New York City? | SELECT COUNT(*) FROM projects WHERE location = 'New York, NY' AND status = 'In Progress' AND type = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE salaries (id INT, employee_id INT, salary INT, position_id INT); CREATE TABLE positions (id INT, position_title TEXT, job_level INT); | Show the average salary by job level from the "positions" and "salaries" tables | SELECT positions.job_level, AVG(salaries.salary) as avg_salary FROM salaries JOIN positions ON salaries.position_id = positions.id GROUP BY positions.job_level; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue(location VARCHAR(255), revenue INT); INSERT INTO restaurant_revenue(location, revenue) VALUES ('Location1', 5000), ('Location2', 7000), ('Location3', 3000), ('Restaurant4', 6000), ('Restaurant5', 10000), ('Restaurant6', 8000); | What is the maximum revenue for restaurants in Chicago? | SELECT MAX(revenue) FROM restaurant_revenue WHERE location LIKE '%Chicago%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (cuisine_type VARCHAR(255), total_revenue DECIMAL(10,2)); INSERT INTO restaurant_revenue (cuisine_type, total_revenue) VALUES ('Italian', '5000.00'), ('Mexican', '7000.00'), ('Chinese', '6000.00'), ('Indian', '8000.00'); | Calculate the total revenue for each cuisine type | SELECT r.cuisine_type, SUM(r.total_revenue) as total_revenue FROM restaurant_revenue r GROUP BY r.cuisine_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (id INT, name VARCHAR(50), start_stop_id INT, end_stop_id INT); INSERT INTO routes (id, name, start_stop_id, end_stop_id) VALUES (5, 'Yellow Line', 90, 105); CREATE TABLE fares (id INT, route_id INT, start_date DATE, end_date DATE, price DECIMAL(5,2)); INSERT INTO fares (id, route_id, start_date, en... | What is the latest fare price increase for the 'Yellow Line'? | SELECT MAX(f.end_date) FROM fares f WHERE f.route_id IN (SELECT id FROM routes WHERE name = 'Yellow Line'); | gretelai_synthetic_text_to_sql |
CREATE TABLE machine (machine_id INT, machine_name VARCHAR(20)); INSERT INTO machine (machine_id, machine_name) VALUES (1, 'MachineA'), (2, 'MachineB'); CREATE TABLE water_consumption (consumption_id INT, machine_id INT, consumption_quantity INT, consumption_date DATE); INSERT INTO water_consumption (consumption_id, ma... | What was the maximum water consumption by a single machine in the Western region for the year 2019? | SELECT machine_id, MAX(consumption_quantity) FROM water_consumption WHERE consumption_date BETWEEN '2019-01-01' AND '2019-12-31' GROUP BY machine_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (name VARCHAR(100), sport VARCHAR(50), country VARCHAR(50)); | Create a table named 'athletes' with columns 'name', 'sport', and 'country' | CREATE TABLE athletes (name VARCHAR(100), sport VARCHAR(50), country VARCHAR(50)); | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(20), enrollment_date DATE); INSERT INTO students (student_id, name, gender, department, enrollment_date) VALUES (1, 'John Doe', 'Male', 'Computer Science', '2019-08-15'), (2, 'Jane Smith', 'Female', 'Computer Science', '2020... | What is the total number of male and female students enrolled in the "Computer Science" department as of 2020-01-01? | SELECT SUM(CASE WHEN gender = 'Male' THEN 1 ELSE 0 END) AS male_count, SUM(CASE WHEN gender = 'Female' THEN 1 ELSE 0 END) AS female_count FROM students WHERE department = 'Computer Science' AND enrollment_date <= '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Europium_Production (id INT, year INT, country VARCHAR(255), quantity FLOAT); | What is the total quantity of Europium extracted in South Africa and Russia from 2010 to 2014? | SELECT SUM(quantity) FROM Europium_Production WHERE year BETWEEN 2010 AND 2014 AND country IN ('South Africa', 'Russia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ambulances (id INT, city VARCHAR(255), number_of_ambulances INT); INSERT INTO ambulances (id, city, number_of_ambulances) VALUES (1, 'Chicago', 120), (2, 'New_York', 100); | What is the total number of ambulances in the city of Chicago? | SELECT SUM(number_of_ambulances) FROM ambulances WHERE city = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE agroecology_events (event_name VARCHAR(255), location VARCHAR(255), attendees INT); | List all agroecology events in France and the number of attendees. | SELECT location, event_name, SUM(attendees) as total_attendees FROM agroecology_events WHERE location = 'France' GROUP BY event_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE DrugApprovals (drug_name VARCHAR(255), approval_date DATE, approval_status VARCHAR(255)); | Create a new table for drug approval data with columns for drug name, approval date, and approval status. | INSERT INTO DrugApprovals (drug_name, approval_date, approval_status) VALUES ('DrugN', '2022-03-15', 'Approved'), ('DrugO', '2021-12-20', 'Approved'), ('DrugP', '2022-01-03', 'Rejected'); | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency_annual (technology VARCHAR(255), year INT, improvement FLOAT); | What is the average energy efficiency improvement (in %) per technology per year from 2015 to 2020? | SELECT technology, AVG(improvement) FROM energy_efficiency_annual WHERE year BETWEEN 2015 AND 2020 GROUP BY technology; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_tracking (id INT, vessel_name VARCHAR(50), cargo_weight DECIMAL(10,2)); | What is the total weight of cargo transported by 'Vessel A' in the 'cargo_tracking' table? | SELECT SUM(cargo_weight) FROM cargo_tracking WHERE vessel_name = 'Vessel A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget2023 (Service TEXT, Amount INT); INSERT INTO Budget2023 (Service, Amount) VALUES ('Healthcare', 1600000), ('Education', 1300000), ('Transportation', 1400000); | What is the total budget allocated for each service category in 2023? | SELECT Service, Amount FROM Budget2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE RiceArea (Location VARCHAR(20), Crop VARCHAR(20), Area FLOAT); INSERT INTO RiceArea (Location, Crop, Area) VALUES ('China', 'Rice', 1500000), ('India', 'Rice', 1750000), ('Indonesia', 'Rice', 1200000); | What is the average area of land used for rice farming in Asia? | SELECT AVG(Area) FROM RiceArea WHERE Location = 'China' OR Location = 'India' OR Location = 'Indonesia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DEEPEST_POINTS (OCEAN VARCHAR(20), DEPTH INT); INSERT INTO DEEPEST_POINTS (OCEAN, DEPTH) VALUES ('Pacific Ocean', 10994), ('Atlantic Ocean', 8605), ('Indian Ocean', 8047), ('Southern Ocean', 7235), ('Arctic Ocean', 5527); | List the deepest point in each ocean, showing the ocean name and depth. | SELECT OCEAN, DEPTH FROM DEEPEST_POINTS WHERE DEPTH = (SELECT MAX(DEPTH) FROM DEEPEST_POINTS GROUP BY OCEAN); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, Name TEXT, TotalDonation DECIMAL(10,2)); INSERT INTO Donors (DonorID, Name, TotalDonation) VALUES (1, 'John Doe', 5000.00), (2, 'Jane Smith', 3500.00); | What is the total amount donated by each donor in the past year? | SELECT Name, SUM(TotalDonation) FROM Donors WHERE DonationDate >= DATEADD(year, -1, GETDATE()) GROUP BY Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name TEXT, region TEXT, max_depth FLOAT); INSERT INTO marine_protected_areas (name, region, max_depth) VALUES ('MPA1', 'Arctic', 567.89); INSERT INTO marine_protected_areas (name, region, max_depth) VALUES ('MPA2', 'Pacific', 456.78); | What is the maximum depth of all marine protected areas in the Arctic region? | SELECT MAX(max_depth) FROM marine_protected_areas WHERE region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(50)); CREATE TABLE student_grants (student_id INT, grant_id INT); INSERT INTO students (id, name) VALUES (1, 'John Smith'), (2, 'Jane Doe'); INSERT INTO student_grants (student_id, grant_id) VALUES (1, 1), (2, 2); CREATE TABLE grants (id INT, title VARCHAR(100), year INT, amo... | Display the names of students who have not received any research grants. | SELECT students.name FROM students LEFT JOIN student_grants ON students.id = student_grants.student_id LEFT JOIN grants ON student_grants.grant_id = grants.id WHERE grants.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Global_Chain_Sales (chain TEXT, revenue INT); INSERT INTO Global_Chain_Sales (chain, revenue) VALUES ('Global Luxury Resorts', 12000000), ('Premium International Hotels', 10000000), ('Economy Lodgings', 8000000); | Find the top 2 hotel chains with the highest revenue in the 'Global_Chain_Sales' table. | SELECT chain, revenue FROM (SELECT chain, revenue, DENSE_RANK() OVER (ORDER BY revenue DESC) as rank FROM Global_Chain_Sales) WHERE rank <= 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (department_id INT, department_name TEXT); CREATE TABLE employees (employee_id INT, employee_name TEXT, department_id INT, industry_id INT); CREATE TABLE industries (industry_id INT, industry_name TEXT); INSERT INTO departments VALUES (1, 'HR'), (2, 'Marketing'), (3, 'IT'), (4, 'Finance')... | What is the total number of employees in each department in the 'technology' industry? | SELECT departments.department_name, COUNT(employees.employee_id) FROM departments INNER JOIN employees ON departments.department_id = employees.department_id INNER JOIN industries ON employees.industry_id = industries.industry_id WHERE industries.industry_name = 'technology' GROUP BY departments.department_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_date DATE, salesperson VARCHAR(255), revenue FLOAT); | What is the total revenue for each salesperson in Q2 2022? | SELECT salesperson, SUM(revenue) AS total_revenue FROM sales WHERE sale_date BETWEEN '2022-04-01' AND '2022-06-30' GROUP BY salesperson; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO Exhibitions (exhibition_id, name, start_date, end_date) VALUES (1, 'Impressionist', '2020-05-01', '2021-01-01'); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT, age INT, gender VARCHAR(10)); | What was the average age of visitors who attended the Impressionist exhibition? | SELECT AVG(age) FROM Visitors WHERE exhibition_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE esports_events (id INT, year INT, location VARCHAR(20)); INSERT INTO esports_events (id, year, location) VALUES (1, 2022, 'USA'), (2, 2021, 'Germany'), (3, 2020, 'France'), (4, 2019, 'China'); | What is the total number of esports events held in total in 2020? | SELECT COUNT(*) FROM esports_events WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (mission_id INT, agency VARCHAR(50), launch_year INT); INSERT INTO space_missions (mission_id, agency, launch_year) VALUES (1, 'NASA', 2000), (2, 'NASA', 2000), (3, 'NASA', 2010), (4, 'ESA', 1990), (5, 'ESA', 1990), (6, 'ESA', 2020), (7, 'ISRO', 2005), (8, 'ISRO', 2005), (9, 'ISRO', 2015); | How many space missions were launched by each space agency, in total and per launch year? | SELECT agency, launch_year, COUNT(*) as mission_count FROM space_missions GROUP BY agency, launch_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_heritage_sites (id INT, name TEXT, country TEXT, visitors INT); INSERT INTO cultural_heritage_sites (id, name, country, visitors) VALUES (1, 'Colosseum', 'Italy', 5000), (2, 'Leaning Tower', 'Italy', 2000), (3, 'Pompeii', 'Italy', 1200); | Find the number of cultural heritage sites in Italy visited by more than 1000 tourists. | SELECT COUNT(*) FROM cultural_heritage_sites WHERE country = 'Italy' AND visitors > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT PRIMARY KEY, waste_type_id INT, generation_rate FLOAT); INSERT INTO waste_generation (id, waste_type_id, generation_rate) VALUES (1, 1, 50.5), (2, 2, 40.3); CREATE TABLE recycling_rates (id INT PRIMARY KEY, waste_type_id INT, recycling_rate FLOAT); INSERT INTO recycling_rates (id, ... | Calculate the recycling rate for each waste type | SELECT waste_types.waste_type, (recycling_rates.recycling_rate / waste_generation.generation_rate) * 100 AS recycling_percentage FROM waste_types INNER JOIN waste_generation ON waste_types.id = waste_generation.waste_type_id INNER JOIN recycling_rates ON waste_types.id = recycling_rates.waste_type_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation (project_id INTEGER, project_name TEXT, location TEXT, budget INTEGER); INSERT INTO climate_adaptation (project_id, project_name, location, budget) VALUES (1, 'Project F', 'Europe', 600000), (2, 'Project G', 'Asia', 400000); | Which climate adaptation projects are in 'Europe' and have a budget over '500000'? | SELECT project_name FROM climate_adaptation WHERE location = 'Europe' AND budget > 500000; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_demographics (fan_id INT, age INT, gender VARCHAR(10)); INSERT INTO fan_demographics (fan_id, age, gender) VALUES (1, 25, 'Female'), (2, 35, 'Male'), (3, 45, 'Female'), (4, 55, 'Male'); | What is the percentage of female fans in the 'fan_demographics' table, grouped by their age range? | SELECT age_range, (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM fan_demographics)) AS percentage FROM (SELECT CASE WHEN age < 30 THEN '18-29' WHEN age < 50 THEN '30-49' ELSE '50+' END AS age_range, gender FROM fan_demographics WHERE gender = 'Female') t GROUP BY age_range; | gretelai_synthetic_text_to_sql |
CREATE TABLE soccer_games (game_id INT, player_name VARCHAR(100), goals INT); | List the number of goals scored by each player in the soccer_games table. | SELECT player_name, SUM(goals) as total_goals FROM soccer_games GROUP BY player_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft (id INT, name VARCHAR(255), country VARCHAR(255), weight INT); INSERT INTO spacecraft (id, name, country, weight) VALUES (1, 'Soyuz', 'Russia', 7000); | What is the total weight of all spacecraft launched by Russia? | SELECT SUM(weight) FROM spacecraft WHERE country = 'Russia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT, name VARCHAR(255)); INSERT INTO dispensaries (id, name) VALUES (1, 'Dispensary A'), (2, 'Dispensary B'); CREATE TABLE sales (dispensary_id INT, sale_date DATE, revenue DECIMAL(10, 2)); INSERT INTO sales (dispensary_id, sale_date, revenue) VALUES (1, '2022-01-01', 5000), (1, '2022-01-1... | What was the total sales revenue for each dispensary in the month of January 2022? | SELECT d.name, SUM(s.revenue) as total_revenue FROM sales s JOIN dispensaries d ON s.dispensary_id = d.id WHERE s.sale_date BETWEEN '2022-01-01' AND '2022-01-31' GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, founded DATE); INSERT INTO companies (id, name, founded) VALUES (1, 'Foobar Inc', '2017-01-01'), (2, 'Gizmos Inc', '2019-06-15'), (3, 'Widgets Inc', '2015-09-27'); CREATE TABLE funding (company_id INT, amount INT); INSERT INTO funding (company_id, amount) VALUES (1, 1000000), ... | Update the funding amount for a specific startup by 10% | UPDATE funding SET amount = amount * 1.1 WHERE company_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE resilience_metrics (project_id INT, flood_resistance INT, wind_resistance INT); | In the 'resilience_metrics' table, update the 'flood_resistance' value for the project with ID 3 to 85. | UPDATE resilience_metrics SET flood_resistance = 85 WHERE project_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Crimes (id INT, state VARCHAR(20), date DATE, number_of_crimes INT); | What is the total number of crimes committed in the state of New York in the past month? | SELECT SUM(number_of_crimes) FROM Crimes WHERE state = 'New York' AND date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, player_name TEXT, country TEXT, score INT); INSERT INTO players (player_id, player_name, country, score) VALUES (1, 'John', 'Canada', 90); INSERT INTO players (player_id, player_name, country, score) VALUES (2, 'Mia', 'USA', 85); INSERT INTO players (player_id, player_name, country,... | What is the average score of players from Canada and the United States? | SELECT AVG(score) FROM players WHERE country IN ('Canada', 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE technology_adoption (hotel_id INT, technology TEXT, region TEXT, adoption_date DATE, adopted BOOLEAN); INSERT INTO technology_adoption (hotel_id, technology, region, adoption_date, adopted) VALUES (1, 'contactless check-in', 'MEA', '2022-02-10', true), (2, 'contactless check-in', 'MEA', '2021-11-25', false... | What is the adoption rate of contactless check-in technology in hotels in the MEA region? | SELECT technology, region, COUNT(*) FILTER (WHERE adopted = true) / COUNT(*) AS adoption_rate FROM technology_adoption WHERE technology = 'contactless check-in' AND region = 'MEA' GROUP BY technology, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, name VARCHAR(50), ocean VARCHAR(20)); INSERT INTO marine_species (species_id, name, ocean) VALUES (1, 'Species1', 'Northern Atlantic'), (2, 'Species2', 'Southern Ocean'); | What is the total number of marine species in the Northern Atlantic and Southern Ocean? | SELECT COUNT(*) FROM marine_species WHERE ocean IN ('Northern Atlantic', 'Southern Ocean'); | 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.