context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE SpaceMissions (id INT, mission_name VARCHAR(30), destination VARCHAR(30)); INSERT INTO SpaceMissions (id, mission_name, destination) VALUES (1, 'Galileo', 'Jupiter'); INSERT INTO SpaceMissions (id, mission_name, destination) VALUES (2, 'Juno', 'Jupiter'); INSERT INTO SpaceMissions (id, mission_name, destin...
List all missions to Jupiter
SELECT mission_name FROM SpaceMissions WHERE destination = 'Jupiter';
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Age INT, Ethnicity VARCHAR(20), CulturalCompetencyTraining DATE, UnderrepresentedCommunity VARCHAR(20)); INSERT INTO CommunityHealthWorkers (WorkerID, Age, Ethnicity, CulturalCompetencyTraining, UnderrepresentedCommunity) VALUES (1, 35, 'Hispanic', NULL, 'Yes'); INSERT...
Which community health workers are from underrepresented communities and have not received cultural competency training?
SELECT * FROM CommunityHealthWorkers WHERE CulturalCompetencyTraining IS NULL AND UnderrepresentedCommunity = 'Yes';
gretelai_synthetic_text_to_sql
CREATE TABLE garments (id INT, name VARCHAR(100), category VARCHAR(50), price DECIMAL(5,2), sales_volume INT);
What is the average price of garments in the 'Dresses' category?
SELECT AVG(garments.price) AS avg_price FROM garments WHERE garments.category = 'Dresses';
gretelai_synthetic_text_to_sql
CREATE TABLE ny_coownership (id INT, quarter INT, year INT, co_ownership BOOLEAN); INSERT INTO ny_coownership (id, quarter, year, co_ownership) VALUES (1, 1, 2021, TRUE), (2, 2, 2021, FALSE), (3, 1, 2021, TRUE), (4, 2, 2021, TRUE), (5, 3, 2021, FALSE);
What is the distribution of property co-ownership by quarter in New York?
SELECT quarter, co_ownership, COUNT(*) FROM ny_coownership GROUP BY quarter, co_ownership;
gretelai_synthetic_text_to_sql
CREATE TABLE item_prices (item_id INT, price FLOAT, is_vegan BOOLEAN, contains_tofu BOOLEAN);INSERT INTO item_prices (item_id, price, is_vegan, contains_tofu) VALUES (1, 12.99, true, true), (2, 14.99, true, false), (3, 10.99, false, true), (4, 15.99, false, false);
What is the average price of vegan entrees that contain tofu?
SELECT AVG(price) FROM item_prices WHERE is_vegan = true AND contains_tofu = true;
gretelai_synthetic_text_to_sql
CREATE TABLE EmployeeData (EmployeeID INT, Age INT, Training VARCHAR(50), Country VARCHAR(50)); INSERT INTO EmployeeData (EmployeeID, Age, Training, Country) VALUES (1, 30, 'Diversity and Inclusion', 'USA'), (2, 35, 'Cybersecurity', 'Canada');
What is the average age of employees who have completed diversity and inclusion training in the USA?
SELECT AVG(Age) FROM EmployeeData WHERE Training = 'Diversity and Inclusion' AND Country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE regions (id INT, name TEXT); CREATE TABLE products (id INT, category TEXT, is_vegan BOOLEAN); CREATE TABLE sales (id INT, region_id INT, product_id INT, quantity INT); INSERT INTO regions (id, name) VALUES (1, 'Northeast'), (2, 'Southeast'), (3, 'Midwest'), (4, 'Southwest'); INSERT INTO products (id, categ...
Which regions have the highest consumption of vegan snacks?
SELECT r.name AS region_name, SUM(s.quantity) AS total_quantity FROM sales s JOIN regions r ON s.region_id = r.id JOIN products p ON s.product_id = p.id WHERE p.is_vegan = true GROUP BY r.name ORDER BY total_quantity DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE restorative_programs (program_id INT, state VARCHAR(20)); INSERT INTO restorative_programs (program_id, state) VALUES (1, 'New York'), (2, 'California');
What is the total number of restorative justice programs in the state of New York?
SELECT COUNT(*) FROM restorative_programs WHERE state = 'New York';
gretelai_synthetic_text_to_sql
CREATE TABLE shipments (shipment_id INT, warehouse_id INT, shipped_date DATE, delivered_date DATE); INSERT INTO shipments (shipment_id, warehouse_id, shipped_date, delivered_date) VALUES (1, 1, '2022-03-01', '2022-03-05'), (2, 2, '2022-03-02', '2022-03-07'), (3, 3, '2022-03-03', '2022-03-09');
What are the average delivery times (in days) for packages shipped from each warehouse, in the last month?
SELECT warehouse_id, AVG(DATEDIFF(delivered_date, shipped_date)) as avg_delivery_time_days FROM shipments WHERE shipped_date BETWEEN DATEADD(day, -30, GETDATE()) AND GETDATE() GROUP BY warehouse_id;
gretelai_synthetic_text_to_sql
CREATE TABLE visitors (id INT, age INT, gender VARCHAR(10), visit_date DATE);
Delete any records in the 'visitors' table where the age is greater than 65
DELETE FROM visitors WHERE age > 65;
gretelai_synthetic_text_to_sql
CREATE TABLE rural_clinics (id INT, name TEXT, location TEXT, num_workers INT, avg_age FLOAT); CREATE TABLE healthcare_workers (id INT, clinic_id INT, age FLOAT);
What is the average age of healthcare workers by location?
SELECT r.location, AVG(hw.age) FROM rural_clinics r INNER JOIN healthcare_workers hw ON r.id = hw.clinic_id GROUP BY r.location;
gretelai_synthetic_text_to_sql
CREATE TABLE community_workers (worker_id INT, worker_name VARCHAR(50), community_type VARCHAR(50), patients_served INT); INSERT INTO community_workers (worker_id, worker_name, community_type, patients_served) VALUES (1, 'John Doe', 'African American', 50), (2, 'Jane Smith', 'Hispanic', 75), (3, 'Alice Johnson', 'LGBTQ...
Which community health workers have served the most patients from underrepresented communities?
SELECT community_type, worker_name, SUM(patients_served) as total_patients_served FROM community_workers WHERE community_type IN ('African American', 'Hispanic', 'LGBTQ+') GROUP BY community_type, worker_name ORDER BY total_patients_served DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, garment_id INT, price DECIMAL(5,2), country VARCHAR(255)); CREATE TABLE garments (id INT, garment_type VARCHAR(255), material VARCHAR(255), sustainable BOOLEAN);
Calculate the total revenue of sustainable fabric sales in Japan
SELECT SUM(sales.price) FROM sales JOIN garments ON sales.garment_id = garments.id WHERE garments.sustainable = TRUE AND sales.country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Country VARCHAR(50)); INSERT INTO Artists (ArtistID, ArtistName, Country) VALUES (1, 'Taylor Swift', 'USA'), (2, 'BTS', 'South Korea'); CREATE TABLE Songs (SongID INT, SongName VARCHAR(100), ArtistID INT); INSERT INTO Songs (SongID, SongName, ArtistID) VALUES...
What is the total number of streams for each artist from the United States?
SELECT Artists.ArtistName, SUM(Streaming.StreamCount) AS TotalStreams FROM Artists INNER JOIN Songs ON Artists.ArtistID = Songs.ArtistID INNER JOIN Streaming ON Songs.SongID = Streaming.SongID WHERE Artists.Country = 'USA' GROUP BY Artists.ArtistName;
gretelai_synthetic_text_to_sql
CREATE TABLE fish_observations (id INT, reef TEXT, species_count INT);
Calculate the average number of fish species observed in coral reefs
SELECT AVG(species_count) FROM fish_observations WHERE reef LIKE '%coral reef%';
gretelai_synthetic_text_to_sql
CREATE TABLE Artworks (id INT, name TEXT, artist TEXT, year INT, price FLOAT, country TEXT, category TEXT, is_textile BOOLEAN); INSERT INTO Artworks (id, name, artist, year, price, country, category, is_textile) VALUES (1, 'Textile1', 'SouthAsianArtist1', 1960, 1500.00, 'India', 'textile', true), (2, 'Painting2', 'Amer...
How many textile artworks were created by South Asian artists between 1950 and 1999?
SELECT COUNT(*) FROM Artworks WHERE country IN ('India', 'Pakistan', 'Bangladesh', 'Sri Lanka', 'Nepal') AND is_textile = true AND year BETWEEN 1950 AND 1999;
gretelai_synthetic_text_to_sql
CREATE TABLE patients (patient_id INT, age INT, therapy BOOLEAN, lgbtq_identification BOOLEAN); INSERT INTO patients (patient_id, age, therapy, lgbtq_identification) VALUES (1, 25, TRUE, TRUE), (2, 32, FALSE, FALSE), (3, 40, TRUE, TRUE), (4, 50, FALSE, TRUE);
What is the average age of patients who identified as LGBTQ+ and received therapy?
SELECT AVG(age) FROM patients WHERE therapy = TRUE AND lgbtq_identification = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE countries (id INT, name TEXT, region TEXT, media_literacy_score INT); INSERT INTO countries VALUES (1, 'Australia', 'Asia-Pacific', 90), (2, 'China', 'Asia-Pacific', 50), (3, 'India', 'Asia-Pacific', 60), (4, 'Indonesia', 'Asia-Pacific', 55), (5, 'Japan', 'Asia-Pacific', 75), (6, 'Malaysia', 'Asia-Pacific'...
What is the average media literacy score for each country in the Asia-Pacific region?
SELECT region, subregion, AVG(media_literacy_score) as avg_score FROM countries WHERE region = 'Asia-Pacific' GROUP BY region, subregion;
gretelai_synthetic_text_to_sql
CREATE TABLE sourcing (id INT, garment_id INT, country VARCHAR(50), cost DECIMAL(5,2)); INSERT INTO sourcing (id, garment_id, country, cost) VALUES (1, 1001, 'Italy', 12.50);
What is the average fabric cost for garments sourced from Italy?
SELECT AVG(cost) FROM sourcing WHERE country = 'Italy';
gretelai_synthetic_text_to_sql
CREATE TABLE public_libraries_budget (state VARCHAR(20), budget INT); INSERT INTO public_libraries_budget (state, budget) VALUES ('New York', 8000000); INSERT INTO public_libraries_budget (state, budget) VALUES ('New York', 10000000); INSERT INTO public_libraries_budget (state, budget) VALUES ('Florida', 5000000);
What is the minimum budget allocated for public libraries in the state of New York?
SELECT MIN(budget) FROM public_libraries_budget WHERE state = 'New York';
gretelai_synthetic_text_to_sql
CREATE TABLE Faculty (FacultyID INT, Gender VARCHAR(10)); INSERT INTO Faculty VALUES (1, 'Female'), (2, 'Male'); CREATE TABLE ResearchGrants (GrantID INT, FacultyID INT, Amount DECIMAL(10,2), GrantDate DATE); INSERT INTO ResearchGrants VALUES (1, 2, 5000, '2022-01-01'), (2, 1, 7000, '2021-12-01');
What is the total number of research grants received by female faculty members in the past two years?
SELECT SUM(Amount) FROM Faculty INNER JOIN ResearchGrants ON Faculty.FacultyID = ResearchGrants.FacultyID WHERE Gender = 'Female' AND GrantDate >= DATEADD(year, -2, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE donors (id INT, name VARCHAR(50), age INT, donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donors (id, name, age, donation_amount, donation_date) VALUES (1, 'John Doe', 25, 500.00, '2020-05-10'); INSERT INTO donors (id, name, age, donation_amount, donation_date) VALUES (2, 'Jane Smith', 33,...
What was the total amount donated by 'young donors' (age 18-35) in 2020?
SELECT SUM(donation_amount) FROM donors WHERE YEAR(donation_date) = 2020 AND age BETWEEN 18 AND 35;
gretelai_synthetic_text_to_sql
CREATE TABLE temperature_data (month INTEGER, location TEXT, temperature FLOAT); INSERT INTO temperature_data (month, location, temperature) VALUES (1, 'Arctic Ocean', -2.0); INSERT INTO temperature_data (month, location, temperature) VALUES (7, 'Arctic Ocean', 10.0);
Calculate the maximum temperature of the Arctic Ocean in July.
SELECT MAX(temperature) FROM temperature_data WHERE month = 7 AND location = 'Arctic Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE users (id INT, age INT, preference VARCHAR(20)); INSERT INTO users (id, age, preference) VALUES (1, 35, 'sports'), (2, 45, 'politics'), (3, 28, 'business'), (4, 50, 'business'), (5, 60, 'business'), (6, 32, 'entertainment'), (7, 40, 'entertainment');
How many users are there who prefer watching entertainment news and are above 30 years old?
SELECT COUNT(*) FROM users WHERE preference = 'entertainment' AND age > 30;
gretelai_synthetic_text_to_sql
CREATE TABLE underwater_volcanoes (name VARCHAR(255), depth FLOAT);
What is the minimum depth recorded for any underwater volcano?
SELECT MIN(depth) FROM underwater_volcanoes;
gretelai_synthetic_text_to_sql
CREATE TABLE legal_aid_services (id INT, region TEXT, service_type TEXT, date DATE);
What is the total number of legal_aid_services provided by region?
SELECT region, COUNT(*) FROM legal_aid_services GROUP BY region;
gretelai_synthetic_text_to_sql
cargo(cargo_id, cargo_name, weight, volume, description)
Update the weight of a specific cargo
UPDATE cargo SET weight = 600 WHERE cargo_id = 2002;
gretelai_synthetic_text_to_sql
CREATE TABLE AllGalleriesI (gallery_name VARCHAR(20), artwork_ID INT, exhibition_duration INT); INSERT INTO AllGalleriesI (gallery_name, artwork_ID, exhibition_duration) VALUES ('GalleryD', 1, 45), ('GalleryD', 2, 60), ('GalleryD', 3, 30), ('GalleryE', 4, 70), ('GalleryE', 5, 50), ('GalleryF', 6, 95), ('GalleryF', 7, 8...
List the artworks that were exhibited in the top 10% of the longest exhibitions.
SELECT artwork_ID, exhibition_duration FROM (SELECT artwork_ID, exhibition_duration, NTILE(10) OVER (ORDER BY exhibition_duration) as tile_num FROM AllGalleriesI) tmp WHERE tile_num <= 2;
gretelai_synthetic_text_to_sql
CREATE TABLE aquafarms (id INT, name TEXT); INSERT INTO aquafarms (id, name) VALUES (1, 'Farm A'), (2, 'Farm B'), (3, 'Farm C'), (4, 'Farm D'); CREATE TABLE fish_data (aquafarm_id INT, species TEXT, biomass FLOAT, timestamp TIMESTAMP);
What is the growth rate of the fish population for each species at Farm D?
SELECT species, aquafarm_id, AVG(biomass_diff) AS avg_growth_rate FROM (SELECT species, aquafarm_id, biomass, LAG(biomass) OVER (PARTITION BY species, aquafarm_id ORDER BY timestamp) AS prev_biomass, (biomass - COALESCE(prev_biomass, biomass)) AS biomass_diff FROM fish_data) fish_growth GROUP BY species, aquafarm_id;
gretelai_synthetic_text_to_sql
CREATE TABLE teacher_pd (teacher_id INT, course VARCHAR(20), hours INT); INSERT INTO teacher_pd (teacher_id, course, hours) VALUES (1, 'diversity_equity_inclusion', 12), (2, 'diversity_equity_inclusion', 10), (3, 'diversity_equity_inclusion', 15);
What is the maximum number of hours a teacher has spent on professional development in 'diversity_equity_inclusion'?
SELECT MAX(hours) FROM teacher_pd WHERE course = 'diversity_equity_inclusion';
gretelai_synthetic_text_to_sql
CREATE TABLE north_sea_platforms (platform_id INT, platform_name VARCHAR(50), location VARCHAR(50), operational_status VARCHAR(15)); INSERT INTO north_sea_platforms VALUES (1, 'Forties', 'North Sea', 'Active'); INSERT INTO north_sea_platforms VALUES (2, 'Brent', 'North Sea', 'Active'); CREATE TABLE oil_production (plat...
What is the maximum oil production in the North Sea for 2016?
SELECT MAX(production) FROM oil_production WHERE year = 2016 AND location = 'North Sea';
gretelai_synthetic_text_to_sql
CREATE SCHEMA art; CREATE TABLE art_pieces (art_id INT, art_name VARCHAR(255), artist_name VARCHAR(255), artist_gender VARCHAR(10), medium VARCHAR(50), creation_date DATE); INSERT INTO art.art_pieces (art_id, art_name, artist_name, artist_gender, medium, creation_date) VALUES (1, 'Painting', 'Sarah Johnson', 'Female', ...
How many art pieces were created by female artists in each medium?
SELECT medium, COUNT(*) as count FROM art.art_pieces WHERE artist_gender = 'Female' GROUP BY medium;
gretelai_synthetic_text_to_sql
CREATE TABLE research_projects (id INT, name VARCHAR(50), lead_researcher VARCHAR(50), participants INT, start_date DATE, end_date DATE);
Show genetic research projects with less than 5 participants.
SELECT name FROM research_projects WHERE participants < 5;
gretelai_synthetic_text_to_sql
CREATE TABLE ethical_ai_courses (country VARCHAR(20), year INT, courses INT); INSERT INTO ethical_ai_courses (country, year, courses) VALUES ('Australia', 2019, 15), ('New Zealand', 2019, 12), ('Fiji', 2019, 18);
What is the maximum number of ethical AI courses offered in Oceania in 2019?
SELECT MAX(courses) FROM ethical_ai_courses WHERE country = 'Oceania' AND year = 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE threat_actors (actor_id INT, actor_name VARCHAR(255), threat_category VARCHAR(255)); INSERT INTO threat_actors (actor_id, actor_name, threat_category) VALUES (1, 'Hacktivist', 'DDoS'), (2, 'Cyber Criminal', 'Phishing'), (3, 'State-Sponsored', 'Espionage'), (4, 'Insider Threat', 'Data Exfiltration'), (5, 'O...
Identify the number of unique threat actors and their associated threat categories in the past 3 months.
SELECT threat_category, COUNT(DISTINCT actor_name) as actor_count FROM threat_actors WHERE actor_id IN (SELECT actor_id FROM threat_actors WHERE actor_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH)) GROUP BY threat_category;
gretelai_synthetic_text_to_sql
CREATE TABLE teachers (teacher_id INT, teacher_name VARCHAR(255)); INSERT INTO teachers VALUES (1, 'Teacher A'), (2, 'Teacher B'); CREATE TABLE courses (course_id INT, course_name VARCHAR(255), teacher_id INT); INSERT INTO courses VALUES (1, 'Course 1', 1), (2, 'Course 2', 1), (3, 'Course 3', 2), (4, 'Course 4', 2);
What is the total number of professional development courses taken by each teacher?
SELECT t.teacher_name, COUNT(c.course_id) as total_courses FROM courses c JOIN teachers t ON c.teacher_id = t.teacher_id GROUP BY t.teacher_name;
gretelai_synthetic_text_to_sql
CREATE TABLE species (id INT, name VARCHAR(255), conservation_status VARCHAR(255)); INSERT INTO species (id, name, conservation_status) VALUES (1, 'Clownfish', 'Least Concern'), (2, 'Blue Whale', 'Endangered'), (3, 'Jellyfish', 'Least Concern'); CREATE VIEW species_status AS SELECT conservation_status, COUNT(*) AS coun...
What is the number of marine species in each conservation status category?
SELECT * FROM species_status;
gretelai_synthetic_text_to_sql
CREATE TABLE company_founding (id INT PRIMARY KEY, name TEXT, location TEXT, founding_year INT, gender TEXT); CREATE VIEW company_founding_summary AS SELECT location, COUNT(*) as count, SUM(CASE WHEN gender = 'female' THEN 1 ELSE 0 END) as female_count FROM company_founding GROUP BY location;
What is the percentage of female founders in 'California'?
SELECT s.location, s.female_count, s.count, s.female_count / s.count as percentage FROM company_founding_summary s WHERE s.location = 'California';
gretelai_synthetic_text_to_sql
CREATE TABLE spending (district VARCHAR(20), amount FLOAT, spending_date DATE); INSERT INTO spending (district, amount, spending_date) VALUES ('North', 30000.0, '2021-02-01'), ('East', 40000.0, '2021-03-15'), ('West', 20000.0, '2021-01-01'), ('South', 50000.0, '2021-07-01');
What is the total spending on transparency measures for the first half of 2021?
SELECT SUM(amount) FROM spending WHERE spending_date BETWEEN '2021-01-01' AND '2021-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE transactions (transaction_id INT, customer_id INT, transaction_value DECIMAL(10, 2), transaction_date DATE); INSERT INTO transactions (transaction_id, customer_id, transaction_value, transaction_date) VALUES (1, 1, 100.00, '2022-02-01'); INSERT INTO transactions (transaction_id, customer_id, transaction_va...
What is the total transaction value for each day in the month of February 2022?
SELECT DATE_FORMAT(transaction_date, '%%Y-%%m-%%d') AS transaction_date, SUM(transaction_value) AS total_value FROM transactions WHERE transaction_date BETWEEN '2022-02-01' AND '2022-02-28' GROUP BY transaction_date;
gretelai_synthetic_text_to_sql
CREATE TABLE community_development.schools (id INT, name VARCHAR(50), capacity INT, location VARCHAR(50));
What is the total capacity for schools located in the capital city?
SELECT SUM(capacity) FROM community_development.schools WHERE location = 'capital city';
gretelai_synthetic_text_to_sql
CREATE TABLE departments (id INT, name TEXT, manager TEXT); INSERT INTO departments (id, name, manager) VALUES (1, 'metals', 'John'), (2, 'electronics', 'Jane'), (3, 'textiles', 'Bob'); CREATE TABLE workers (id INT, department_id INT, salary FLOAT); INSERT INTO workers (id, department_id, salary) VALUES (1, 1, 70000), ...
Find the maximum salary of workers in the 'metals' department.
SELECT MAX(salary) FROM workers INNER JOIN departments ON workers.department_id = departments.id WHERE departments.name = 'metals';
gretelai_synthetic_text_to_sql
CREATE TABLE museums (museum_id INT, museum_name VARCHAR(50), revenue DECIMAL(10,2), year INT); INSERT INTO museums (museum_id, museum_name, revenue, year) VALUES (1, 'Museum A', 500000, 2020); INSERT INTO museums (museum_id, museum_name, revenue, year) VALUES (2, 'Museum B', 700000, 2020);
Determine the total revenue for each museum for the year 2020.
SELECT museum_name, SUM(revenue) as total_revenue FROM museums WHERE year = 2020 GROUP BY museum_name;
gretelai_synthetic_text_to_sql
CREATE TABLE actors (id INT, name VARCHAR(255), total_appearances INT, genre VARCHAR(50)); INSERT INTO actors (id, name, total_appearances, genre) VALUES (1, 'Actor1', 5, 'Action'), (2, 'Actor2', 3, 'Comedy'), (3, 'Actor3', 7, 'Action'), (4, 'Actor4', 2, 'Action');
Who are the top 3 actors with the most number of appearances in action movies?
SELECT name, total_appearances FROM actors WHERE genre = 'Action' ORDER BY total_appearances DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE mars_rovers_temperatures (rover_name TEXT, temperature FLOAT); INSERT INTO mars_rovers_temperatures (rover_name, temperature) VALUES ('Spirit', 20.5), ('Opportunity', 15.2), ('Curiosity', 10.1);
What is the average temperature recorded for each Mars Rover?
SELECT rover_name, AVG(temperature) as avg_temperature FROM mars_rovers_temperatures GROUP BY rover_name;
gretelai_synthetic_text_to_sql
CREATE TABLE adaptation_projects (id INT, region VARCHAR(255), year INT, type VARCHAR(255), cost FLOAT); INSERT INTO adaptation_projects (id, region, year, type, cost) VALUES (1, 'South America', 2010, 'climate change adaptation', 300000);
What is the average number of climate change adaptation projects per year in South America from 2010 to 2020?
SELECT AVG(cost) FROM adaptation_projects WHERE region = 'South America' AND type = 'climate change adaptation' AND year BETWEEN 2010 AND 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE MilitaryInnovation (InnovationID INT PRIMARY KEY, Country VARCHAR(50), Budget DECIMAL(10,2), InnovationType VARCHAR(50), Year INT); INSERT INTO MilitaryInnovation (InnovationID, Country, Budget, InnovationType, Year) VALUES (1, 'China', 5000000, 'Artificial Intelligence', 2022), (2, 'Japan', 3000000, 'Cybe...
What is the total budget allocated for military innovation by country in the Asia-Pacific region for the year 2022?
SELECT SUM(Budget) AS 'Total Budget', Country FROM MilitaryInnovation WHERE Year = 2022 AND Country IN ('China', 'Japan', 'South Korea') GROUP BY Country;
gretelai_synthetic_text_to_sql
CREATE TABLE labor_unions (id INT, union_name VARCHAR(50), members INT); CREATE TABLE safety_records (id INT, union_id INT, safety_score INT); CREATE TABLE employees (id INT, union_id INT, name VARCHAR(50), position VARCHAR(50));
Show the union_name and number of employees for unions with a safety record below 70 from the 'labor_unions', 'safety_records', and 'employees' tables
SELECT l.union_name, COUNT(e.id) AS employee_count FROM labor_unions l JOIN safety_records s ON l.id = s.union_id JOIN employees e ON l.id = e.union_id WHERE s.safety_score < 70 GROUP BY l.union_name;
gretelai_synthetic_text_to_sql
CREATE TABLE wind_energy (country VARCHAR(20), capacity INT); INSERT INTO wind_energy (country, capacity) VALUES ('Germany', 60000), ('Spain', 35000), ('Germany', 65000);
What is the total installed capacity of wind energy in Germany and Spain?
SELECT SUM(capacity) FROM wind_energy WHERE country IN ('Germany', 'Spain');
gretelai_synthetic_text_to_sql
CREATE TABLE MarineProtectedAreas (AreaID INT PRIMARY KEY, AreaName TEXT, Location TEXT);
What are the names and locations of marine protected areas from the 'MarineProtectedAreas' table?
SELECT AreaName, Location FROM MarineProtectedAreas;
gretelai_synthetic_text_to_sql
CREATE TABLE Publications (PublicationID INT, PublicationYear INT, Journal VARCHAR(50)); INSERT INTO Publications (PublicationID, PublicationYear, Journal) VALUES (1, 2020, 'Journal A'); INSERT INTO Publications (PublicationID, PublicationYear, Journal) VALUES (2, 2019, 'Journal B'); INSERT INTO Publications (Publicati...
Calculate the total number of academic publications by year and journal.
SELECT p.PublicationYear, p.Journal, COUNT(p.PublicationID) as PublicationCount FROM Publications p GROUP BY p.PublicationYear, p.Journal;
gretelai_synthetic_text_to_sql
CREATE TABLE state_services (state VARCHAR(20), service VARCHAR(20), budget INT); INSERT INTO state_services (state, service, budget) VALUES ('New South Wales', 'Public Parks', 15000000);
What is the total budget allocated for public parks in the state of New South Wales?
SELECT SUM(budget) FROM state_services WHERE state = 'New South Wales' AND service = 'Public Parks';
gretelai_synthetic_text_to_sql
CREATE TABLE marine_trenches (name VARCHAR(255), location VARCHAR(255), max_depth DECIMAL(5,2)); INSERT INTO marine_trenches (name, location, max_depth) VALUES ('Mariana Trench', 'Pacific Ocean', 36084.00);
What is the maximum depth recorded for the Mariana Trench?
SELECT MAX(max_depth) FROM marine_trenches WHERE name = 'Mariana Trench';
gretelai_synthetic_text_to_sql
CREATE TABLE vulnerability_resolution(id INT, severity VARCHAR(50), resolution_time INT, vulnerability_date DATE);
What is the average time to resolution for high severity vulnerabilities in the past month?
SELECT severity, AVG(resolution_time) as avg_resolution_time FROM vulnerability_resolution WHERE severity = 'high' AND vulnerability_date > DATE(NOW()) - INTERVAL 30 DAY GROUP BY severity;
gretelai_synthetic_text_to_sql
CREATE TABLE hotels (id INT, country TEXT, is_ecofriendly BOOLEAN, rating FLOAT); INSERT INTO hotels (id, country, is_ecofriendly, rating) VALUES (1, 'Thailand', TRUE, 4.5), (2, 'Thailand', FALSE, 4.2), (3, 'Indonesia', TRUE, 4.8);
How many eco-friendly hotels are there in Thailand and what is their average rating?
SELECT COUNT(*), AVG(rating) FROM hotels WHERE is_ecofriendly = TRUE AND country = 'Thailand';
gretelai_synthetic_text_to_sql
CREATE TABLE Vessels (vessel_name VARCHAR(255)); INSERT INTO Vessels (vessel_name) VALUES ('VesselX'), ('VesselY'); CREATE TABLE Compliance (vessel_name VARCHAR(255), compliance_date DATE); INSERT INTO Compliance (vessel_name, compliance_date) VALUES ('VesselX', '2022-01-03'), ('VesselX', '2022-01-19'), ('VesselY', '20...
List all the regulatory compliance records for 'VesselX' in January 2022.
SELECT * FROM Compliance WHERE vessel_name = 'VesselX' AND compliance_date BETWEEN '2022-01-01' AND '2022-01-31';
gretelai_synthetic_text_to_sql
CREATE TABLE mediterranean_wildlife (id INT, species VARCHAR(50), year INT, region VARCHAR(20)); INSERT INTO mediterranean_wildlife (id, species, year, region) VALUES (1, 'Lynx', 2017, 'Mediterranean'), (2, 'Wild Boar', 2017, 'Mediterranean'), (3, 'Iberian Wolf', 2018, 'Mediterranean'), (4, 'Eagle', 2018, 'Mediterranea...
Find the number of distinct wildlife species observed in Mediterranean forests since 2017.
SELECT region, COUNT(DISTINCT species) as num_distinct_species FROM mediterranean_wildlife WHERE region = 'Mediterranean' AND year >= 2017 GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE permit_data (state VARCHAR(255), permit INT, sustainable BOOLEAN); INSERT INTO permit_data (state, permit, sustainable) VALUES ('California', 500, TRUE), ('Texas', 400, FALSE), ('New York', 600, TRUE);
What is the total number of building permits issued in each state for sustainable building practices?
SELECT state, SUM(permit) FROM permit_data WHERE sustainable = TRUE GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE defi (id INT, name VARCHAR(50), platform VARCHAR(50), country VARCHAR(50)); INSERT INTO defi (id, name, platform, country) VALUES (1, 'DeFi1', 'Ethereum', 'Singapore'), (2, 'DeFi2', 'Binance Smart Chain', 'Malaysia'), (3, 'DeFi3', 'Ethereum', 'Thailand');
What is the distribution of decentralized finance (DeFi) protocols by platform type in Southeast Asia?
SELECT platform, COUNT(*) as defi_count FROM defi WHERE country IN ('Singapore', 'Malaysia', 'Thailand') GROUP BY platform;
gretelai_synthetic_text_to_sql
CREATE TABLE productivity (project_id INT, region TEXT, mineral TEXT, quantity INT, environmental_impact TEXT); INSERT INTO productivity (project_id, region, mineral, quantity, environmental_impact) VALUES (1, 'Oceania', 'gold', 1200, 'high'), (2, 'Oceania', 'copper', 1500, 'low');
What is the total quantity of minerals extracted (in kg) for all mining projects in Oceania that have a reported environmental impact?
SELECT SUM(quantity) FROM productivity WHERE region = 'Oceania' AND environmental_impact IS NOT NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE City_Staffing (City VARCHAR(255), Department VARCHAR(255), Staff_Count INT); INSERT INTO City_Staffing (City, Department, Staff_Count) VALUES ('New York', 'Police', 34000); INSERT INTO City_Staffing (City, Department, Staff_Count) VALUES ('Los Angeles', 'Police', 10000); INSERT INTO City_Population (City, ...
What is the ratio of police officers to citizens in each city?
SELECT City, Staff_Count/Population AS Police_Per_Capita FROM City_Staffing, City_Population WHERE City_Staffing.City = City_Population.City AND Department = 'Police';
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityHealthWorker (WorkerID int, Age int, Gender varchar(10)); INSERT INTO CommunityHealthWorker (WorkerID, Age, Gender) VALUES (1, 35, 'Female'), (2, 42, 'Male'), (3, 38, 'Female'), (4, 50, 'Male');
What is the average age of community health workers, partitioned by gender and ordered by age?
SELECT Gender, Age, AVG(Age) OVER (PARTITION BY Gender) AS AvgAge, ROW_NUMBER() OVER (PARTITION BY Gender ORDER BY Age) AS Rank FROM CommunityHealthWorker;
gretelai_synthetic_text_to_sql
CREATE TABLE Users (UserID INT, Country VARCHAR(255)); CREATE TABLE StreamingService (StreamingID INT, UserID INT, GenreID INT, Streams INT); INSERT INTO Users VALUES (1, 'Country A'); INSERT INTO Users VALUES (2, 'Country B'); INSERT INTO StreamingService VALUES (1, 1, 1, 100); INSERT INTO StreamingService VALUES (2, ...
Find the number of unique users who have streamed music from "Country A" and "Country B" on the "Streaming Service" platform.
SELECT COUNT(DISTINCT UserID) FROM Users u JOIN StreamingService s ON u.UserID = s.UserID WHERE u.Country IN ('Country A', 'Country B');
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists aerospace;CREATE TABLE if not exists aerospace.aircraft (id INT PRIMARY KEY, name VARCHAR(50), model VARCHAR(50), accidents INT); INSERT INTO aerospace.aircraft (id, name, model, accidents) VALUES (1, 'Boeing', '737', 3), (2, 'Boeing', '747', 2), (3, 'Airbus', 'A320', 6);
What is the average number of accidents for each aircraft model?
SELECT model, AVG(accidents) as avg_accidents FROM aerospace.aircraft GROUP BY model;
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (state varchar(2), num_hospitals int, num_beds int); INSERT INTO hospitals (state, num_hospitals, num_beds) VALUES ('NY', 15, 20100), ('CA', 25, 50000), ('TX', 20, 45000), ('FL', 12, 22000);
What is the difference in the number of hospital beds between the state with the most beds and the state with the fewest beds, for states with at least 10 hospitals?
SELECT MAX(num_beds) - MIN(num_beds) as bed_difference FROM (SELECT state, SUM(num_beds) as num_beds FROM hospitals WHERE num_hospitals >= 10 GROUP BY state) as subquery;
gretelai_synthetic_text_to_sql
CREATE TABLE RestorativeJusticeFacilitators (FacilitatorName text, City text, CaseType text, Year int, NumCases int); INSERT INTO RestorativeJusticeFacilitators VALUES ('Facilitator1', 'LA', 'Assault', 2022, 15, '2022-01-01'), ('Facilitator1', 'LA', 'Theft', 2022, 10, '2022-01-01'), ('Facilitator2', 'NY', 'Assault', 20...
What is the number of cases handled by each restorative justice facilitator, broken down by facilitator name, case type, and year, for facilitators located in the city of Los Angeles?
SELECT FacilitatorName, CaseType, Year, SUM(NumCases) FROM RestorativeJusticeFacilitators WHERE City = 'LA' GROUP BY FacilitatorName, CaseType, Year;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellite_Components (component_cost DECIMAL(10,2), manufacturer VARCHAR(255)); INSERT INTO Satellite_Components (component_cost, manufacturer) VALUES (100000.00, 'SpaceTech Inc.'), (120000.00, 'Galactic Enterprises'), (110000.00, 'SpaceTech Inc.');
What is the average cost of satellite components for each satellite manufacturer?
SELECT manufacturer, AVG(component_cost) FROM Satellite_Components GROUP BY manufacturer;
gretelai_synthetic_text_to_sql
CREATE TABLE Salaries (Salary DECIMAL(10,2), JobCategory VARCHAR(20)); INSERT INTO Salaries (Salary, JobCategory) VALUES (65000, 'IT'), (60000, 'HR');
What is the average salary for each job category in the company?
SELECT JobCategory, AVG(Salary) as AvgSalary FROM Salaries GROUP BY JobCategory;
gretelai_synthetic_text_to_sql
CREATE TABLE Virtual_Tour (month TEXT, revenue NUMERIC); INSERT INTO Virtual_Tour (month, revenue) VALUES ('January', 5000), ('February', 7000), ('March', 8000), ('April', 9000), ('May', 10000), ('June', 11000), ('July', 12000), ('August', 13000), ('September', 14000), ('October', 15000), ('November', 16000), ('Decembe...
What is the trend of virtual tour revenue over the past year?
SELECT month, revenue FROM Virtual_Tour ORDER BY month;
gretelai_synthetic_text_to_sql
CREATE TABLE standard (id INT, name VARCHAR(50), description TEXT, category VARCHAR(20)); INSERT INTO standard (id, name, description, category) VALUES (2, 'HDS', 'Standard guidelines for water management', 'Design');
What are the design standards related to 'water management'?
SELECT name FROM standard WHERE category = 'Design' AND description LIKE '%water%management%';
gretelai_synthetic_text_to_sql
CREATE TABLE community_events (id INT, event_name VARCHAR(255), location VARCHAR(255), year INT); INSERT INTO community_events (id, event_name, location, year) VALUES (1, 'Festival de Arte', 'Angola', 2010), (2, 'Masquerade Ball', 'Nigeria', 2005);
What is the total number of community engagement events in Africa?
SELECT COUNT(*) FROM community_events WHERE location LIKE 'Africa%';
gretelai_synthetic_text_to_sql
CREATE TABLE WaterUsage (Material varchar(50), WaterUsage decimal);
What is the average water usage for the production of each material type?
SELECT Material, AVG(WaterUsage) AS AvgWaterUsage FROM WaterUsage GROUP BY Material;
gretelai_synthetic_text_to_sql
CREATE TABLE rural_infra(id INT, project TEXT, location TEXT); INSERT INTO rural_infra (id, project, location) VALUES (1, 'Rural Water Supply Project', 'Caribbean');
What is the number of rural infrastructure projects in 'Caribbean'?
SELECT COUNT(*) FROM rural_infra WHERE location = 'Caribbean';
gretelai_synthetic_text_to_sql
CREATE TABLE states (id INT, name VARCHAR(255), voter_turnout INT); INSERT INTO states (id, name, voter_turnout) VALUES (1, 'California', 70), (2, 'Texas', 60), (3, 'New York', 65);
Which states in the United States have the lowest voter turnout?
SELECT name FROM states WHERE voter_turnout < 70 ORDER BY voter_turnout ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE uranium_mines (id INT, name TEXT, location TEXT, production_rate INT); INSERT INTO uranium_mines (id, name, location, production_rate) VALUES (1, 'Priargunsky', 'Russia', 1500), (2, 'Krasnokamensk', 'Russia', 800);
List the names of uranium mines in Russia with production rates less than 1000.
SELECT name FROM uranium_mines WHERE production_rate < 1000 AND location = 'Russia';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_projects (project_name VARCHAR(50), location VARCHAR(50), start_year INT, budget INT, sector VARCHAR(50)); INSERT INTO climate_projects (project_name, location, start_year, budget, sector) VALUES ('Flood Prevention C', 'Brazil', 2018, 800000, 'Climate Adaptation'), ('Drought Resistance D', 'Argenti...
What is the number of climate adaptation projects in South America and their respective start years?
SELECT COUNT(*), start_year FROM climate_projects WHERE location IN ('South America') AND sector = 'Climate Adaptation' GROUP BY start_year;
gretelai_synthetic_text_to_sql
CREATE TABLE military_personnel (id INT, name VARCHAR(50), rank VARCHAR(50), branch VARCHAR(50)); INSERT INTO military_personnel (id, name, rank, branch) VALUES (1, 'John Doe', 'Commander', 'Navy'); INSERT INTO military_personnel (id, name, rank, branch) VALUES (2, 'Jane Smith', 'Lieutenant', 'Navy');
What is the average rank in the 'navy' branch?
SELECT AVG(rank) FROM military_personnel WHERE branch = 'Navy';
gretelai_synthetic_text_to_sql
CREATE TABLE mining_operation (id INT, name VARCHAR(255), location VARCHAR(255));CREATE TABLE environmental_assessment (id INT, mining_operation_id INT, date DATE, impact VARCHAR(255)); INSERT INTO mining_operation (id, name, location) VALUES (1, 'Swedish Iron', 'Sweden'); INSERT INTO environmental_assessment (id, mini...
List all environmental impact assessments for mining operations in Sweden.
SELECT mining_operation.name, environmental_assessment.date, environmental_assessment.impact FROM mining_operation JOIN environmental_assessment ON mining_operation.id = environmental_assessment.mining_operation_id WHERE mining_operation.location = 'Sweden';
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy (project_id INT, location TEXT, installed_capacity FLOAT, technology TEXT); INSERT INTO renewable_energy (project_id, location, installed_capacity, technology) VALUES (1, 'San Francisco', 100.5, 'Solar'), (2, 'New York', 200.3, 'Wind'), (3, 'Los Angeles', 150.0, 'Solar');
What is the maximum installed capacity in MW for wind projects in the 'renewable_energy' table?
SELECT MAX(installed_capacity) FROM renewable_energy WHERE technology = 'Wind';
gretelai_synthetic_text_to_sql
CREATE TABLE acidification (id INT, ocean VARCHAR(50), year INT, level FLOAT); INSERT INTO acidification (id, ocean, year, level) VALUES (1, 'Arctic Ocean', 2018, 7.1), (2, 'Arctic Ocean', 2019, 7.2), (3, 'Arctic Ocean', 2020, NULL);
What was the average ocean acidification level in the Arctic Ocean in 2020?
SELECT AVG(level) FROM acidification WHERE ocean = 'Arctic Ocean' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Supplier (SupplierID INT, SupplierName VARCHAR(100), Country VARCHAR(50)); CREATE TABLE Sales (SalesID INT, SupplierID INT, EquipmentID INT, Quantity INT, SaleDate DATE);
Who are the top 5 suppliers of military equipment to the APAC region?
SELECT SupplierName, COUNT(EquipmentID) AS NumberOfSales FROM Supplier JOIN Sales ON Supplier.SupplierID = Sales.SupplierID WHERE Country = 'APAC' GROUP BY SupplierName ORDER BY NumberOfSales DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE broadband_plans (id INT, name VARCHAR(255), type VARCHAR(255), price DECIMAL(10,2), region VARCHAR(255)); CREATE TABLE complaints (id INT, plan_id INT, complaint_type VARCHAR(255), complaint_count INT); CREATE TABLE regions (id INT, name VARCHAR(255));
What is the total number of customer complaints for each broadband plan in Latin America?
SELECT broadband_plans.name AS broadband_plan, SUM(complaints.complaint_count) FROM complaints JOIN broadband_plans ON complaints.plan_id = broadband_plans.id JOIN regions ON broadband_plans.region = regions.name WHERE regions.name = 'Latin America' GROUP BY broadband_plans.name;
gretelai_synthetic_text_to_sql
CREATE TABLE inclusive_policies (id INT, policy_name VARCHAR(255), city VARCHAR(255)); INSERT INTO inclusive_policies (id, policy_name, city) VALUES (1, 'Policy A', 'City X'), (2, 'Policy B', 'City Y'), (3, 'Policy C', 'City Z'), (4, 'Policy D', 'City X');
What is the total number of inclusive housing policies in inclusive_policies table?
SELECT COUNT(*) FROM inclusive_policies;
gretelai_synthetic_text_to_sql
CREATE TABLE Chemical_Production (Plant_Name VARCHAR(255), Chemical_Name VARCHAR(255), Production_Rate INT); INSERT INTO Chemical_Production (Plant_Name, Chemical_Name, Production_Rate) VALUES ('Plant A', 'Chemical X', 500), ('Plant A', 'Chemical Y', 800), ('Plant B', 'Chemical X', 700), ('Plant B', 'Chemical Y', 900);
What is the production rate of each chemical in Plant A and Plant B?
SELECT Plant_Name, Chemical_Name, Production_Rate FROM Chemical_Production;
gretelai_synthetic_text_to_sql
CREATE TABLE retailers (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(100)); CREATE TABLE sales (id INT PRIMARY KEY, retailer_id INT, quantity INT, revenue INT); INSERT INTO retailers (id, name, location) VALUES (1, 'Retailer X', 'City X'), (2, 'Retailer Y', 'City Y'), (3, 'Retailer Z', 'City Y'); INSERT INTO...
Who are the top 2 retailers with the highest revenue from sales in City Y?
SELECT r.name, s.revenue FROM retailers r INNER JOIN sales s ON r.id = s.retailer_id WHERE r.location = 'City Y' GROUP BY r.name ORDER BY SUM(s.revenue) DESC LIMIT 2;
gretelai_synthetic_text_to_sql
CREATE TABLE fares (ride_type TEXT, fare DECIMAL(5,2));
Update the fare for 'Cable Car' rides
UPDATE fares SET fare = 2.50 WHERE ride_type = 'Cable Car';
gretelai_synthetic_text_to_sql
CREATE TABLE Countries (country VARCHAR(255), launched_satellites BOOLEAN, manufactured_aircraft BOOLEAN); INSERT INTO Countries (country, launched_satellites, manufactured_aircraft) VALUES ('Country1', true, true); INSERT INTO Countries (country, launched_satellites, manufactured_aircraft) VALUES ('Country2', true, fa...
What are the names of all countries that have both launched satellites and manufactured aircraft?
SELECT country FROM Countries WHERE launched_satellites = true AND manufactured_aircraft = true;
gretelai_synthetic_text_to_sql
CREATE TABLE donations (donor_id INT, organization_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (donor_id, organization_id, amount, donation_date) VALUES (1, 101, 500.00, '2022-01-01'), (2, 102, 350.00, '2022-01-15'), (3, 101, 200.00, '2022-01-30'); CREATE TABLE volunteer_hours (volunteer_id...
What is the sum of donations and volunteer hours for each organization in Q1 2022?
SELECT organization_id, SUM(amount) + SUM(hours) as total FROM (SELECT organization_id, amount FROM donations WHERE donation_date BETWEEN '2022-01-01' AND '2022-01-31' UNION ALL SELECT organization_id, hours FROM volunteer_hours WHERE volunteer_date BETWEEN '2022-01-01' AND '2022-01-31') AS total_data GROUP BY organiza...
gretelai_synthetic_text_to_sql
CREATE TABLE marine_farms_2 (id INT, name TEXT, location TEXT, species TEXT, biomass FLOAT); INSERT INTO marine_farms_2 (id, name, location, species, biomass) VALUES (1, 'Farm E', 'Norway', 'Haddock', 1500.0), (2, 'Farm F', 'Spain', 'Tuna', 4500.0);
What is the total biomass of fish species in marine farms, excluding Cod?
SELECT SUM(biomass) FROM marine_farms_2 WHERE species != 'Cod';
gretelai_synthetic_text_to_sql
CREATE TABLE Departments (DepartmentID INT, Name TEXT, Budget FLOAT); INSERT INTO Departments (DepartmentID, Name, Budget) VALUES (1, 'Education', 5000.00), (2, 'Fundraising', 7000.00);
What is the total budget for the 'Education' department?
SELECT SUM(Budget) as TotalBudget FROM Departments WHERE Name = 'Education';
gretelai_synthetic_text_to_sql
CREATE TABLE CarbonCaptureTechnologies (id INT, country VARCHAR(20), technology_start_date DATE); INSERT INTO CarbonCaptureTechnologies (id, country, technology_start_date) VALUES (1, 'Indonesia', '2014-01-01'), (2, 'Malaysia', '2013-06-01'), (3, 'Thailand', '2016-03-15');
How many countries in Southeast Asia have implemented carbon capture and storage technologies since 2012?
SELECT COUNT(DISTINCT country) FROM CarbonCaptureTechnologies WHERE technology_start_date >= '2012-01-01' AND country IN ('Indonesia', 'Malaysia', 'Thailand', 'Philippines', 'Singapore', 'Vietnam', 'Myanmar', 'Cambodia', 'Laos', 'Brunei');
gretelai_synthetic_text_to_sql
CREATE TABLE startups(id INT, name TEXT, industry TEXT, total_funding FLOAT, founder TEXT); INSERT INTO startups VALUES(1, 'StartupA', 'Finance', 10000000, 'Woman'); INSERT INTO startups VALUES(2, 'StartupB', 'Tech', 20000000, 'Man'); INSERT INTO startups VALUES(3, 'StartupC', 'Finance', 15000000, 'Man'); INSERT INTO s...
What is the maximum total funding received by a startup founded by a woman in the Finance sector?
SELECT MAX(total_funding) FROM startups WHERE industry = 'Finance' AND founder = 'Woman';
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists biotech;CREATE TABLE if not exists biotech.investors (id INT, name TEXT, location TEXT, investment_amount DECIMAL(10,2), sector TEXT);INSERT INTO biotech.investors (id, name, location, investment_amount, sector) VALUES (1, 'InvestorA', 'USA', 3000000.00, 'Biotechnology'), (2, 'InvestorB', 'C...
Identify the top 3 startup investors based on the total funding they have invested in the biotechnology sector.
SELECT name, investment_amount FROM biotech.investors WHERE sector = 'Biotechnology' ORDER BY investment_amount DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE StateHospitals (StateName VARCHAR(50), NumHospitals INT, AvgCapacity INT); INSERT INTO StateHospitals (StateName, NumHospitals, AvgCapacity) VALUES ('Alabama', 2, 275), ('Alaska', 1, 50), ('Arizona', 2, 375);
What is the number of hospitals and average hospital capacity for each state?
SELECT StateName, COUNT(*) AS NumHospitals, AVG(AvgCapacity) AS AvgCapacity FROM StateHospitals GROUP BY StateName
gretelai_synthetic_text_to_sql
CREATE TABLE GreenBuildingProjects (id INT, reduction_type VARCHAR(50), co2_reduction FLOAT); INSERT INTO GreenBuildingProjects (id, reduction_type, co2_reduction) VALUES (1, 'Insulation', 50.0), (2, 'Lighting', 75.0), (3, 'Insulation', 60.0), (4, 'HVAC', 40.0), (5, 'HVAC', 35.0);
What is the minimum CO2 emission reduction of green building projects in each reduction type, for reduction types with at least two projects?
SELECT reduction_type, MIN(co2_reduction) FROM GreenBuildingProjects GROUP BY reduction_type HAVING COUNT(*) >= 2;
gretelai_synthetic_text_to_sql
CREATE TABLE Projects(id INT, name VARCHAR(255), start_date DATE, end_date DATE, extension_date DATE);
Which defense projects had a timeline extension in the first quarter of the previous year?
SELECT name FROM Projects WHERE end_date < (SELECT end_date FROM Projects WHERE id = Projects.id - 1) AND extension_date BETWEEN DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 1 YEAR), INTERVAL 3 MONTH) AND DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 1 YEAR), INTERVAL 2 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE chemical_storages (id INT, facility_name VARCHAR(100), country VARCHAR(50), temperature FLOAT); INSERT INTO chemical_storages (id, facility_name, country, temperature) VALUES (1, 'India Storage 1', 'India', 24.5), (2, 'India Storage 2', 'India', 26.3);
What is the minimum temperature in chemical storage facilities in India?
SELECT MIN(temperature) FROM chemical_storages WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (exhibition_id INT, city VARCHAR(20), country VARCHAR(20)); INSERT INTO Exhibitions (exhibition_id, city, country) VALUES (1, 'Jakarta', 'Indonesia'), (2, 'Bandung', 'Indonesia'), (3, 'Surabaya', 'Indonesia'); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT, age INT); INSERT INTO Visit...
What is the total number of visitors who attended exhibitions in 'Jakarta' or 'Bandung' and are below 30 years of age?
SELECT COUNT(visitor_id) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.exhibition_id WHERE e.city IN ('Jakarta', 'Bandung') AND v.age < 30;
gretelai_synthetic_text_to_sql
CREATE TABLE AI_Ethics (company VARCHAR(50), budget INT); INSERT INTO AI_Ethics (company, budget) VALUES ('Google', 2000000), ('Microsoft', 1500000), ('IBM', 1000000), ('Amazon', 2500000);
What is the total budget allocated for AI ethics by company?
SELECT company, SUM(budget) FROM AI_Ethics;
gretelai_synthetic_text_to_sql
CREATE TABLE customers (customer_id INT, age INT, name VARCHAR(255)); CREATE TABLE transactions (transaction_id INT, customer_id INT, product_id INT, category_id INT, transaction_date DATE, amount DECIMAL(10,2)); CREATE TABLE products (product_id INT, name VARCHAR(255), category_id INT);
What is the total transaction volume for each customer in the past month, split by product category, for customers over 30 years old?
SELECT c.age, c.name, p.category_id, SUM(t.amount) as total_transaction_volume FROM customers c INNER JOIN transactions t ON c.customer_id = t.customer_id INNER JOIN products p ON t.product_id = p.product_id WHERE c.age > 30 AND t.transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY c.age, c.name, p.ca...
gretelai_synthetic_text_to_sql