context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE expenses (id INT, category TEXT, country TEXT, year INT, amount_spent DECIMAL(10,2)); INSERT INTO expenses
What was the total amount spent on education in Afghanistan in 2015?
SELECT SUM(amount_spent) FROM expenses WHERE category = 'education' AND country = 'Afghanistan' AND year = 2015;
gretelai_synthetic_text_to_sql
CREATE TABLE socially_responsible_loans (id INT, year INT, country VARCHAR(255), loan_type VARCHAR(255), amount DECIMAL(10,2)); INSERT INTO socially_responsible_loans (id, year, country, loan_type, amount) VALUES (1, 2021, 'Canada', 'Microloan', 5000.00), (2, 2021, 'Canada', 'Education Loan', 20000.00);
Find the total number of socially responsible loans issued in Canada in 2021.
SELECT COUNT(*) FROM socially_responsible_loans WHERE year = 2021 AND country = 'Canada' AND loan_type = 'Microloan' OR loan_type = 'Education Loan';
gretelai_synthetic_text_to_sql
CREATE TABLE investments (region VARCHAR(20), investment_sum NUMERIC(12,2)); INSERT INTO investments (region, investment_sum) VALUES ('Asia', 50000), ('Europe', 75000), ('Africa', 35000), ('North America', 90000), ('South America', 45000), ('Australia', 60000);
What are the top 3 regions with the highest average investment sums?
SELECT region, AVG(investment_sum) as avg_investment FROM investments GROUP BY region ORDER BY avg_investment DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE shipment (shipment_id VARCHAR(10), status VARCHAR(20), warehouse_id VARCHAR(10), carrier_name VARCHAR(30), shipped_date DATE);
Get the status and count of shipments for each warehouse_id from the shipment table where the shipped_date is between '2021-01-01' and '2021-12-31' grouped by status and warehouse_id
SELECT status, warehouse_id, COUNT(*) as count FROM shipment WHERE shipped_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY status, warehouse_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), CompletedDiversityTraining BOOLEAN, Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, CompletedDiversityTraining, Salary) VALUES (1, 'John', 'Doe', 'IT', TRUE, 80000.00),...
What is the average salary for employees who have completed diversity and inclusion training, by department?
SELECT Department, AVG(Salary) FROM Employees WHERE CompletedDiversityTraining = TRUE GROUP BY Department;
gretelai_synthetic_text_to_sql
CREATE TABLE research_stations (station_name VARCHAR(50), ocean VARCHAR(20)); INSERT INTO research_stations (station_name, ocean) VALUES ('Hawaii Ocean Observing System', 'Pacific'), ('Monterey Bay Aquarium Research Institute', 'Pacific');
How many marine research stations are in the Pacific Ocean?
SELECT COUNT(*) FROM research_stations WHERE ocean = 'Pacific';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance (project_name VARCHAR(255), region VARCHAR(255), sector VARCHAR(255), amount DECIMAL(10,2)); INSERT INTO climate_finance (project_name, region, sector, amount) VALUES ('Solar Power Plant', 'Asia', 'Renewable Energy', 5000000.00); INSERT INTO climate_finance (project_name, region, sector, am...
What is the total climate finance committed to renewable energy projects in Asia?
SELECT SUM(amount) FROM climate_finance WHERE region = 'Asia' AND sector = 'Renewable Energy';
gretelai_synthetic_text_to_sql
CREATE TABLE decentralized_applications (app_id INT PRIMARY KEY, app_name VARCHAR(100), app_category VARCHAR(50));
Update the 'decentralized_applications' table to set the app_category to 'Lending' for all records where the app_name is 'Aave'
UPDATE decentralized_applications SET app_category = 'Lending' WHERE app_name = 'Aave';
gretelai_synthetic_text_to_sql
CREATE TABLE artists (id INT, name TEXT, birth_year INT, death_year INT); INSERT INTO artists (id, name, birth_year, death_year) VALUES (1, 'Artist 1', 1900, 1980); CREATE TABLE artworks (id INT, title TEXT, year_created INT, artist_id INT); INSERT INTO artworks (id, title, year_created, artist_id) VALUES (1, 'Artwork ...
How many artworks were created by female artists in the 20th century?
SELECT COUNT(*) FROM artworks a INNER JOIN artists ar ON a.artist_id = ar.id WHERE ar.death_year IS NULL AND ar.birth_year <= 1900 AND ar.birth_year >= 1900;
gretelai_synthetic_text_to_sql
CREATE TABLE Highways (id INT, name TEXT, location TEXT, state TEXT, cost FLOAT); INSERT INTO Highways (id, name, location, state, cost) VALUES (1, 'Highway A', 'Location A', 'Texas', 25000000), (2, 'Highway B', 'Location B', 'New York', 30000000);
What is the maximum construction cost of highways in Texas?
SELECT MAX(cost) FROM Highways WHERE state = 'Texas';
gretelai_synthetic_text_to_sql
CREATE TABLE attorneys (attorney_id INT, name VARCHAR(50)); CREATE TABLE cases (case_id INT, attorney_id INT, category VARCHAR(20));
Count the number of cases for each attorney who has more than 5 cases in the family law category.
SELECT attorney_id, COUNT(*) FROM cases WHERE category = 'family' GROUP BY attorney_id HAVING COUNT(*) > 5;
gretelai_synthetic_text_to_sql
CREATE TABLE world_heritage_sites (name VARCHAR(255), location VARCHAR(255), year INT); INSERT INTO world_heritage_sites (name, location, year) VALUES ('Machu Picchu', 'Peru', 1983), ('Galápagos Islands', 'Ecuador', 1978);
How many world heritage sites are in South America?
SELECT COUNT(*) FROM world_heritage_sites WHERE location LIKE '%South America%';
gretelai_synthetic_text_to_sql
CREATE TABLE MiningOperations (OperationID INT, OperationName VARCHAR(50), Country VARCHAR(50), ProductionRate FLOAT, EnvironmentalImpactScore INT); INSERT INTO MiningOperations (OperationID, OperationName, Country, ProductionRate, EnvironmentalImpactScore) VALUES (4, 'Operation C', 'China', 6000, 50); INSERT INTO Mini...
What is the average environmental impact score of mining operations in the Asian region?
SELECT AVG(EnvironmentalImpactScore) FROM MiningOperations WHERE Country IN (SELECT Country FROM Countries WHERE Region = 'Asia');
gretelai_synthetic_text_to_sql
CREATE TABLE incidents (incident_id INT, incident_date DATE, resolution_date DATE, department VARCHAR(50));
What is the maximum time to resolution for security incidents in the finance department, and which incident took the longest to resolve?
SELECT department, MAX(DATEDIFF(resolution_date, incident_date)) as max_resolution_time FROM incidents WHERE department = 'finance' GROUP BY department; SELECT incident_id, DATEDIFF(resolution_date, incident_date) as resolution_time FROM incidents WHERE department = 'finance' ORDER BY resolution_time DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE creative_ai (app_id INT, app_name TEXT, fairness_score FLOAT);
What is the minimum fairness score for creative AI applications in the 'creative_ai' table?
SELECT MIN(fairness_score) FROM creative_ai;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO marine_species (id, name, region) VALUES (1, 'Tuna', 'Atlantic Ocean'), (2, 'Tuna', 'Pacific Ocean');
Which marine species have been observed in both the Atlantic and Pacific Oceans?
SELECT marine_species.name FROM marine_species WHERE marine_species.region IN ('Atlantic Ocean', 'Pacific Ocean') GROUP BY marine_species.name HAVING COUNT(DISTINCT marine_species.region) > 1;
gretelai_synthetic_text_to_sql
CREATE TABLE waste_generation (state VARCHAR(2), generation INT); INSERT INTO waste_generation (state, generation) VALUES ('CA', 5000000), ('NY', 4000000), ('NJ', 3000000);
What is the average waste generation in the state of California?
SELECT AVG(generation) FROM waste_generation WHERE state = 'CA';
gretelai_synthetic_text_to_sql
CREATE TABLE animal_population (id INT PRIMARY KEY, species VARCHAR(30), name VARCHAR(20), population INT);
Update the 'name' field to 'Tiger' in the 'animal_population' table for all records where the 'species' is 'Panthera tigris'
UPDATE animal_population SET name = 'Tiger' WHERE species = 'Panthera tigris';
gretelai_synthetic_text_to_sql
CREATE TABLE MuseumData (id INT, city VARCHAR(50), num_employees INT); INSERT INTO MuseumData (id, city, num_employees) VALUES (1, 'New York', 10), (2, 'New York', 3), (3, 'Los Angeles', 7), (4, 'Los Angeles', 8), (5, 'Chicago', 6);
How many museums are there in New York with more than 5 employees?
SELECT COUNT(*) FROM MuseumData WHERE city = 'New York' AND num_employees > 5;
gretelai_synthetic_text_to_sql
CREATE TABLE region (id INT, name VARCHAR(255), rainfall FLOAT); INSERT INTO region (id, name, rainfall) VALUES (1, 'US-MN', 12.5), (2, 'US-ND', 11.8), (3, 'CA-BC', 18.3);
What is the total rainfall in the last week for region 'US-MN'?
SELECT SUM(rainfall) FROM region WHERE name = 'US-MN' AND rainfall_timestamp >= DATEADD(week, -1, CURRENT_TIMESTAMP);
gretelai_synthetic_text_to_sql
CREATE TABLE ports (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE cargo_operations (id INT, port_id INT, company VARCHAR(50), type VARCHAR(50), weight INT); INSERT INTO ports (id, name, country) VALUES (1, 'Port of Oakland', 'USA'), (2, 'Port of Singapore', 'Singapore'), (3, 'Port of Hong Kong', 'China')...
What is the total cargo weight handled by the company Orion Lines at the Port of Hong Kong?
SELECT SUM(weight) FROM cargo_operations WHERE company = 'Orion Lines' AND port_id = (SELECT id FROM ports WHERE name = 'Port of Hong Kong');
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID int, DonationDate date, Amount decimal(10,2)); INSERT INTO Donations (DonationID, DonationDate, Amount) VALUES (1, '2022-01-01', 500.00), (2, '2022-01-02', 200.00);
Calculate the total amount donated by top 3 donors in Q1 2022.
SELECT SUM(Amount) as TotalDonation FROM (SELECT DonorID, SUM(Amount) as Amount FROM Donations WHERE DonationDate BETWEEN '2022-01-01' AND '2022-03-31' GROUP BY DonorID ORDER BY Amount DESC LIMIT 3) as TopDonors;
gretelai_synthetic_text_to_sql
CREATE TABLE veteran_skills (id INT PRIMARY KEY, veteran_id INT, skill VARCHAR(50), years_of_experience INT);
Generate a table 'veteran_skills' to store veteran skills and experience
CREATE TABLE veteran_skills (id INT PRIMARY KEY, veteran_id INT, skill VARCHAR(50), years_of_experience INT);
gretelai_synthetic_text_to_sql
CREATE TABLE garment (garment_id INT, garment_type VARCHAR(255), restocked_date DATE); INSERT INTO garment (garment_id, garment_type, restocked_date) VALUES (1, 'T-Shirt', '2021-07-15'), (2, 'Jeans', '2021-08-01'), (3, 'Jackets', '2021-10-10');
Which garment types were most frequently restocked in the past year in the North region?
SELECT garment_type, COUNT(*) as restock_count FROM garment WHERE restocked_date >= DATEADD(year, -1, CURRENT_DATE) AND region = 'North' GROUP BY garment_type ORDER BY restock_count DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE elements_producers (element_id INT, producer_id INT, PRIMARY KEY (element_id, producer_id)); CREATE TABLE producers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), air_pollution INT); CREATE TABLE elements (id INT PRIMARY KEY, name VARCHAR(255), symbol VARCHAR(3), weight FLOAT, element_id IN...
Find the average air pollution for elements with symbol 'H'
SELECT AVG(p.air_pollution) FROM elements AS e JOIN elements_producers AS ep ON e.id = ep.element_id JOIN producers AS p ON ep.producer_id = p.id WHERE e.symbol LIKE 'H%';
gretelai_synthetic_text_to_sql
CREATE TABLE organic_farms (id INT, country VARCHAR(50), region VARCHAR(50), farm_type VARCHAR(50), area_ha FLOAT); INSERT INTO organic_farms (id, country, region, farm_type, area_ha) VALUES (1, 'Australia', 'Oceania', 'Smallholder', 1234.5); INSERT INTO organic_farms (id, country, region, farm_type, area_ha) VALUES (2...
Which farm type has the highest average area of organic farming in 'Oceania'?
SELECT farm_type, AVG(area_ha) FROM organic_farms WHERE region = 'Oceania' GROUP BY farm_type ORDER BY AVG(area_ha) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE energy_efficiency_scores_3 (state VARCHAR(20), score INT); INSERT INTO energy_efficiency_scores_3 (state, score) VALUES ('Texas', 90), ('Texas', 85), ('Texas', 95);
What is the maximum energy efficiency score in Texas
SELECT state, MAX(score) FROM energy_efficiency_scores_3 WHERE state = 'Texas';
gretelai_synthetic_text_to_sql
CREATE SCHEMA music; USE music;
Create a new table for storing artist demographics with columns for artist_id, name, age, and genre.
CREATE TABLE artist_demographics (artist_id INT, name VARCHAR(255), age INT, genre VARCHAR(255));
gretelai_synthetic_text_to_sql
CREATE TABLE defense_spending (country VARCHAR(50), continent VARCHAR(50), year INT, amount FLOAT); INSERT INTO defense_spending (country, continent, year, amount) VALUES ('United States', 'North America', 2020, 750.3), ('Canada', 'North America', 2020, 23.4), ('Mexico', 'North America', 2020, 6.7);
What is the total defense spending by countries in North America for the year 2020?
SELECT SUM(amount) FROM defense_spending WHERE continent = 'North America' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Vehicles (ID INT, VehicleType VARCHAR(255), CO2Emission INT); INSERT INTO Vehicles (ID, VehicleType, CO2Emission) VALUES (1, 'Car', 4000), (2, 'Truck', 8000), (3, 'Motorcycle', 2000);
What is the average CO2 emission per vehicle type in the transportation sector?
SELECT VehicleType, AVG(CO2Emission) FROM Vehicles GROUP BY VehicleType;
gretelai_synthetic_text_to_sql
CREATE TABLE likes (id INT, post_id INT, user_id INT); INSERT INTO likes (id, post_id, user_id) VALUES (1, 1, 1), (2, 1, 2), (3, 2, 1); CREATE TABLE posts (id INT, user_id INT); INSERT INTO posts (id, user_id) VALUES (1, 1), (2, 2), (3, 3); CREATE TABLE users (id INT, country VARCHAR(255)); INSERT INTO users (id, count...
What is the total number of likes received by users in Germany and the UK?
SELECT SUM(1) FROM (SELECT * FROM likes INNER JOIN posts ON likes.post_id = posts.id INNER JOIN users ON posts.user_id = users.id WHERE users.country IN ('Germany', 'UK')) AS subquery;
gretelai_synthetic_text_to_sql
CREATE TABLE wildlife_sanctuaries (id INT, name VARCHAR(50), location POINT); CREATE TABLE timber_production (id INT, location POINT);
List all the wildlife sanctuaries that do not intersect with areas used for timber production
SELECT w.name FROM wildlife_sanctuaries w LEFT JOIN timber_production t ON ST_Intersects(w.location, t.location) WHERE t.id IS NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE CoOwnershipProperties (PropertyID INT, City VARCHAR(50), Population INT, MaintenanceCost DECIMAL(5,2)); INSERT INTO CoOwnershipProperties (PropertyID, City, Population, MaintenanceCost) VALUES (1, 'New York', 8500000, 50.50), (2, 'Los Angeles', 4000000, 120.00), (3, 'Chicago', 2700000, 75.25);
Delete co-ownership properties in cities with a population below 1,000,000.
DELETE FROM CoOwnershipProperties WHERE Population < 1000000;
gretelai_synthetic_text_to_sql
CREATE TABLE garments (id INT, garment_type VARCHAR(255), material VARCHAR(255), price DECIMAL(5,2), country VARCHAR(255));
Find the average retail price of organic cotton t-shirts sold in Germany
SELECT AVG(price) FROM garments WHERE garment_type = 'T-Shirt' AND material = 'Organic Cotton' AND country = 'Germany';
gretelai_synthetic_text_to_sql
CREATE TABLE TV_shows (id INT, title VARCHAR(255), release_year INT, runtime INT, imdb_rating DECIMAL(2,1)); INSERT INTO TV_shows (id, title, release_year, runtime, imdb_rating) VALUES (1, 'Show1', 2018, 60, 7.2), (2, 'Show2', 2019, 45, 8.1), (3, 'Show3', 2020, 30, 6.5);
Find the average runtime of TV shows released in 2019 with an IMDb rating above 8.0.
SELECT AVG(runtime) FROM TV_shows WHERE release_year = 2019 AND imdb_rating > 8.0;
gretelai_synthetic_text_to_sql
CREATE TABLE patient (patient_id INT, name VARCHAR(50), age INT, diagnosis VARCHAR(50)); INSERT INTO patient (patient_id, name, age, diagnosis) VALUES (1, 'John Doe', 30, 'Depression');
What's the average age of patients diagnosed with depression in the 'clinic_a' database?
SELECT AVG(age) FROM patient WHERE diagnosis = 'Depression' AND database_name = 'clinic_a';
gretelai_synthetic_text_to_sql
CREATE TABLE games (game_type VARCHAR(20), ticket_price DECIMAL(5,2)); INSERT INTO games (game_type, ticket_price) VALUES ('Football', 80.50), ('Football', 90.00), ('Basketball', 60.00), ('Basketball', 65.00);
What is the average ticket price for football and basketball games?
SELECT AVG(ticket_price) FROM games WHERE game_type IN ('Football', 'Basketball');
gretelai_synthetic_text_to_sql
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT, revenue FLOAT); INSERT INTO hotels (hotel_id, hotel_name, country, revenue) VALUES (1, 'Green Lodge', 'Germany', 50000.00), (2, 'Eco Retreat', 'France', 75000.00);
What is the total revenue generated from eco-friendly hotel bookings in Germany and France?
SELECT SUM(revenue) FROM hotels WHERE country IN ('Germany', 'France') AND hotel_name LIKE '%eco%';
gretelai_synthetic_text_to_sql
CREATE TABLE InfrastructureProjects (id INT, category VARCHAR(20), cost FLOAT); INSERT INTO InfrastructureProjects (id, category, cost) VALUES (1, 'Roads', 500000), (2, 'Bridges', 750000);
What is the total cost of all projects in 'Roads' category?
SELECT SUM(cost) FROM InfrastructureProjects WHERE category = 'Roads';
gretelai_synthetic_text_to_sql
CREATE TABLE country_severity (id INT, ip_address VARCHAR(255), country VARCHAR(255), severity VARCHAR(255)); INSERT INTO country_severity (id, ip_address, country, severity) VALUES (1, '172.16.0.1', 'Brazil', 'Critical'), (2, '10.0.0.1', 'Canada', 'Low'), (3, '172.16.0.2', 'India', 'Critical'), (4, '10.0.0.2', 'Canada...
Which countries have 'Critical' severity vulnerabilities and the number of such vulnerabilities? Provide the output in the format: country, count_of_critical_severity_vulnerabilities.
SELECT country, COUNT(*) as count_of_critical_severity_vulnerabilities FROM country_severity WHERE severity = 'Critical' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE wind_farms (id INT, name TEXT, region TEXT, capacity_mw FLOAT); INSERT INTO wind_farms (id, name, region, capacity_mw) VALUES (1, 'Windfarm A', 'west', 150.5); INSERT INTO wind_farms (id, name, region, capacity_mw) VALUES (2, 'Windfarm B', 'east', 120.2); CREATE TABLE solar_power_plants (id INT, name TEXT,...
What is the total installed capacity (in MW) of all renewable energy projects in the 'east' region?
SELECT SUM(capacity_mw) FROM wind_farms WHERE region = 'east' UNION ALL SELECT SUM(capacity_mw) FROM solar_power_plants WHERE region = 'east';
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (exhibition_id INT, name VARCHAR(50), start_date DATE, end_date DATE); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT, age INT, gender VARCHAR(50));
What is the maximum age of visitors who attended the 'Contemporary Art' exhibition?
SELECT MAX(age) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.exhibition_id WHERE e.name = 'Contemporary Art';
gretelai_synthetic_text_to_sql
CREATE TABLE BuildingEfficiency ( BuildingID INT, Country VARCHAR(255), Rating FLOAT );
What is the maximum and minimum energy efficiency rating for buildings in France?
SELECT MAX(Rating) as MaxRating, MIN(Rating) as MinRating FROM BuildingEfficiency WHERE Country = 'France';
gretelai_synthetic_text_to_sql
CREATE TABLE Artworks (id INT, name TEXT, artist TEXT, year INT, price FLOAT, country TEXT, category TEXT, is_indigenous BOOLEAN); INSERT INTO Artworks (id, name, artist, year, price, country, category, is_indigenous) VALUES (1, 'Print1', 'CanadianIndigenousArtist1', 2000, 1000.00, 'Canada', 'print', true), (2, 'Painti...
What is the maximum price of a print created by an Indigenous artist from Canada or the USA?
SELECT MAX(price) FROM Artworks WHERE (country IN ('Canada', 'USA') AND is_indigenous = true AND category = 'print');
gretelai_synthetic_text_to_sql
CREATE TABLE species (id INT, name VARCHAR(255), max_habitat_depth FLOAT, ocean_basin VARCHAR(255)); INSERT INTO species (id, name, max_habitat_depth, ocean_basin) VALUES (1, 'Atlantic Salmon', 100.0, 'Atlantic'), (2, 'Blue Whale', 500.0, 'Pacific'), (3, 'Southern Ocean Orca', 1000.0, 'Southern');
What is the maximum depth ever recorded for a marine species habitat that is found in the Southern Ocean?
SELECT MAX(max_habitat_depth) FROM species WHERE ocean_basin = 'Southern';
gretelai_synthetic_text_to_sql
CREATE TABLE routes (route_id INT, name VARCHAR(255), stations_served INT, FOREIGN KEY (stations_served) REFERENCES stations(station_id));
Create a table named "routes" with columns "route_id", "name", and "stations_served" that references the "stations" table.
CREATE TABLE routes (route_id INT, name VARCHAR(255), stations_served INT, FOREIGN KEY (stations_served) REFERENCES stations(station_id));
gretelai_synthetic_text_to_sql
CREATE TABLE Waste(department VARCHAR(255),waste_quantity INT,waste_date DATE);INSERT INTO Waste(department,waste_quantity,waste_date) VALUES('Bakery',50,'2021-11-01'),('Bakery',60,'2021-11-02'),('Bakery',40,'2021-11-03');
What is the total waste produced by the 'Bakery' department in the month of 'November' 2021?
SELECT SUM(waste_quantity) FROM Waste WHERE department = 'Bakery' AND waste_date BETWEEN '2021-11-01' AND '2021-11-30';
gretelai_synthetic_text_to_sql
CREATE TABLE VeteranJobs (JobID INT, JobTitle VARCHAR(50), Quarter INT, Year INT, JobApplications INT); INSERT INTO VeteranJobs (JobID, JobTitle, Quarter, Year, JobApplications) VALUES (1, 'Software Engineer', 2, 2021, 25), (2, 'Mechanical Engineer', 2, 2021, 30), (3, 'Data Analyst', 2, 2021, 20), (4, 'Project Manager'...
List the number of veteran job applications received in Q2 2021?
SELECT SUM(JobApplications) FROM VeteranJobs WHERE Quarter = 2 AND Year = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE SAFETY_INSPECTIONS (ID INT, VESSEL_ID INT, INSPECTION_DATE DATE, SCORE INT);
Insert a new record of safety inspection with a score of 90 and inspection date of 2022-01-01 for vessel with ID 789 into the SAFETY_INSPECTIONS table
INSERT INTO SAFETY_INSPECTIONS (ID, VESSEL_ID, INSPECTION_DATE, SCORE) VALUES (1, 789, '2022-01-01', 90);
gretelai_synthetic_text_to_sql
CREATE TABLE genres (genre_id INT, genre VARCHAR(50)); INSERT INTO genres VALUES (1, 'Pop'), (2, 'Rock'), (3, 'Jazz'); CREATE TABLE songs (song_id INT, song VARCHAR(50), genre_id INT); INSERT INTO songs VALUES (1, 'Hit Me Baby', 1), (2, 'Smells Like Teen Spirit', 2), (3, 'Take Five', 3);
What are the top 3 genres by total number of songs in the music streaming platform?
SELECT g.genre, COUNT(s.song_id) as song_count FROM genres g JOIN songs s ON g.genre_id = s.genre_id GROUP BY g.genre ORDER BY song_count DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE ocean_co2_concentration (year INTEGER, co2_concentration FLOAT);
What is the total CO2 concentration in the ocean for each year?
SELECT year, SUM(co2_concentration) FROM ocean_co2_concentration GROUP BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE fares (service text, date date, fare decimal); INSERT INTO fares (service, date, fare) VALUES ('subway', '2023-01-01', 2.50), ('bus', '2023-01-02', 1.50), ('subway', '2023-02-01', 2.50), ('bus', '2023-02-02', 1.50), ('subway', '2023-03-01', 2.50), ('bus', '2023-03-02', 1.50);
What is the average fare for each service in the first quarter of 2023?
SELECT service, AVG(fare) FROM fares WHERE date BETWEEN '2023-01-01' AND '2023-03-31' GROUP BY service;
gretelai_synthetic_text_to_sql
CREATE TABLE Military_Equipment_Sales (sale_date DATE, equipment_name VARCHAR(50), customer_country VARCHAR(50), sale_value INT); INSERT INTO Military_Equipment_Sales (sale_date, equipment_name, customer_country, sale_value) VALUES ('2020-01-01', 'Tank A', 'Japan', 5000000); INSERT INTO Military_Equipment_Sales (sale_d...
What is the total military equipment sale value to Japan, grouped by the quarter of the sale date?
SELECT EXTRACT(QUARTER FROM sale_date) AS quarter, SUM(sale_value) FROM Military_Equipment_Sales WHERE customer_country = 'Japan' GROUP BY quarter;
gretelai_synthetic_text_to_sql
CREATE TABLE ingredients (id INT PRIMARY KEY, name VARCHAR(255), cost DECIMAL(10, 2), menu_item_id INT); INSERT INTO ingredients (id, name, cost, menu_item_id) VALUES (1, 'Tomato', 0.50, 1), (2, 'Pasta', 1.00, 1), (3, 'Chicken', 2.50, 2); CREATE TABLE menu_items (id INT PRIMARY KEY, name VARCHAR(255), price DECIMAL(10,...
Show the total cost of ingredients for each menu item
SELECT menu_items.name, SUM(ingredients.cost) AS total_cost FROM ingredients JOIN menu_items ON ingredients.menu_item_id = menu_items.id GROUP BY menu_items.name;
gretelai_synthetic_text_to_sql
CREATE TABLE Stores (store_id INT, store_name VARCHAR(50), state VARCHAR(50)); INSERT INTO Stores (store_id, store_name, state) VALUES (1, 'Eco-Store', 'California'), (2, 'Green Haven', 'Colorado'); CREATE TABLE Inventory (product_id INT, product_name VARCHAR(50), store_id INT, price DECIMAL(5, 2)); INSERT INTO Invento...
Update the price of 'Organic Cotton Shirts' to $19.99 in stores located in 'California' and 'Colorado'
UPDATE Inventory SET price = 19.99 WHERE product_name = 'Organic Cotton Shirts' AND store_id IN (SELECT store_id FROM Stores WHERE state IN ('California', 'Colorado'));
gretelai_synthetic_text_to_sql
CREATE TABLE game_sessions (game_id INT, user_id INT, region VARCHAR(10)); INSERT INTO game_sessions (game_id, user_id, region) VALUES (1, 2, 'europe'), (2, 3, 'america'), (1, 4, 'europe');
How many unique games were played by users from 'europe' region?
SELECT COUNT(DISTINCT game_id) FROM game_sessions WHERE region = 'europe';
gretelai_synthetic_text_to_sql
CREATE TABLE Attorneys (AttorneyID INT, Name VARCHAR(50), TotalBilling FLOAT); INSERT INTO Attorneys (AttorneyID, Name, TotalBilling) VALUES (1, 'Smith', 5000.00), (2, 'Johnson', 3500.00), (3, 'Williams', 7000.00);
Find the total billing amount for each attorney, ordered by the total amount in descending order.
SELECT AttorneyID, Name, TotalBilling FROM Attorneys ORDER BY TotalBilling DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID INT, DonationCategory TEXT, DonationAmount DECIMAL(10,2)); INSERT INTO Donations (DonationID, DonationCategory, DonationAmount) VALUES (1, 'Education', 1000.00), (2, 'Health', 1500.00), (3, 'Environment', 2000.00), (4, 'Education', 500.00), (5, 'Health', 800.00), (6, 'Environment', 12...
What is the total donation amount per category, ranked by the highest total?
SELECT DonationCategory, SUM(DonationAmount) AS TotalDonation, RANK() OVER (ORDER BY SUM(DonationAmount) DESC) AS Rank FROM Donations GROUP BY DonationCategory;
gretelai_synthetic_text_to_sql
CREATE TABLE vehicles (id INT, type VARCHAR(50)); CREATE TABLE vehicle_safety (id INT, vehicle_id INT, safety_rating FLOAT); INSERT INTO vehicles VALUES (1, 'sedan'); INSERT INTO vehicle_safety VALUES (1, 1, 4.5);
What is the average safety rating for sedans in the 'vehicle_safety' schema?
SELECT AVG(safety_rating) FROM vehicle_safety INNER JOIN vehicles ON vehicle_safety.vehicle_id = vehicles.id WHERE vehicles.type = 'sedan';
gretelai_synthetic_text_to_sql
CREATE TABLE wildlife_habitats (id INT, country VARCHAR(255), habitat_type VARCHAR(255));
how many wildlife habitats are there in each country in the 'forestry' schema?
SELECT country, COUNT(DISTINCT habitat_type) as num_habitats FROM wildlife_habitats GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE threats (name VARCHAR(50), description TEXT, mitigated BOOLEAN); INSERT INTO threats (name, description, mitigated) VALUES ('Threat 1', '...', TRUE), ('Threat 2', '...', FALSE);
Return the names and descriptions of all threats that have been mitigated in the energy sector.
SELECT name, description FROM threats WHERE mitigated = TRUE AND sector = 'Energy';
gretelai_synthetic_text_to_sql
CREATE TABLE water_sanitation_assistance (id INT, country VARCHAR(50), aid_type VARCHAR(50), amount FLOAT, date DATE); INSERT INTO water_sanitation_assistance (id, country, aid_type, amount, date) VALUES (1, 'Syria', 'water', 1200000, '2017-01-01');
Which countries have received the most humanitarian aid in the form of water and sanitation assistance in the last 5 years?
SELECT country, SUM(amount) as total_water_sanitation_aid FROM water_sanitation_assistance WHERE aid_type = 'water' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) GROUP BY country ORDER BY total_water_sanitation_aid DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE water_consumption_miami (customer_id INT, category VARCHAR(20), consumption FLOAT, day INT, month INT, year INT, city VARCHAR(20)); INSERT INTO water_consumption_miami (customer_id, category, consumption, day, month, year, city) VALUES (1, 'commercial', 30, 1, 1, 2019, 'Miami'); INSERT INTO water_consumpti...
What is the average daily water consumption per customer in the commercial category for the year 2019 in the city of Miami?
SELECT AVG(consumption) FROM water_consumption_miami WHERE category = 'commercial' AND year = 2019 AND city = 'Miami' GROUP BY day;
gretelai_synthetic_text_to_sql
CREATE TABLE Policyholders (PolicyID INT, Gender VARCHAR(10), State VARCHAR(10)); INSERT INTO Policyholders VALUES (1, 'Male', 'New York'); INSERT INTO Policyholders VALUES (2, 'Female', 'Florida'); CREATE TABLE Policies (PolicyID INT, RetentionRate DECIMAL(3,2)); INSERT INTO Policies VALUES (1, 0.80); INSERT INTO Poli...
What is the policy retention rate for male policyholders in New York and Florida?
SELECT p.Gender, AVG(pr.RetentionRate) as RetentionRate FROM Policyholders p INNER JOIN Policies pr ON p.PolicyID = pr.PolicyID WHERE (p.Gender = 'Male' AND p.State IN ('New York', 'Florida')) GROUP BY p.Gender;
gretelai_synthetic_text_to_sql
CREATE TABLE south_american_tourists (id INT, country VARCHAR(20), tourists INT); INSERT INTO south_american_tourists (id, country, tourists) VALUES (1, 'Brazil', 60000000), (2, 'Argentina', 5000000), (3, 'Colombia', 4000000);
What is the total number of tourists visiting countries in the South American continent?
SELECT SUM(tourists) FROM south_american_tourists;
gretelai_synthetic_text_to_sql
CREATE TABLE shark_population (shark_id INTEGER, species TEXT, length REAL); INSERT INTO shark_population (shark_id, species, length) VALUES (1, 'Whale Shark', 12000.1), (2, 'Basking Shark', 10000.2), (3, 'Great White Shark', 6000.3);
What is the maximum recorded length for each shark species in the 'shark_population' table?
SELECT species, MAX(length) FROM shark_population GROUP BY species;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(20), Ethnicity VARCHAR(20), CompletedDiversityTraining BOOLEAN);
What is the count of non-white female employees who have completed diversity training?
SELECT COUNT(*) FROM Employees WHERE Gender = 'Female' AND Ethnicity != 'White' AND CompletedDiversityTraining = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE products (product_id INT, product_name VARCHAR(50), restock_date DATE); INSERT INTO products (product_id, product_name, restock_date) VALUES (1, 'Product A', '2022-01-01'), (2, 'Product B', '2022-04-15'), (3, 'Product C', '2021-12-01');
Delete all records for products that have not been restocked in the last 6 months.
DELETE FROM products WHERE restock_date < DATEADD(month, -6, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE Products (id INT, category VARCHAR(20), price DECIMAL(5,2)); CREATE TABLE Orders (id INT, product_id INT, quantity INT, order_date DATE); INSERT INTO Products (id, category, price) VALUES (1, 'Tops', 15.99), (2, 'Bottoms', 29.99), (3, 'Outerwear', 49.99), (4, 'Accessories', 7.99), (5, 'Tops', 12.99); INSER...
What is the total quantity of orders for each product category?
SELECT p.category, SUM(o.quantity) FROM Products p JOIN Orders o ON p.id = o.product_id GROUP BY p.category;
gretelai_synthetic_text_to_sql
CREATE TABLE california_cities (id INT, city VARCHAR(50), water_consumption FLOAT, year INT); INSERT INTO california_cities (id, city, water_consumption, year) VALUES (1, 'Los Angeles', 1200000, 2019); INSERT INTO california_cities (id, city, water_consumption, year) VALUES (2, 'San Diego', 800000, 2019); INSERT INTO c...
List the top 5 water consuming cities in the state of California for the year 2019, ordered by water consumption in descending order.
SELECT city, water_consumption FROM california_cities WHERE year = 2019 ORDER BY water_consumption DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE warehouses (id VARCHAR(10), name VARCHAR(20), city VARCHAR(10), country VARCHAR(10)); CREATE TABLE inventory (item VARCHAR(10), warehouse_id VARCHAR(10), quantity INT); INSERT INTO warehouses (id, name, city, country) VALUES ('SEA-WH-01', 'Seattle Warehouse', 'Seattle', 'USA'), ('NYC-WH-01', 'New York City...
Which are the top 3 cities with the most inventory quantity?
SELECT city, SUM(quantity) as total_quantity FROM inventory i JOIN warehouses w ON i.warehouse_id = w.id GROUP BY city ORDER BY total_quantity DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, city TEXT, country TEXT);CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, tour_date DATE); INSERT INTO hotels VALUES (1, 'Hotel B', 'Tokyo', 'Japan'); INSERT INTO virtual_tours VALUES (1, 1, '2022-03-15');
How many virtual tours were engaged in the last month for hotels in Japan, grouped by city?
SELECT city, COUNT(*) FROM hotels INNER JOIN virtual_tours ON hotels.hotel_id = virtual_tours.hotel_id WHERE country = 'Japan' AND tour_date >= DATEADD(month, -1, GETDATE()) GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE mine_operations (id INT PRIMARY KEY, mine_name VARCHAR(255), location VARCHAR(255), extraction_type VARCHAR(255), production_volume INT);CREATE TABLE environmental_impact (id INT PRIMARY KEY, mine_id INT, pollution_level INT, waste_generation INT);
What is the maximum pollution level and corresponding mine name for mines in the Arctic region?
SELECT m.mine_name, e.pollution_level FROM mine_operations m JOIN environmental_impact e ON m.id = e.mine_id WHERE m.location = 'Arctic' AND e.pollution_level = (SELECT MAX(pollution_level) FROM environmental_impact WHERE mine_id = m.id);
gretelai_synthetic_text_to_sql
CREATE TABLE Products (ProductID int, ProductName varchar(50), ProductType varchar(50), Size varchar(10), Price decimal(5,2)); INSERT INTO Products (ProductID, ProductName, ProductType, Size, Price) VALUES (1, 'Eco Casual Shirt', 'Men', 'XL', 40); INSERT INTO Products (ProductID, ProductName, ProductType, Size, Price) ...
What is the average price per size for men's shirts in size XL, for all brands, and display the top 5 results?
SELECT AVG(Price) as AvgPrice, ProductType FROM Products WHERE ProductType = 'Men' AND Size = 'XL' GROUP BY ProductType ORDER BY AvgPrice DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE labor_hours (worker_id INT, state VARCHAR(20), hours_per_week DECIMAL(5,2)); INSERT INTO labor_hours (worker_id, state, hours_per_week) VALUES (1, 'TX', 40.00), (2, 'TX', 45.00);
Calculate the average number of construction labor hours per week in Texas
SELECT AVG(hours_per_week) FROM labor_hours WHERE state = 'TX';
gretelai_synthetic_text_to_sql
CREATE TABLE arts_and_sites (id INT, item_name VARCHAR(255), type VARCHAR(255), location VARCHAR(255)); INSERT INTO arts_and_sites (id, item_name, type, location) VALUES (1, 'Taiko', 'traditional art', 'Japan'), (2, 'Great Wall', 'heritage site', 'China');
What is the total number of traditional arts and heritage sites in Asia?
SELECT COUNT(*) FROM arts_and_sites WHERE location = 'Asia';
gretelai_synthetic_text_to_sql
CREATE TABLE Programs (ProgramID int, ProgramName varchar(50)); CREATE TABLE Volunteers (VolunteerID int, ProgramID int, VolunteerDate date);
How many volunteers engaged in each program in Q1 2022?
SELECT Programs.ProgramName, COUNT(Volunteers.VolunteerID) as VolunteersInProgram FROM Programs INNER JOIN Volunteers ON Programs.ProgramID = Volunteers.ProgramID WHERE QUARTER(VolunteerDate) = 1 AND YEAR(VolunteerDate) = 2022 GROUP BY Programs.ProgramName;
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours (country VARCHAR(255), quarter VARCHAR(10), local_impact FLOAT); INSERT INTO virtual_tours (country, quarter, local_impact) VALUES ('Australia', 'Q1', 500000), ('Brazil', 'Q1', 600000), ('Russia', 'Q1', 400000);
Which countries had the lowest local economic impact from virtual tours in Q1 2022?
SELECT country, MIN(local_impact) FROM virtual_tours WHERE quarter = 'Q1' GROUP BY country ORDER BY MIN(local_impact) ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE checking_acct (acct_number INT, name VARCHAR(50), balance DECIMAL(10,2), is_shariah BOOLEAN); INSERT INTO checking_acct (acct_number, name, balance, is_shariah) VALUES (2001, 'Fatima', 5000.00, true), (2002, 'Hassan', 7000.00, false), (2003, 'Aisha', 3000.00, true), (2004, 'Ali', 9000.00, false);
Find the customer with the lowest balance in the Shariah-compliant checking accounts, and display their account number, name, and balance.
SELECT acct_number, name, balance FROM (SELECT acct_number, name, balance, ROW_NUMBER() OVER (PARTITION BY is_shariah ORDER BY balance ASC) as rn FROM checking_acct WHERE is_shariah = true) t WHERE rn = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Events (event_name TEXT, volunteers INTEGER, event_date DATE); INSERT INTO Events (event_name, volunteers, event_date) VALUES ('Event A', 50, '2020-01-10'); INSERT INTO Events (event_name, volunteers, event_date) VALUES ('Event B', 75, '2020-04-20');
How many volunteers worked at each event in H1 of 2020?
SELECT event_name, SUM(volunteers) FROM Events WHERE event_date BETWEEN '2020-01-01' AND '2020-06-30' GROUP BY event_name;
gretelai_synthetic_text_to_sql
CREATE TABLE TeacherAccess (TeacherID INT, Resource VARCHAR(100), AccessDate DATE); INSERT INTO TeacherAccess (TeacherID, Resource, AccessDate) VALUES (1, 'Open Textbook', '2022-01-15');
Which open pedagogy resources have been accessed by the most teachers?
SELECT Resource, COUNT(*) FROM TeacherAccess GROUP BY Resource ORDER BY COUNT(*) DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(255)); CREATE TABLE depth_distribution (distribution_id INT, species_id INT, avg_depth DECIMAL(5,2)); INSERT INTO marine_species (species_id, species_name) VALUES (1, 'Green Sea Turtle'), (2, 'Humpback Whale'); INSERT INTO depth_distribution (distributio...
List all marine species and their average depth distribution.
SELECT marine_species.species_name, depth_distribution.avg_depth FROM marine_species INNER JOIN depth_distribution ON marine_species.species_id = depth_distribution.species_id;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT, state VARCHAR(20), revenue DECIMAL(10,2), month INT, year INT);
What was the total revenue for each state in the first quarter of 2022?
SELECT state, SUM(revenue) FROM sales WHERE month BETWEEN 1 AND 3 AND year = 2022 GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE funding_breakdown (id INT, project VARCHAR(50), region VARCHAR(50), funding FLOAT); INSERT INTO funding_breakdown VALUES (1, 'Project Epsilon', 'North America', 4500000); INSERT INTO funding_breakdown VALUES (2, 'Project Zeta', 'Asia', 5000000);
Get total funding for autonomous driving research projects in North America
SELECT SUM(funding) FROM funding_breakdown WHERE region = 'North America';
gretelai_synthetic_text_to_sql
CREATE TABLE A320Sales (id INT, sale_date DATE, sale_price DECIMAL(10,2));
What is the total revenue generated by Airbus A320 family aircraft sales?
SELECT SUM(sale_price) FROM A320Sales WHERE sale_price IS NOT NULL;
gretelai_synthetic_text_to_sql
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Age INT, Genre VARCHAR(50)); INSERT INTO Artists VALUES (1, 'Artist A', 35, 'Hip-Hop'), (2, 'Artist B', 28, 'Pop');
What is the average age of all hip-hop artists in our database?
SELECT AVG(Age) FROM Artists WHERE Genre = 'Hip-Hop';
gretelai_synthetic_text_to_sql
CREATE TABLE WasteGenerationEurope (region VARCHAR(50), year INT, waste_quantity INT); INSERT INTO WasteGenerationEurope (region, year, waste_quantity) VALUES ('Europe/East', 2020, 250000), ('Europe/West', 2020, 270000), ('Europe/North', 2020, 300000), ('Europe/South', 2020, 280000);
What is the total waste generation in Europe for the year 2020, separated by region?
SELECT region, SUM(waste_quantity) FROM WasteGenerationEurope WHERE year = 2020 GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE models (id INT, name VARCHAR(255), region VARCHAR(255), is_fairness_test BOOLEAN); INSERT INTO models (id, name, region, is_fairness_test) VALUES (1, 'ModelA', 'US', true), (2, 'ModelB', 'EU', false), (3, 'ModelC', 'APAC', true);
What is the total number of models trained and tested for fairness across all regions?
SELECT COUNT(*) FROM models WHERE is_fairness_test = true;
gretelai_synthetic_text_to_sql
CREATE TABLE music_platform (id INT, artist VARCHAR(100), country VARCHAR(50), streams INT);
Show the top 5 artists with the highest number of streams on the music streaming platform in the USA.
SELECT artist, SUM(streams) as total_streams FROM music_platform WHERE country = 'USA' GROUP BY artist ORDER BY total_streams DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE mining_unions (id INT, name TEXT, sector TEXT, incident_count INT); CREATE TABLE mining_incidents (id INT, union_id INT, incident_type TEXT, incident_date DATE);
List the names and number of workplace safety incidents of unions in the 'mining' sector, ordered by the number of incidents in descending order.
SELECT m.name, COUNT(mi.id) as incidents_count FROM mining_unions m JOIN mining_incidents mi ON m.id = mi.union_id WHERE m.sector = 'mining' GROUP BY m.id ORDER BY incidents_count DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE solana_digital_assets (id INT, name VARCHAR(255), network VARCHAR(255), market_cap DECIMAL(10, 2)); INSERT INTO solana_digital_assets (id, name, network, market_cap) VALUES (1, 'Asset3', 'solana', 200), (2, 'Asset4', 'solana', 250);
What's the name and market capitalization of the digital asset with the lowest market capitalization in the 'Solana' network?
SELECT name, market_cap FROM solana_digital_assets WHERE network = 'solana' ORDER BY market_cap LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_investments(investment_id INT, investment_type VARCHAR(20), country VARCHAR(10));
Maximum number of sustainable investments in African countries?
SELECT MAX(COUNT(*)) FROM sustainable_investments WHERE country LIKE 'Africa%' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE companies (id INT, name TEXT, industry TEXT, founding_year INT, founder_immigration_status TEXT, num_employees INT); INSERT INTO companies (id, name, industry, founding_year, founder_immigration_status, num_employees) VALUES (1, 'ShopEase', 'E-commerce', 2019, 'Immigrant', 50); INSERT INTO companies (id, n...
What is the average number of employees for startups founded by immigrants from Asia in the e-commerce sector?
SELECT AVG(companies.num_employees) FROM companies WHERE companies.industry = 'E-commerce' AND companies.founder_immigration_status = 'Immigrant';
gretelai_synthetic_text_to_sql
CREATE TABLE platforms (platform_id INT, platform VARCHAR(50)); INSERT INTO platforms VALUES (1, 'Spotify'), (2, 'Apple Music'), (3, 'Tidal'); CREATE TABLE song_platforms (song_id INT, platform_id INT); INSERT INTO song_platforms VALUES (1, 1), (1, 2), (2, 2), (3, 3); CREATE TABLE songs (song_id INT, song VARCHAR(50), ...
How many unique streaming platforms have distributed songs by artist 'The Beatles'?
SELECT COUNT(DISTINCT p.platform_id) as platform_count FROM platforms p JOIN song_platforms sp ON p.platform_id = sp.platform_id JOIN songs s ON sp.song_id = s.song_id WHERE s.artist = 'The Beatles';
gretelai_synthetic_text_to_sql
CREATE TABLE ocean_trenches (name VARCHAR(50), location VARCHAR(50), avg_depth FLOAT); INSERT INTO ocean_trenches
What is the average depth of all trenches in the Pacific Ocean?
SELECT AVG(avg_depth) FROM ocean_trenches WHERE location = 'Pacific Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE labor_rights_advocacy_events (event_id INTEGER, union_name TEXT); INSERT INTO labor_rights_advocacy_events (event_id, union_name) VALUES (1, 'Union A'), (2, 'Union A'), (3, 'Union B'), (4, 'Union C'), (5, 'Union D'), (6, 'Union E'), (7, 'Union A'), (8, 'Union B'), (9, 'Union C'), (10, 'Union D'), (11, 'Uni...
What is the number of union members who have participated in labor rights advocacy events, by union?
SELECT union_name, COUNT(*) as num_participants FROM labor_rights_advocacy_events GROUP BY union_name;
gretelai_synthetic_text_to_sql
CREATE TABLE international_satellite_launches (id INT, launch_year INT, country VARCHAR(50), satellites INT); INSERT INTO international_satellite_launches (id, launch_year, country, satellites) VALUES (1, 2020, 'USA', 20), (2, 2020, 'China', 30), (3, 2021, 'Russia', 15);
How many satellites were launched per country?
SELECT country, SUM(satellites) FROM international_satellite_launches GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE farmer (farmer_id INT, farmer_name TEXT, region TEXT); INSERT INTO farmer (farmer_id, farmer_name, region) VALUES (1, 'FarmerA', 'region1'), (2, 'FarmerB', 'region2'), (3, 'FarmerC', 'region2'); CREATE TABLE animal_rearing (rearing_id INT, farmer_id INT, animal_type TEXT, quantity INT); INSERT INTO animal_...
Who are the farmers that raised animals in 'region1' and what was the total quantity of animals?
SELECT f.farmer_name, SUM(ar.quantity) as total_animals FROM farmer f INNER JOIN animal_rearing ar ON f.farmer_id = ar.farmer_id WHERE f.region = 'region1' GROUP BY f.farmer_name;
gretelai_synthetic_text_to_sql
CREATE TABLE incidents (id INT, threat_actor VARCHAR(255), incident_date DATE); INSERT INTO incidents (id, threat_actor, incident_date) VALUES (1, 'insider', '2022-01-15'), (2, 'outsider', '2022-02-20'), (3, 'insider', '2022-03-05'); SELECT CURDATE(), DATE_SUB(CURDATE(), INTERVAL 6 MONTH) INTO @current_date, @start_dat...
What is the total number of security incidents caused by insider threats in the last six months?
SELECT COUNT(*) FROM incidents WHERE threat_actor = 'insider' AND incident_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND CURDATE();
gretelai_synthetic_text_to_sql
CREATE TABLE Videos (id INT, title VARCHAR(255), language VARCHAR(255), duration INT); INSERT INTO Videos (id, title, language, duration) VALUES (1, 'Video1', 'English', 60), (2, 'Video2', 'French', 90), (3, 'Video3', 'English', 45);
What is the total duration of videos by language?
SELECT language, SUM(duration) as total_duration FROM Videos GROUP BY language;
gretelai_synthetic_text_to_sql