context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE sales_region (region VARCHAR(50), revenue INT); INSERT INTO sales_region VALUES ('Region A', 5000); INSERT INTO sales_region VALUES ('Region A', 7000); INSERT INTO sales_region VALUES ('Region B', 8000); INSERT INTO sales_region VALUES ('Region C', 9000); CREATE TABLE product_sales (product_category VARCHA...
What is the total revenue for each product category and sales region?
SELECT region, product_category, SUM(revenue) as total_revenue FROM product_sales GROUP BY region, product_category;
gretelai_synthetic_text_to_sql
CREATE TABLE space_telescopes(telescope_name TEXT, observing_wavelength TEXT); INSERT INTO space_telescopes (telescope_name, observing_wavelength) VALUES ('Hubble', 'Visible, UV, NIR'), ('Spitzer', 'IR'), ('Chandra', 'X-ray');
List the space telescopes and their observing wavelengths.
SELECT telescope_name, observing_wavelength FROM space_telescopes;
gretelai_synthetic_text_to_sql
CREATE TABLE Department (DeptID INT, DeptName VARCHAR(50), City VARCHAR(50)); INSERT INTO Department (DeptID, DeptName, City) VALUES (1, 'Disability Services', 'New York'); INSERT INTO Department (DeptID, DeptName, City) VALUES (2, 'Student Support', 'Los Angeles'); CREATE TABLE Accommodation (AccID INT, AccName VARCHA...
What is the average disability accommodation cost per student for each department, ordered by the highest cost?
SELECT DeptName, AVG(Cost) AS AvgCost FROM Accommodation A JOIN Department D ON A.DeptID = D.DeptID GROUP BY DeptName ORDER BY AvgCost DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE MultiplayerGames (GameID INT, MaxPlayers INT, Country VARCHAR(50)); INSERT INTO MultiplayerGames (GameID, MaxPlayers, Country) VALUES (1, 8, 'USA'), (2, 4, 'Canada'), (3, 16, 'Mexico');
What is the maximum number of players in multiplayer games, and what are their countries?
SELECT MAX(MaxPlayers) AS MaxNumberOfPlayers, GROUP_CONCAT(Country) AS Countries FROM MultiplayerGames;
gretelai_synthetic_text_to_sql
CREATE TABLE donations (id INT, donor_id INT, cause VARCHAR(255), amount DECIMAL(10, 2));
Calculate the percentage of donations to education causes
SELECT (COUNT(CASE WHEN cause = 'Education' THEN 1 END) * 100.0 / COUNT(*)) AS education_donation_percentage
gretelai_synthetic_text_to_sql
CREATE TABLE workplaces (id INT, name VARCHAR(255), union_status VARCHAR(255), num_employees INT); INSERT INTO workplaces (id, name, union_status, num_employees) VALUES (1, 'ABC Company', 'Union', 500), (2, 'XYZ Corporation', 'Union', 250), (3, 'DEF Industries', 'Non-Union', 300);
What is the average number of employees per workplace, categorized by union status?
SELECT AVG(num_employees) as 'Average', union_status FROM workplaces GROUP BY union_status;
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (id INT, name VARCHAR(255), city VARCHAR(255), start_date DATE, end_date DATE, revenue FLOAT);
What is the total revenue for each art exhibition in each city?
SELECT e.city, e.name, SUM(e.revenue) FROM Exhibitions e GROUP BY e.city, e.name;
gretelai_synthetic_text_to_sql
CREATE TABLE permits (permit_type VARCHAR(20), permit_count INT, permit_date DATE); INSERT INTO permits (permit_type, permit_count, permit_date) VALUES ('Building', 500, '2022-11-01');
How many permits were issued in the city of Seattle, broken down by type, for the month of November 2022?
SELECT permit_type, SUM(permit_count) FROM permits WHERE permit_date BETWEEN '2022-11-01' AND '2022-11-30' GROUP BY permit_type;
gretelai_synthetic_text_to_sql
CREATE TABLE menu_engineering (date DATE, menu_item VARCHAR(255), category VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO menu_engineering (date, menu_item, category, revenue) VALUES ('2021-01-01', 'Scrambled Eggs', 'Breakfast', 1000.00), ('2021-01-01', 'Pancakes', 'Breakfast', 1200.00), ('2021-01-02', 'Scrambled Eg...
What was the total revenue for each menu item in the breakfast category in the first week of January 2021?
SELECT category, menu_item, SUM(revenue) as total_revenue FROM menu_engineering WHERE date BETWEEN '2021-01-01' AND '2021-01-07' AND category = 'Breakfast' GROUP BY category, menu_item;
gretelai_synthetic_text_to_sql
CREATE TABLE if not exists event_attendees (id INT, name VARCHAR(50), age INT, program VARCHAR(50), year INT); INSERT INTO event_attendees (id, name, age, program, year) VALUES (1, 'James', 35, 'Painting Classes', 2021), (2, 'Alice', 42, 'Photography Workshop', 2021), (3, 'Eli', 28, 'Sculpture Studio', 2021);
Find the average age of attendees for 'Visual Arts' programs in 2021.
SELECT AVG(age) FROM event_attendees WHERE program LIKE '%Visual Arts%' AND year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE repeat_attendees (attendee_id INT, event_name VARCHAR(50)); INSERT INTO repeat_attendees (attendee_id, event_name) VALUES (1, 'Music Festival'), (1, 'Music Concert'), (2, 'Music Festival'), (3, 'Music Concert'), (3, 'Music Festival'); CREATE TABLE event_attendance (attendee_id INT, event_name VARCHAR(50));...
What is the percentage of repeat attendees at 'Music' events?
SELECT COUNT(DISTINCT r.attendee_id) * 100.0 / COUNT(DISTINCT e.attendee_id) FROM repeat_attendees r JOIN event_attendance e ON r.attendee_id = e.attendee_id WHERE r.event_name = 'Music Festival' OR r.event_name = 'Music Concert';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance_ap (id INT, project VARCHAR(50), location VARCHAR(50), amount FLOAT); INSERT INTO climate_finance_ap (id, project, location, amount) VALUES (1, 'Adaptation Project', 'Asia-Pacific', 6000000.0); INSERT INTO climate_finance_ap (id, project, location, amount) VALUES (2, 'Mitigation Project', '...
What is the total climate finance committed to projects in the Asia-Pacific region?
SELECT SUM(amount) FROM climate_finance_ap WHERE location = 'Asia-Pacific';
gretelai_synthetic_text_to_sql
CREATE TABLE VehicleSales (Location VARCHAR(50), VehicleType VARCHAR(50), Sales INT); INSERT INTO VehicleSales (Location, VehicleType, Sales) VALUES ('Urban', 'Electric', 75000), ('Urban', 'Gasoline', 50000), ('Rural', 'Electric', 25000), ('Rural', 'Gasoline', 75000);
What is the percentage of electric vehicles sold in urban areas compared to rural areas?
SELECT Location, (SUM(CASE WHEN VehicleType = 'Electric' THEN Sales ELSE 0 END) / SUM(Sales)) * 100 as Percentage FROM VehicleSales GROUP BY Location;
gretelai_synthetic_text_to_sql
CREATE TABLE factories (factory_id INT, department VARCHAR(20), waste_generated_kg INT); INSERT INTO factories VALUES (1, 'textiles', 500), (2, 'metalwork', 300), (3, 'textiles', 700), (4, 'electronics', 400), (5, 'textiles', 600);
What is the total waste generated by each department?
SELECT department, SUM(waste_generated_kg) FROM factories GROUP BY department;
gretelai_synthetic_text_to_sql
CREATE TABLE articles (id INT, title VARCHAR(50), author_id INT, publish_date DATE); CREATE TABLE authors (id INT, name VARCHAR(50)); INSERT INTO articles (id, title, author_id, publish_date) VALUES (1, 'Article1', 1, '2022-06-01'), (2, 'Article2', 1, '2022-06-15'), (3, 'Article3', 2, '2022-05-30'); INSERT INTO authors...
What is the total number of articles written by each author, and how many of those articles were written in the month of June 2022?
SELECT a.name, COUNT(*) as total_articles, SUM(CASE WHEN DATE_FORMAT(a.publish_date, '%Y-%m') = '2022-06' THEN 1 ELSE 0 END) as articles_in_june FROM articles a JOIN authors au ON a.author_id = au.id GROUP BY a.name
gretelai_synthetic_text_to_sql
CREATE TABLE WorkerTrainings (WorkerID INT, WorkerName TEXT, Region TEXT, TrainingYear INT); INSERT INTO WorkerTrainings (WorkerID, WorkerName, Region, TrainingYear) VALUES (1, 'John Doe', 'Northeast', 2021), (2, 'Jane Smith', 'Northeast', 2020), (3, 'Alice Johnson', 'South', 2021);
What is the percentage of community health workers who have received cultural competency training by region?
SELECT Region, ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM WorkerTrainings WHERE TrainingYear >= 2020) , 2) as Percentage_Trained FROM WorkerTrainings WHERE TrainingYear >= 2020 GROUP BY Region;
gretelai_synthetic_text_to_sql
CREATE TABLE praseodymium_production (id INT, country TEXT, year INT, praseodymium_prod FLOAT); INSERT INTO praseodymium_production (id, country, year, praseodymium_prod) VALUES (1, 'China', 2015, 32000.0), (2, 'China', 2016, 35000.0), (3, 'China', 2017, 40000.0), (4, 'China', 2018, 42000.0), (5, 'China', 2019, 45000.0...
Which countries have the highest average annual Praseodymium production from 2015 to 2020?
SELECT country, AVG(praseodymium_prod) as avg_praseodymium_prod FROM praseodymium_production WHERE year BETWEEN 2015 AND 2020 GROUP BY country ORDER BY avg_praseodymium_prod DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Autonomous_Driving_Research (vehicle_id INT, status VARCHAR(20));
Delete all records of autonomous vehicles in 'Autonomous Driving Research' table.
DELETE FROM Autonomous_Driving_Research WHERE status = 'Autonomous';
gretelai_synthetic_text_to_sql
CREATE TABLE purchases (id INT, state VARCHAR(50), month VARCHAR(50), customer_id INT); INSERT INTO purchases (id, state, month, customer_id) VALUES (1, 'Michigan', 'July', 100), (2, 'Michigan', 'August', 101), (3, 'Michigan', 'September', 102), (4, 'Michigan', 'October', 103), (5, 'Michigan', 'November', 104), (6, 'Mi...
How many unique customers made purchases in Michigan in the second half of 2021?
SELECT COUNT(DISTINCT customer_id) FROM purchases WHERE state = 'Michigan' AND (month = 'July' OR month = 'August' OR month = 'September' OR month = 'October' OR month = 'November' OR month = 'December') AND customer_id IS NOT NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE unions (id INT, name VARCHAR(255), country VARCHAR(255));INSERT INTO unions (id, name, country) VALUES (1, 'CNTU', 'Nigeria'), (2, 'ZCTU', 'Zimbabwe'), (3, 'UGTC', 'Uganda'), (4, 'TUC', 'Tanzania');CREATE TABLE violations (id INT, union_id INT, resolved INT, year INT);INSERT INTO violations (id, union_id, ...
What is the total number of labor rights violation cases in Africa by each union, and how many were resolved?
SELECT unions.name, COUNT(violations.id) as total_violations, SUM(CASE WHEN violations.resolved = 1 THEN 1 ELSE 0 END) as resolved_violations FROM unions JOIN violations ON unions.id = violations.union_id WHERE unions.country = 'Africa' GROUP BY unions.name;
gretelai_synthetic_text_to_sql
CREATE TABLE BusinessStudentPublications (id INT, name VARCHAR(255), department VARCHAR(255), publications INT, graduation_year INT);
List the top 3 graduate students with the highest number of research publications in the School of Business and Management, ordered by total publications in descending order. Include their names, total publications, and graduation year.
SELECT name, SUM(publications) as total_publications, graduation_year FROM BusinessStudentPublications WHERE department LIKE 'Business%' GROUP BY name, graduation_year ORDER BY total_publications DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE film_screenings (attendee_id INT, attendee_name TEXT); CREATE TABLE theater_productions (attendee_id INT, attendee_name TEXT);
What are the names of all audience members who have attended film screenings but never theater productions?
SELECT attendee_name FROM film_screenings WHERE attendee_id NOT IN (SELECT attendee_id FROM theater_productions);
gretelai_synthetic_text_to_sql
CREATE TABLE counties (id INT, name VARCHAR(255), state VARCHAR(255), median_income INT); INSERT INTO counties (id, name, state, median_income) VALUES (1, 'Harris', 'Texas', 65000), (2, 'Dallas', 'Texas', 55000), (3, 'Tarrant', 'Texas', 70000);
Which counties in the state of 'Texas' have a median income below the national average ( $60,293 )?
SELECT name FROM counties WHERE state = 'Texas' AND median_income < 60293;
gretelai_synthetic_text_to_sql
CREATE TABLE customers (customer_id INT, name VARCHAR(50)); CREATE TABLE transactions (transaction_id INT, customer_id INT, transaction_amount DECIMAL(10,2)); INSERT INTO customers (customer_id, name) VALUES (1, 'John Doe'), (2, 'Jane Smith'); INSERT INTO transactions (transaction_id, customer_id, transaction_amount) V...
What is the average transaction amount for each customer?
SELECT c.name, AVG(t.transaction_amount) FROM customers c JOIN transactions t ON c.customer_id = t.customer_id GROUP BY c.name;
gretelai_synthetic_text_to_sql
CREATE TABLE engineering_design_standards (id INT, standard_name VARCHAR(255), standard_type VARCHAR(255)); INSERT INTO engineering_design_standards (id, standard_name, standard_type) VALUES (1, 'ANSI/AWWA B100', 'Water Treatment'), (2, 'ANSI/AWWA B120', 'Water Distribution'), (3, 'ANSI/AWWA B124', 'Water Storage'), (4...
Which engineering design standards are associated with water treatment facilities in the United States?
SELECT standard_name FROM engineering_design_standards WHERE standard_type = 'Water Treatment';
gretelai_synthetic_text_to_sql
CREATE TABLE military_equipment (equipment_type VARCHAR(255), unit_count INT); INSERT INTO military_equipment (equipment_type, unit_count) VALUES ('Tank', 4000), ('Aircraft', 7000), ('Ship', 300), ('Helicopter', 2500);
What is the total number of military equipment units by type?
SELECT equipment_type, SUM(unit_count) FROM military_equipment;
gretelai_synthetic_text_to_sql
CREATE TABLE electric_vehicles (vehicle_id INT, co2_emission_reduction FLOAT, city VARCHAR(20)); INSERT INTO electric_vehicles (vehicle_id, co2_emission_reduction, city) VALUES (201, 2.5, 'CityC'), (202, 3.1, 'CityC'), (203, 1.9, 'CityD');
What is the total CO2 emissions reduction in CityC due to electric vehicle adoption?
SELECT SUM(co2_emission_reduction) FROM electric_vehicles WHERE city = 'CityC';
gretelai_synthetic_text_to_sql
CREATE TABLE shipment_details (shipment_id INT, package_id INT, weight DECIMAL(5,2)); CREATE TABLE transportation (shipment_id INT, transportation_type TEXT);
What is the total weight of packages shipped via ground transportation from the 'shipment_details' and 'transportation' tables?
SELECT SUM(weight) FROM shipment_details sd JOIN transportation t ON sd.shipment_id = t.shipment_id WHERE t.transportation_type = 'ground';
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists us_rural_healthcare; USE us_rural_healthcare; CREATE TABLE Hospitals (id INT, name VARCHAR(100), location VARCHAR(100), beds INT, state VARCHAR(50)); INSERT INTO Hospitals VALUES (1, 'Rural General Hospital', 'Smalltown, Alabama', 50, 'Alabama'), (2, 'Mountain View Clinic', 'Mountain Village...
What is the average number of hospital beds per hospital in each state in the US's rural healthcare system?
SELECT state, AVG(beds) FROM Hospitals GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE VesselArrivals (ID INT, VesselName VARCHAR(50), ArrivalPort VARCHAR(50), ArrivalDate DATE, AverageSpeed DECIMAL(5,2)); INSERT INTO VesselArrivals (ID, VesselName, ArrivalPort, ArrivalDate, AverageSpeed) VALUES (1, 'Test Vessel 1', 'Amsterdam', '2022-01-01', 15.5), (2, 'Test Vessel 2', 'Rotterdam', '2022-01...
Find the vessel with the highest average speed that arrived in the Netherlands ports?
SELECT VesselName, MAX(AverageSpeed) FROM VesselArrivals WHERE ArrivalPort LIKE 'Netherlands%' GROUP BY VesselName;
gretelai_synthetic_text_to_sql
CREATE TABLE WaterConservationInitiatives (ID INT, State VARCHAR(20), Initiative VARCHAR(50)); INSERT INTO WaterConservationInitiatives (ID, State, Initiative) VALUES (5, 'Texas', 'Water-saving toilets'), (6, 'Texas', 'Dual-pane windows'), (7, 'Florida', 'Rain sensors for irrigation'), (8, 'Georgia', 'Smart landscaping...
Find the number of water conservation initiatives in the state of Texas.
SELECT COUNT(*) FROM WaterConservationInitiatives WHERE State = 'Texas'
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (exhibition_id INT, city VARCHAR(20)); INSERT INTO Exhibitions (exhibition_id, city) VALUES (1, 'New York'), (2, 'Los Angeles'), (3, 'Chicago'); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT, age INT); INSERT INTO Visitors (visitor_id, exhibition_id, age) VALUES (1, 1, 30), (2, 1, 35...
What is the average age of visitors who attended exhibitions in New York?
SELECT AVG(age) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.exhibition_id WHERE e.city = 'New York';
gretelai_synthetic_text_to_sql
CREATE TABLE satellites (id INT, country VARCHAR(255), launch_year INT); INSERT INTO satellites (id, country, launch_year) VALUES (1, 'USA', 2017), (2, 'Russia', 2018), (3, 'China', 2016), (4, 'India', 2015), (5, 'Germany', 2019);
Identify the top 3 countries with the most satellites deployed since 2015?
SELECT country, COUNT(*) AS num_satellites FROM satellites WHERE launch_year >= 2015 GROUP BY country ORDER BY num_satellites DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID INT, Country VARCHAR(50));
List the number of employees hired in each country, ranked by the number of employees in descending order.
SELECT Country, COUNT(*) AS EmployeeCount FROM Employees GROUP BY Country ORDER BY EmployeeCount DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE consumer_awareness_scores (country VARCHAR(50), score INT); INSERT INTO consumer_awareness_scores (country, score) VALUES ('Brazil', 75), ('Colombia', 80), ('Ecuador', 85), ('Peru', 90), ('Venezuela', 70);
What is the average consumer awareness score for each country in the ethical fashion industry?
SELECT country, AVG(score) FROM consumer_awareness_scores GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE Charging_Stations (country VARCHAR(50), quantity INT); INSERT INTO Charging_Stations (country, quantity) VALUES ('France', 5000);
What is the maximum number of electric vehicle charging stations in France?
SELECT MAX(quantity) FROM Charging_Stations WHERE country = 'France';
gretelai_synthetic_text_to_sql
CREATE TABLE donors (id INT, name VARCHAR(50)); CREATE TABLE donations (id INT, donor_id INT, organization_id INT, amount DECIMAL(10, 2)); INSERT INTO donors (id, name) VALUES (1, 'Donor1'), (2, 'Donor2'), (3, 'Donor3'), (4, 'Donor4'), (5, 'Donor5'); INSERT INTO donations (id, donor_id, organization_id, amount) VALUES ...
How many unique donors have donated to any organization in the 'Environment' category?
SELECT COUNT(DISTINCT donor_id) FROM donations JOIN organizations ON donations.organization_id = organizations.id WHERE organizations.category = 'Environment';
gretelai_synthetic_text_to_sql
CREATE TABLE water_usage_2 (customer_id INT, usage_date DATE, amount FLOAT); INSERT INTO water_usage_2 (customer_id, usage_date, amount) VALUES (5, '2020-01-01', 100), (5, '2020-02-01', 120), (5, '2020-03-01', 150), (5, '2020-04-01', 180), (5, '2020-05-01', 200), (5, '2020-06-01', 220), (5, '2020-07-01', 250), (5, '202...
Display the monthly water usage for the customer with ID 5 for the year 2020
SELECT usage_date, amount FROM water_usage_2 WHERE customer_id = 5 AND usage_date BETWEEN '2020-01-01' AND '2020-12-31' ORDER BY usage_date ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE grants (id INT, faculty_id INT, department VARCHAR(50), year INT, amount FLOAT); INSERT INTO grants (id, faculty_id, department, year, amount) VALUES (1, 1, 'Engineering', 2020, 10000.00), (2, 1, 'Engineering', 2019, 15000.00), (3, 2, 'Engineering', 2020, 20000.00), (4, 3, 'Engineering', 2019, 5000.00);
What is the maximum number of research grants awarded to a single faculty member in the Engineering department?
SELECT MAX(amount) FROM grants WHERE faculty_id IN (SELECT faculty_id FROM grants GROUP BY faculty_id HAVING COUNT(DISTINCT year) > 1 AND department = 'Engineering');
gretelai_synthetic_text_to_sql
CREATE TABLE regions (id INT, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'RegionA'), (2, 'RegionB'), (3, 'RegionC'); CREATE TABLE rainfall (region_id INT, rainfall DECIMAL(5,2), date DATE); INSERT INTO rainfall (region_id, rainfall, date) VALUES (1, 2.5, '2022-01-01'), (1, 3.0, '2022-01-02'), (2, 1.5...
What is the total rainfall (in inches) for each region in Texas in the first half of 2022?
SELECT region_id, SUM(rainfall) as total_rainfall FROM rainfall WHERE date BETWEEN '2022-01-01' AND '2022-06-30' GROUP BY region_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Streams (artist_name VARCHAR(50), year INT, streams INT); INSERT INTO Streams (artist_name, year, streams) VALUES ('Taylor Swift', 2018, 12000000), ('Drake', 2018, 18000000), ('BTS', 2018, 20000000), ('Billie Eilish', 2018, 10000000), ('Taylor Swift', 2019, 15000000);
Find the names of artists who had more than 15 million streams in any year.
SELECT artist_name FROM Streams WHERE streams > 15000000;
gretelai_synthetic_text_to_sql
CREATE TABLE Sales (sale_id INT, customer_id INT, strain_name TEXT, state TEXT, quantity DECIMAL(3,1)); INSERT INTO Sales (sale_id, customer_id, strain_name, state, quantity) VALUES (1, 1001, 'Bubba Kush', 'Washington', 0.25), (2, 1002, 'Sour Diesel', 'Washington', 0.5), (3, 1003, 'Blue Dream', 'Washington', 0.125), (4...
How many unique customers purchased an eighth of an ounce or more of any strain in Washington state?
SELECT COUNT(DISTINCT customer_id) as unique_customers FROM Sales WHERE state = 'Washington' AND quantity >= 0.125;
gretelai_synthetic_text_to_sql
CREATE TABLE sales_summary (sale_id int, product_id int, production_location varchar, is_ethical boolean);
How many ethical and non-ethical products have been sold in each region?
SELECT production_location, SUM(CASE WHEN is_ethical THEN 1 ELSE 0 END) AS ethical_sales, SUM(CASE WHEN NOT is_ethical THEN 1 ELSE 0 END) AS non_ethical_sales FROM sales_summary GROUP BY production_location;
gretelai_synthetic_text_to_sql
CREATE TABLE European_Union_Members (Country VARCHAR(255), Members_2020 INT); INSERT INTO European_Union_Members (Country, Members_2020) VALUES ('Germany', 6000000), ('France', 5500000), ('Italy', 4500000);
What is the total number of union members in each European country in 2020, grouped by country?
SELECT Country, SUM(Members_2020) as Total_Members_2020 FROM European_Union_Members GROUP BY Country;
gretelai_synthetic_text_to_sql
CREATE TABLE community_health_workers (id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), years_experience INT, cultural_competency_score INT); INSERT INTO community_health_workers (id, name, region, years_experience, cultural_competency_score) VALUES (1, 'Ada Williams', 'Southeast', 8, 95), (2, 'Brian Johnson...
Show the average cultural competency score for community health workers in each region
SELECT region, AVG(cultural_competency_score) as avg_score FROM community_health_workers GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, name TEXT, region TEXT, capacity_mw FLOAT); INSERT INTO projects (id, name, region, capacity_mw) VALUES (1, 'Solar Project A', 'Asia-Pacific', 120.6); INSERT INTO projects (id, name, region, capacity_mw) VALUES (2, 'Solar Project B', 'Europe', 150.2);
How many solar power projects are there in the 'Asia-Pacific' region with an installed capacity greater than 100 MW?
SELECT COUNT(*) FROM projects WHERE region = 'Asia-Pacific' AND capacity_mw > 100;
gretelai_synthetic_text_to_sql
CREATE TABLE Elevators (line VARCHAR(20), station VARCHAR(20), elevator BOOLEAN); INSERT INTO Elevators (line, station, elevator) VALUES ('Blue Line', 'State', true), ('Blue Line', 'Government Center', false);
Which stations on the Blue Line have elevators?
SELECT station FROM Elevators WHERE line = 'Blue Line' AND elevator = true;
gretelai_synthetic_text_to_sql
CREATE TABLE vessels (id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), length FLOAT, year_built INT);
Add a new vessel to the 'vessels' table
INSERT INTO vessels (id, name, type, length, year_built) VALUES (1, 'MV Ocean Wave', 'Container Ship', 300.0, 2010);
gretelai_synthetic_text_to_sql
CREATE TABLE ports (port_id INT, port_name VARCHAR(50), country VARCHAR(50)); INSERT INTO ports VALUES (1, 'Port of Los Angeles', 'USA'); INSERT INTO ports VALUES (2, 'Port of Rotterdam', 'Netherlands'); CREATE TABLE cargo (cargo_id INT, port_id INT, cargo_weight INT, handling_date DATE); INSERT INTO cargo VALUES (1, 1...
What is the total cargo weight handled by each port in descending order?
SELECT port_name, SUM(cargo_weight) as total_cargo_weight FROM cargo JOIN ports ON cargo.port_id = ports.port_id GROUP BY port_name ORDER BY total_cargo_weight DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE landfill_capacity (city VARCHAR(255), year INT, capacity_m3 INT); INSERT INTO landfill_capacity (city, year, capacity_m3) VALUES ('Mexico City', 2018, 2000000);
What is the landfill capacity in Mexico City for 2018?
SELECT capacity_m3 FROM landfill_capacity WHERE city = 'Mexico City' AND year = 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE Donors (DonorID int, Name varchar(50), Age int, Country varchar(50), Donations int); INSERT INTO Donors (DonorID, Name, Age, Country, Donations) VALUES (1, 'John Doe', 30, 'USA', 5000), (2, 'Jane Smith', 45, 'Canada', 7000), (3, 'Pedro Martinez', 25, 'Mexico', 6000);
What is the name, age, and country of donors who have donated more than $5000?
SELECT d.Name, d.Age, d.Country FROM Donors d WHERE d.Donations > 5000;
gretelai_synthetic_text_to_sql
CREATE TABLE trips (id INT, start_time TIMESTAMP, end_time TIMESTAMP, route_id INT, vehicle_id INT);
Update the 'start_time' column to '2022-01-01 00:00:00' for the record with id 1001 in the 'trips' table
UPDATE trips SET start_time = '2022-01-01 00:00:00' WHERE id = 1001;
gretelai_synthetic_text_to_sql
CREATE TABLE financial_wellbeing (customer_id INT, score DECIMAL(3,2)); INSERT INTO financial_wellbeing (customer_id, score) VALUES (12345, 75.2), (98765, 82.6);
Find the financial wellbeing score for the customer with ID 98765?
SELECT score FROM financial_wellbeing WHERE customer_id = 98765;
gretelai_synthetic_text_to_sql
CREATE TABLE startups(id INT, name TEXT, founding_year INT, founder_disability BOOLEAN); INSERT INTO startups (id, name, founding_year, founder_disability) VALUES (1, 'Acme Inc', 2010, true); INSERT INTO startups (id, name, founding_year, founder_disability) VALUES (2, 'Beta Corp', 2015, false); INSERT INTO startups (i...
Get the total number of startups founded by people with disabilities
SELECT COUNT(*) FROM startups WHERE founder_disability = true;
gretelai_synthetic_text_to_sql
CREATE TABLE WildlifeSightings (species VARCHAR(255), location VARCHAR(255), year INT, sightings INT); INSERT INTO WildlifeSightings (species, location, year, sightings) VALUES ('Polar bear', 'Arctic National Wildlife Refuge', 2021, 150); INSERT INTO WildlifeSightings (species, location, year, sightings) VALUES ('Polar...
How many polar bear sightings occurred in the Arctic National Wildlife Refuge in 2021?
SELECT SUM(sightings) FROM WildlifeSightings WHERE species = 'Polar bear' AND location = 'Arctic National Wildlife Refuge' AND year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE authorships (id INT, author_gender VARCHAR(10), year INT, publication_id INT); INSERT INTO authorships (id, author_gender, year, publication_id) VALUES (1, 'Female', 2021, 1); INSERT INTO authorships (id, author_gender, year, publication_id) VALUES (2, 'Male', 2019, 2); CREATE TABLE publications (id INT, y...
What is the percentage of female authors in academic publications in the past year?
SELECT (COUNT(a.id) / (SELECT COUNT(id) FROM authorships WHERE year = 2021)) * 100 AS percentage FROM authorships a WHERE a.author_gender = 'Female';
gretelai_synthetic_text_to_sql
CREATE TABLE animals (id INT PRIMARY KEY, name VARCHAR(50), population INT); INSERT INTO animals (id, name, population) VALUES (1, 'Tiger', 2000), (2, 'Elephant', 3000), (3, 'Giraffe', 1000);
What is the population of the animal named Giraffe in the 'animals' table?
SELECT population FROM animals WHERE name = 'Giraffe';
gretelai_synthetic_text_to_sql
CREATE TABLE tech_accessibility_projects (project_id INT, region VARCHAR(20), budget DECIMAL(10,2), completion_year INT); INSERT INTO tech_accessibility_projects (project_id, region, budget, completion_year) VALUES (1, 'Australia', 100000.00, 2016), (2, 'New Zealand', 150000.00, 2015), (3, 'Australia', 120000.00, 2018)...
What is the total budget for technology accessibility projects in Oceania in the last 5 years?
SELECT SUM(budget) FROM tech_accessibility_projects WHERE region IN ('Australia', 'New Zealand') AND completion_year BETWEEN 2015 AND 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Aircraft (aircraft_id INT, model VARCHAR(255), manufacturer VARCHAR(255), manufacturing_date DATE);
List all aircraft models manufactured by AeroCo in the United States that have a manufacturing date on or after 2010-01-01.
SELECT model FROM Aircraft WHERE manufacturer = 'AeroCo' AND manufacturing_date >= '2010-01-01' AND country = 'United States';
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_fashion (id INT, product_id INT, material VARCHAR(255), sustainability_score INT); INSERT INTO sustainable_fashion (id, product_id, material, sustainability_score) VALUES (1, 101, 'Organic Cotton', 90), (2, 102, 'Recycled Polyester', 80), (3, 103, 'Tencel', 85), (4, 101, 'Hemp', 95), (5, 102, '...
Which sustainable materials have the lowest sustainability score?
SELECT material, sustainability_score FROM sustainable_fashion WHERE sustainability_score < 90;
gretelai_synthetic_text_to_sql
CREATE TABLE departments (dept_name VARCHAR(255), num_professors INT, num_female_professors INT); INSERT INTO departments (dept_name, num_professors, num_female_professors) VALUES ('Humanities', 50, 20), ('Social_Sciences', 60, 25), ('Sciences', 70, 30);
Find the number of female professors in the 'Humanities' department.
SELECT SUM(num_female_professors) FROM departments WHERE dept_name = 'Humanities';
gretelai_synthetic_text_to_sql
CREATE TABLE zip_codes (id INT, zip VARCHAR(10), city VARCHAR(50), state VARCHAR(2)); CREATE TABLE covid_data (id INT, zip_code INT, confirmed_cases INT); INSERT INTO zip_codes (id, zip, city, state) VALUES (1, '12345', 'Albany', 'NY'), (2, '67890', 'Springfield', 'IL'); INSERT INTO covid_data (id, zip_code, confirmed_...
Which ZIP codes have the highest number of confirmed COVID-19 cases?
SELECT z.zip, z.city, z.state, c.confirmed_cases FROM zip_codes z JOIN covid_data c ON z.id = c.zip_code ORDER BY c.confirmed_cases DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE clients (client_id INT, name VARCHAR(50), region VARCHAR(50), account_balance DECIMAL(10,2)); INSERT INTO clients VALUES (1, 'John Doe', 'Asia-Pacific', 25000.00), (2, 'Jane Smith', 'North America', 35000.00), (3, 'Alice Johnson', 'Asia-Pacific', 18000.00), (4, 'Bob Williams', 'Europe', 45000.00), (5, 'Cha...
Who are the top 3 clients with the highest account balance in Europe?
SELECT name, account_balance FROM clients WHERE region = 'Europe' ORDER BY account_balance DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE solar_projects_2 (project_id INT, country VARCHAR(50), start_year INT, end_year INT); INSERT INTO solar_projects_2 (project_id, country, start_year, end_year) VALUES (1, 'Australia', 2017, 2021), (2, 'South Africa', 2018, 2020), (3, 'Egypt', 2016, 2019), (4, 'Australia', 2019, 2022), (5, 'South Africa', 20...
How many solar power projects were implemented in Australia, South Africa, and Egypt between 2016 and 2021?
SELECT COUNT(*) FROM solar_projects_2 WHERE country IN ('Australia', 'South Africa', 'Egypt') AND start_year BETWEEN 2016 AND 2021 AND end_year BETWEEN 2016 AND 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE the_denver_daily (publication_date DATE);
How many articles were published by 'The Denver Daily' in each month of the last year, including months without any articles?
SELECT to_char(publication_date, 'Month') as month, COUNT(*) as articles FROM the_denver_daily WHERE publication_date > DATE('now','-1 year') GROUP BY month ORDER BY MIN(publication_date);
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, garment_id INT, garment_name VARCHAR(50), sale_price DECIMAL(10, 2), sale_date DATE, quantity INT);
What is the total revenue from sales of all garments, in the 'sales' table, that were sold in the last week?
SELECT SUM(sale_price * quantity) AS total_revenue FROM sales WHERE sale_date >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK);
gretelai_synthetic_text_to_sql
CREATE TABLE Suppliers (supplier_id INT, supplier_name VARCHAR(100), country VARCHAR(50), has_vegan_options BOOLEAN); INSERT INTO Suppliers (supplier_id, supplier_name, country, has_vegan_options) VALUES (1, 'ABC Foods', 'USA', false), (2, 'GreenVeggies', 'Canada', true), (3, 'Farm Fresh', 'Kenya', true);
Find all suppliers from Africa who provide vegan options.
SELECT * FROM Suppliers WHERE country LIKE 'Africa%' AND has_vegan_options = true;
gretelai_synthetic_text_to_sql
CREATE TABLE subway (id INT, city VARCHAR(50), fare DECIMAL(5,2)); INSERT INTO subway (id, city, fare) VALUES (1, 'London', 4.90), (2, 'London', 5.20), (3, 'Berlin', 3.10);
What is the maximum fare for subway rides in London?
SELECT MAX(fare) FROM subway WHERE city = 'London';
gretelai_synthetic_text_to_sql
CREATE TABLE agri_innovation_projects (project VARCHAR(50), country VARCHAR(50), start_year INT, end_year INT, investment FLOAT); INSERT INTO agri_innovation_projects (project, country, start_year, end_year, investment) VALUES ('Precision Agriculture', 'Nigeria', 2016, 2018, 1500000), ('Climate-smart Farming', 'Nigeria...
What was the total investment in agricultural innovation projects in Nigeria between 2016 and 2018, and how many were implemented?
SELECT SUM(investment), COUNT(*) FROM agri_innovation_projects WHERE country = 'Nigeria' AND start_year BETWEEN 2016 AND 2018 AND end_year BETWEEN 2016 AND 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE students (student_id INT, enrollment_date DATE, underrepresented_community INT, program_id INT); INSERT INTO students (student_id, enrollment_date, underrepresented_community, program_id) VALUES (26, '2020-09-01', 1, 6), (27, '2021-01-15', 0, 7), (28, '2022-06-01', 1, 8), (29, '2023-02-28', 0, 9), (30, '20...
How many students from underrepresented communities have enrolled since 2020 in lifelong learning programs?
SELECT COUNT(*) FROM students JOIN programs ON students.program_id = programs.program_id WHERE underrepresented_community = 1 AND enrollment_date >= '2020-01-01' AND programs.program_type = 'Lifelong Learning';
gretelai_synthetic_text_to_sql
CREATE TABLE animal_population (id INT, animal_species VARCHAR(50), population INT); INSERT INTO animal_population (id, animal_species, population) VALUES (1, 'Tiger', 2000), (2, 'Elephant', 5000), (3, 'Giraffe', 8000), (4, 'Tiger', 3000), (5, 'Panda', 1500);
Find the animal species with the highest population in the 'animal_population' table
SELECT animal_species, MAX(population) FROM animal_population GROUP BY animal_species;
gretelai_synthetic_text_to_sql
CREATE TABLE mine (id INT, name VARCHAR(255), type VARCHAR(255), gold_tons INT, workers INT); INSERT INTO mine (id, name, type, gold_tons, workers) VALUES (1, 'Alaskan Gold Mine', 'Open Pit', 700, 300), (2, 'Colorado Gold Mine', 'Underground', 400, 200);
What is the average amount of gold extracted per worker, for mines that extract more than 500 tons of gold per year?
SELECT AVG(gold_tons/workers) as avg_gold_per_worker FROM mine WHERE gold_tons > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE Lutetium_Production (id INT, year INT, country VARCHAR(255), quantity FLOAT);
What is the total quantity of Lutetium extracted in Brazil and Argentina between 2015 and 2017?
SELECT SUM(quantity) FROM Lutetium_Production WHERE year BETWEEN 2015 AND 2017 AND country IN ('Brazil', 'Argentina');
gretelai_synthetic_text_to_sql
CREATE TABLE ArcticPollution (country TEXT, initiative_count INTEGER); INSERT INTO ArcticPollution (country, initiative_count) VALUES ('Russia', 5), ('Greenland', 3), ('Canada', 7); CREATE TABLE Countries (country TEXT, region TEXT); INSERT INTO Countries (country, region) VALUES ('Russia', 'Europe'), ('Greenland', 'No...
Identify countries with the fewest pollution control initiatives in the Arctic Ocean.
SELECT Countries.country, ArcticPollution.initiative_count FROM Countries INNER JOIN ArcticPollution ON Countries.country = ArcticPollution.country ORDER BY initiative_count ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE item_details (item_id INT, item_name VARCHAR(255), is_fair_trade BOOLEAN, is_sustainable BOOLEAN, price DECIMAL(10,2));
Display the average price of all fair trade and sustainable clothing items available in the 'EthicalFashion' database
SELECT AVG(price) FROM item_details WHERE is_fair_trade = TRUE AND is_sustainable = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE trucks (id INT PRIMARY KEY, make VARCHAR(50), model VARCHAR(50), year INT);
Update the "year" column to 2024 for records in the "trucks" table where the "make" is "Rivian"
UPDATE trucks SET year = 2024 WHERE make = 'Rivian';
gretelai_synthetic_text_to_sql
CREATE TABLE ports (id INT, name TEXT, country TEXT); INSERT INTO ports (id, name, country) VALUES (1, 'Los Angeles', 'USA'), (2, 'Seattle', 'USA'), (3, 'Vancouver', 'Canada'); CREATE TABLE vessels (id INT, name TEXT, type TEXT, cargo_weight INT, port_id INT); INSERT INTO vessels (id, name, type, cargo_weight, port_id)...
What is the total cargo weight transported from Canada to the US West Coast ports in Q1 2022?
SELECT SUM(cargo_weight) FROM vessels WHERE port_id IN (SELECT id FROM ports WHERE country = 'Canada' AND name = 'Vancouver') AND EXTRACT(QUARTER FROM departure_date) = 1 AND EXTRACT(COUNTRY FROM IP_ADDRESS) = 'US';
gretelai_synthetic_text_to_sql
CREATE TABLE psychologists (id INT, name TEXT, age INT, country TEXT, campaigns INT); INSERT INTO psychologists (id, name, age, country, campaigns) VALUES (1, 'John Doe', 45, 'Canada', 3), (2, 'Jane Smith', 35, 'US', 5), (3, 'Alice Johnson', 40, 'Canada', 2), (4, 'Bob Brown', 50, 'US', 4);
What is the average age of psychologists who have conducted mental health awareness campaigns in Canada and the US, ordered by the campaign's reach?
SELECT AVG(age) as avg_age FROM (SELECT age, ROW_NUMBER() OVER (PARTITION BY country ORDER BY campaigns DESC) as rn FROM psychologists WHERE country IN ('Canada', 'US')) t WHERE rn = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE WasteTypes (waste_type_id INT PRIMARY KEY, name VARCHAR, description VARCHAR); CREATE TABLE Facilities (facility_id INT PRIMARY KEY, name VARCHAR, location VARCHAR, capacity INT, waste_type_id INT, FOREIGN KEY (waste_type_id) REFERENCES WasteTypes(waste_type_id)); INSERT INTO WasteTypes (waste_type_id, nam...
List all facilities along with their waste types
SELECT Facilities.name AS facility_name, WasteTypes.name AS waste_type_name FROM Facilities INNER JOIN WasteTypes ON Facilities.waste_type_id = WasteTypes.waste_type_id;
gretelai_synthetic_text_to_sql
CREATE TABLE community_development.schools (id INT, name VARCHAR(50), capacity INT, region VARCHAR(50));
What is the average number of schools per region ('community_development')?
SELECT region, AVG(capacity) FROM community_development.schools GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE RnDExpenditures (drug_name VARCHAR(255), rnd_expenditure DECIMAL(10,2)); INSERT INTO RnDExpenditures (drug_name, rnd_expenditure) VALUES ('DrugD', 60000.00), ('DrugE', 80000.00), ('DrugF', 40000.00); CREATE TABLE SalesData (drug_name VARCHAR(255), sales_quantity INT, sales_amount DECIMAL(10,2)); INSERT INT...
What are the total R&D expenditures and sales amounts for each drug, unpivoted and with a total row?
SELECT drug_name, 'rnd_expenditure' as metric, SUM(rnd_expenditure) as value FROM RnDExpenditures GROUP BY drug_name UNION ALL SELECT drug_name, 'sales_amount' as metric, SUM(sales_amount) as value FROM SalesData GROUP BY drug_name UNION ALL SELECT 'Total', SUM(value) as value FROM (SELECT drug_name, 'rnd_expenditure' ...
gretelai_synthetic_text_to_sql
CREATE TABLE military_tech (id INT, name VARCHAR(255), description TEXT, country VARCHAR(255)); INSERT INTO military_tech (id, name, description, country) VALUES (1, 'Stealth Drone', 'Unmanned aerial vehicle with low observable radar profile', 'US');
Update the description of an existing military technology in the "military_tech" table
UPDATE military_tech SET description = 'Unmanned aerial vehicle with advanced stealth capabilities' WHERE name = 'Stealth Drone';
gretelai_synthetic_text_to_sql
CREATE TABLE Farmers (id INT PRIMARY KEY, name VARCHAR(100), age INT, location VARCHAR(100)); INSERT INTO Farmers (id, name, age, location) VALUES (1, 'Olga Ivanova', 35, 'Russia'); INSERT INTO Farmers (id, name, age, location) VALUES (2, 'Ahmed Hussein', 42, 'Egypt'); CREATE TABLE Plots (id INT PRIMARY KEY, farmer_id ...
Which farmers are younger than 40 and own plots smaller than 0.5 acre?
SELECT f.name FROM Farmers f INNER JOIN Plots p ON f.id = p.farmer_id INNER JOIN Currencies c ON f.location = c.country WHERE f.age < 40 AND p.size < 0.5;
gretelai_synthetic_text_to_sql
CREATE TABLE Regions (RegionName VARCHAR(20), HealthcareCenterName VARCHAR(20), HealthcareCenterCapacity INT); INSERT INTO Regions (RegionName, HealthcareCenterName, HealthcareCenterCapacity) VALUES ('Region4', 'CenterA', 100), ('Region4', 'CenterB', 120);
List all healthcare centers and their capacities in 'Region4'
SELECT HealthcareCenterName, HealthcareCenterCapacity FROM Regions WHERE RegionName = 'Region4';
gretelai_synthetic_text_to_sql
CREATE TABLE strain_sales (id INT, strain VARCHAR(20), sales DECIMAL(10,2), state VARCHAR(2), sale_date DATE); INSERT INTO strain_sales (id, strain, sales, state, sale_date) VALUES (1, 'Purple Haze', 12000, 'AZ', '2022-04-15'), (2, 'Blue Dream', 11000, 'AZ', '2022-05-20'), (3, 'OG Kush', 13000, 'AZ', '2022-06-05');
List all cannabis strains sold in Arizona dispensaries in the second quarter of 2022, with sales greater than $10,000.
SELECT strain FROM strain_sales WHERE state = 'AZ' AND sales > 10000 AND sale_date BETWEEN '2022-04-01' AND '2022-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE Permits (PermitID INT, ProjectID INT, PermitType CHAR(1), PermitDate DATE, State CHAR(2));
How many permits were issued for commercial projects in Texas in 2022?
SELECT COUNT(*) FROM Permits WHERE State='TX' AND PermitType='C' AND PermitDate BETWEEN '2022-01-01' AND '2022-12-31';
gretelai_synthetic_text_to_sql
CREATE TABLE restaurant_revenue(restaurant_id INT, category VARCHAR(255), revenue DECIMAL(10,2), date DATE);
What was the total revenue for the 'Seafood' category in January 2021?
SELECT SUM(revenue) FROM restaurant_revenue WHERE category = 'Seafood' AND date BETWEEN '2021-01-01' AND '2021-01-31';
gretelai_synthetic_text_to_sql
CREATE TABLE subscribers (id INT, service VARCHAR(10), region VARCHAR(10)); INSERT INTO subscribers (id, service, region) VALUES (1, 'broadband', 'Southeast'), (2, 'mobile', 'Southeast'); CREATE TABLE speeds (subscriber_id INT, connection_speed INT); INSERT INTO speeds (subscriber_id, connection_speed) VALUES (1, 600),...
How many broadband customers have a connection speed of over 500 Mbps in the Southeast region?
SELECT COUNT(*) FROM speeds JOIN subscribers ON speeds.subscriber_id = subscribers.id WHERE subscribers.service = 'broadband' AND connection_speed > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE resource_depletion (resource VARCHAR(20), depletion_rate DECIMAL(5,2), region VARCHAR(20));
Insert a new record in the 'resource_depletion' table for 'Gold' with a depletion_rate of 3% in the 'Australia' region
INSERT INTO resource_depletion (resource, depletion_rate, region) VALUES ('Gold', 0.03, 'Australia');
gretelai_synthetic_text_to_sql
CREATE TABLE humanitarian_assistance (id INT, provider_country VARCHAR(255), recipient_country VARCHAR(255), amount FLOAT, year INT);
Present the humanitarian assistance provided by the United Nations, sorted by year
SELECT recipient_country, amount FROM humanitarian_assistance WHERE provider_country = 'United Nations' ORDER BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE materials (id INT, name TEXT, recycled BOOLEAN); CREATE TABLE inventory (id INT, material_id INT, quantity INT); INSERT INTO materials (id, name, recycled) VALUES (1, 'Material A', true), (2, 'Material B', false), (3, 'Material C', true); INSERT INTO inventory (id, material_id, quantity) VALUES (1, 1, 50),...
What is the total quantity of recycled materials in stock?
SELECT SUM(inventory.quantity) FROM inventory INNER JOIN materials ON inventory.material_id = materials.id WHERE materials.recycled = true;
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (supplier_id INT, name VARCHAR(20), total_quantity INT); INSERT INTO suppliers (supplier_id, name, total_quantity) VALUES (1, 'EcoFibers', 5000), (2, 'GreenMaterials', 3000), (3, 'SustainableSource', 7000); CREATE TABLE supplies (supply_id INT, supplier_id INT, material_id INT, quantity INT); INS...
Who are the top 3 suppliers of sustainable materials by quantity?
SELECT suppliers.name, SUM(supplies.quantity) AS total_quantity FROM suppliers JOIN supplies ON suppliers.supplier_id = supplies.supplier_id GROUP BY suppliers.name ORDER BY total_quantity DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE tilapia_farms (id INT, name TEXT, country TEXT, latitude DECIMAL(9,6), longitude DECIMAL(9,6)); INSERT INTO tilapia_farms (id, name, country, latitude, longitude) VALUES (1, 'Farm I', 'Kenya', -0.456789, 36.987654); INSERT INTO tilapia_farms (id, name, country, latitude, longitude) VALUES (2, 'Farm J', 'Ke...
Which tilapia farms in Kenya have experienced dissolved oxygen levels below 5 ppm in the last week?
SELECT twd.farm_id, tf.name FROM tilapia_water_data twd JOIN tilapia_farms tf ON twd.farm_id = tf.id WHERE tf.country = 'Kenya' AND twd.dissolved_oxygen < 5 AND twd.timestamp >= NOW() - INTERVAL 1 WEEK;
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (name VARCHAR(255), type VARCHAR(255), region VARCHAR(255)); INSERT INTO hospitals (name, type, region) VALUES ('Hospital A', 'Public', 'Pacific'), ('Hospital B', 'Private', 'Pacific'), ('Hospital C', 'Teaching', 'Pacific'), ('Hospital D', 'Public', 'Atlantic'), ('Hospital E', 'Private', 'Atlanti...
What is the total number of hospitals and their types in the Pacific region?
SELECT type, COUNT(*) FROM hospitals WHERE region = 'Pacific' GROUP BY type;
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (id INT PRIMARY KEY, name VARCHAR(255), beds INT, location VARCHAR(255)); INSERT INTO hospitals (id, name, beds, location) VALUES (1, 'Johns Hopkins Hospital', 1138, 'Baltimore, MD'); INSERT INTO hospitals (id, name, beds, location) VALUES (2, 'Massachusetts General Hospital', 999, 'Boston, MA');...
What is the average number of hospital beds per hospital in hospitals located in Texas?
SELECT AVG(beds) FROM hospitals WHERE location LIKE '%Texas%';
gretelai_synthetic_text_to_sql
CREATE TABLE carbon_offset_programs (id INT, name TEXT, start_date DATE, end_date DATE);
Add a new row to the carbon_offset_programs table for a program with id 6, name 'Public Transportation', start_date 2024-01-01 and end_date 2026-12-31
INSERT INTO carbon_offset_programs (id, name, start_date, end_date) VALUES (6, 'Public Transportation', '2024-01-01', '2026-12-31');
gretelai_synthetic_text_to_sql
CREATE TABLE Warehouse (id INT, name VARCHAR(20), city VARCHAR(20)); INSERT INTO Warehouse (id, name, city) VALUES (1, 'Toronto Warehouse 1', 'Toronto'), (2, 'Montreal Warehouse', 'Montreal'); CREATE TABLE Shipment (id INT, weight INT, warehouse_id INT); INSERT INTO Shipment (id, weight, warehouse_id) VALUES (101, 1200...
Which warehouse in 'Toronto' has the highest total weight of shipments?
SELECT w.name, SUM(s.weight) as total_weight FROM Warehouse w JOIN Shipment s ON w.id = s.warehouse_id WHERE w.city = 'Toronto' GROUP BY w.id ORDER BY total_weight DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Hotels_Oceania (id INT, name VARCHAR(50), price DECIMAL(5,2), continent VARCHAR(50)); INSERT INTO Hotels_Oceania (id, name, price, continent) VALUES (1, 'Pacific Palace', 450.00, 'Oceania'), (2, 'Coral Reef Resort', 380.00, 'Oceania'), (3, 'Island Breeze Hotel', 290.00, 'Oceania');
What are the names and prices of the 3 most expensive hotels in Oceania?
SELECT name, price FROM Hotels_Oceania ORDER BY price DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE workouts (id INT, user_id INT, workout_date DATE, calories INT, country VARCHAR(50)); INSERT INTO workouts (id, user_id, workout_date, calories, country) VALUES (1, 123, '2022-01-01', 300, 'USA'); INSERT INTO workouts (id, user_id, workout_date, calories, country) VALUES (2, 456, '2022-01-02', 400, 'Canada...
What is the average number of calories burned in workouts per user in Germany?
SELECT AVG(calories) FROM workouts WHERE country = 'Germany' GROUP BY user_id;
gretelai_synthetic_text_to_sql
CREATE TABLE ai_researcher(id INT PRIMARY KEY, name VARCHAR(50), country VARCHAR(50)); INSERT INTO ai_researcher (id, name, country) VALUES (1, 'Alice', 'USA'), (2, 'Bob', 'Canada'), (3, 'Charlie', 'UK'), (4, 'Dave', 'India'); CREATE TABLE ai_papers(id INT PRIMARY KEY, title VARCHAR(50), researcher_id INT); INSERT INTO...
Which AI researchers have not published any papers?
SELECT r.name FROM ai_researcher r LEFT JOIN ai_papers p ON r.id = p.researcher_id WHERE p.id IS NULL;
gretelai_synthetic_text_to_sql