context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE properties (id INT, size FLOAT, co_owned BOOLEAN, city VARCHAR(20)); INSERT INTO properties (id, size, co_owned, city) VALUES (1, 2500, TRUE, 'Sydney'), (2, 1500, TRUE, 'Sydney'), (3, 1000, FALSE, 'Sydney'); | What is the percentage of co-owned properties with a size greater than 2000 square feet in Sydney? | SELECT 100.0 * COUNT(*) FILTER (WHERE co_owned = TRUE AND size > 2000) / COUNT(*) FILTER (WHERE size > 2000) FROM properties WHERE city = 'Sydney'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm (id INT, region VARCHAR(20), crop VARCHAR(20), yield INT); INSERT INTO farm (id, region, crop, yield) VALUES (1, 'Andean region', 'quinoa', 20), (2, 'Andean region', 'potato', 30); | What is the total yield of 'quinoa' in 'Andean region'? | SELECT SUM(yield) FROM farm WHERE region = 'Andean region' AND crop = 'quinoa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_operations (id INT, operation_name VARCHAR(255), region VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO intelligence_operations (id, operation_name, region, start_date, end_date) VALUES (3, 'Operation African Shield', 'Africa', '2020-01-01', NULL); | What are the active intelligence operations in the African region? | SELECT * FROM intelligence_operations WHERE region = 'Africa' AND end_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, athlete_name VARCHAR(50), gender VARCHAR(10)); CREATE TABLE wellbeing_programs (program_id INT, athlete_id INT, cost DECIMAL(5,2)); INSERT INTO athletes (athlete_id, athlete_name, gender) VALUES (1, 'AthleteA', 'Male'), (2, 'AthleteB', 'Female'); INSERT INTO wellbeing_programs (pr... | What is the total cost of wellbeing programs by athlete gender? | SELECT a.gender, SUM(wellbeing_programs.cost) as total_cost FROM athletes JOIN wellbeing_programs ON athletes.athlete_id = wellbeing_programs.athlete_id GROUP BY a.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningSites (SiteID INT, SiteName VARCHAR(50), Location VARCHAR(50), CarbonEmissions INT); INSERT INTO MiningSites (SiteID, SiteName, Location, CarbonEmissions) VALUES (1, 'Site C', 'California', 1500), (2, 'Site D', 'Texas', 2000), (3, 'Site E', 'Alberta', 2500); | Identify mining sites with high carbon emissions and their average emission rate | SELECT SiteName, Location, AVG(CarbonEmissions) as AverageEmissionRate FROM MiningSites WHERE CarbonEmissions > 1500 GROUP BY SiteID; | gretelai_synthetic_text_to_sql |
CREATE TABLE investigations (id INT, title TEXT, description TEXT, status TEXT, created_at DATE); | Insert a new record into the "investigations" table with the following details: id 7, title "Unethical media practices", description "Investigation into media companies", status "Open", created_at "2022-04-01" | INSERT INTO investigations (id, title, description, status, created_at) VALUES (7, 'Unethical media practices', 'Investigation into media companies', 'Open', '2022-04-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_life_research_stations (id INT, station_name TEXT); CREATE TABLE pollution_control_initiatives (id INT, initiative_name TEXT); | What is the total number of marine life research stations and pollution control initiatives? | SELECT COUNT(*) FROM marine_life_research_stations UNION ALL SELECT COUNT(*) FROM pollution_control_initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibitions (exhibition_id INT, name VARCHAR(255)); INSERT INTO exhibitions (exhibition_id, name) VALUES (1, 'Art of the Renaissance'), (2, 'Modern Art'), (3, 'Digital Museum'); CREATE TABLE visitors (visitor_id INT, exhibition_id INT, country VARCHAR(50)); INSERT INTO visitors (visitor_id, exhibition_id, ... | What percentage of visitors to the Digital Museum were from Europe? | SELECT (COUNT(visitors.visitor_id) * 100.0 / (SELECT COUNT(visitor_id) FROM visitors WHERE exhibition_id = 3)) as percentage FROM visitors WHERE exhibition_id = 3 AND country LIKE 'Europe%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Product (product_id INT PRIMARY KEY, product_name VARCHAR(50), price DECIMAL(5,2), is_ethically_sourced BOOLEAN); | Display the number of products that are ethically sourced and have a price greater than $50 in the 'Product' table | SELECT COUNT(*) FROM Product WHERE is_ethically_sourced = TRUE AND price > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_life_research_stations (station_id INT, station_name TEXT, location TEXT, depth FLOAT); INSERT INTO marine_life_research_stations (station_id, station_name, location, depth) VALUES (1, 'Station A', 'Pacific Ocean', 3000.5), (2, 'Station B', 'Atlantic Ocean', 4000.2); | List the names and depths of all marine life research stations in the Pacific Ocean. | SELECT station_name, depth FROM marine_life_research_stations WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_name VARCHAR(50), location VARCHAR(50), oil_production NUMERIC(10,2)); INSERT INTO wells (well_name, location, oil_production) VALUES ('Well A', 'North Sea', 200.5), ('Well B', 'North Sea', 250.3), ('Well C', 'North Sea', 180.9), ('Well D', 'North Sea', 300.1), ('Well E', 'North Sea', 220.7); | What is the daily production of oil from the top 5 wells in the North Sea? | SELECT well_name, oil_production FROM (SELECT well_name, oil_production, ROW_NUMBER() OVER (ORDER BY oil_production DESC) as rank FROM wells WHERE location = 'North Sea') sub WHERE rank <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity_incidents (id INT, region VARCHAR(50), incidents INT); INSERT INTO mental_health_parity_incidents (id, region, incidents) VALUES (1, 'Northeast', 10), (2, 'Northeast', 15), (3, 'Southeast', 5), (4, 'Southeast', 8), (5, 'Midwest', 12), (6, 'Midwest', 18), (7, 'West', 7), (8, 'West', 11)... | What is the maximum number of mental health parity violation incidents reported in each region? | SELECT region, MAX(incidents) FROM mental_health_parity_incidents GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name TEXT, area_size INTEGER, avg_depth REAL, ocean TEXT); | What is the average depth of all marine protected areas in the Southern Ocean? | SELECT AVG(avg_depth) FROM marine_protected_areas WHERE ocean = 'Southern Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SportsField (fan_id INT, fan_name VARCHAR(50), country VARCHAR(50), date DATE); | Which countries have fewer than 5,000 fans who attended the 'SportsField' last year? | SELECT country, COUNT(fan_id) AS fan_count FROM SportsField WHERE date >= '2021-01-01' AND date <= '2021-12-31' GROUP BY country HAVING fan_count < 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (satellite_id INT, name VARCHAR(50), launch_date DATE, manufacturer VARCHAR(50)); INSERT INTO Satellites (satellite_id, name, launch_date, manufacturer) VALUES (1, 'Sat1', '2020-01-01', 'SpaceTech Inc.'), (2, 'Sat2', '2019-05-15', 'Orbital Inc.'), (3, 'Sat3', '2021-03-27', 'SpaceTech Inc.'), (4,... | What are the names and launch dates of all satellites launched before 2020? | SELECT name, launch_date FROM Satellites WHERE launch_date < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Email VARCHAR(50)); INSERT INTO Volunteers (VolunteerID, FirstName, LastName, Email) VALUES (1, 'John', 'Doe', 'johndoe@email.com'), (2, 'Jane', 'Smith', 'janesmith@email.com'), (3, 'Alice', 'Johnson', 'alicejohnson@email.com'), (4, ... | What is the rank of the volunteer with the most total hours volunteered? | SELECT ROW_NUMBER() OVER (ORDER BY total_hours DESC) FROM (SELECT VolunteerID, SUM(Hours) AS total_hours FROM VolunteerHours GROUP BY VolunteerID) subquery WHERE VolunteerID = (SELECT VolunteerID FROM VolunteerHours GROUP BY VolunteerID ORDER BY SUM(Hours) DESC LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (id INT, customer_id INT, transaction_date DATE, amount DECIMAL(10,2)); INSERT INTO transactions (id, customer_id, transaction_date, amount) VALUES (1, 1, '2021-02-03', 1000.00), (2, 2, '2021-04-05', 2000.00), (3, 2, '2021-11-20', 500.00); | List all transactions made by 'Jane Smith' between '2021-01-01' and '2021-12-31'? | SELECT * FROM transactions WHERE customer_id = (SELECT id FROM customers WHERE name = 'Jane Smith') AND transaction_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (sale_id INT PRIMARY KEY, brand_name VARCHAR(100), quantity_sold INT); INSERT INTO sales_data (sale_id, brand_name, quantity_sold) VALUES (1, 'EcoFriendlyBrand', 200), (2, 'GreenFashion', 300), (3, 'SustainableTextiles', 400); | What is the total quantity of sustainable clothing sold by each brand? | SELECT brand_name, SUM(quantity_sold) FROM sales_data GROUP BY brand_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (id INT PRIMARY KEY, name VARCHAR(255), age INT, city VARCHAR(255), account_id INT, balance DECIMAL(10,2)); INSERT INTO clients (id, name, age, city, account_id, balance) VALUES (1001, 'Jacob Smith', 34, 'New York', 1, 5000.00), (1002, 'Sophia Johnson', 45, 'Los Angeles', 2, 25000.00), (1003, 'Etha... | What is the average account balance for clients in 'Toronto'? | SELECT AVG(balance) FROM clients WHERE city = 'Toronto'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id SERIAL PRIMARY KEY, name VARCHAR(255), type VARCHAR(255)); CREATE TABLE ports (id INT, name VARCHAR(255)); CREATE TABLE voyages (id INT, vessel_id INT, port_id INT, arrival_time TIMESTAMP); | Add a new vessel 'Blue Horizon' with type 'Bulk Carrier' to the vessels table. | INSERT INTO vessels (name, type) VALUES ('Blue Horizon', 'Bulk Carrier'); | gretelai_synthetic_text_to_sql |
CREATE TABLE game_sessions (session_id INT, player_id INT, game_id INT, genre VARCHAR(50), start_time TIMESTAMP, end_time TIMESTAMP); INSERT INTO game_sessions (session_id, player_id, game_id, genre, start_time, end_time) VALUES (1, 1, 3, 'Racing', '2021-01-01 10:00:00', '2021-01-01 12:00:00'), (2, 2, 3, 'Racing', '202... | What is the total playtime of 'Racing' genre games for users from the EU region? | SELECT SUM(TIMESTAMP_DIFF(end_time, start_time, MINUTE)) AS total_playtime_minutes FROM game_sessions WHERE genre = 'Racing' AND EXTRACT(HOUR FROM start_time) BETWEEN 0 AND 23 AND EXTRACT(MINUTE FROM start_time) = 0 AND EXTRACT(SECOND FROM start_time) = 0 AND EXTRACT(HOUR FROM end_time) BETWEEN 0 AND 23 AND EXTRACT(MIN... | gretelai_synthetic_text_to_sql |
CREATE TABLE shipment_deliveries(id INT, shipment_id INT, delivery_time INT); CREATE TABLE shipments(id INT, source VARCHAR(255), destination VARCHAR(255), shipment_date DATE); INSERT INTO shipment_deliveries(id, shipment_id, delivery_time) VALUES (1, 1, 7), (2, 2, 10), (3, 3, 8); INSERT INTO shipments(id, source... | What is the earliest delivery time for shipments to Africa? | SELECT MIN(delivery_time) FROM shipment_deliveries JOIN shipments ON shipment_deliveries.shipment_id = shipments.id WHERE shipments.destination LIKE 'Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Country TEXT); CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Country TEXT); | What is the number of unique donors and volunteers in each country? | SELECT Donors.Country, COUNT(DISTINCT Donors.DonorID) AS DonorCount, COUNT(DISTINCT Volunteers.VolunteerID) AS VolunteerCount FROM Donors FULL OUTER JOIN Volunteers ON Donors.Country = Volunteers.Country GROUP BY Donors.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE public.vehicles (id INT, type VARCHAR(20), city VARCHAR(20)); INSERT INTO public.vehicles (id, type, city) VALUES (1, 'electric_car', 'Toronto'), (2, 'conventional_car', 'Toronto'), (3, 'autonomous_bus', 'Toronto'), (4, 'autonomous_car', 'Montreal'), (5, 'conventional_car', 'Montreal'), (6, 'electric_bus',... | Show the total number of electric and autonomous vehicles in 'Toronto' and 'Montreal' | SELECT SUM(cnt) FROM (SELECT city, COUNT(*) AS cnt FROM public.vehicles WHERE city IN ('Toronto', 'Montreal') AND (type LIKE 'electric%' OR type LIKE 'autonomous%') GROUP BY city) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE TextileSourcing (TextileType VARCHAR(255), IsSustainable BOOLEAN); INSERT INTO TextileSourcing (TextileType, IsSustainable) VALUES ('Organic Hemp', TRUE), ('Recycled Nylon', TRUE), ('Viscose', FALSE), ('Bamboo', TRUE); | Identify the unique textile types used in sustainable clothing items. | SELECT DISTINCT TextileType FROM TextileSourcing WHERE IsSustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE LanguagePreservation (id INT, name VARCHAR(255), region VARCHAR(255), start_year INT); INSERT INTO LanguagePreservation (id, name, region, start_year) VALUES (1, 'Quechua Revitalization', 'South America', 2010); | How many language preservation programs have been initiated in 'South America' since 2010? | SELECT COUNT(*) FROM LanguagePreservation WHERE region = 'South America' AND start_year >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, name VARCHAR(50), location VARCHAR(50), mineral VARCHAR(50), extraction_rate DECIMAL(5,2)); INSERT INTO mining_sites (id, name, location, mineral, extraction_rate) VALUES (1, 'Gold Mine', 'California', 'Gold', 12.5), (2, 'Silver Mine', 'Nevada', 'Silver', 15.2), (3, 'Copper Mine', 'Ar... | List the mines in the mining_sites table that have extraction rates higher than the average extraction rate for each mineral type. | SELECT * FROM mining_sites t1 WHERE extraction_rate > (SELECT AVG(extraction_rate) FROM mining_sites t2 WHERE t1.mineral = t2.mineral) | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (id INT, title TEXT, amount FLOAT, department VARCHAR(50), year INT); INSERT INTO grants (id, title, amount, department, year) VALUES (1, 'Fundamentals of Organic Chemistry', 50000, 'Chemistry', 1999); INSERT INTO grants (id, title, amount, department, year) VALUES (2, 'Advanced Physical Chemistry',... | Delete all grant records for the Chemistry department that were awarded before the year 2000. | DELETE FROM grants WHERE department = 'Chemistry' AND year < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (contract_id INT, supplier VARCHAR(50), negotiation_date DATE, region VARCHAR(50)); | How many contract negotiations were conducted with each supplier in Europe in 2019? | SELECT supplier, region, COUNT(contract_id) FROM ContractNegotiations WHERE negotiation_date BETWEEN '2019-01-01' AND '2019-12-31' AND region = 'Europe' GROUP BY supplier, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, region_name VARCHAR(50), avg_monthly_rainfall_mm INT); INSERT INTO regions (id, region_name, avg_monthly_rainfall_mm) VALUES (1, 'Amazon', 300); INSERT INTO regions (id, region_name, avg_monthly_rainfall_mm) VALUES (2, 'Congo Basin', 250); INSERT INTO regions (id, region_name, avg_monthly_... | What is the average monthly rainfall in the top 3 wettest regions, and their ranks? | SELECT id, region_name, avg_monthly_rainfall_mm, RANK() OVER (ORDER BY avg_monthly_rainfall_mm DESC) as rank FROM regions WHERE id IN (SELECT id FROM (SELECT id, RANK() OVER (ORDER BY avg_monthly_rainfall_mm DESC) as district_rank FROM regions) ranked_regions WHERE district_rank <= 3); | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name VARCHAR(50), country VARCHAR(50), is_vegan BOOLEAN, price INT); INSERT INTO dishes (id, name, country, is_vegan, price) VALUES (1, 'Palak Paneer', 'India', false, 10), (2, 'Chana Masala', 'India', true, 15); | What is the average price of vegan dishes in India? | SELECT AVG(price) FROM dishes WHERE is_vegan = true AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Agricultural_Innovation_India (id INT, country VARCHAR(50), year INT, cost FLOAT); INSERT INTO Agricultural_Innovation_India (id, country, year, cost) VALUES (1, 'India', 2019, 200000.0), (2, 'India', 2020, 250000.0), (3, 'India', 2021, 300000.0); | What was the total cost of agricultural innovation projects in India in 2019? | SELECT SUM(cost) FROM Agricultural_Innovation_India WHERE country = 'India' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (event_date DATE, event_type VARCHAR(255)); INSERT INTO defense_diplomacy (event_date, event_type) VALUES ('2020-01-01', 'Summit'), ('2021-01-01', 'Conference'), ('2020-06-01', 'Workshop'); | Calculate the total defense diplomacy events in 2021 | SELECT COUNT(*) as total_events FROM defense_diplomacy WHERE YEAR(event_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Streams (state TEXT, genre TEXT, num_streams INTEGER); INSERT INTO Streams (state, genre, num_streams) VALUES ('New York', 'Pop', 500000), ('California', 'Rock', 600000), ('Texas', 'Jazz', 400000), ('Florida', 'Pop', 700000), ('New York', 'Rock', 300000), ('California', 'Jazz', 200000), ('Texas', 'Pop', 80... | What are the unique genres of music that have been streamed in each state and the total number of streams for those genres? | SELECT state, genre, SUM(num_streams) as total_streams FROM Streams GROUP BY state, genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists ai_applications (app_id INT PRIMARY KEY, name TEXT, country TEXT); INSERT INTO ai_applications (app_id, name, country) VALUES (1, 'DeepArt', 'USA'), (2, 'DeepDream', 'Canada'), (3, 'Shelley', 'USA'); | Which creative AI applications were developed in the US and Canada? | SELECT name FROM ai_applications WHERE country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (property_id INT, size FLOAT, city VARCHAR(20)); INSERT INTO properties (property_id, size, city) VALUES (1, 1200.0, 'Oakland'), (2, 1500.0, 'San_Francisco'), (3, 1000.0, 'Berkeley'); | What is the minimum size of a property in the city of Oakland? | SELECT city, MIN(size) FROM properties WHERE city = 'Oakland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bioprocess_eng (id INT PRIMARY KEY, name VARCHAR(255), description VARCHAR(255), yield FLOAT); INSERT INTO bioprocess_eng (id, name, description, yield) VALUES (1, 'Enzymatic Hydrolysis', 'Conversion of cellulose to glucose using enzymes', 0.92); | Which bioprocess engineering methods have a yield greater than 0.9? | SELECT * FROM bioprocess_eng WHERE yield > 0.9; | gretelai_synthetic_text_to_sql |
CREATE TABLE fund (id INT, name VARCHAR(50), manager_gender VARCHAR(10), strategy VARCHAR(20)); INSERT INTO fund (id, name, manager_gender, strategy) VALUES (1, 'GreenTech Fund', 'female', 'sustainable'); INSERT INTO fund (id, name, manager_gender, strategy) VALUES (2, 'InnoVentures', 'male', 'hybrid'); | What is the total number of sustainable investments made by women-led funds? | SELECT SUM(1) FROM fund WHERE manager_gender = 'female' AND strategy = 'sustainable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50)); INSERT INTO Restaurants (RestaurantID, Name) VALUES (1, 'Paleteria Y Neveria'), (2, 'Thai Spice'), (3, 'Bombay Kitchen'), (4, 'Sushi Bar'); CREATE TABLE MenuItems (MenuItemID int, RestaurantID int, Name varchar(50), Revenue decimal(5,2)); INSERT INTO MenuIt... | Calculate the average revenue per menu item for each restaurant, and find the restaurants with an average revenue per item above the overall average. | SELECT R.Name, AVG(MI.Revenue) AS AvgRevenuePerItem FROM Restaurants R JOIN MenuItems MI ON R.RestaurantID = MI.RestaurantID GROUP BY R.Name HAVING AVG(MI.Revenue) > (SELECT AVG(MI.Revenue) FROM MenuItems MI); | gretelai_synthetic_text_to_sql |
CREATE TABLE economic_diversification (id INT, initiative_name VARCHAR(50), location VARCHAR(50), implementation_date DATE); INSERT INTO economic_diversification (id, initiative_name, location, implementation_date) VALUES (1, 'Handicraft Market', 'Nepal', '2003-08-15'); | List the economic diversification initiatives in the 'economic_diversification' table that were implemented before 2005. | SELECT initiative_name, location FROM economic_diversification WHERE implementation_date < '2005-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_farms (id INT, name VARCHAR(255), size FLOAT, country VARCHAR(255)); INSERT INTO organic_farms (id, name, size, country) VALUES (1, 'Farm A', 12.5, 'USA'), (2, 'Farm B', 20.0, 'Canada'), (3, 'Farm C', 5.5, 'Mexico'); | What is the average size of small-scale organic farms in hectares, grouped by country and only considering farms with more than 50 farms? | SELECT country, AVG(size) as avg_size FROM organic_farms GROUP BY country HAVING COUNT(*) > 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, name VARCHAR(100)); CREATE TABLE episodes (id INT, tv_show_id INT, season_number INT, episode_number INT); INSERT INTO tv_shows (id, name) VALUES (1, 'Show1'), (2, 'Show2'); INSERT INTO episodes (id, tv_show_id, season_number, episode_number) VALUES (1, 1, 1, 1), (2, 1, 1, 2), (3, 2, 1, 1... | How many episodes of each TV show are there in the "episodes" table? | SELECT tv_shows.name, COUNT(episodes.id) FROM tv_shows INNER JOIN episodes ON tv_shows.id = episodes.tv_show_id GROUP BY tv_shows.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_projects (project_name TEXT, start_date DATE, end_date DATE, total_cost FLOAT); INSERT INTO construction_projects (project_name, start_date, end_date, total_cost) VALUES ('Solar Panel Installation', '2022-02-15', '2022-03-31', 12000.0), ('Green Building Demo', '2022-04-01', '2022-07-31', 15000... | What is the total cost of projects that started in the first quarter of 2022? | SELECT SUM(total_cost) FROM construction_projects WHERE start_date >= '2022-01-01' AND start_date < '2022-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_and_clean_air_coalition (fund_id INT, project_name VARCHAR(100), country VARCHAR(50), sector VARCHAR(50), amount FLOAT, renewable_energy_flag BOOLEAN); INSERT INTO climate_and_clean_air_coalition (fund_id, project_name, country, sector, amount, renewable_energy_flag) VALUES (1, 'Solar Power Africa'... | What is the average amount of climate finance provided to projects in Africa for renewable energy by the Climate and Clean Air Coalition? | SELECT AVG(amount) FROM climate_and_clean_air_coalition WHERE country = 'Africa' AND sector = 'Energy' AND renewable_energy_flag = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_locations (project_id INT, city TEXT, state TEXT); CREATE TABLE construction_workers (worker_id INT, name TEXT); CREATE TABLE worker_projects (worker_id INT, project_id INT); INSERT INTO project_locations (project_id, city, state) VALUES (1, 'Seattle', 'Washington'), (2, 'Houston', 'Texas'), (3, 'L... | Show the number of workers who have worked on projects in each state, excluding states with no construction projects. | SELECT project_locations.state, COUNT(DISTINCT worker_projects.worker_id) FROM worker_projects INNER JOIN project_locations ON worker_projects.project_id = project_locations.project_id GROUP BY project_locations.state HAVING COUNT(DISTINCT worker_projects.project_id) > 0 ORDER BY COUNT(DISTINCT worker_projects.worker_i... | gretelai_synthetic_text_to_sql |
CREATE TABLE regulatory_framework (id INT, name VARCHAR(255)); INSERT INTO regulatory_framework (id, name) VALUES (1, 'EU GDPR'), (2, 'US CFTC'), (3, 'Japan FSA'); | Update the name of the regulatory framework with id 1 to 'EU General Data Protection Regulation'. | UPDATE regulatory_framework SET name = 'EU General Data Protection Regulation' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, country VARCHAR(50)); CREATE TABLE maintenance_requests (request_id INT, equipment_id INT, request_date DATE, cost FLOAT); | Identify the total number of military equipment maintenance requests and associated costs for the top 5 countries with the most requests | SELECT m.country, COUNT(mr.request_id) AS num_requests, SUM(mr.cost) AS total_cost FROM military_equipment m JOIN maintenance_requests mr ON m.equipment_id = mr.equipment_id GROUP BY m.country ORDER BY num_requests DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vendors (VendorID INT, VendorName TEXT, Country TEXT);CREATE TABLE Products (ProductID INT, ProductName TEXT, Price DECIMAL, Organic BOOLEAN, FairTrade BOOLEAN, VendorID INT); INSERT INTO Vendors VALUES (1, 'VendorB', 'France'); INSERT INTO Products VALUES (1, 'Coffee', 7.5, true, true, 1), (2, 'Tea', 3.5,... | Find all vendors in France that sell both fair trade and organic products. | SELECT v.VendorName FROM Vendors v JOIN Products p ON v.VendorID = p.VendorID WHERE v.Country = 'France' AND p.Organic = true AND p.FairTrade = true GROUP BY v.VendorName HAVING COUNT(DISTINCT p.ProductID) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Album (AlbumID INT, ReleaseYear INT, GenreID INT); INSERT INTO Album (AlbumID, ReleaseYear, GenreID) VALUES (1, 2010, 1), (2, 2011, 1), (3, 2012, 2), (4, 2013, 2), (5, 2014, 3); | How many albums were released in each year? | SELECT ReleaseYear, COUNT(*) OVER (PARTITION BY ReleaseYear) AS AlbumCount FROM Album; | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_emergencies (id INT, incident_type VARCHAR(255), city VARCHAR(255), response_time INT, incident_date DATE); INSERT INTO medical_emergencies (id, incident_type, city, response_time, incident_date) VALUES (1, 'Medical', 'Chicago', 7, '2022-01-15'); | What is the average response time for medical emergencies in Chicago?" | SELECT AVG(response_time) as avg_response_time FROM medical_emergencies WHERE city = 'Chicago' AND incident_type = 'Medical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_aid (id INT PRIMARY KEY, aid_name VARCHAR(50), recipient_country VARCHAR(50), amount_donated DECIMAL(10,2)); INSERT INTO humanitarian_aid (id, aid_name, recipient_country, amount_donated) VALUES (5, 'Medical Aid', 'Afghanistan', 250000.00), (6, 'Food Aid', 'Afghanistan', 300000.00); | Delete records of humanitarian aid with a specific aid_name in the humanitarian_aid table. | WITH del_data AS (DELETE FROM humanitarian_aid WHERE aid_name = 'Medical Aid' RETURNING *) DELETE FROM humanitarian_aid WHERE id IN (SELECT id FROM del_data); | gretelai_synthetic_text_to_sql |
CREATE TABLE Textiles (brand VARCHAR(20), fabric_type VARCHAR(20), quantity INT); INSERT INTO Textiles (brand, fabric_type, quantity) VALUES ('Eco-friendly Fashions', 'Organic Cotton', 1500), ('Eco-friendly Fashions', 'Recycled Polyester', 2000), ('Fab Fashions', 'Viscose', 1200), ('Fab Fashions', 'Recycled Polyester',... | Find the total quantity of sustainable fabric used by the 'Green Garments' brand in the 'Textiles' table. | SELECT SUM(quantity) FROM Textiles WHERE brand = 'Green Garments'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_ethics (developer VARCHAR(255), principle VARCHAR(255)); INSERT INTO ai_ethics (developer, principle) VALUES ('IBM', 'Fairness'), ('Google', 'Accountability'), ('IBM', 'Transparency'); | Update the 'principle' column to 'Transparency' for 'IBM' in the 'ai_ethics' table | UPDATE ai_ethics SET principle = 'Transparency' WHERE developer = 'IBM'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shows (id INT, title VARCHAR(100), genre VARCHAR(50), country VARCHAR(50), release_year INT, runtime INT); | What is the average release year of shows in the shows table, excluding shows with a runtime of less than 30 minutes? | SELECT AVG(release_year) FROM shows WHERE runtime >= 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_certifications (id INT, name VARCHAR(255), certification_type VARCHAR(255)); INSERT INTO building_certifications (id, name, certification_type) VALUES (1, 'GreenBuilding1', 'LEED'), (2, 'GreenBuilding2', 'BREEAM'), (3, 'GreenBuilding3', 'WELL'); | Find the buildings certified by the same type as 'GreenBuilding3' | SELECT name FROM building_certifications WHERE certification_type = (SELECT certification_type FROM building_certifications WHERE name = 'GreenBuilding3'); | gretelai_synthetic_text_to_sql |
CREATE TABLE regulatory_frameworks (framework_id INT, framework_name VARCHAR(255), sector VARCHAR(255)); INSERT INTO regulatory_frameworks (framework_id, framework_name, sector) VALUES (1, 'Regulation1', 'NFT'), (2, 'Regulation2', 'NFT'), (3, 'Regulation3', 'Traditional Finance'); | List the regulatory frameworks in place for the 'NFT' sector. | SELECT framework_name FROM regulatory_frameworks WHERE sector = 'NFT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_providers (provider_id INT, name TEXT, city TEXT, state TEXT, score INT); INSERT INTO healthcare_providers (provider_id, name, city, state, score) VALUES (1, 'Dr. Smith', 'San Francisco', 'CA', 90), (2, 'Dr. Johnson', 'Los Angeles', 'CA', 85), (3, 'Dr. Rodriguez', 'Houston', 'TX', 95), (4, 'Dr. ... | What is the average cultural competency score for healthcare providers by city? | SELECT city, AVG(score) FROM healthcare_providers GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Country TEXT); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (1, 'John Doe', 'USA'); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (2, 'Jane Smith', 'Canada'); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount DECIMAL, DonationDate ... | Who are the top 5 donors by total donation amount in 2021? | SELECT DonorName, SUM(Donations.DonationAmount) AS TotalDonationAmount FROM Donors INNER JOIN Donations ON Donors.DonorID = Donations.DonorID GROUP BY DonorName ORDER BY TotalDonationAmount DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(100), country VARCHAR(100)); INSERT INTO players (id, name, country) VALUES (1, 'John Doe', 'United States'), (2, 'Jane Smith', 'Canada'), (3, 'Alex Brown', 'United States'); | Update the country for all players who live in 'United States' to 'USA'? | UPDATE players SET country = 'USA' WHERE country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exoplanets (ExoplanetId INT, PlanetName VARCHAR(50), DiscoveryDate DATE, StarName VARCHAR(50), PlanetType VARCHAR(50)); INSERT INTO Exoplanets (ExoplanetId, PlanetName, DiscoveryDate, StarName, PlanetType) VALUES (5, 'Kepler-10b', '2011-01-10', 'Kepler-10', 'Rocky'); | How many rocky exoplanets were discovered by NASA before 2015? | SELECT COUNT(*) FROM Exoplanets WHERE PlanetType = 'Rocky' AND DiscoveryDate < '2015-01-01' AND StarName = 'NASA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE OceanicFarm (date DATE, fish_harvested INT); INSERT INTO OceanicFarm (date, fish_harvested) VALUES ('2022-05-01', 120), ('2022-05-02', 150), ('2022-05-03', 180); | How many fish were harvested in the OceanicFarm table for May 2022? | SELECT SUM(fish_harvested) FROM OceanicFarm WHERE MONTH(date) = 5 AND YEAR(date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artifacts (ArtifactID INT, ArtifactType VARCHAR(50), Quantity INT); INSERT INTO Artifacts (ArtifactID, ArtifactType, Quantity) VALUES (1, 'Pottery', 25), (2, 'Tools', 12), (3, 'Pottery', 30); | Which artifacts have a quantity greater than the average? | SELECT ArtifactID, ArtifactType, Quantity FROM (SELECT ArtifactID, ArtifactType, Quantity, AVG(Quantity) OVER () AS AvgQuantity FROM Artifacts) AS Subquery WHERE Quantity > AvgQuantity; | gretelai_synthetic_text_to_sql |
CREATE TABLE CustomerSpendingJP (CustomerID INT, Country TEXT, AvgSpending DECIMAL(5,2)); INSERT INTO CustomerSpendingJP (CustomerID, Country, AvgSpending) VALUES (1, 'Japan', 120.50), (2, 'Japan', 110.50), (3, 'Japan', 130.50), (4, 'Japan', 90.50); CREATE TABLE CustomerSpendingKR (CustomerID INT, Country TEXT, AvgSpen... | What is the difference in average customer spending between customers in Japan and South Korea? | SELECT AVG(CSJP.AvgSpending) - AVG(CSKR.AvgSpending) FROM CustomerSpendingJP CSJP, CustomerSpendingKR CSKR WHERE CSJP.Country = 'Japan' AND CSKR.Country = 'South Korea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE probes (id INT, name VARCHAR(50), launch_date DATE, current_location VARCHAR(50), max_temperature FLOAT, min_temperature FLOAT); | What is the minimum temperature (in Kelvin) recorded by the Voyager 1 probe? | SELECT MIN(min_temperature) FROM probes WHERE name = 'Voyager 1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_statistics (state TEXT, year INTEGER, workers INTEGER, hours_worked INTEGER);INSERT INTO labor_statistics (state, year, workers, hours_worked) VALUES ('Texas', 2021, 1500, 900000), ('Texas', 2021, 2000, 1200000); | What is the total number of workers in construction labor statistics for the state of Texas for the year 2021? | SELECT SUM(workers) FROM labor_statistics WHERE state = 'Texas' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), depth FLOAT); INSERT INTO marine_protected_areas (name, depth) VALUES ('Galapagos Islands', 2000.0), ('Great Barrier Reef', 500.0); | Update the depth of the 'Galapagos Islands' marine protected area to 3000 meters | UPDATE marine_protected_areas SET depth = 3000 WHERE name = 'Galapagos Islands'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (tx_id INT, app_id INT, transaction_volume DECIMAL(10,2), transaction_date DATE); CREATE TABLE decentralized_applications (app_id INT, name VARCHAR(255)); | What is the average transaction volume for each decentralized application in the last 30 days? | SELECT app_id, name, AVG(transaction_volume) OVER (PARTITION BY app_id) as avg_transaction_volume FROM transactions t JOIN decentralized_applications d ON t.app_id = d.app_id WHERE transaction_date >= DATEADD(day, -30, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE orders(order_id INT, order_date DATE, menu_item_id INT, quantity INT); CREATE TABLE menu_items(menu_item_id INT, name TEXT, type TEXT, price DECIMAL); | How many items were sold between specific dates? | SELECT SUM(orders.quantity) FROM orders WHERE orders.order_date BETWEEN '2022-01-01' AND '2022-01-15'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (Id INT, Name VARCHAR(100), Country VARCHAR(50), Game VARCHAR(50)); INSERT INTO Players VALUES (1, 'Player1', 'USA', 'GameA'), (2, 'Player2', 'Canada', 'GameB'), (3, 'Player3', 'USA', 'GameC'), (4, 'Player4', 'Mexico', 'GameA'), (5, 'Player5', 'Canada', 'GameB'), (6, 'Player6', 'USA', 'GameD'), (7,... | How many players are there in each country playing 'RPG' games? | SELECT p.Country, COUNT(*) AS Players_Count FROM Players p JOIN Games g ON p.Game = g.Name WHERE g.Genre = 'RPG' GROUP BY p.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, case_type VARCHAR(20)); INSERT INTO cases (id, case_type) VALUES (1, 'Civil'), (2, 'Criminal'), (3, 'Civil'); | List the unique case types and the number of cases for each type, sorted alphabetically by case type. | SELECT case_type, COUNT(*) AS num_cases FROM cases GROUP BY case_type ORDER BY case_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), location VARCHAR(255), avg_depth FLOAT, max_depth FLOAT); | What is the maximum depth recorded for all marine protected areas? | SELECT max_depth FROM marine_protected_areas; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidity (region VARCHAR(255), year INT, acidity FLOAT); INSERT INTO ocean_acidity (region, year, acidity) VALUES ('Arctic', 2010, 8.1), ('Arctic', 2011, 8.15), ('Arctic', 2012, 8.2), ('Atlantic', 2010, 8.05), ('Atlantic', 2011, 8.08), ('Atlantic', 2012, 8.1); | What is the difference in ocean acidity levels between the Arctic and Atlantic regions? | SELECT region, acidity - LAG(acidity) OVER(PARTITION BY region ORDER BY year) as acidity_difference FROM ocean_acidity; | gretelai_synthetic_text_to_sql |
CREATE TABLE advisory_levels (id INT, country VARCHAR(20), advisory_level INT, advisory_date DATE); INSERT INTO advisory_levels (id, country, advisory_level, advisory_date) VALUES (1, 'Kenya', 2, '2021-01-01'), (2, 'Tanzania', 3, '2021-01-02'), (3, 'Kenya', 2, '2021-01-03'); | What is the average travel advisory level for African countries in 2021? | SELECT AVG(advisory_level) FROM advisory_levels WHERE country IN ('Kenya', 'Tanzania', 'Nigeria', 'Egypt', 'South Africa') AND advisory_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incomes (id INT, province VARCHAR(50), income FLOAT, year INT); INSERT INTO incomes (id, province, income, year) VALUES (1, 'Ontario', 55000, 2020), (2, 'Quebec', 48000, 2020), (3, 'British Columbia', 60000, 2020), (4, 'Alberta', 70000, 2020), (5, 'Manitoba', 45000, 2020); | What is the average income of citizens in each Canadian province in 2020? | SELECT province, AVG(income) FROM incomes WHERE year = 2020 GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (id INT, dish TEXT, ingredient TEXT, cost FLOAT); INSERT INTO ingredients (id, dish, ingredient, cost) VALUES (1, 'Paella', 'Rice', 1.50); INSERT INTO ingredients (id, dish, ingredient, cost) VALUES (2, 'Paella', 'Chicken', 5.00); | What is the total cost of ingredients for dish 'Paella' in the ingredients table? | SELECT SUM(cost) FROM ingredients WHERE dish = 'Paella'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (id INT, product_id INT, name TEXT, is_organic BOOLEAN, weight FLOAT); INSERT INTO inventory (id, product_id, name, is_organic, weight) VALUES (1, 1, 'apple', true, 0.5), (2, 2, 'banana', false, 0.3), (3, 3, 'carrot', true, 1.0), (4, 4, 'broccoli', true, 2.0); | What is the total weight of organic fruits and vegetables in the inventory? | SELECT SUM(weight) FROM inventory WHERE is_organic = true AND category = 'fruit' OR category = 'vegetable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Categories (category_id INT, category VARCHAR(50), PRIMARY KEY (category_id)); INSERT INTO Categories (category_id, category) VALUES (1, 'Kids'), (2, 'Adults'); | What was the maximum price of kids' garments in Australia? | SELECT MAX(price) as max_price FROM Products JOIN Categories ON Products.category = Categories.category WHERE Categories.category = 'Kids' AND Products.country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DailyIncidents (id INT, incident_date DATE, incident_count INT); INSERT INTO DailyIncidents (id, incident_date, incident_count) VALUES (1, '2021-01-01', 10), (2, '2021-01-02', 15); | What is the average number of security incidents per day for the last year? | SELECT AVG(incident_count) as daily_average FROM DailyIncidents WHERE incident_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS military_tech; CREATE TABLE IF NOT EXISTS tech_budget (id INT PRIMARY KEY, name TEXT, budget DECIMAL(10, 2)); INSERT INTO tech_budget (id, name, budget) VALUES (1, 'F-35 Fighter Jet', 100000000.00), (2, 'Navy Destroyer', 50000000.00), (3, 'Submarine', 70000000.00); | What is the name of the military technology with the highest budget? | SELECT name FROM military_tech.tech_budget WHERE budget = (SELECT MAX(budget) FROM military_tech.tech_budget); | gretelai_synthetic_text_to_sql |
CREATE TABLE sourcing (country VARCHAR(255), material VARCHAR(255), eco_friendly BOOLEAN); | What is the distribution of eco-friendly materials sourced by country and material type? | SELECT country, material, COUNT(*) as eco_friendly_materials_count FROM sourcing WHERE eco_friendly = TRUE GROUP BY country, material; | gretelai_synthetic_text_to_sql |
CREATE TABLE Arctic_Research_Station_11 (date DATE, snow_depth FLOAT); CREATE TABLE Arctic_Research_Station_12 (date DATE, snow_depth FLOAT); | What is the maximum snow depth recorded in the Arctic Research Station 11 and 12? | SELECT MAX(snow_depth) FROM Arctic_Research_Station_11; SELECT MAX(snow_depth) FROM Arctic_Research_Station_12; SELECT GREATEST(MAX(snow_depth), MAX(snow_depth)) FROM Arctic_Research_Station_11, Arctic_Research_Station_12; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(255), founder VARCHAR(255), founder_country VARCHAR(255), founder_gender VARCHAR(10)); INSERT INTO company (id, name, founder, founder_country, founder_gender) VALUES (1, 'Acme Inc', 'Sara', 'India', 'female'), (2, 'Beta Corp', 'Ahmed', 'Pakistan', 'male'), (3, 'Charlie Inc', ... | What is the total number of founders who are female or from India? | SELECT COUNT(*) FROM company WHERE founder_gender = 'female' OR founder_country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_violations (site_id INT, site_name TEXT, violation_date DATE); | List all mining sites that have reported environmental violations. | SELECT site_name FROM environmental_violations WHERE violation_date IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE visual_art_exhibitions (id INT, exhibition_name VARCHAR(255), city VARCHAR(255), visitor_count INT); | What is the total number of visitors to visual art exhibitions by city? | SELECT city, SUM(visitor_count) as total_visitors FROM visual_art_exhibitions GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_charging_stations (id INT, name VARCHAR(255), city VARCHAR(255), capacity FLOAT, installation_date DATE); | What is the total number of electric vehicle charging stations in the city of Seattle, and what is their total capacity? | SELECT COUNT(*) AS total_stations, SUM(capacity) AS total_capacity FROM ev_charging_stations WHERE city = 'Seattle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, product_name VARCHAR(50), country VARCHAR(50), quantity INT, sale_date DATE); | Select all records from sales table where country='India' and quantity>10 | SELECT * FROM sales WHERE country = 'India' AND quantity > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE MarineSpecies (SpeciesID INT, SpeciesName VARCHAR(255), Habitat VARCHAR(255), ConservationStatus VARCHAR(255)); | Update the 'ConservationStatus' of the 'Shark' species in the 'MarineSpecies' table | UPDATE MarineSpecies SET ConservationStatus = 'Vulnerable' WHERE SpeciesName = 'Shark'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(50), Gender VARCHAR(10), Salary FLOAT, HireDate DATE); INSERT INTO Employees (EmployeeID, Department, Gender, Salary, HireDate) VALUES (1, 'IT', 'Male', 85000, '2021-04-20'), (2, 'HR', 'Female', 75000, '2020-02-15'), (3, 'IT', 'Female', 80000, '2020-01-08'), (4... | How many female employees were hired in each department in 2020? | SELECT Department, COUNT(*) FROM Employees WHERE Gender = 'Female' AND YEAR(HireDate) = 2020 GROUP BY Department; | 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); | List all regions and their total carbon sequestration. | SELECT region, SUM(amount) FROM carbon_sequestration GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID int, ProgramName varchar(50), Category varchar(50)); INSERT INTO Programs (ProgramID, ProgramName, Category) VALUES (1, 'Theater Workshop', 'Arts & Culture'), (2, 'Eco-Gardening', 'Environment'); CREATE TABLE Donations (DonationID int, DonationAmount decimal(10,2), ProgramID int); INSER... | What are the total donation amounts for each program in the 'Arts & Culture' and 'Environment' categories? | SELECT p.Category, SUM(d.DonationAmount) as TotalDonationAmount FROM Donations d JOIN Programs p ON d.ProgramID = p.ProgramID WHERE p.Category IN ('Arts & Culture', 'Environment') GROUP BY p.Category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Venues (VenueID INT, VenueName VARCHAR(100), Location VARCHAR(50)); INSERT INTO Venues (VenueID, VenueName, Location) VALUES (1001, 'VenueA', 'New York'), (1002, 'VenueB', 'Los Angeles'), (1003, 'VenueC', 'Tokyo'), (1004, 'VenueD', 'Paris'), (1005, 'VenueE', 'Sydney'); CREATE TABLE Concerts (ConcertID INT,... | Which artists have performed in 'Tokyo' and 'Paris'? | SELECT ArtistID FROM Concerts C1 JOIN Venues V1 ON C1.VenueID = V1.VenueID WHERE V1.Location = 'Tokyo' INTERSECT SELECT ArtistID FROM Concerts C2 JOIN Venues V2 ON C2.VenueID = V2.VenueID WHERE V2.Location = 'Paris'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings.building_energy_consumption (city VARCHAR(50), consumption FLOAT); INSERT INTO green_buildings.building_energy_consumption (city, consumption) VALUES ('London', 5000.0), ('Tokyo', 6000.0), ('Sydney', 7000.0), ('Paris', 8000.0), ('Berlin', 1500.0), ('Rome', 2500.0); | What is the sum of energy consumption for buildings in the 'green_buildings' schema, grouped by city, and only for buildings with consumption > 2000? | SELECT city, SUM(consumption) AS total_consumption FROM green_buildings.building_energy_consumption WHERE consumption > 2000 GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_spending (customer_id INT, product_id INT, quantity INT, revenue FLOAT, is_ethically_sourced BOOLEAN); | Identify the top 3 customers by total spending on ethically sourced products | SELECT customer_id, SUM(revenue) as total_spending FROM customer_spending WHERE is_ethically_sourced = TRUE GROUP BY customer_id ORDER BY total_spending DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (id INT, shipped_date DATE, destination VARCHAR(20), weight INT); INSERT INTO shipments (id, shipped_date, destination, weight) VALUES (1, '2022-03-05', 'South America', 150), (2, '2022-03-07', 'North America', 200), (3, '2022-03-16', 'South America', 250); | What is the maximum weight of shipments sent to 'South America' in March? | SELECT MAX(weight) FROM shipments WHERE shipped_date >= '2022-03-01' AND shipped_date < '2022-04-01' AND destination = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Race VARCHAR(255), Score INT); INSERT INTO CommunityHealthWorkers (WorkerID, Race, Score) VALUES (1, 'Hispanic', 85), (2, 'African American', 85), (3, 'Caucasian', 90); | How many community health workers of each race have a cultural competency score greater than 80? | SELECT Race, COUNT(*) as Count FROM CommunityHealthWorkers WHERE Score > 80 GROUP BY Race; | gretelai_synthetic_text_to_sql |
CREATE TABLE cyber_attacks (attack_id INT, attack_date DATE, attack_country VARCHAR(50), attack_ip VARCHAR(50)); INSERT INTO cyber_attacks (attack_id, attack_date, attack_country, attack_ip) VALUES (1, '2022-01-01', 'USA', '192.168.1.1'), (2, '2022-01-02', 'Canada', '192.168.1.2'), (3, '2022-01-01', 'USA', '192.168.1.3... | List the top 3 countries with the most unique IP addresses involved in cyber attacks in the last month. | SELECT attack_country, COUNT(DISTINCT attack_ip) as unique_ips FROM cyber_attacks WHERE attack_date >= DATEADD(month, -1, GETDATE()) GROUP BY attack_country ORDER BY unique_ips DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_facilities (id INT, name VARCHAR(50), state VARCHAR(10)); INSERT INTO healthcare_facilities (id, name, state) VALUES (1, 'Facility A', 'State 1'), (2, 'Facility B', 'State 2'), (3, 'Facility C', 'State 3'); | List the names of states that have both healthcare facilities and mental health facilities. | SELECT h.state FROM healthcare_facilities h INNER JOIN mental_health_facilities m ON h.state = m.state GROUP BY h.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE FinancialWellbeingPrograms (id INT, program_name VARCHAR(50), country VARCHAR(50), income FLOAT, expenses FLOAT); INSERT INTO FinancialWellbeingPrograms (id, program_name, country, income, expenses) VALUES (1, 'Financial Literacy Program', 'UK', 30000, 18000), (2, 'Debt Management Program', 'UK', 35000, 21... | What is the average income and expenses for financial wellbeing programs in the United Kingdom? | SELECT country, AVG(income) as avg_income, AVG(expenses) as avg_expenses FROM FinancialWellbeingPrograms WHERE country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PollutionTypes (id INT PRIMARY KEY, type VARCHAR(255)); CREATE TABLE PollutionProjects (id INT PRIMARY KEY, type_id INT, name VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE, FOREIGN KEY (type_id) REFERENCES PollutionTypes(id)); | Find the number of pollution control initiatives by type in the 'PollutionTypes' and 'PollutionProjects' tables | SELECT PollutionTypes.type, COUNT(*) FROM PollutionTypes INNER JOIN PollutionProjects ON PollutionTypes.id = PollutionProjects.type_id GROUP BY PollutionTypes.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResidentialWaterConsumption (date DATE, city VARCHAR(20), water_consumption FLOAT); | What is the total volume of water (in cubic meters) consumed by the residential sector in Mexico City in the year 2020? | SELECT SUM(water_consumption) FROM ResidentialWaterConsumption WHERE date BETWEEN '2020-01-01' AND '2020-12-31' AND city = 'Mexico City'; | 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.