context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE Infrastructure_Projects (Project_ID INT, Project_Name VARCHAR(255), Project_Type VARCHAR(255), Cost FLOAT, Year INT, State VARCHAR(255));
What are the total costs for each infrastructure project, categorized by type, for the year 2022 in California?
SELECT Project_Type, SUM(Cost) FROM Infrastructure_Projects WHERE Year = 2022 AND State = 'California' GROUP BY Project_Type;
gretelai_synthetic_text_to_sql
CREATE TABLE mobile_subscribers (subscriber_id INT, state VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id, state) VALUES (1, 'New York'), (2, 'California'); CREATE TABLE voice_calls (subscriber_id INT, revenue DECIMAL(5,2)); INSERT INTO voice_calls (subscriber_id, revenue) VALUES (1, 25.99), (2, 30.00); CRE...
What is the total revenue generated from voice calls and SMS messages for each mobile subscriber in the state of New York?
SELECT ms.subscriber_id, ms.state, SUM(vc.revenue + sm.revenue) as total_revenue FROM mobile_subscribers ms INNER JOIN voice_calls vc ON ms.subscriber_id = vc.subscriber_id INNER JOIN sms_messages sm ON ms.subscriber_id = sm.subscriber_id WHERE ms.state = 'New York' GROUP BY ms.subscriber_id, ms.state;
gretelai_synthetic_text_to_sql
CREATE TABLE counties (id INT, name TEXT, state TEXT, population INT, area_sq_mi INT); INSERT INTO counties (id, name, state, population, area_sq_mi) VALUES (1, 'New York County', 'New York', 1600000, 33), (2, 'Kings County', 'New York', 2600000, 71), (3, 'Queens County', 'New York', 2300000, 109);
List the names of all counties in the state of New York that have a population density greater than 1000 people per square mile?
SELECT name FROM counties WHERE state = 'New York' AND population / area_sq_mi > 1000;
gretelai_synthetic_text_to_sql
CREATE TABLE srl_orgs (org_name TEXT, location TEXT); INSERT INTO srl_orgs (org_name, location) VALUES ('Canada Credit Union', 'Canada'), ('British Lending Ltd', 'UK'), ('Fair Finance France', 'France');
How many socially responsible lending organizations are there in Canada and the UK?
SELECT COUNT(*) FROM srl_orgs WHERE location IN ('Canada', 'UK');
gretelai_synthetic_text_to_sql
CREATE TABLE AutoShows (ShowID INT PRIMARY KEY, ShowName VARCHAR(50), Location VARCHAR(50)); CREATE TABLE VehicleModels (ModelID INT PRIMARY KEY, ModelName VARCHAR(50), ShowID INT, FOREIGN KEY (ShowID) REFERENCES AutoShows(ShowID));
What are the vehicle models and show names for vehicles featured in auto shows held in Tokyo?
SELECT VehicleModels.ModelName, AutoShows.ShowName FROM VehicleModels INNER JOIN AutoShows ON VehicleModels.ShowID = AutoShows.ShowID WHERE Location = 'Tokyo';
gretelai_synthetic_text_to_sql
CREATE TABLE ai_safety_incidents (id INT, incident_name VARCHAR(255), country VARCHAR(255), incident_category VARCHAR(255)); INSERT INTO ai_safety_incidents (id, incident_name, country, incident_category) VALUES (1, 'IncidentA', 'China', 'Malfunction'), (2, 'IncidentB', 'Japan', 'Unintended Behavior'), (3, 'IncidentC',...
List all AI safety incidents in Asia with their respective categories.
SELECT * FROM ai_safety_incidents WHERE country = 'Asia';
gretelai_synthetic_text_to_sql
CREATE TABLE hotel_amenities (hotel_id INT, pool BOOLEAN, spa BOOLEAN); INSERT INTO hotel_amenities (hotel_id, pool, spa) VALUES (1, true, true), (2, false, true);
What is the average guest rating for hotels in Miami and virtual tour views?
SELECT AVG(gr.guest_rating), AVG(vt.num_views) FROM hotel_reviews gr INNER JOIN hotel_info hi ON gr.hotel_id = hi.hotel_id INNER JOIN virtual_tours vt ON gr.hotel_id = vt.hotel_id WHERE hi.city = 'Miami';
gretelai_synthetic_text_to_sql
CREATE TABLE Aid (AidID INT, Country VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO Aid (AidID, Country, Amount) VALUES (1, 'Syria', 200.00), (2, 'Afghanistan', 250.00);
Which countries received the most humanitarian aid?
SELECT Country, SUM(Amount) as TotalAid FROM Aid GROUP BY Country ORDER BY TotalAid DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE volunteers (id INT, program_id INT, total_volunteers INT, quarter INT, year INT, age INT); INSERT INTO volunteers (id, program_id, total_volunteers, quarter, year, age) VALUES (1, 1, 5, 3, 2022, 25), (2, 2, 3, 3, 2022, 30), (3, 1, 6, 4, 2022, 45), (4, 3, 4, 4, 2022, 55);
How many volunteers are needed for each program in the upcoming quarter, broken down by their age group?
SELECT program_id, AVG(age), SUM(total_volunteers) FROM volunteers WHERE quarter = (SELECT quarter FROM quarters WHERE quarter_name = 'upcoming_quarter') GROUP BY program_id, FLOOR(age/10)*10;
gretelai_synthetic_text_to_sql
CREATE TABLE AgentSales (SaleID INT, AgentID INT, PolicyID INT, SaleYear INT); INSERT INTO AgentSales VALUES (1, 1, 1, 2021), (2, 2, 2, 2022), (3, 1, 3, 2021), (4, 2, 4, 2022), (5, 3, 5, 2021), (6, 3, 6, 2022); CREATE TABLE Agents (AgentID INT, AgentName VARCHAR(255)); INSERT INTO Agents VALUES (1, 'Aaron Alvarez'), (2...
What is the number of policies sold by each agent per year?
SELECT a.AgentName, SaleYear, COUNT(*) AS PoliciesSold FROM AgentSales AS s JOIN Agents AS a ON s.AgentID = a.AgentID GROUP BY a.AgentName, SaleYear;
gretelai_synthetic_text_to_sql
CREATE TABLE cities (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE schools (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), city_id INT, FOREIGN KEY (city_id) REFERENCES cities(id)); INSERT INTO cities (id, name) VALUES (1, 'New York'); INSERT INTO cities (id, name) VALUES (2, 'Los Angeles');
Find the number of public schools in each city from the 'education' database.
SELECT cities.name, COUNT(schools.id) as school_count FROM cities INNER JOIN schools ON cities.id = schools.city_id GROUP BY cities.name;
gretelai_synthetic_text_to_sql
CREATE SCHEMA open_education; CREATE TABLE open_education.courses (course_id INT, student_id INT); CREATE TABLE open_education.students (student_id INT, name VARCHAR(50)); INSERT INTO open_education.students (student_id, name) VALUES (1, 'Noah'), (2, 'Lea'), (3, 'Mateo'), (4, 'Olivia'), (5, 'Ava'), (6, 'William'), (7, ...
List all courses from the 'open_education' schema that have more than 5 students enrolled
SELECT course_id FROM open_education.courses GROUP BY course_id HAVING COUNT(DISTINCT student_id) > 5;
gretelai_synthetic_text_to_sql
CREATE TABLE community_health_workers (worker_id INT, name TEXT, state TEXT); INSERT INTO community_health_workers (worker_id, name, state) VALUES (1, 'Ms. Sarah Johnson', 'TX'), (2, 'Mr. David Kim', 'CA');
Count community health workers by state, sorted by the number of workers in descending order.
SELECT c.state, COUNT(*) AS worker_count FROM community_health_workers c GROUP BY c.state ORDER BY worker_count DESC;
gretelai_synthetic_text_to_sql
CREATE SCHEMA XAI;CREATE TABLE Models (model_id INT, complexity_score INT, accuracy_score FLOAT); INSERT INTO XAI.Models (model_id, complexity_score, accuracy_score) VALUES (1, 6, 0.95), (2, 4, 0.9), (3, 7, 0.8);
Find the explainable AI models with the highest accuracy scores in the 'XAI' schema.
SELECT model_id, accuracy_score FROM XAI.Models ORDER BY accuracy_score DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE weather (country VARCHAR(255), temperature INT, precipitation FLOAT); INSERT INTO weather (country, temperature, precipitation) VALUES ('Canada', 10, 0.5), ('Mexico', 20, 1.2), ('Canada', 12, 0.7);
Find the average temperature and total precipitation for each country in the 'agriculture' schema.
SELECT w.country, AVG(w.temperature) AS avg_temperature, SUM(w.precipitation) AS total_precipitation FROM agriculture.weather w GROUP BY w.country;
gretelai_synthetic_text_to_sql
CREATE TABLE carbon_offsets (id INT PRIMARY KEY, company VARCHAR(255), project VARCHAR(255), country VARCHAR(255), year INT, amount_offset INT);
What is the total amount of carbon offset by each company in India, with an offset greater than 50,000?
SELECT company, SUM(amount_offset) FROM carbon_offsets WHERE country = 'India' GROUP BY company HAVING SUM(amount_offset) > 50000;
gretelai_synthetic_text_to_sql
CREATE TABLE military_operations (id INT, country TEXT, operation TEXT, year INT);INSERT INTO military_operations (id, country, operation, year) VALUES (1, 'Country X', 'Operation Red Fox', 2018), (2, 'Country X', 'Operation Black Hawk', 2019), (3, 'Country Y', 'Operation Blue Whale', 2020);
What is the total number of military operations conducted by countries X and Y in the years 2018, 2019, and 2020?
SELECT country, COUNT(*) as total_operations FROM military_operations WHERE country IN ('Country X', 'Country Y') AND year IN (2018, 2019, 2020) GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE timber_production (region VARCHAR(255), production INTEGER, year INTEGER);
List all regions with timber production below the average for the last 10 years.
SELECT region FROM timber_production WHERE year BETWEEN YEAR(CURRENT_DATE)-10 AND YEAR(CURRENT_DATE) GROUP BY region HAVING AVG(production) < (SELECT AVG(production) FROM timber_production WHERE year BETWEEN YEAR(CURRENT_DATE)-10 AND YEAR(CURRENT_DATE));
gretelai_synthetic_text_to_sql
CREATE TABLE education_aid (id INT, donor_country VARCHAR(50), recipient_region VARCHAR(20), aid_type VARCHAR(20), year INT, amount INT); INSERT INTO education_aid (id, donor_country, recipient_region, aid_type, year, amount) VALUES (1, 'Germany', 'Africa', 'education', 2020, 5000000), (2, 'France', 'Africa', 'educatio...
What are the top 3 donor countries for education aid in Africa in 2020?
SELECT donor_country, SUM(amount) FROM education_aid WHERE aid_type = 'education' AND recipient_region = 'Africa' AND year = 2020 GROUP BY donor_country ORDER BY SUM(amount) DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE players (id INT, name VARCHAR(50), age INT, game_preference VARCHAR(20)); INSERT INTO players (id, name, age, game_preference) VALUES (1, 'John Doe', 25, 'VR'); INSERT INTO players (id, name, age, game_preference) VALUES (2, 'Jane Smith', 30, 'Non-VR'); INSERT INTO players (id, name, age, game_preference) ...
How many players are there in each game preference category?
SELECT game_preference, COUNT(*) FROM players GROUP BY game_preference;
gretelai_synthetic_text_to_sql
CREATE TABLE Chemical_Plant (plant_name VARCHAR(255), location VARCHAR(255), chemical VARCHAR(255), quantity INT);INSERT INTO Chemical_Plant (plant_name, location, chemical, quantity) VALUES ('Chemical Plant J', 'New York', 'Acetic Acid', 600), ('Chemical Plant J', 'New York', 'Benzene', 800), ('Chemical Plant K', 'New...
What are the total quantities of all chemicals produced by 'Chemical Plant J' and 'Chemical Plant K'?
SELECT plant_name, SUM(quantity) FROM Chemical_Plant WHERE plant_name IN ('Chemical Plant J', 'Chemical Plant K') GROUP BY plant_name;
gretelai_synthetic_text_to_sql
CREATE TABLE damages (id INT, incident_date DATE, reported_cost INT);
Update the incident_date of the record with id 2 in the 'damages' table to '2018-05-22'
UPDATE damages SET incident_date = '2018-05-22' WHERE id = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE water_consumption (id INT, continent VARCHAR(20), year INT, consumption FLOAT); INSERT INTO water_consumption (id, continent, year, consumption) VALUES (1, 'Asia', 2018, 150.0), (2, 'Asia', 2019, 160.0), (3, 'Europe', 2018, 120.0), (4, 'Europe', 2019, 130.0);
What is the total water consumption in Asia for the years 2018 and 2019?
SELECT SUM(consumption) FROM water_consumption WHERE continent = 'Asia' AND year IN (2018, 2019);
gretelai_synthetic_text_to_sql
CREATE TABLE hotel_systems (hotel_id INT, hotel_name VARCHAR(255), pms_system VARCHAR(255), country VARCHAR(255)); INSERT INTO hotel_systems (hotel_id, hotel_name, pms_system, country) VALUES (1, 'Hotel A', 'Cloud-based', 'UK'), (2, 'Hotel B', 'On-premises', 'UK'), (3, 'Hotel C', 'Cloud-based', 'USA');
What is the percentage of hotels in the United Kingdom that have adopted cloud-based PMS systems?
SELECT (COUNT(*) FILTER (WHERE pms_system = 'Cloud-based') * 100.0 / COUNT(*)) FROM hotel_systems WHERE country = 'UK';
gretelai_synthetic_text_to_sql
CREATE TABLE Volunteers (id INT, volunteer_name VARCHAR(255), program VARCHAR(255), volunteer_hours INT, volunteer_date DATE); INSERT INTO Volunteers (id, volunteer_name, program, volunteer_hours, volunteer_date) VALUES (1, 'Olivia Davis', 'Healthcare', 12, '2020-08-02'), (2, 'James Miller', 'Healthcare', 18, '2020-11-...
How many volunteers helped in the healthcare programs in the United Kingdom in 2020?
SELECT COUNT(*) FROM Volunteers WHERE program = 'Healthcare' AND volunteer_date BETWEEN '2020-01-01' AND '2020-12-31';
gretelai_synthetic_text_to_sql
CREATE TABLE GenreStreams (Platform varchar(50), Genre varchar(50), Streams int); INSERT INTO GenreStreams VALUES ('Spotify', 'Pop', 10000000); INSERT INTO GenreStreams VALUES ('Spotify', 'Rock', 5000000); INSERT INTO GenreStreams VALUES ('AppleMusic', 'HipHop', 7000000); INSERT INTO GenreStreams VALUES ('AppleMusic', ...
Identify the platforms that have more than 50% of their streams dedicated to a single genre.
SELECT Platform FROM GenreStreams GROUP BY Platform HAVING SUM(Streams) / (SELECT SUM(Streams) FROM GenreStreams WHERE Platform = GROUPINGSET(Platform)) > 0.5;
gretelai_synthetic_text_to_sql
CREATE TABLE cybersecurity_threats (country VARCHAR(50), region VARCHAR(50), threat_score INT, year INT); INSERT INTO cybersecurity_threats (country, region, threat_score, year) VALUES ('Country11', 'Latin America', 70, 2021), ('Country12', 'Latin America', 80, 2021), ('Country13', 'Latin America', 60, 2021), ('Country...
What is the average cybersecurity threat score for Latin American countries in the past year?
SELECT AVG(threat_score) FROM cybersecurity_threats WHERE year = 2021 AND region = 'Latin America';
gretelai_synthetic_text_to_sql
CREATE TABLE Aircrafts (id INT PRIMARY KEY, name VARCHAR(50), manufacturer VARCHAR(50), type VARCHAR(50)); INSERT INTO Aircrafts (id, name, manufacturer, type) VALUES (1, 'Boeing 737', 'Boeing', 'Narrowbody'), (2, 'Boeing 787', 'Boeing', 'Widebody');
What are the names and manufacturers of aircrafts that have 'Boeing' as their manufacturer?
SELECT a.name, a.manufacturer FROM Aircrafts a WHERE a.manufacturer = 'Boeing';
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy (country VARCHAR(50), year INT, capacity_mw FLOAT); INSERT INTO renewable_energy (country, year, capacity_mw) VALUES ('South Africa', 2022, 7000), ('South Africa', 2022, 7500), ('South Africa', 2022, 8000), ('Egypt', 2022, 9000), ('Egypt', 2022, 9500);
What is the total installed renewable energy capacity (in MW) for South Africa as of 2022?
SELECT SUM(capacity_mw) AS total_capacity_mw FROM renewable_energy WHERE country = 'South Africa' AND year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE vendors (vendor_id INT, vendor_name TEXT, country TEXT);CREATE TABLE products (product_id INT, product_name TEXT, price DECIMAL, vegan BOOLEAN, vendor_id INT); INSERT INTO vendors (vendor_id, vendor_name, country) VALUES (1, 'VendorA', 'Germany'), (2, 'VendorB', 'France'); INSERT INTO products (product_id,...
What is the total revenue generated by vegan products in the EU?
SELECT SUM(price) FROM products JOIN vendors ON products.vendor_id = vendors.vendor_id WHERE vegan = true AND country IN ('Germany', 'France');
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (Satellite_ID INT, Name VARCHAR(100), Orbit VARCHAR(50)); INSERT INTO Satellites (Satellite_ID, Name, Orbit) VALUES (1, 'Starlink-1', 'Low Earth Orbit'), (2, 'Galaxy 1R', 'Geostationary Orbit');
What is the most common type of orbit for satellites in the 'Satellites' table?
SELECT Orbit, COUNT(*) FROM Satellites GROUP BY Orbit ORDER BY COUNT(*) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE organizations (id INT, name VARCHAR(50), type VARCHAR(50), country VARCHAR(50)); INSERT INTO organizations (id, name, type, country) VALUES (1, 'Accessible AI', 'Non-profit', 'USA'), (2, 'Tech for Social Good', 'Non-governmental', 'India'), (3, 'Digital Divide Initiative', 'Non-profit', 'Brazil');
List all unique 'countries' in the 'organizations' table
SELECT DISTINCT country FROM organizations;
gretelai_synthetic_text_to_sql
CREATE TABLE Members (MemberID INT, MemberName VARCHAR(50), State VARCHAR(50), JoinDate DATE, MembershipType VARCHAR(50), MembershipFee DECIMAL(5,2)); INSERT INTO Members (MemberID, MemberName, State, JoinDate, MembershipType, MembershipFee) VALUES (1, 'John Doe', 'California', '2021-01-01', 'Premium', 59.99), (2, 'Jan...
What is the total revenue generated from members in California in the last quarter?
SELECT SUM(MembershipFee) FROM Members WHERE State = 'California' AND JoinDate >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE grants (id INT, department VARCHAR(50), amount DECIMAL(10,2), date DATE); INSERT INTO grants (id, department, amount, date) VALUES (1, 'Mathematics', 50000.00, '2020-03-15'), (2, 'Physics', 100000.00, '2019-06-20'), (3, 'Mathematics', 75000.00, '2020-11-05'), (4, 'Physics', 120000.00, '2020-07-22');
What is the total amount of research grants awarded to the Physics department in the year 2020?
SELECT SUM(amount) FROM grants WHERE department = 'Physics' AND YEAR(date) = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE VIOLATIONS (id INT, vessel_name VARCHAR(50), violation VARCHAR(50), sea VARCHAR(50)); CREATE VIEW caribbean_sea AS SELECT 'Caribbean Sea';
Identify the most common violations for vessels in the Caribbean Sea
SELECT violation, COUNT(*) AS frequency FROM VIOLATIONS WHERE sea IN (SELECT * FROM caribbean_sea) GROUP BY violation ORDER BY frequency DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_projects (project_name VARCHAR(255), project_type VARCHAR(255), state VARCHAR(255), installed_capacity INT);
What is the total installed capacity of solar energy projects in the 'renewable_projects' table, grouped by state?
SELECT state, SUM(installed_capacity) FROM renewable_projects WHERE project_type = 'Solar' GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE teachers (teacher_id INT, district_id INT, professional_development BOOLEAN);
How many teachers have participated in professional development programs in each district?
SELECT district_id, COUNT(teacher_id) as num_teachers FROM teachers WHERE professional_development = true GROUP BY district_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Purchases (PurchaseID INT, CustomerID INT, Brand VARCHAR(50), PurchaseDate DATE); INSERT INTO Purchases (PurchaseID, CustomerID, Brand, PurchaseDate) VALUES (1, 1, 'BrandA', '2022-01-01'), (2, 2, 'BrandB', '2022-02-01'), (3, 3, 'BrandC', '2022-03-01'), (4, 4, 'BrandA', '2022-04-01'), (5, 5, 'BrandB', '2022...
How many unique customers have purchased from each brand in the last year?
SELECT Brand, COUNT(DISTINCT CustomerID) as UniqueCustomers FROM Purchases WHERE PurchaseDate >= '2021-01-01' GROUP BY Brand;
gretelai_synthetic_text_to_sql
CREATE TABLE public.trips (id SERIAL PRIMARY KEY, vehicle_type TEXT, city TEXT, trip_count INTEGER); INSERT INTO public.trips (vehicle_type, city, trip_count) VALUES ('ebike', 'NYC', 3000), ('ebike', 'NYC', 4000), ('ebike', 'LA', 5000);
What is the total number of trips taken by electric bikes in New York city?
SELECT SUM(trip_count) FROM public.trips WHERE vehicle_type = 'ebike' AND city = 'NYC';
gretelai_synthetic_text_to_sql
CREATE TABLE islamic_finance (id INT PRIMARY KEY, product_name VARCHAR(50), type VARCHAR(50), currency VARCHAR(3), roi DECIMAL(5,2), mudarabah DECIMAL(5,2), wakalah DECIMAL(5,2)); CREATE VIEW islamic_finance_avg AS SELECT product_name, AVG(roi) AS avg_roi, AVG(mudarabah) AS avg_mudarabah, AVG(wakalah) AS avg_wakalah FR...
What is the average mudarabah and wakalah for each product in the islamic_finance table where the average roi is greater than the overall average roi, and the currency is SGD?
SELECT i.product_name, AVG(i.mudarabah) AS avg_mudarabah, AVG(i.wakalah) AS avg_wakalah FROM islamic_finance i JOIN islamic_finance_avg a ON i.product_name = a.product_name WHERE i.currency = 'SGD' AND a.avg_roi > (SELECT AVG(roi) FROM islamic_finance) GROUP BY i.product_name;
gretelai_synthetic_text_to_sql
CREATE TABLE traffic_violations (county VARCHAR(20), violation_count INT, violation_date DATE); INSERT INTO traffic_violations (county, violation_count, violation_date) VALUES ('New York County', 500, '2022-07-01');
How many traffic violations were issued in the state of New York, broken down by county, in the month of July 2022?
SELECT county, SUM(violation_count) FROM traffic_violations WHERE violation_date BETWEEN '2022-07-01' AND '2022-07-31' GROUP BY county;
gretelai_synthetic_text_to_sql
CREATE TABLE menu (restaurant_id INT, item_name TEXT, item_type TEXT, diet TEXT); INSERT INTO menu (restaurant_id, item_name, item_type, diet) VALUES (6, 'Veggie Burger', 'Entree', 'Vegan');
Add a new menu item 'Veggie Burger' to Restaurant F.
INSERT INTO menu (restaurant_id, item_name, item_type, diet) VALUES (6, 'Veggie Burger', 'Entree', 'Vegan');
gretelai_synthetic_text_to_sql
CREATE TABLE vessel_inspections (vessel_name TEXT, ocean TEXT, inspections INTEGER); INSERT INTO vessel_inspections (vessel_name, ocean, inspections) VALUES ('Seabird', 'Southern Ocean', 2), ('Southern Explorer', 'Southern Ocean', 3), ('Endurance', 'Southern Ocean', 1);
Show the total number of vessels inspected for maritime law compliance in the Southern Ocean
SELECT SUM(inspections) FROM vessel_inspections WHERE ocean = 'Southern Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE certifications (certification_id INT, certification_name TEXT); INSERT INTO certifications (certification_id, certification_name) VALUES (1, 'Fair Trade'), (2, 'GOTS Organic'), (3, 'B Corp'); CREATE TABLE garments (garment_id INT, garment_name TEXT, production_cost FLOAT, certification_id INT); INSERT INTO...
What is the total production cost of fair trade certified garments?
SELECT SUM(g.production_cost) FROM garments g WHERE g.certification_id = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE decentralized_exchanges (exchange_name TEXT, transaction_volume INTEGER);
What is the total transaction volume for each decentralized exchange in the past month?
SELECT exchange_name, SUM(transaction_volume) FROM decentralized_exchanges WHERE transaction_date >= DATEADD(day, -30, GETDATE()) GROUP BY exchange_name;
gretelai_synthetic_text_to_sql
CREATE TABLE FundingSources (FundingSourceID INT PRIMARY KEY, Name VARCHAR(100), Amount FLOAT, Date DATE); INSERT INTO FundingSources (FundingSourceID, Name, Amount, Date) VALUES (1, 'National Endowment for the Arts', 50000, '2021-12-15');
List all funding sources with amounts greater than $10,000
SELECT * FROM FundingSources WHERE Amount > 10000;
gretelai_synthetic_text_to_sql
CREATE TABLE Vaccinations (Country VARCHAR(50), Continent VARCHAR(50), Date DATE, Vaccinated INT); INSERT INTO Vaccinations (Country, Continent, Date, Vaccinated) VALUES ('Nigeria', 'Africa', '2021-01-01', 100), ('Kenya', 'Africa', '2021-01-15', 200), ('Egypt', 'Africa', '2021-02-01', 300);
How many people got vaccinated in African countries in Q1 2021?
SELECT COUNT(*) FROM Vaccinations WHERE Continent = 'Africa' AND Date BETWEEN '2021-01-01' AND '2021-03-31';
gretelai_synthetic_text_to_sql
CREATE TABLE spacecrafts (spacecraft_id INT, name VARCHAR(100), destination VARCHAR(50)); INSERT INTO spacecrafts (spacecraft_id, name, destination) VALUES (1, 'Mariner 4', 'Mars'), (2, 'Viking 1', 'Mars'), (3, 'Mars Pathfinder', 'Mars'), (4, 'Mars Global Surveyor', 'Mars'), (5, 'Mars Reconnaissance Orbiter', 'Mars'), ...
What are the unique names of all spacecrafts that have been to Mars?
SELECT DISTINCT name FROM spacecrafts WHERE destination = 'Mars';
gretelai_synthetic_text_to_sql
CREATE TABLE cultural_tours (tour_id INT, tour_name VARCHAR(255), country VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO cultural_tours (tour_id, tour_name, country, revenue) VALUES (1, 'Cultural Tour Rome', 'Italy', 50000); INSERT INTO cultural_tours (tour_id, tour_name, country, revenue) VALUES (2, 'Cultural Tour ...
What is the revenue generated by cultural heritage tours in Italy?
SELECT SUM(revenue) FROM cultural_tours WHERE country = 'Italy';
gretelai_synthetic_text_to_sql
CREATE TABLE factories (factory_id INT, factory_name VARCHAR(255), country VARCHAR(255), is_fair_trade_certified BOOLEAN);
What is the total number of factories in each country that have a Fair Trade certification?
SELECT country, SUM(CASE WHEN is_fair_trade_certified THEN 1 ELSE 0 END) AS total_factories FROM factories GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE Workouts (WorkoutID INT, MemberID INT, Duration INT, MembershipType VARCHAR(20));
Update the 'Workouts' table to increase the duration of workouts by 10% for members with a 'Premium' membership type
UPDATE Workouts w SET Duration = w.Duration * 1.1 WHERE w.MemberID IN (SELECT m.MemberID FROM Members m WHERE m.MembershipType = 'Premium');
gretelai_synthetic_text_to_sql
CREATE TABLE ProviderData (ProviderID INT, ProviderName VARCHAR(50), Specialty VARCHAR(30), State VARCHAR(20)); INSERT INTO ProviderData (ProviderID, ProviderName, Specialty, State) VALUES (1, 'Sunshine Clinic', 'Primary Care', 'Florida'); INSERT INTO ProviderData (ProviderID, ProviderName, Specialty, State) VALUES (2,...
List the names of healthcare providers offering Primary Care services in Florida.
SELECT ProviderName FROM ProviderData WHERE Specialty = 'Primary Care' AND State = 'Florida';
gretelai_synthetic_text_to_sql
CREATE TABLE fares (line VARCHAR(10), passenger_type VARCHAR(10), fare FLOAT); INSERT INTO fares (line, passenger_type, fare) VALUES ('red', 'adult', 2.50), ('red', 'child', 1.50), ('blue', 'adult', 3.00), ('blue', 'child', 2.00);
Update the fare for child passengers in the 'blue' line to $1.50.
UPDATE fares SET fare = 1.50 WHERE line = 'blue' AND passenger_type = 'child';
gretelai_synthetic_text_to_sql
CREATE TABLE seafood_imports (import_id INT, import_date DATE, product VARCHAR(255), weight INT, country VARCHAR(255));
What is the total weight of seafood imported from Thailand in the seafood_imports table?
SELECT SUM(weight) FROM seafood_imports WHERE product LIKE '%seafood%' AND country = 'Thailand';
gretelai_synthetic_text_to_sql
CREATE TABLE sales_data (drug_name TEXT, country TEXT, sales INTEGER);
Which drug has the highest sales in 'South America'?
SELECT drug_name, MAX(sales) FROM sales_data WHERE country = 'South America' GROUP BY drug_name ORDER BY MAX(sales) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE drilling_rigs (rig_id INT, rig_name VARCHAR(100), location VARCHAR(100), drilling_depth FLOAT, operational_status VARCHAR(50)); INSERT INTO drilling_rigs (rig_id, rig_name, location, drilling_depth, operational_status) VALUES (9, 'Rig E', 'Nigeria', 6000.0, 'Active'); INSERT INTO drilling_rigs (rig_id, rig...
Which drilling rigs in Africa have the lowest drilling depths, and what are their operational_status values?
SELECT rig_id, rig_name, location, drilling_depth, operational_status, MIN(drilling_depth) OVER (PARTITION BY operational_status) as lowest_depth FROM drilling_rigs WHERE location = 'Nigeria' OR location = 'Algeria';
gretelai_synthetic_text_to_sql
CREATE TABLE Inventory (product_id INT, product_name VARCHAR(100), is_gluten_free BOOLEAN, calorie_count INT); INSERT INTO Inventory (product_id, product_name, is_gluten_free, calorie_count) VALUES (1, 'Quinoa', true, 220), (2, 'Bread', false, 120), (3, 'Pasta', false, 200);
What is the total calorie count for gluten-free products in our inventory?
SELECT SUM(calorie_count) FROM Inventory WHERE is_gluten_free = true;
gretelai_synthetic_text_to_sql
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50), Location varchar(50)); INSERT INTO Restaurants (RestaurantID, Name, Location) VALUES (1, 'Organic Oasis', 'California'); CREATE TABLE Dishes (DishID int, Name varchar(50), Category varchar(50), CaloricContent int); INSERT INTO Dishes (DishID, Name, Category,...
What is the average caloric content of organic dishes served in restaurants located in California?
SELECT AVG(Dishes.CaloricContent) FROM Dishes JOIN Restaurants ON Dishes.Category = 'Organic' WHERE Restaurants.Location = 'California';
gretelai_synthetic_text_to_sql
CREATE TABLE accounts (client_id INT, region VARCHAR(20), balance DECIMAL(10, 2)); INSERT INTO accounts (client_id, region, balance) VALUES (1, 'Northeast', 5000.00), (2, 'Southeast', 7000.00), (3, 'Northeast', 3000.00), (4, 'Southeast', 8000.00), (5, 'Midwest', 6000.00), (6, 'West', 9000.00);
Calculate the average account balance for clients in each region.
SELECT region, AVG(balance) FROM accounts GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE ocean_floor_mapping_projects (project_id INT, project_name TEXT, station_id INT); INSERT INTO ocean_floor_mapping_projects (project_id, project_name, station_id) VALUES (1, 'Project 4', 1), (2, 'Project 5', 3), (3, 'Project 6', 2), (4, 'Project 7', 4); CREATE TABLE marine_life_research_stations (station_id...
Show the total depth surveyed by each ocean floor mapping project and the number of projects
SELECT p.project_name, SUM(m.depth) AS total_depth, COUNT(*) AS projects_count FROM ocean_floor_mapping_projects p JOIN marine_life_research_stations m ON p.station_id = m.station_id GROUP BY p.project_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Students (StudentID INT, Name VARCHAR(100), Grade INT);
Insert data into 'Students' table with values (1, 'John Doe', 10), (2, 'Jane Smith', 11)
INSERT INTO Students (StudentID, Name, Grade) VALUES (1, 'John Doe', 10), (2, 'Jane Smith', 11);
gretelai_synthetic_text_to_sql
CREATE TABLE Restaurant (id INT, name VARCHAR(50), city VARCHAR(50), is_organic BOOLEAN); INSERT INTO Restaurant (id, name, city, is_organic) VALUES (1, 'Green Garden', 'New York', TRUE); INSERT INTO Restaurant (id, name, city, is_organic) VALUES (2, 'Tasty Bites', 'Los Angeles', FALSE); CREATE TABLE Nutrition (id INT,...
What is the nutritional information for dishes served at organic restaurants?
SELECT n.calories, n.protein, n.carbs FROM Nutrition n JOIN Restaurant r ON n.menu_id = r.id WHERE r.is_organic = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE startup_founding (id INT PRIMARY KEY, name VARCHAR(255), founding_date DATE);
List all startups founded in 2010
SELECT name FROM startup_founding WHERE founding_date BETWEEN '2010-01-01' AND '2010-12-31';
gretelai_synthetic_text_to_sql
CREATE TABLE news_channels (id INT, name TEXT, focus TEXT, location TEXT); INSERT INTO news_channels (id, name, focus, location) VALUES (1, 'Channel1', 'Diversity and Inclusion', 'Africa'); INSERT INTO news_channels (id, name, focus, location) VALUES (2, 'Channel2', 'Politics', 'Europe');
How many news channels in Africa have a focus on diversity and inclusion?
SELECT COUNT(*) FROM news_channels WHERE focus = 'Diversity and Inclusion' AND location = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE broadband_subscribers (subscriber_id INT, name VARCHAR(100), dob DATE, plan VARCHAR(50), speed INT);
Update a broadband subscriber's plan and speed in the broadband_subscribers table
UPDATE broadband_subscribers SET plan = 'Broadband 200 Mbps', speed = 200 WHERE subscriber_id = 1002;
gretelai_synthetic_text_to_sql
CREATE TABLE advisories (advisory_id INT, country TEXT, reason TEXT); CREATE TABLE tourists (tourist_id INT, name TEXT, country TEXT, arrival_date DATE); CREATE TABLE certifications (certification_id INT, tourist_id INT, hotel_id INT, issue_date DATE); CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, is_sust...
Find the number of tourists visiting Asian destinations with sustainable certifications.
SELECT COUNT(*) FROM tourists t INNER JOIN certifications c ON t.tourist_id = c.tourist_id INNER JOIN hotels h ON c.hotel_id = h.hotel_id WHERE h.is_sustainable = TRUE AND t.country IN (SELECT name FROM countries WHERE region = 'Asia');
gretelai_synthetic_text_to_sql
CREATE TABLE VehicleSales(id INT, type VARCHAR(20), country VARCHAR(20), year INT, quantity INT);
What is the market share of electric vehicles in each country in the EU over time?
SELECT type, country, AVG(quantity*100.0/SUM(quantity)) OVER (PARTITION BY type, country ORDER BY year ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as market_share FROM VehicleSales WHERE country IN (SELECT country FROM Countries WHERE region = 'European Union') AND type IN ('Electric', 'Gasoline') GROUP BY type, ...
gretelai_synthetic_text_to_sql
CREATE TABLE financial_wellbeing_programs (program VARCHAR(50), category VARCHAR(50));
Insert records for new financial wellbeing programs focusing on mental health and wellness.
INSERT INTO financial_wellbeing_programs (program, category) VALUES ('Mental Health Matters', 'Mental Health'), ('Mindful Money', 'Wellness');
gretelai_synthetic_text_to_sql
CREATE TABLE bicycle_rentals (city VARCHAR(50), rentals INT); INSERT INTO bicycle_rentals (city, rentals) VALUES ('Paris', 25000), ('Amsterdam', 20000);
What is the maximum number of bicycles rented in a day in Paris and Amsterdam?
SELECT MAX(rentals) FROM bicycle_rentals WHERE city IN ('Paris', 'Amsterdam');
gretelai_synthetic_text_to_sql
CREATE TABLE defense_projects_3 (project_name varchar(255), year int, budget int); INSERT INTO defense_projects_3 (project_name, year, budget) VALUES ('Project C', 2021, 4000000), ('Project C', 2022, 4400000), ('Project D', 2021, 6000000), ('Project D', 2022, 6300000);
Which defense projects had a budget increase of over 10% in 2022 compared to 2021?
SELECT project_name FROM defense_projects_3 WHERE (budget[(SELECT budget FROM defense_projects_3 WHERE project_name = defense_projects_3.project_name AND year = 2021)] * 1.10) < budget WHERE year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE Garments (GarmentID INT, GarmentName VARCHAR(50), ManufacturerID INT);CREATE TABLE Manufacturers (ManufacturerID INT, ManufacturerName VARCHAR(50));
Insert new records of garments for a specific manufacturer.
INSERT INTO Garments (GarmentID, GarmentName, ManufacturerID) SELECT 4, 'Eco-friendly T-Shirt', 3 FROM Manufacturers WHERE ManufacturerName = 'GreenThreads';
gretelai_synthetic_text_to_sql
CREATE TABLE Property_Size_History (Property_ID INT, Underrepresented VARCHAR(20), Property_Size INT); INSERT INTO Property_Size_History (Property_ID, Underrepresented, Property_Size) VALUES (1, 'Yes', 1200), (2, 'No', 1000), (3, 'Yes', 1500), (4, 'No', 1300); CREATE TABLE Property_Details (Property_ID INT, Underrepres...
What is the average property size in historically underrepresented communities?
SELECT AVG(Property_Size) FROM Property_Size_History psh JOIN Property_Details pd ON psh.Property_ID = pd.Property_ID WHERE Underrepresented = 'Historically Underrepresented';
gretelai_synthetic_text_to_sql
CREATE TABLE Forests (id INT, name VARCHAR(255), hectares FLOAT, country VARCHAR(255), carbon_sequestration_tonnes INT); INSERT INTO Forests (id, name, hectares, country, carbon_sequestration_tonnes) VALUES (1, 'Amazon Rainforest', 55000000.0, 'Brazil', 120000000), (2, 'Congo Rainforest', 35000000.0, 'Congo', 90000000)...
What is the total carbon sequestered and average carbon sequestration per hectare for forests in a specific country?
SELECT country, SUM(carbon_sequestration_tonnes) as total_carbon_sequestration, AVG(carbon_sequestration_tonnes/hectares) as avg_carbon_sequestration_per_hectare FROM Forests GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE SeafoodProduction (id INT, country VARCHAR(50), year INT, tons_produced INT, sustainable BOOLEAN); INSERT INTO SeafoodProduction (id, country, year, tons_produced, sustainable) VALUES (1, 'Canada', 2018, 1000, true), (2, 'Canada', 2019, 1200, true), (3, 'Canada', 2018, 800, false);
What is the total amount of seafood (in tons) produced by sustainable aquaculture farms in Canada, for the years 2018 and 2019?
SELECT SUM(tons_produced) FROM SeafoodProduction WHERE country = 'Canada' AND sustainable = true AND year IN (2018, 2019);
gretelai_synthetic_text_to_sql
CREATE TABLE ProductIngredients (ingredient_id INT, product_id INT, contains_palm_oil BOOLEAN); INSERT INTO ProductIngredients (ingredient_id, product_id, contains_palm_oil) VALUES (1, 401, true); CREATE TABLE BeautyProductSales (sale_id INT, product_id INT, sale_price DECIMAL(5,2), sale_date DATE, country TEXT); INSER...
What is the sum of all sales for beauty products containing palm oil in the UK?
SELECT SUM(bps.sale_price) FROM ProductIngredients pi JOIN BeautyProductSales bps ON pi.product_id = bps.product_id WHERE pi.contains_palm_oil = true AND bps.country = 'UK';
gretelai_synthetic_text_to_sql
CREATE TABLE Population (id INT PRIMARY KEY, country_id INT, year INT, population INT); INSERT INTO Population (id, country_id, year, population) VALUES (1, 1, 2010, 23000000); INSERT INTO Population (id, country_id, year, population) VALUES (2, 1, 2011, 24000000); INSERT INTO Population (id, country_id, year, populati...
How many cultural destinations are in countries with a population greater than 30 million?
SELECT COUNT(d.id) FROM Destinations d JOIN Countries c ON d.country_id = c.id JOIN Population p ON c.id = p.country_id WHERE d.type = 'Cultural' AND p.population > 30000000 GROUP BY c.id;
gretelai_synthetic_text_to_sql
CREATE TABLE city_recycling (city_id INT, material VARCHAR(50), recycling_rate FLOAT); INSERT INTO city_recycling (city_id, material, recycling_rate) VALUES (1, 'Plastic', 0.3), (1, 'Paper', 0.6), (1, 'Glass', 0.5);
What is the recycling rate for each material in CityA?
SELECT material, recycling_rate FROM city_recycling WHERE city_id = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE satellites (satellite_id INT, satellite_name VARCHAR(100), country VARCHAR(50), launch_date DATE, semi_major_axis FLOAT, eccentricity FLOAT, inclination FLOAT); INSERT INTO satellites (satellite_id, satellite_name, country, launch_date, semi_major_axis, eccentricity, inclination) VALUES (1, 'ISS (Zarya)', ...
What are the orbital parameters of the International Space Station?
SELECT * FROM satellites WHERE satellite_name = 'ISS (Zarya)';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance (country VARCHAR(255), population INT); INSERT INTO climate_finance VALUES ('Brazil', 210000000); INSERT INTO climate_finance VALUES ('Argentina', 44000000);
What is the total population of countries involved in climate finance initiatives in South America?
SELECT SUM(population) FROM climate_finance WHERE continent = 'South America';
gretelai_synthetic_text_to_sql
CREATE TABLE projects_2 (id INT, name VARCHAR, technology_accessibility BOOLEAN, budget FLOAT); INSERT INTO projects_2 (id, name, technology_accessibility, budget) VALUES (1, 'AI for accessibility', true, 200000), (2, 'Accessible software development', true, 150000), (3, 'Mainstream technology without accessibility', f...
What is the maximum budget for projects focused on technology accessibility?
SELECT MAX(budget) FROM projects_2 WHERE technology_accessibility = true;
gretelai_synthetic_text_to_sql
CREATE TABLE Provinces (Province VARCHAR(255), SatisfactionScore INT); INSERT INTO Provinces (Province, SatisfactionScore) VALUES ('Alberta', 75), ('British Columbia', 85), ('Ontario', 90), ('Quebec', 80);
Identify the top 2 provinces with the highest public transportation satisfaction scores, and display the province name and satisfaction score.
SELECT Province, SatisfactionScore FROM (SELECT Province, SatisfactionScore, ROW_NUMBER() OVER (ORDER BY SatisfactionScore DESC) AS Rank FROM Provinces) AS ProvinceRanks WHERE Rank <= 2;
gretelai_synthetic_text_to_sql
CREATE TABLE cybersecurity_strategies (id INT, strategy_name VARCHAR(50), strategy_category VARCHAR(50)); INSERT INTO cybersecurity_strategies (id, strategy_name, strategy_category) VALUES (1, 'Zero Trust', 'Architecture'), (2, 'Threat Hunting', 'Operations');
List the cybersecurity strategies in the 'cybersecurity_strategies' table and the respective strategy categories.
SELECT strategy_name, strategy_category FROM cybersecurity_strategies;
gretelai_synthetic_text_to_sql
CREATE TABLE animal_population (id INT, animal_name VARCHAR(50), population INT); INSERT INTO animal_population VALUES (1, 'Tiger', 500), (2, 'Elephant', 800);
What is the sum of populations of animals in 'animal_population' table with a population greater than 500?
SELECT SUM(population) FROM animal_population WHERE population > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE Ships (ID INT, Type TEXT, Country TEXT, Maintenance_Cost FLOAT); INSERT INTO Ships (ID, Type, Country, Maintenance_Cost) VALUES (1, 'Frigate', 'Canada', 2000000); INSERT INTO Ships (ID, Type, Country, Maintenance_Cost) VALUES (2, 'Destroyer', 'Canada', 2500000);
What is the minimum maintenance cost for naval ships in Canada?
SELECT MIN(Maintenance_Cost) FROM Ships WHERE Country = 'Canada' AND Type LIKE '%naval%ship%';
gretelai_synthetic_text_to_sql
CREATE TABLE Project_Timeline (project_id INT, project_name VARCHAR(50), state VARCHAR(2), timeline INT, is_sustainable BOOLEAN); INSERT INTO Project_Timeline VALUES (1, 'Manhattan Highrise', 'NY', 36, true);
What is the average project timeline in New York for sustainable buildings?
SELECT AVG(timeline) FROM Project_Timeline WHERE state = 'NY' AND is_sustainable = true;
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (donation_id INT, region VARCHAR(20), amount DECIMAL(10,2), donation_year INT); INSERT INTO Donations (donation_id, region, amount, donation_year) VALUES (1, 'Midwest', 1500.00, 2021), (2, 'Midwest', 2000.00, 2021);
What was the minimum donation amount in the 'Midwest' region for the year 2021?
SELECT MIN(amount) FROM Donations WHERE region = 'Midwest' AND donation_year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE coral_reefs (id INT, name TEXT, location TEXT, ocean TEXT); INSERT INTO coral_reefs (id, name, location, ocean) VALUES (1, 'Eilat Coral Reef Reserve', 'Red Sea', 'Red'), (2, 'Ras Mohammed National Park', 'Red Sea', 'Red');
List all coral reefs in the Red Sea.
SELECT * FROM coral_reefs WHERE ocean = 'Red';
gretelai_synthetic_text_to_sql
CREATE TABLE ratings (id INT, product VARCHAR(255), organic BOOLEAN, rating FLOAT, country VARCHAR(255)); INSERT INTO ratings (id, product, organic, rating, country) VALUES (1, 'Serum', true, 4.8, 'USA'), (2, 'Cream', false, 3.5, 'Canada'), (3, 'Cleanser', true, 4.6, 'USA');
What is the maximum rating of organic skincare products sold in the US?
SELECT MAX(rating) FROM ratings WHERE organic = true AND country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE military_tech (id INT, tech_name VARCHAR(255), country VARCHAR(255));
How many military technologies were developed in each country based on the 'military_tech' table?
SELECT country, COUNT(*) as tech_count FROM military_tech GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE subscribers(id INT, technology VARCHAR(20), type VARCHAR(10)); INSERT INTO subscribers(id, technology, type) VALUES (1, '4G', 'mobile'), (2, '5G', 'mobile'), (3, '3G', 'mobile');
Update mobile subscribers to the latest technology '5G'.
UPDATE subscribers SET technology = '5G' WHERE type = 'mobile';
gretelai_synthetic_text_to_sql
CREATE TABLE OnshoreWells (WellName TEXT, Location TEXT, DrillDate DATE); INSERT INTO OnshoreWells (WellName, Location, DrillDate) VALUES ('Well1', 'Canada', '2015-05-01'), ('Well2', 'Canada', '2016-07-15'), ('Well3', 'Canada', '2017-03-28');
How many onshore wells were drilled in Canada in each year since 2015?
SELECT COUNT(*) AS WellCount, EXTRACT(YEAR FROM DrillDate) AS Year FROM OnshoreWells WHERE Location = 'Canada' GROUP BY Year;
gretelai_synthetic_text_to_sql
CREATE TABLE soil_moisture (date DATE, moisture_level INT); INSERT INTO soil_moisture (date, moisture_level) VALUES ('2021-05-01', 60), ('2021-05-02', 65), ('2021-05-03', 70), ('2021-05-04', 75), ('2021-05-05', 80), ('2021-05-06', 85), ('2021-05-07', 90);
What is the minimum soil moisture level in the past week?
SELECT MIN(moisture_level) FROM soil_moisture WHERE date >= DATE_SUB(CURDATE(), INTERVAL 7 DAY);
gretelai_synthetic_text_to_sql
CREATE TABLE museums (museum_id INT, name VARCHAR(50), location VARCHAR(50), status VARCHAR(10));
Update the 'museums' table to mark 'open' status for the 'New York Museum of Modern Art'.
UPDATE museums SET status = 'open' WHERE name = 'New York Museum of Modern Art';
gretelai_synthetic_text_to_sql
CREATE TABLE Concerts (id INT, city VARCHAR(50), price DECIMAL(5,2)); INSERT INTO Concerts (id, city, price) VALUES (1, 'New York', 50.00), (2, 'Los Angeles', 60.00);
What is the average ticket price for concerts in New York?
SELECT AVG(price) FROM Concerts WHERE city = 'New York';
gretelai_synthetic_text_to_sql
CREATE TABLE PlayerWins (PlayerID int, PlayerName varchar(50), GameID int, Wins int); INSERT INTO PlayerWins (PlayerID, PlayerName, GameID, Wins) VALUES (1, 'Alice', 1, 60), (2, 'Bob', 1, 55), (3, 'Charlie', 1, 50), (4, 'David', 1, 45), (5, 'Eve', 1, 40), (1, 'Alice', 2, 70), (2, 'Bob', 2, 65), (3, 'Charlie', 2, 60), (...
What is the maximum number of wins for each player?
SELECT PlayerID, MAX(Wins) FROM PlayerWins GROUP BY PlayerID;
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance (id INT PRIMARY KEY, donor VARCHAR(100), recipient VARCHAR(100), amount FLOAT, category VARCHAR(50), year INT); INSERT INTO climate_finance (id, donor, recipient, amount, category, year) VALUES (1, 'European Union', 'Bangladesh', 5000000, 'climate adaptation', 2018); INSERT INTO climate_fin...
What is the total funding provided by the European Union in the climate adaptation category?
SELECT donor, SUM(amount) as total_funding FROM climate_finance WHERE donor = 'European Union' AND category = 'climate adaptation' GROUP BY donor;
gretelai_synthetic_text_to_sql
CREATE TABLE WasteGeneration (country VARCHAR(50), generation_rate FLOAT); INSERT INTO WasteGeneration (country, generation_rate) VALUES ('USA', 2.5), ('Canada', 1.3), ('Mexico', 1.1);
What is the maximum waste generation rate in North America?
SELECT MAX(generation_rate) FROM WasteGeneration WHERE country IN ('USA', 'Canada', 'Mexico');
gretelai_synthetic_text_to_sql
CREATE TABLE shariah_compliant_finance (id INT PRIMARY KEY, loan_amount DECIMAL(10, 2), approval_date DATE);
What is the minimum and maximum loan amount for Shariah-compliant finance in Q2 2022?
SELECT MIN(loan_amount), MAX(loan_amount) FROM shariah_compliant_finance WHERE approval_date BETWEEN '2022-04-01' AND '2022-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE peacekeeping_operations (id INT, year INT, commander_gender VARCHAR(255), operation VARCHAR(255)); INSERT INTO peacekeeping_operations (id, year, commander_gender, operation) VALUES (1, 2015, 'Male', 'Operation Restore Hope'), (2, 2016, 'Female', 'Operation Peaceful Resolution'), (3, 2017, 'Male', 'Operati...
What is the percentage of peacekeeping operations that were led by female commanders in each year, ordered by the year?
SELECT year, (COUNT(*) FILTER (WHERE commander_gender = 'Female') * 100.0 / COUNT(*)) AS pct_female_commanders FROM peacekeeping_operations GROUP BY year ORDER BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE membership (member_id INT, age INT, gender VARCHAR(10)); INSERT INTO membership (member_id, age, gender) VALUES (1, 25, 'Female'), (2, 32, 'Male'), (3, 46, 'Non-binary'), (4, 55, 'Female'), (5, 38, 'Male'); CREATE TABLE activity_data (member_id INT, steps INT, timestamp TIMESTAMP); INSERT INTO activity_dat...
How many steps did members take in total, in the past week, separated by age group and gender?
SELECT gender, FLOOR(age/10)*10 as age_group, SUM(steps) as total_steps FROM activity_data a JOIN membership m ON a.member_id = m.member_id WHERE timestamp BETWEEN '2022-01-01 00:00:00' AND '2022-01-08 23:59:59' GROUP BY gender, age_group;
gretelai_synthetic_text_to_sql