context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE clean_energy_policies_oceania (id INT, policy VARCHAR(50), region VARCHAR(50)); INSERT INTO clean_energy_policies_oceania (id, policy, region) VALUES (1, 'Renewable Energy Target', 'oceania'), (2, 'Carbon Price', 'oceania'), (3, 'Feed-in Tariff', 'oceania');
What is the number of clean energy policies in the 'oceania' region, ranked in descending order?
SELECT region, COUNT(policy) as total_policies FROM clean_energy_policies_oceania WHERE region = 'oceania' GROUP BY region ORDER BY total_policies DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE FestivalRevenue (region VARCHAR(255), year INT, revenue FLOAT);
What is the total revenue from music festivals in Europe in 2021?
SELECT SUM(revenue) FROM FestivalRevenue WHERE region = 'Europe' AND year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE Vessels(Id INT, Name VARCHAR(255), AverageSpeed DECIMAL(5,2)); INSERT INTO Vessels VALUES (1, 'VesselA', 15.5), (2, 'CoastalCruiser', 18.3), (3, 'VesselC', 20.2);
What is the average speed in knots for the vessel 'CoastalCruiser'?
SELECT AVG(v.AverageSpeed) FROM Vessels v WHERE v.Name = 'CoastalCruiser';
gretelai_synthetic_text_to_sql
CREATE TABLE ai_safety_initiatives (country TEXT, initiative_name TEXT); CREATE TABLE countries (country TEXT, continent TEXT);
List all countries with their respective AI safety initiatives count.
SELECT c.country, COUNT(ai_safety_initiatives.country) FROM countries c LEFT JOIN ai_safety_initiatives ON c.country = ai_safety_initiatives.country GROUP BY c.country;
gretelai_synthetic_text_to_sql
CREATE TABLE SafetyPapers (id INT, title VARCHAR(255), year INT);
What are the names of all AI safety research papers that were published in the year 2020?
SELECT title FROM SafetyPapers WHERE year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Streaming (id INT, artist VARCHAR(50), streams INT, country VARCHAR(50)); INSERT INTO Streaming (id, artist, streams, country) VALUES (1, 'Arijit Singh', 1500000, 'India'), (2, 'Shreya Ghoshal', 1200000, 'India'), (3, 'Badshah', 1000000, 'India');
What is the minimum number of streams for any artist from India?
SELECT MIN(streams) FROM Streaming WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE accidents (accident_id INT, aircraft_model VARCHAR(50), num_injuries INT, accident_year INT); INSERT INTO accidents (accident_id, aircraft_model, num_injuries, accident_year) VALUES (1, 'Airbus A320', 20, 2010), (2, 'Airbus A330', 30, 2011), (3, 'Airbus A340', 10, 2012), (4, 'Airbus A350', 5, 2013), (5, 'A...
What is the average number of injuries in Airbus aircraft accidents since 2010?
SELECT AVG(num_injuries) FROM accidents WHERE aircraft_model LIKE 'Airbus%' AND accident_year >= 2010;
gretelai_synthetic_text_to_sql
CREATE TABLE loans (id INT, employee_id INT, amount INT, is_shariah_compliant BOOLEAN, financial_wellbeing_score INT); INSERT INTO loans (id, employee_id, amount, is_shariah_compliant, financial_wellbeing_score) VALUES (1, 2, 25000, TRUE, 7), (2, 2, 40000, TRUE, 9), (3, 3, 50000, FALSE, 8);
Find the average financial wellbeing score for Shariah-compliant loans in Florida?
SELECT AVG(loans.financial_wellbeing_score) FROM loans WHERE loans.is_shariah_compliant = TRUE AND loans.id IN (SELECT loan_id FROM customers WHERE customers.city = 'Florida');
gretelai_synthetic_text_to_sql
CREATE TABLE Finance (country VARCHAR(255)); INSERT INTO Finance VALUES ('Country1'), ('Country2'), ('Country3'); CREATE TABLE Communication (country VARCHAR(255)); INSERT INTO Communication VALUES ('Country1'), ('Country3'), ('Country4');
List all unique countries involved in "Finance" projects that don't have any "Communication" projects in the same countries.
SELECT Finance.country FROM Finance WHERE Finance.country NOT IN (SELECT Communication.country FROM Communication)
gretelai_synthetic_text_to_sql
CREATE TABLE Menu (item_id INT, name VARCHAR(50), has_meat BOOLEAN, has_dairy BOOLEAN); INSERT INTO Menu (item_id, name, has_meat, has_dairy) VALUES (1, 'Cheese Pizza', true, true), (2, 'Garden Salad', false, false), (3, 'Vegan Pizza', false, false);
How many menu items contain both meat and dairy products?
SELECT COUNT(*) FROM Menu WHERE has_meat = true AND has_dairy = true;
gretelai_synthetic_text_to_sql
CREATE TABLE Chemicals (id INT, name VARCHAR(255), max_safe_pressure FLOAT); CREATE TABLE Storage (id INT, chemical_id INT, facility_id INT, storage_date DATE);
What is the maximum safe pressure for each chemical stored at a specific facility?
SELECT Chemicals.name, Chemicals.max_safe_pressure FROM Chemicals INNER JOIN Storage ON Chemicals.id = Storage.chemical_id WHERE Storage.facility_id = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE garment_suppliers(supplier_id INT, country VARCHAR(255), lead_time FLOAT); INSERT INTO garment_suppliers(supplier_id, country, lead_time) VALUES (1, 'Bangladesh', 60.5), (2, 'China', 45.3), (3, 'Vietnam', 52.7);
What is the average lead time for each country of garment suppliers?
SELECT country, AVG(lead_time) FROM garment_suppliers GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE MentalHealthParityRace (ViolationID INT, Race VARCHAR(255), ViolationDate DATE); INSERT INTO MentalHealthParityRace (ViolationID, Race, ViolationDate) VALUES (1, 'Hispanic', '2022-01-01'), (2, 'African American', '2022-02-01'), (3, 'Hispanic', '2022-03-01');
How many mental health parity violations were reported by race?
SELECT Race, COUNT(*) as ViolationCount FROM MentalHealthParityRace GROUP BY Race;
gretelai_synthetic_text_to_sql
CREATE TABLE organizations (id INT, name VARCHAR(100), sector VARCHAR(50), ESG_score FLOAT); INSERT INTO organizations (id, name, sector, ESG_score) VALUES (1, 'Tesla', 'Technology', 85.0), (2, 'Microsoft', 'Technology', 82.5), (3, 'IBM', 'Technology', 80.0);
What is the average ESG score for organizations in the technology sector?
SELECT AVG(ESG_score) FROM organizations WHERE sector = 'Technology';
gretelai_synthetic_text_to_sql
CREATE TABLE satellites (id INT, name TEXT, country TEXT, launch_date DATE); INSERT INTO satellites (id, name, country, launch_date) VALUES (1, 'Himawari-8', 'Japan', '2014-10-07'); INSERT INTO satellites (id, name, country, launch_date) VALUES (2, 'GCOM-W1', 'Japan', '2012-05-18');
List the names and launch dates of satellites from Japan
SELECT name, launch_date FROM satellites WHERE country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE affordable_housing (community_id INT, property_id INT, price DECIMAL(10,2)); INSERT INTO affordable_housing (community_id, property_id, price) VALUES (1, 111, 200000.00), (1, 112, 215000.00), (2, 221, 185000.00);
What's the minimum property price in affordable housing areas?
SELECT MIN(price) FROM affordable_housing;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellite_Imagery_Analysis (id INT, analysis_type VARCHAR(50), Farm_id INT); INSERT INTO Satellite_Imagery_Analysis (id, analysis_type, Farm_id) VALUES (1, 'NDVI', 1), (2, 'EVI', 2), (3, 'SAVI', 3);
List all distinct satellite imagery analysis types performed in the USA and Australia.
SELECT DISTINCT analysis_type FROM Satellite_Imagery_Analysis WHERE Farm_id IN (SELECT id FROM Farmers WHERE country IN ('USA', 'Australia'));
gretelai_synthetic_text_to_sql
CREATE TABLE ev_adoption_stats (id INT, city VARCHAR, state VARCHAR, num_evs INT);
List the top 3 cities with the most electric vehicle adoption in the 'ev_adoption_stats' table.
SELECT city, state, num_evs, RANK() OVER (PARTITION BY state ORDER BY num_evs DESC) as rank FROM ev_adoption_stats WHERE rank <= 3;
gretelai_synthetic_text_to_sql
CREATE TABLE species_data (species_id INT, species_name VARCHAR(255), biomass FLOAT); INSERT INTO species_data (species_id, species_name, biomass) VALUES (1, 'polar_bear', 800.0), (2, 'arctic_fox', 15.0), (3, 'caribou', 220.0), (4, 'lemming', 5.0);
Delete records with a biomass value lower than 10 in the 'species_data' table.
DELETE FROM species_data WHERE biomass < 10;
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityCenters (CenterID INT, CenterName VARCHAR(50)); CREATE TABLE LanguageCourses (CourseID INT, CourseName VARCHAR(50), CenterID INT); INSERT INTO CommunityCenters VALUES (1, 'CenterA'), (2, 'CenterB'), (3, 'CenterC'); INSERT INTO LanguageCourses VALUES (1, 'Spanish', 1), (2, 'French', 1), (3, 'Spanis...
What is the total number of language courses offered per community center?
SELECT CC.CenterName, COUNT(LC.CourseID) AS TotalCourses FROM CommunityCenters CC JOIN LanguageCourses LC ON CC.CenterID = LC.CenterID GROUP BY CC.CenterName;
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists bike_trips (id INT, city VARCHAR(20), num_trips INT); INSERT INTO bike_trips (id, city, num_trips) VALUES (1, 'Beijing', 10000), (2, 'Shanghai', 8000);
What is the total number of bike-sharing trips in Beijing?
SELECT num_trips FROM bike_trips WHERE city = 'Beijing';
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tourism_italy (location TEXT, year INT, revenue INT); INSERT INTO virtual_tourism_italy (location, year, revenue) VALUES ('Rome', 2022, 1200000), ('Rome', 2023, 1400000);
What is the virtual tourism revenue in Rome for 2022?
SELECT revenue FROM virtual_tourism_italy WHERE location = 'Rome' AND year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE Garments (id INT, name VARCHAR(255), category VARCHAR(255), color VARCHAR(255), size VARCHAR(10), price DECIMAL(5, 2));
Update the color of all garments in the 'Tops' category to 'Red'
UPDATE Garments SET color = 'Red' WHERE category = 'Tops';
gretelai_synthetic_text_to_sql
CREATE TABLE wastewater_treatment (region VARCHAR(255), year INT, treated_volume INT); INSERT INTO wastewater_treatment (region, year, treated_volume) VALUES ('North', 2018, 4000), ('North', 2019, 4500), ('South', 2018, 4800), ('South', 2019, 5200); CREATE TABLE drought_info (region VARCHAR(255), year INT, severity INT...
What is the total volume of wastewater treated in regions that experienced a drought in 2018?
SELECT SUM(w.treated_volume) FROM wastewater_treatment w JOIN drought_info d ON w.region = d.region WHERE w.year = 2018 AND d.severity > 0;
gretelai_synthetic_text_to_sql
CREATE TABLE SharedMobilityNYC (id INT, program VARCHAR(20), num_vehicles INT, agency VARCHAR(20));
Insert new records of shared mobility programs in NYC.
INSERT INTO SharedMobilityNYC (id, program, num_vehicles, agency) VALUES (1, 'CitiBike NYC', 1000, 'NYC DOT'), (2, 'Revel NYC', 500, 'NYC DOT'), (3, 'Via NYC', 200, 'NYC DOT'), (4, 'Lyft Bikes NYC', 300, 'NYC DOT');
gretelai_synthetic_text_to_sql
CREATE TABLE concert_ticket_sales (ticket_id INT, song_id INT, quantity INT, price FLOAT, city_id INT, sale_date DATE);
What is the average ticket price per city in 'concert_ticket_sales' table?
SELECT city_id, AVG(price) as avg_price FROM concert_ticket_sales GROUP BY city_id;
gretelai_synthetic_text_to_sql
use rural_health; CREATE TABLE hospital_specialists (id int, hospital_id int, specialist text); INSERT INTO hospital_specialists (id, hospital_id, specialist) VALUES (1, 1, 'Cardiologist'); INSERT INTO hospital_specialists (id, hospital_id, specialist) VALUES (2, 1, 'Dermatologist'); INSERT INTO hospital_specialists (i...
What is the distribution of medical specialists by rural hospital?
SELECT hospital_id, specialist, COUNT(*) as count FROM rural_health.hospital_specialists GROUP BY hospital_id, specialist;
gretelai_synthetic_text_to_sql
CREATE TABLE CHWTraining (CHWId INT, TrainingYear INT, Region VARCHAR(255)); INSERT INTO CHWTraining (CHWId, TrainingYear, Region) VALUES (1, 2018, 'North'); INSERT INTO CHWTraining (CHWId, TrainingYear, Region) VALUES (2, 2019, 'South'); INSERT INTO CHWTraining (CHWId, TrainingYear, Region) VALUES (3, 2020, 'East'); I...
How many community health workers have been trained in each region in the last 5 years?
SELECT Region, COUNT(*) FROM CHWTraining WHERE TrainingYear BETWEEN 2018 AND 2022 GROUP BY Region;
gretelai_synthetic_text_to_sql
CREATE TABLE transactions_4 (id INT, customer_id INT, amount DECIMAL(10,2), tx_date DATE, country VARCHAR(255)); INSERT INTO transactions_4 (id, customer_id, amount, tx_date, country) VALUES (1, 1, 100.00, '2022-01-01', 'India'), (2, 2, 50.00, '2022-01-01', 'USA'), (3, 3, 200.00, '2022-01-02', 'Canada'), (4, 1, 300.00,...
Find the transaction dates and the total transaction amount for transactions made by customers residing in India.
SELECT tx_date, SUM(amount) as total_transaction_amount FROM transactions_4 WHERE country = 'India' GROUP BY tx_date;
gretelai_synthetic_text_to_sql
CREATE TABLE waste_generation (city VARCHAR(20), year INT, daily_waste_generation FLOAT);INSERT INTO waste_generation (city, year, daily_waste_generation) VALUES ('San Francisco', 2019, 3.2), ('San Francisco', 2020, 3.5), ('San Francisco', 2021, 3.7), ('Oakland', 2019, 2.8), ('Oakland', 2020, 3.1), ('Oakland', 2021, 3....
Calculate the average daily waste generation rate for the city of San Francisco in the year 2020
SELECT AVG(daily_waste_generation) FROM waste_generation WHERE city = 'San Francisco' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE RuralHealthFacility10 (patient_id INT, patient_name VARCHAR(50), age INT, diagnosis VARCHAR(20)); INSERT INTO RuralHealthFacility10 (patient_id, patient_name, age, diagnosis) VALUES (22, 'Penny', 42, 'diabetes'), (23, 'Quentin', NULL, 'hypertension'), (24, 'Rosa', 47, NULL);
Delete records of patients without a diagnosis in 'RuralHealthFacility10'.
DELETE FROM RuralHealthFacility10 WHERE diagnosis IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE Claims (ClaimID INT, PolicyID INT, ClaimAmount DECIMAL(10,2)); CREATE TABLE Policy (PolicyID INT, PolicyType VARCHAR(20), Country VARCHAR(20)); INSERT INTO Claims (ClaimID, PolicyID, ClaimAmount) VALUES (1, 1, 1500.00), (2, 2, 250.00), (3, 3, 500.00), (4, 1, 1000.00); INSERT INTO Policy (PolicyID, PolicyTy...
What is the average claim amount for each policy type, excluding policy types with fewer than 3 policies in the United Kingdom?
SELECT Policy.PolicyType, AVG(Claims.ClaimAmount) AS AvgClaimAmount FROM Policy INNER JOIN Claims ON Policy.PolicyID = Claims.PolicyID WHERE Policy.Country = 'UK' GROUP BY Policy.PolicyType HAVING COUNT(DISTINCT Policy.PolicyID) >= 3;
gretelai_synthetic_text_to_sql
CREATE TABLE MakeupProducts(productID INT, productName VARCHAR(50), price DECIMAL(5,2), isVegan BOOLEAN, country VARCHAR(50)); INSERT INTO MakeupProducts(productID, productName, price, isVegan, country) VALUES (1, 'Red Lipstick', 32.99, FALSE, 'US'), (2, 'Black Mascara', 19.99, TRUE, 'Germany'), (3, 'Brown Eyeshadow', ...
What is the maximum price of vegan makeup products sold in Germany?
SELECT MAX(price) FROM MakeupProducts WHERE country = 'Germany' AND isVegan = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE autonomous_driving_tests (id INT PRIMARY KEY, company VARCHAR(255), test_location VARCHAR(255), test_date DATE, safety_rating INT);
Add a new safety testing record for 'Cruise Automation' in the 'autonomous_driving_tests' table
INSERT INTO autonomous_driving_tests (company, test_location, test_date, safety_rating) VALUES ('Cruise Automation', 'San Francisco', '2023-01-05', 95);
gretelai_synthetic_text_to_sql
CREATE TABLE zinc_mines (id INT, name TEXT, location TEXT, zinc_production INT); INSERT INTO zinc_mines (id, name, location, zinc_production) VALUES (1, 'Antamina', 'Ancash, Peru', 560000), (2, 'Cerro Verde', 'Arequipa, Peru', 480000), (3, 'Tara', 'Junin, Peru', 340000);
What is the sum of zinc produced by mines in Peru?
SELECT SUM(zinc_production) FROM zinc_mines WHERE location LIKE '%Peru%';
gretelai_synthetic_text_to_sql
CREATE TABLE tours(id INT, name TEXT, eco_friendly BOOLEAN, revenue FLOAT); INSERT INTO tours (id, name, eco_friendly, revenue) VALUES (1, 'Amazon Rainforest Tour', TRUE, 5000), (2, 'City Bus Tour', FALSE, 2000), (3, 'Solar Powered Bike Tour', TRUE, 3000);
How many eco-friendly tours are there in total?
SELECT COUNT(*) FROM tours WHERE eco_friendly = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE production (id INT, crop VARCHAR(255), country VARCHAR(255), quantity INT); INSERT INTO production (id, crop, country, quantity) VALUES (1, 'wheat', 'USA', 5000000), (2, 'wheat', 'Canada', 3000000), (3, 'rice', 'China', 8000000), (4, 'wheat', 'Australia', 2500000);
Identify the top 3 countries with the highest wheat production in the 'agriculture' database.
SELECT country, SUM(quantity) as total_production FROM production WHERE crop = 'wheat' GROUP BY country ORDER BY total_production DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE animal_habitat (habitat_id INT, habitat_name VARCHAR(50), animal_name VARCHAR(50), acres FLOAT); INSERT INTO animal_habitat (habitat_id, habitat_name, animal_name, acres) VALUES (1, 'African Savannah', 'Lion', 5000.0), (2, 'Asian Rainforest', 'Tiger', 2000.0), (3, 'African Rainforest', 'Elephant', 3000.0);
What is the total number of acres of habitat for each animal species in the 'animal_habitat' table?
SELECT animal_name, SUM(acres) FROM animal_habitat GROUP BY animal_name;
gretelai_synthetic_text_to_sql
CREATE TABLE Farm (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE Species (id INT, name VARCHAR(50), scientific_name VARCHAR(50)); CREATE TABLE FarmSpecies (farm_id INT, species_id INT, biomass INT);
Calculate the total biomass of fish in all aquaculture farms, categorized by the farm's country.
SELECT f.country, SUM(fs.biomass) FROM Farm f JOIN FarmSpecies fs ON f.id = fs.farm_id GROUP BY f.country;
gretelai_synthetic_text_to_sql
CREATE TABLE WastewaterTreatment (record_id INT, treatment_date DATE, region VARCHAR(20)); INSERT INTO WastewaterTreatment (record_id, treatment_date, region) VALUES (1, '2019-01-01', 'RegionA'), (2, '2021-05-03', 'RegionB'), (3, '2018-07-15', 'RegionC');
Update wastewater treatment records with treatment_date in 2022 in 'WastewaterTreatment' table?
UPDATE WastewaterTreatment SET treatment_date = '2022-01-01' WHERE record_id = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Policyholders (PolicyholderID INT, Country VARCHAR(50), Cancelled BOOLEAN, FirstMonth BOOLEAN); INSERT INTO Policyholders VALUES (1, 'Mexico', TRUE, TRUE); INSERT INTO Policyholders VALUES (2, 'Mexico', FALSE, TRUE); INSERT INTO Policyholders VALUES (3, 'Mexico', FALSE, FALSE);
What is the policy cancellation rate for policyholders from Mexico, calculated as the percentage of policyholders who cancelled their policies within the first month?
SELECT COUNT(*) * 100.0 / SUM(CASE WHEN FirstMonth THEN 1 ELSE 0 END) AS PolicyCancellationRate FROM Policyholders WHERE Country = 'Mexico';
gretelai_synthetic_text_to_sql
CREATE TABLE events (event_id INT, team_id INT, num_fans INT);
What is the maximum number of fans in the 'events' table?
SELECT MAX(num_fans) FROM events;
gretelai_synthetic_text_to_sql
CREATE TABLE ExcavationSites (SiteID int, SiteName varchar(50), Location varchar(50)); CREATE TABLE Artifacts (ArtifactID int, SiteID int, Age varchar(20), Description varchar(100));
What are the names and locations of all excavation sites that have yielded bronze age artifacts?
SELECT ExcavationSites.SiteName, ExcavationSites.Location FROM ExcavationSites INNER JOIN Artifacts ON ExcavationSites.SiteID = Artifacts.SiteID WHERE Artifacts.Age = 'Bronze Age';
gretelai_synthetic_text_to_sql
CREATE TABLE Roads (id INT, name TEXT, length REAL, intersects_river BOOLEAN); INSERT INTO Roads (id, name, length, intersects_river) VALUES (1, 'I-5', 1381.5, TRUE), (2, 'I-80', 2899.8, FALSE), (3, 'I-90', 3020.5, FALSE);
What is the total length of all the roads in the road network that intersect with a river?
SELECT SUM(length) FROM Roads WHERE intersects_river = TRUE
gretelai_synthetic_text_to_sql
CREATE TABLE investments (id INT, initiative TEXT, country TEXT, investment FLOAT); INSERT INTO investments (id, initiative, country, investment) VALUES (1, 'Training', 'Nigeria', 50000), (2, 'Workshop', 'South Africa', 75000);
What is the total investment in community development initiatives in Nigeria and South Africa?
SELECT SUM(investment) FROM investments WHERE country IN ('Nigeria', 'South Africa');
gretelai_synthetic_text_to_sql
CREATE TABLE energy_efficiency (id INT, appliance TEXT, country TEXT, rating FLOAT); INSERT INTO energy_efficiency (id, appliance, country, rating) VALUES (1, 'Fridge', 'Japan', 5.0), (2, 'TV', 'Japan', 4.5);
What is the maximum energy efficiency rating of appliances in Japan?
SELECT MAX(rating) FROM energy_efficiency WHERE country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE ModernArtMuseum(id INT, type VARCHAR(20), artist VARCHAR(30)); CREATE TABLE ContemporaryArtGallery(id INT, type VARCHAR(20), artist VARCHAR(30)); INSERT INTO ModernArtMuseum(id, type, artist) VALUES (1, 'Painting', 'Matisse'), (2, 'Sculpture', 'Brancusi'), (3, 'Painting', 'Miro'); INSERT INTO ContemporaryA...
What is the difference in the number of art pieces between the Modern Art Museum and the Contemporary Art Gallery?
SELECT COUNT(*) FROM ModernArtMuseum.artpieces EXCEPT SELECT COUNT(*) FROM ContemporaryArtGallery.artpieces;
gretelai_synthetic_text_to_sql
CREATE TABLE Restaurant (id INT, name VARCHAR(50), city VARCHAR(50), is_vegan BOOLEAN, is_gluten_free BOOLEAN); INSERT INTO Restaurant (id, name, city, is_vegan, is_gluten_free) VALUES (1, 'Vegan Vibes', 'Seattle', TRUE, TRUE); INSERT INTO Restaurant (id, name, city, is_vegan, is_gluten_free) VALUES (2, 'Plant-Based Pi...
List the names and cities of vegan restaurants with gluten-free options.
SELECT name, city FROM Restaurant WHERE is_vegan = TRUE AND is_gluten_free = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE military_sales (id INT, region VARCHAR, sale_value DECIMAL, sale_date DATE); INSERT INTO military_sales (id, region, sale_value, sale_date) VALUES (1, 'Japan', 12000, '2019-07-14'); INSERT INTO military_sales (id, region, sale_value, sale_date) VALUES (2, 'Japan', 15000, '2019-09-28'); INSERT INTO military...
What was the total number of military equipment sales to Japan in Q3 2019?
SELECT SUM(sale_value) FROM military_sales WHERE region = 'Japan' AND sale_date BETWEEN '2019-07-01' AND '2019-09-30';
gretelai_synthetic_text_to_sql
CREATE TABLE satellite_image_analysis (image_id INT, image_timestamp TIMESTAMP, cloud_cover FLOAT, rainfall_probability FLOAT);
Delete records from the "satellite_image_analysis" table where the "image_timestamp" is before '2022-01-01'
DELETE FROM satellite_image_analysis WHERE image_timestamp < '2022-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Renewable_Energy (Company VARCHAR(255), Year INT, Solar_Energy FLOAT, Wind_Energy FLOAT); INSERT INTO Renewable_Energy (Company, Year, Solar_Energy, Wind_Energy) VALUES ('DEF Mining', 2017, 15.5, 16.6), ('GHI Mining', 2018, 17.7, 18.8); CREATE TABLE Emissions (Company VARCHAR(255), Year INT, CO2_Emissions ...
What is the average renewable energy consumption and CO2 emissions for companies in the mining industry?
SELECT R.Company, AVG(R.Solar_Energy + R.Wind_Energy) AS Average_Renewable_Energy, E.CO2_Emissions FROM Renewable_Energy R JOIN Emissions E ON R.Company = E.Company WHERE R.Year = E.Year GROUP BY R.Company, E.CO2_Emissions;
gretelai_synthetic_text_to_sql
CREATE TABLE Water_Usage (Year INT, Sector VARCHAR(20), Volume INT); INSERT INTO Water_Usage (Year, Sector, Volume) VALUES (2019, 'Industry', 12300000), (2018, 'Industry', 12000000), (2020, 'Industry', 12500000);
What is the total volume of water consumed by the industrial sector in the state of Florida in 2020?
SELECT SUM(Volume) FROM Water_Usage WHERE Year = 2020 AND Sector = 'Industry';
gretelai_synthetic_text_to_sql
CREATE TABLE Dispensaries (id INT, name VARCHAR(255), city VARCHAR(255), state VARCHAR(255));CREATE TABLE Inventory (id INT, dispensary_id INT, weight DECIMAL(10, 2), product_type VARCHAR(255), month INT, year INT);INSERT INTO Dispensaries (id, name, city, state) VALUES (1, 'Green Leaf', 'Denver', 'CO');INSERT INTO Inv...
What was the total weight of cannabis flower sold by each dispensary in the city of Denver in the month of April 2021?
SELECT d.name, SUM(i.weight) as total_weight FROM Dispensaries d JOIN Inventory i ON d.id = i.dispensary_id WHERE d.city = 'Denver' AND i.product_type = 'flower' AND i.month = 4 AND i.year = 2021 GROUP BY d.name;
gretelai_synthetic_text_to_sql
CREATE TABLE Departments (DepartmentID INT PRIMARY KEY, DepartmentName VARCHAR(50), BudgetForDisabilityAccommodations DECIMAL(10,2), NumberOfStudentsWithDisabilities INT); CREATE TABLE Universities (UniversityID INT PRIMARY KEY, UniversityName VARCHAR(50), UniversityLocation VARCHAR(50)); CREATE TABLE UniversityDepartm...
What is the total budget for disability accommodations in departments with more than 20% of students with disabilities in a university in Canada?
SELECT SUM(BudgetForDisabilityAccommodations) as TotalBudget FROM UniversityDepartments ud JOIN Departments d ON ud.DepartmentID = d.DepartmentID JOIN Universities u ON ud.UniversityID = u.UniversityID WHERE u.UniversityLocation LIKE '%Canada%' GROUP BY ud.UniversityID HAVING AVG(d.NumberOfStudentsWithDisabilities) > 0...
gretelai_synthetic_text_to_sql
CREATE TABLE Aircraft (aircraft_id INT, model VARCHAR(50), orders INT); INSERT INTO Aircraft (aircraft_id, model, orders) VALUES (1, 'B787', 180), (2, 'A320', 220), (3, 'A350', 120);
List all aircraft models with more than 150 orders in descending order.
SELECT model FROM Aircraft WHERE orders > 150 ORDER BY orders DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Concerts (genre VARCHAR(20), concert_date DATE); INSERT INTO Concerts (genre, concert_date) VALUES ('Classical', '2022-03-12'), ('Jazz', '2021-11-28'), ('Classical', '2022-01-01');
Find the number of classical concerts in the last year.
SELECT COUNT(*) FROM Concerts WHERE genre = 'Classical' AND concert_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR);
gretelai_synthetic_text_to_sql
CREATE TABLE locations (location_id INT PRIMARY KEY, location_name VARCHAR(50), country VARCHAR(50));
Update the 'status' column to 'inactive' for all records in the 'locations' table where the 'country' is 'India'
UPDATE locations SET status = 'inactive' WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE fabrics (id INT, supplier VARCHAR(50), fabric_type VARCHAR(50), sustainability_rating INT); INSERT INTO fabrics (id, supplier, fabric_type, sustainability_rating) VALUES (1, 'Supplier1', 'Cotton', 80); INSERT INTO fabrics (id, supplier, fabric_type, sustainability_rating) VALUES (2, 'Supplier2', 'Polyester...
Find the average sustainability rating of fabrics by supplier
SELECT supplier, AVG(sustainability_rating) FROM fabrics GROUP BY supplier;
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours (country VARCHAR(255), quarter VARCHAR(10), local_impact FLOAT); INSERT INTO virtual_tours (country, quarter, local_impact) VALUES ('China', 'Q3', 1000000), ('Japan', 'Q3', 800000), ('South Korea', 'Q3', 900000);
What was the local economic impact of virtual tours in Asia in Q3 2022?
SELECT SUM(local_impact) FROM virtual_tours WHERE country IN ('China', 'Japan', 'South Korea') AND quarter = 'Q3';
gretelai_synthetic_text_to_sql
CREATE TABLE sales_volume(product_name TEXT, spf DECIMAL(3,1), sales_volume INT); INSERT INTO sales_volume VALUES ('Sunscreen', 50, 500); INSERT INTO sales_volume VALUES ('Moisturizer', 15, 300); INSERT INTO sales_volume VALUES ('Foundation', 20, 700);
What is the total sales volume of makeup products with SPF sold in Australia?
SELECT SUM(sales_volume) FROM sales_volume WHERE spf IS NOT NULL AND country = 'Australia';
gretelai_synthetic_text_to_sql
CREATE TABLE companies(id INT, name VARCHAR(50), industry VARCHAR(20), num_patents INT); INSERT INTO companies VALUES (1, 'Alpha', 'Healthcare', 5); INSERT INTO companies VALUES (2, 'Beta', 'Finance', 3); INSERT INTO companies VALUES (3, 'Gamma', 'Healthcare', 7); CREATE TABLE founders(id INT, company_id INT); INSERT I...
Who are the founders that have not filed any patents?
SELECT founders.id, founders.company_id FROM founders LEFT JOIN companies ON founders.company_id = companies.id WHERE companies.num_patents IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE Policies (PolicyNumber INT, PolicyholderID INT, PolicyState VARCHAR(20)); CREATE TABLE Claims (PolicyholderID INT, ClaimAmount DECIMAL(10,2), PolicyState VARCHAR(20)); INSERT INTO Policies (PolicyNumber, PolicyholderID, PolicyState) VALUES (1001, 3, 'California'), (1002, 4, 'California'), (1003, 5, 'Califo...
List policy numbers and claim amounts for policyholders living in 'California' who have not filed a claim.
SELECT Policies.PolicyNumber, NULL AS ClaimAmount FROM Policies LEFT JOIN Claims ON Policies.PolicyholderID = Claims.PolicyholderID WHERE Policies.PolicyState = 'California' AND Claims.PolicyholderID IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE Vessels (id INT, name VARCHAR(255)); INSERT INTO Vessels (id, name) VALUES (1, 'Eco Warrior'); CREATE TABLE FuelConsumption (vessel_id INT, fuel_consumption INT, timestamp TIMESTAMP); INSERT INTO FuelConsumption (vessel_id, fuel_consumption, timestamp) VALUES (1, 500, '2021-09-01 10:00:00');
Delete all records for the vessel 'Eco Warrior' in the 'FuelConsumption' table.
DELETE FROM FuelConsumption WHERE vessel_id = (SELECT id FROM Vessels WHERE name = 'Eco Warrior');
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy (country VARCHAR(255), year INT, num_projects INT); INSERT INTO renewable_energy (country, year, num_projects) VALUES ('Brazil', 2016, 150), ('Brazil', 2017, 180), ('Brazil', 2018, 200), ('Brazil', 2019, 220), ('Brazil', 2020, 250);
How many renewable energy projects were completed in Brazil between 2016 and 2018?
SELECT SUM(num_projects) FROM renewable_energy WHERE country = 'Brazil' AND year BETWEEN 2016 AND 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE climate_change_impact (id INT, species_id INT, PRIMARY KEY (id, species_id), FOREIGN KEY (species_id) REFERENCES marine_species(id)); INSERT INTO climate_change_impact (id, species_id) VALUES (1, 1), (2, 3);
List all marine species that have been impacted by climate change.
SELECT marine_species.species_name FROM marine_species INNER JOIN climate_change_impact ON marine_species.id = climate_change_impact.species_id;
gretelai_synthetic_text_to_sql
CREATE TABLE regions (id INT, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'North'), (2, 'South'), (3, 'East'), (4, 'West'); CREATE TABLE donations (id INT, region_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, region_id, amount, donation_date) VALUES (1, 2, 500.00, '2021...
Which regions had the highest total donation amounts in Q2 2021?
SELECT region_id, SUM(amount) as total_donations FROM donations WHERE donation_date BETWEEN '2021-04-01' AND '2021-06-30' GROUP BY region_id ORDER BY total_donations DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE movies (id INT, title TEXT, budget INT, production_country TEXT); INSERT INTO movies (id, title, budget, production_country) VALUES (1, 'Movie1', 5000000, 'USA'), (2, 'Movie2', 10000000, 'Canada'), (3, 'Movie3', 7000000, 'USA');
What is the average budget of movies produced in the USA?
SELECT AVG(budget) FROM movies WHERE production_country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (id INT, country VARCHAR(50), launch_date DATE); INSERT INTO Satellites (id, country, launch_date) VALUES (1, 'USA', '2020-01-01'), (2, 'China', '2020-02-14'), (3, 'Russia', '2020-04-22'), (4, 'India', '2020-05-15'), (5, 'Japan', '2020-06-20');
Which countries have launched the most satellites in the Satellites table?
SELECT country, COUNT(*) as total_satellites FROM Satellites GROUP BY country ORDER BY total_satellites DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (ArtistID int, Name varchar(50), Nationality varchar(50)); CREATE TABLE Artworks (ArtworkID int, ArtistID int, Title varchar(50)); CREATE TABLE Exhibits (ExhibitID int, Gallery varchar(50), ArtworkID int); CREATE TABLE ExhibitionTitles (ExhibitID int, Title varchar(50)); INSERT INTO Artists (Artist...
Which artworks in the 'Post-Impressionism' exhibit were created by artists from France?
SELECT a.Title FROM Artists a INNER JOIN Artworks aw ON a.ArtistID = aw.ArtistID INNER JOIN Exhibits e ON aw.ArtworkID = e.ArtworkID INNER JOIN ExhibitionTitles et ON e.ExhibitID = et.ExhibitID WHERE et.Title = 'Post-Impressionism' AND a.Nationality = 'French';
gretelai_synthetic_text_to_sql
CREATE TABLE users (id INT, country VARCHAR(255)); INSERT INTO users (id, country) VALUES (1, 'United States'), (2, 'Canada'); CREATE TABLE posts (id INT, user_id INT, likes INT); INSERT INTO posts (id, user_id, likes) VALUES (1, 1, 100), (2, 1, 200), (3, 2, 50);
What is the average number of likes on posts from users in the United States?
SELECT AVG(posts.likes) FROM posts JOIN users ON posts.user_id = users.id WHERE users.country = 'United States';
gretelai_synthetic_text_to_sql
CREATE TABLE events (event_id INT, name VARCHAR(50), type VARCHAR(50), tickets_sold INT, ticket_price DECIMAL(5,2)); INSERT INTO events (event_id, name, type, tickets_sold, ticket_price) VALUES (1, 'Basketball Game', 'Sports', 500, 50.00), (2, 'Concert', 'Music', 1000, 75.00);
Get the number of tickets sold for each event in the events table.
SELECT type, SUM(tickets_sold) FROM events GROUP BY type;
gretelai_synthetic_text_to_sql
CREATE TABLE SpaceProbes (id INT, name VARCHAR(50), launch_date DATE, current_distance INT); INSERT INTO SpaceProbes (id, name, launch_date, current_distance) VALUES (1, 'Voyager 1', '1977-09-05', 145000000000);
What is the maximum distance traveled by the Voyager 1 space probe?
SELECT MAX(current_distance) FROM SpaceProbes WHERE name = 'Voyager 1';
gretelai_synthetic_text_to_sql
CREATE TABLE conservation_projects (id INT, project_name VARCHAR(50), ocean VARCHAR(50), budget DECIMAL(10,2)); INSERT INTO conservation_projects (id, project_name, ocean, budget) VALUES (1, 'Project A', 'Mediterranean Sea', 10000), (2, 'Project B', 'Mediterranean Sea', 15000), (3, 'Project C', 'Atlantic Ocean', 20000)...
List all marine conservation projects in the Mediterranean Sea and their budgets.
SELECT project_name, budget FROM conservation_projects WHERE ocean = 'Mediterranean Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (id INT, name TEXT, joined DATE); INSERT INTO Volunteers (id, name, joined) VALUES (1, 'John Doe', '2021-01-01'), (2, 'Jane Smith', '2022-01-01'); CREATE TABLE Donors (id INT, name TEXT, donated DATE); INSERT INTO Donors (id, name, donated) VALUES (3, 'Mike Johnson', '2021-01-01'), (4, 'Sara Wil...
Identify the number of new volunteers and donors in the year 2022.
SELECT 'Volunteers' as type, COUNT(*) as total FROM Volunteers WHERE YEAR(joined) = 2022 UNION ALL SELECT 'Donors' as type, COUNT(*) as total FROM Donors WHERE YEAR(donated) = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE sensor (id INT, name VARCHAR(20), location VARCHAR(20), type VARCHAR(20)); INSERT INTO sensor (id, name, location, type) VALUES (1, 'sensor1', 'farm1', 'temperature'), (2, 'sensor2', 'farm2', 'humidity'), (3, 'sensor3', 'farm3', 'temperature'); CREATE TABLE humidity (id INT, sensor_id INT, timestamp DATETI...
What is the minimum humidity recorded for each sensor in 'farm2'?
SELECT sensor.name as sensor_name, MIN(value) as min_humidity FROM humidity JOIN sensor ON humidity.sensor_id = sensor.id WHERE sensor.location = 'farm2' GROUP BY sensor.name;
gretelai_synthetic_text_to_sql
CREATE TABLE investments (company_id INT, round_type TEXT, raised_amount INT); INSERT INTO investments (company_id, round_type, raised_amount) VALUES (1, 'Series A', 5000000); INSERT INTO investments (company_id, round_type, raised_amount) VALUES (2, 'Seed', 1000000); CREATE TABLE companies (id INT, name TEXT, founding...
What is the median investment amount per round for companies founded in the last 3 years?
SELECT AVG(raised_amount) as median_investment_per_round FROM (SELECT raised_amount FROM investments JOIN companies ON investments.company_id = companies.id WHERE companies.founding_year >= YEAR(CURRENT_DATE) - 3 ORDER BY raised_amount) AS subquery WHERE ROW_NUMBER() OVER (ORDER BY raised_amount) IN ( (SELECT CEIL(COUN...
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists biosensors;CREATE TABLE if not exists biosensors.measurements (id INT PRIMARY KEY, location VARCHAR(100), temperature FLOAT); INSERT INTO biosensors.measurements (id, location, temperature) VALUES (1, 'New York', 25.5), (2, 'Los Angeles', 28.2), (3, 'Chicago', 24.3), (4, 'Houston', 27.1), (5...
What is the maximum biosensor temperature recorded in the United States?
SELECT MAX(temperature) FROM biosensors.measurements WHERE location = 'United States';
gretelai_synthetic_text_to_sql
CREATE TABLE fish_inventory (id INT PRIMARY KEY, species VARCHAR(50), quantity INT, location VARCHAR(50)); INSERT INTO fish_inventory (id, species, quantity, location) VALUES (1, 'Salmon', 50, 'Tank A'), (2, 'Tilapia', 75, 'Tank B'), (3, 'Cod', 100, 'Tank C'), (4, 'Herring', 25, 'Tank A');
List all fish species that have a quantity greater than 50 in the 'fish_inventory' table.
SELECT DISTINCT species FROM fish_inventory WHERE quantity > 50;
gretelai_synthetic_text_to_sql
CREATE TABLE RuralClinics (ClinicID int, ClinicName varchar(50), State varchar(20)); CREATE TABLE HealthcareProfessionals (ProfessionalID int, ProfessionalName varchar(50), ClinicID int, Specialty varchar(50)); INSERT INTO RuralClinics (ClinicID, ClinicName, State) VALUES (1, 'Rural Clinic A', 'QLD'); INSERT INTO Healt...
List all clinics in a rural area with their respective healthcare professionals?
SELECT Clinics.ClinicName, Professionals.ProfessionalName, Professionals.Specialty FROM RuralClinics AS Clinics JOIN HealthcareProfessionals AS Professionals ON Clinics.ClinicID = Professionals.ClinicID;
gretelai_synthetic_text_to_sql
CREATE TABLE Garments(id INT, store VARCHAR(20), retail_price DECIMAL(5,2)); INSERT INTO Garments(id, store, retail_price) VALUES (1, 'Eco_Friendly', 150.00), (2, 'Eco_Friendly', 75.00), (3, 'Sustainable_Outlet', 120.00);
Delete records of garments that have a retail price greater than $100 in the 'Eco_Friendly' store.
DELETE FROM Garments WHERE store = 'Eco_Friendly' AND retail_price > 100;
gretelai_synthetic_text_to_sql
CREATE TABLE NigerianStates (State VARCHAR(50), Births INT, Deaths INT); INSERT INTO NigerianStates (State, Births, Deaths) VALUES ('Lagos', 200000, 5000), ('Kano', 180000, 4500), ('Rivers', 160000, 4000), ('Anambra', 150000, 3500);
What is the infant mortality rate in each state of Nigeria?
SELECT State, (SUM(Deaths) / SUM(Births)) * 100000 AS InfantMortalityRate FROM NigerianStates GROUP BY State;
gretelai_synthetic_text_to_sql
CREATE TABLE Forests ( ForestID INT PRIMARY KEY, Name VARCHAR(50), Country VARCHAR(50), Hectares FLOAT ); CREATE TABLE Management ( ManagementID INT PRIMARY KEY, Method VARCHAR(50), ForestID INT, FOREIGN KEY (ForestID) REFERENCES Forests(ForestID)); CREATE TABLE Sustainability ( SustainabilityID INT PRIMARY KEY, Certif...
Which forests have sustainable management methods?
SELECT Forests.Name FROM Forests INNER JOIN Management ON Forests.ForestID = Management.ForestID INNER JOIN Sustainability ON Management.ManagementID = Sustainability.ManagementID WHERE Sustainability.Certified = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE bridges (id INT, name VARCHAR(50), state VARCHAR(50), length FLOAT, year_built INT); INSERT INTO bridges (id, name, state, length, year_built) VALUES (1, 'Golden Gate Bridge', 'California', 2737, 1937); INSERT INTO bridges (id, name, state, length, year_built) VALUES (2, 'Houston Ship Channel Bridge', 'Tex...
Show the average length of bridges built before 1960
SELECT AVG(length) FROM bridges WHERE year_built < 1960;
gretelai_synthetic_text_to_sql
CREATE TABLE LiteraryEvents (EventID INT, EventName VARCHAR(50), Date DATE); CREATE TABLE Attendees (AttendeeID INT, AttendeeName VARCHAR(50), FirstAttendance DATE, LastAttendance DATE); CREATE TABLE EventAttendees (EventID INT, AttendeeID INT, FOREIGN KEY (EventID) REFERENCES LiteraryEvents(EventID), FOREIGN KEY (Atte...
What is the percentage of repeat attendees for literary events, and what is the average time between their first and last attendance?
SELECT AVG(DATEDIFF(Attendees.LastAttendance, Attendees.FirstAttendance))/365, COUNT(DISTINCT EventAttendees.AttendeeID)/COUNT(DISTINCT Attendees.AttendeeID) * 100 FROM EventAttendees INNER JOIN Attendees ON EventAttendees.AttendeeID = Attendees.AttendeeID INNER JOIN LiteraryEvents ON EventAttendees.EventID = LiteraryE...
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityHealthWorkers (Id INT, Age INT, Race VARCHAR(25), Salary DECIMAL(10,2)); INSERT INTO CommunityHealthWorkers (Id, Age, Race, Salary) VALUES (1, 45, 'Hispanic', 60000.00), (2, 32, 'African American', 55000.00), (3, 50, 'Caucasian', 72000.00), (4, 40, 'Asian', 68000.00), (5, 38, 'Native American', 52...
What is the average age of community health workers by race, excluding those with a salary over $70,000?
SELECT Race, AVG(Age) as AvgAge FROM CommunityHealthWorkers WHERE Salary < 70000 GROUP BY Race;
gretelai_synthetic_text_to_sql
CREATE TABLE ERC20Tokens (id INT, name VARCHAR(100), symbol VARCHAR(50), total_supply DECIMAL(20,2)); INSERT INTO ERC20Tokens (id, name, symbol, total_supply) VALUES (1, 'Tether', 'USDT', 80000000), (2, 'Uniswap', 'UNI', 1000000);
What is the total value of all ERC-20 tokens issued on the Ethereum network?
SELECT SUM(total_supply) FROM ERC20Tokens WHERE symbol IN ('USDT', 'UNI', '...');
gretelai_synthetic_text_to_sql
CREATE TABLE marine_protected_areas (name TEXT, depth INTEGER, area INTEGER); INSERT INTO marine_protected_areas (name, depth, area) VALUES ('Phoenix Islands Protected Area', 4000, 408054), ('Weddell Sea Marine Protected Area', 3500, 2309120), ('Ross Sea Marine Protected Area', 3000, 1599400);
What is the total area (in square kilometers) of all marine protected areas deeper than 3000 meters?
SELECT SUM(area) FROM marine_protected_areas WHERE depth > 3000;
gretelai_synthetic_text_to_sql
CREATE TABLE Movies_Awards (movie VARCHAR(255), director VARCHAR(50), oscar_wins INT);
Number of Oscars won by movies directed by people of color
SELECT SUM(oscar_wins) FROM Movies_Awards WHERE director LIKE '%person%of%color%';
gretelai_synthetic_text_to_sql
CREATE TABLE water_usage_nm (sector VARCHAR(20), usage FLOAT); INSERT INTO water_usage_nm (sector, usage) VALUES ('Industrial', 1200), ('Agriculture', 3000), ('Domestic', 800);
How much water is used in the domestic sector in New Mexico?
SELECT usage FROM water_usage_nm WHERE sector = 'Domestic';
gretelai_synthetic_text_to_sql
CREATE TABLE defense_contracts (contract_id INT, company_name TEXT, community TEXT, value FLOAT); INSERT INTO defense_contracts (contract_id, company_name, community, value) VALUES (1, 'ACME Corp', 'Veteran Owned', 700000), (2, 'DEF Inc', 'Minority Owned', 800000), (3, 'GHI Ltd', 'Women Owned', 900000), (4, 'JKL PLC', ...
List defense contracts awarded to companies in underrepresented communities
SELECT company_name FROM defense_contracts WHERE community IN ('Veteran Owned', 'Minority Owned', 'Women Owned', 'Service Disabled Veteran Owned');
gretelai_synthetic_text_to_sql
CREATE TABLE programs (id INT, category VARCHAR(20), funding DECIMAL(10,2)); INSERT INTO programs (id, category, funding) VALUES (1, 'Visual Arts', 15000.00), (2, 'Performing Arts', 20000.00), (3, 'Literary Arts', 10000.00);
What was the total funding for visual arts programs?
SELECT SUM(funding) FROM programs WHERE category = 'Visual Arts';
gretelai_synthetic_text_to_sql
CREATE TABLE japan_tourism (name VARCHAR(255), country VARCHAR(255), year INT, tourists INT); INSERT INTO japan_tourism (name, country, year, tourists) VALUES ('Tokyo', 'China', 2015, 2020000), ('Osaka', 'South Korea', 2015, 1110000);
What is the percentage of international tourists visiting Japan that are from Asian countries?
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM japan_tourism)) AS percentage FROM japan_tourism WHERE country LIKE '%Asia%';
gretelai_synthetic_text_to_sql
CREATE TABLE department (id INT, name TEXT, budget INT, created_at DATETIME); INSERT INTO department (id, name, budget, created_at) VALUES (1, 'education', 500000, '2021-01-01'), (2, 'social services', 1200000, '2022-01-01');
What is the maximum budget allocated to a 'social services' department in 2025?
SELECT name, MAX(budget) as max_budget FROM department WHERE name = 'social services' AND created_at BETWEEN '2025-01-01' AND '2025-12-31' GROUP BY name;
gretelai_synthetic_text_to_sql
CREATE TABLE EnvironmentalImpact (StudyID INT, StudyName VARCHAR(50), LeadResearcher VARCHAR(50)); INSERT INTO EnvironmentalImpact (StudyID, StudyName, LeadResearcher) VALUES (1, 'Environmental Impact of Electric Vehicles', 'Dr. Maria Garcia');
Who is the lead researcher for the study on the environmental impact of electric vehicles?
SELECT LeadResearcher FROM EnvironmentalImpact WHERE StudyName = 'Environmental Impact of Electric Vehicles';
gretelai_synthetic_text_to_sql
CREATE TABLE disability_support_programs (program_id INT, name VARCHAR(255), created_date DATE); INSERT INTO disability_support_programs (program_id, name, created_date) VALUES (1, 'Peer Mentoring', '2020-01-15'); INSERT INTO disability_support_programs (program_id, name, created_date) VALUES (2, 'Assistive Technology ...
What was the total number of disability support programs created in the year 2020?
SELECT COUNT(*) FROM disability_support_programs WHERE YEAR(created_date) = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE incidents (incident_id INT, department VARCHAR(255), incident_date DATE, incident_status VARCHAR(255)); INSERT INTO incidents (incident_id, department, incident_date, incident_status) VALUES (1, 'IT', '2022-01-01', 'Resolved'), (2, 'HR', '2022-02-01', 'Open'), (3, 'IT', '2022-03-01', 'Resolved'), (4, 'Fina...
Calculate the number of unresolved security incidents for each department in the company, for the last 6 months, partitioned by department and status?
SELECT department, incident_status, COUNT(incident_id) as unresolved_incidents FROM incidents WHERE incident_date >= DATEADD(month, -6, GETDATE()) GROUP BY department, incident_status;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_protected_areas_sa (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO marine_protected_areas_sa (id, name, region) VALUES (1, 'South Georgia and the South Sandwich Islands Marine Protected Area', 'South Atlantic'); INSERT INTO marine_protected_areas_sa (id, name, region) VALUES (2, 'Trist...
How many marine protected areas are there in the South Atlantic Ocean?
SELECT COUNT(DISTINCT name) FROM marine_protected_areas_sa WHERE region = 'South Atlantic';
gretelai_synthetic_text_to_sql
CREATE TABLE menu (category VARCHAR(255), price FLOAT); INSERT INTO menu (category, price) VALUES ('Appetizers', 7.99), ('Entrees', 14.99), ('Desserts', 5.99), ('Drinks', 2.99), ('Sides', 1.99);
What is the average price of dishes in each menu category, excluding the cheapest and most expensive dishes?
SELECT category, AVG(price) FROM (SELECT category, price FROM menu WHERE price NOT IN (SELECT MIN(price) FROM menu WHERE category = menu.category) AND price NOT IN (SELECT MAX(price) FROM menu WHERE category = menu.category)) AS filtered_menu GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (country VARCHAR(20), product_type VARCHAR(20), revenue DECIMAL(10,2)); INSERT INTO sales (country, product_type, revenue) VALUES ('US', 'natural hair care', 2500), ('Canada', 'natural hair care', 1800), ('Mexico', 'natural hair care', 2000), ('US', 'organic skincare', 5000), ('Canada', 'organic skin...
List the top 3 countries with the highest sales revenue for natural hair care products
SELECT country, SUM(revenue) AS total_revenue FROM sales WHERE product_type = 'natural hair care' GROUP BY country ORDER BY total_revenue DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE japan_data (year INT, investment FLOAT); INSERT INTO japan_data (year, investment) VALUES (2019, 5000000), (2020, 5500000), (2021, 6000000);
What is the minimum network infrastructure investment in Japan for the last 3 years?
SELECT MIN(investment) as min_investment FROM japan_data WHERE year BETWEEN 2019 AND 2021;
gretelai_synthetic_text_to_sql