context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE bus_routes (id INT PRIMARY KEY, route_number INT, route_name VARCHAR(255), city VARCHAR(255), num_stops INT);
Delete the bus route 12 from the public transportation system of San Francisco
DELETE FROM bus_routes WHERE route_number = 12 AND city = 'San Francisco';
gretelai_synthetic_text_to_sql
CREATE TABLE articles (id INT, title TEXT, content TEXT, publication_date DATE, newspaper TEXT); CREATE TABLE words (id INT, article_id INT, word TEXT);
List the names and total word count of articles published by "The Daily Times" newspaper in October 2020.
SELECT a.title, COUNT(w.word) AS word_count FROM articles a INNER JOIN words w ON a.id = w.article_id WHERE a.newspaper = 'The Daily Times' AND a.publication_date BETWEEN '2020-10-01' AND '2020-10-31' GROUP BY a.id;
gretelai_synthetic_text_to_sql
CREATE TABLE ingredients (id INT PRIMARY KEY, product_id INT, name TEXT, quantity REAL);
Update the quantity of 'Salt' ingredient to 15 for the food product with id 1
UPDATE ingredients SET quantity = 15 WHERE product_id = 1 AND name = 'Salt';
gretelai_synthetic_text_to_sql
CREATE TABLE ArtForms (ArtFormID int, ArtFormName varchar(255), ArtFormOrigin varchar(255), CultureDomain varchar(255), PractitionersCount int); INSERT INTO ArtForms (ArtFormID, ArtFormName, ArtFormOrigin, CultureDomain, PractitionersCount) VALUES (1, 'Batik', 'Indonesia', 'Southeast Asian', 1000);
Identify the traditional art forms and their origins in the Southeast Asian culture domain with more than 500 practitioners.
SELECT ArtFormName, ArtFormOrigin FROM ArtForms WHERE CultureDomain = 'Southeast Asian' AND PractitionersCount > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE algorithmic_fairness_incidents_monthly (incident_id INT PRIMARY KEY, incident_date DATE, region VARCHAR(255));
What is the average number of algorithmic fairness incidents per month in Africa?
SELECT AVG(EXTRACT(MONTH FROM incident_date)) AS avg_monthly_incidents FROM algorithmic_fairness_incidents_monthly WHERE region = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE defendants (defendant_id INT, program_year INT, participated_restorative_program BOOLEAN); INSERT INTO defendants (defendant_id, program_year, participated_restorative_program) VALUES (1, 2020, true), (2, 2019, false), (3, 2020, false), (4, 2018, true);
Identify the number of defendants who participated in restorative justice programs, broken down by program year
SELECT program_year, COUNT(*) FROM defendants WHERE participated_restorative_program = true GROUP BY program_year;
gretelai_synthetic_text_to_sql
CREATE TABLE faculty (id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); INSERT INTO faculty (id, name, gender, department) VALUES (1, 'Alice', 'Female', 'Engineering'), (2, 'Bob', 'Male', 'Computer Science'), (3, 'Charlie', 'Non-binary', 'Physics');
Who are the female faculty members in the Engineering department?
SELECT name FROM faculty WHERE gender = 'Female' AND department = 'Engineering';
gretelai_synthetic_text_to_sql
CREATE TABLE research_projects (id INT, name VARCHAR(50), start_date DATE, end_date DATE, organization_id INT);
Delete the 'research_projects' table
DROP TABLE research_projects;
gretelai_synthetic_text_to_sql
CREATE TABLE regulatory_frameworks (framework_id INT, country VARCHAR(100), framework VARCHAR(100)); INSERT INTO regulatory_frameworks (framework_id, country, framework) VALUES (1, 'US', 'Framework1'), (2, 'US', 'Framework2'), (3, 'US', 'Framework3');
What are the regulatory frameworks in place for blockchain in the US?
SELECT framework FROM regulatory_frameworks WHERE country = 'US';
gretelai_synthetic_text_to_sql
CREATE TABLE security_incidents (id INT, incident_type VARCHAR(255), region VARCHAR(255)); INSERT INTO security_incidents (id, incident_type, region) VALUES (1, 'Phishing', 'APAC'), (2, 'Malware', 'EMEA'), (3, 'Ransomware', 'AMER');
What is the total number of security incidents by region?
SELECT region, COUNT(*) FROM security_incidents GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE rural_infrastructure (id INT, name VARCHAR(50), type VARCHAR(50), budget FLOAT); INSERT INTO rural_infrastructure (id, name, type, budget) VALUES (1, 'Solar Irrigation', 'Agricultural Innovation', 150000.00); CREATE TABLE community_development (id INT, name VARCHAR(50), type VARCHAR(50), budget FLOAT); INS...
What are the names of all agricultural innovation projects in the 'rural_infrastructure' and 'community_development' tables?
SELECT name FROM rural_infrastructure WHERE type = 'Agricultural Innovation' UNION SELECT name FROM community_development WHERE type = 'Agricultural Innovation';
gretelai_synthetic_text_to_sql
CREATE TABLE Visitor_Information (Visitor_ID INT, First_Visit_Date DATE, Country VARCHAR(255), Continent VARCHAR(255)); INSERT INTO Visitor_Information (Visitor_ID, First_Visit_Date, Country, Continent) VALUES (1001, '2022-01-01', 'USA', 'North America'), (1002, '2022-01-02', 'Canada', 'North America'), (1003, '2022-01...
Find the number of new visitors from each continent who visited the museum in the last week.
SELECT Continent, COUNT(DISTINCT Visitor_ID) AS Number_Of_New_Visitors FROM Visitor_Information INNER JOIN (SELECT Visitor_ID FROM Visitor_Log WHERE Visit_Date >= DATE_SUB(CURDATE(), INTERVAL 1 WEEK) GROUP BY Visitor_ID) AS New_Visitors ON Visitor_Information.Visitor_ID = New_Visitors.Visitor_ID GROUP BY Continent;
gretelai_synthetic_text_to_sql
CREATE TABLE VesselPortVisits (id INT, vessel_id INT, port_name VARCHAR(50), visit_time TIMESTAMP); INSERT INTO VesselPortVisits (id, vessel_id, port_name, visit_time) VALUES (1, 901, 'Port of Santos', '2022-03-25 11:30:00');
Determine the number of unique vessels that visited the Port of Santos in the last 90 days.
SELECT COUNT(DISTINCT vessel_id) as num_unique_vessels FROM VesselPortVisits WHERE port_name = 'Port of Santos' AND visit_time > DATE_SUB(NOW(), INTERVAL 90 DAY);
gretelai_synthetic_text_to_sql
CREATE TABLE endangered_species (animal_id INT, species VARCHAR(50)); CREATE TABLE protected_areas (animal_id INT, species VARCHAR(50));
How many animal species in the endangered_species table are not present in the protected_areas table?
SELECT COUNT(*) FROM endangered_species WHERE animal_id NOT IN (SELECT animal_id FROM protected_areas);
gretelai_synthetic_text_to_sql
CREATE TABLE ingredients (ingredient_id INT, ingredient_name TEXT, organic TEXT, product_id INT, country TEXT); INSERT INTO ingredients VALUES (1, 'Jojoba Oil', 'Organic', 1, 'Mexico'), (2, 'Shea Butter', 'Organic', 2, 'Ghana'), (3, 'Aloe Vera', 'Organic', 3, 'Mexico'), (4, 'Rosehip Oil', 'Organic', 4, 'Chile'), (5, 'C...
Identify the top 5 countries with the most conventional ingredients sourced.
SELECT country, COUNT(*) as conventional_count FROM ingredients WHERE organic = 'Conventional' GROUP BY country ORDER BY conventional_count DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE fares (id INT, type TEXT, amount DECIMAL, collection_date DATE); INSERT INTO fares (id, type, amount, collection_date) VALUES (1, 'Train', 5.00, '2022-01-01'), (2, 'Train', 5.00, '2022-01-02'), (3, 'Bus', 2.00, '2021-12-31');
Delete all fares collected on buses before 2022.
DELETE FROM fares WHERE type = 'Bus' AND collection_date < '2022-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID INT, DonorID INT, DonationDate DATE, Amount FLOAT); INSERT INTO Donations (DonationID, DonorID, DonationDate, Amount) VALUES (1, 1, '2022-01-01', 100.00), (2, 2, '2022-02-15', 150.00);
What's the total donation amount per quarter?
SELECT DATE_PART('quarter', DonationDate) AS Quarter, SUM(Amount) FROM Donations GROUP BY Quarter;
gretelai_synthetic_text_to_sql
CREATE TABLE Customers (CustomerID INT, Name VARCHAR(50), FavoriteItem VARCHAR(50), Location VARCHAR(50)); CREATE VIEW FavoriteItems AS SELECT CustomerID, MenuItemID FROM Customers WHERE FavoriteItem IS NOT NULL;
What are the favorite items of customers who live in 'NYC'?
SELECT Customers.FavoriteItem FROM Customers JOIN FavoriteItems ON Customers.CustomerID = FavoriteItems.CustomerID WHERE Customers.Location = 'NYC';
gretelai_synthetic_text_to_sql
CREATE TABLE Hospitals (name TEXT, location TEXT, type TEXT, num_beds INTEGER, state TEXT); INSERT INTO Hospitals (name, location, type, num_beds, state) VALUES ('Hospital A', 'City A, Rural Central', 'General', 120, 'Rural Central'), ('Hospital B', 'City B, Rural Central', 'Specialty', 60, 'Rural Central');
What is the average number of hospital beds per hospital in Rural Central?
SELECT AVG(num_beds/COUNT(*)) as avg_beds_per_hospital FROM Hospitals WHERE state = 'Rural Central';
gretelai_synthetic_text_to_sql
CREATE TABLE Crops (id INT PRIMARY KEY, name VARCHAR(50), planting_date DATE, harvest_date DATE, yield INT, farmer_id INT, FOREIGN KEY (farmer_id) REFERENCES Farmers(id)); INSERT INTO Crops (id, name, planting_date, harvest_date, yield, farmer_id) VALUES (1, 'Corn', '2022-05-01', '2022-08-01', 100, 1), (2, 'Soybeans', ...
How many crops were harvested in '2021'?
SELECT COUNT(*) FROM Crops WHERE YEAR(harvest_date) = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE product_category (id INT, category VARCHAR(255), units_sold INT); INSERT INTO product_category (id, category, units_sold) VALUES (1, 'Electronics', 200), (2, 'Clothing', 300), (3, 'Books', 100), (4, 'Toys', 400);
How many units were sold in each product category?
SELECT category, SUM(units_sold) FROM product_category GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE matches (match_id INT, home_team_id INT, away_team_id INT, home_team_score INT, away_team_score INT, match_date DATE); CREATE TABLE players (player_id INT, player_name VARCHAR(255), team_id INT, goals INT);
What is the average number of goals scored by each player in the last 10 matches?
SELECT p.player_name, AVG(p.goals) as avg_goals FROM players p JOIN matches m ON (p.team_id = m.home_team_id OR p.team_id = m.away_team_id) WHERE m.match_date >= DATEADD(day, -10, GETDATE()) GROUP BY p.player_name;
gretelai_synthetic_text_to_sql
CREATE TABLE Urban_Farmers (id INT PRIMARY KEY, name VARCHAR(50), age INT, location VARCHAR(50), organic_certified BOOLEAN); INSERT INTO Urban_Farmers (id, name, age, location, organic_certified) VALUES (1, 'Wang Xiu', 35, 'Beijing', true); INSERT INTO Urban_Farmers (id, name, age, location, organic_certified) VALUES (...
What is the product and price information for urban agriculture?
SELECT uf.location, up.product_name, up.price FROM Urban_Farmers uf INNER JOIN Urban_Produce up ON uf.id = up.farmer_id;
gretelai_synthetic_text_to_sql
CREATE TABLE warehouse (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE reverse_logistics (id INT PRIMARY KEY, warehouse_id INT, FOREIGN KEY (warehouse_id) REFERENCES warehouse(id));
Add a new reverse logistics record for the 'GHI' warehouse
INSERT INTO reverse_logistics (id, warehouse_id) VALUES ((SELECT COALESCE(MAX(id), 0) + 1 FROM reverse_logistics), (SELECT id FROM warehouse WHERE name = 'GHI'));
gretelai_synthetic_text_to_sql
CREATE TABLE tunnels (id INT, name VARCHAR(255), location VARCHAR(255), length FLOAT); INSERT INTO tunnels (id, name, location, length) VALUES (1, 'Seikan Tunnel', 'Japan', 53.85);
What is the name of the longest tunnel in Japan?
SELECT name FROM tunnels WHERE location = 'Japan' ORDER BY length DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE military_equipment_sales (sale_id INT, vendor VARCHAR(255), equipment_type VARCHAR(255), quantity INT, country VARCHAR(255)); INSERT INTO military_equipment_sales (sale_id, vendor, equipment_type, quantity, country) VALUES (1, 'Acme Corp', 'tanks', 50, 'Country A');
What is the total quantity of military equipment sold by Acme Corp to Country A?
SELECT SUM(quantity) FROM military_equipment_sales WHERE vendor = 'Acme Corp' AND country = 'Country A';
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours (id INT, location TEXT, attendees INT, tour_date DATE); INSERT INTO virtual_tours (id, location, attendees, tour_date) VALUES (1, 'Paris', 20, '2022-01-01'), (2, 'Berlin', 30, '2022-01-10');
What is the average number of attendees in virtual tours across European countries?
SELECT AVG(attendees) FROM virtual_tours WHERE location LIKE '%Europe%';
gretelai_synthetic_text_to_sql
CREATE TABLE Customers (CustomerID INT, AccountID INT); INSERT INTO Customers (CustomerID, AccountID) VALUES (1, 1001), (1, 1002), (2, 1003), (3, 1004), (3, 1005);
Which customers have more than one account?
SELECT c1.CustomerID FROM Customers c1 INNER JOIN Customers c2 ON c1.CustomerID = c2.CustomerID AND c1.AccountID != c2.AccountID;
gretelai_synthetic_text_to_sql
CREATE TABLE rd_expenditure (id INT PRIMARY KEY, drug_id INT, year INT, amount DECIMAL(10,2)); CREATE TABLE drugs (id INT PRIMARY KEY, name VARCHAR(255), manufacturer VARCHAR(255), approval_date DATE);
What is the average R&D expenditure per year for drugs that were approved after 2015?
SELECT AVG(amount) as avg_annual_rd_expenditure FROM rd_expenditure JOIN drugs ON rd_expenditure.drug_id = drugs.id WHERE approval_date > '2015-01-01' GROUP BY rd_expenditure.drug_id HAVING COUNT(*) > 5;
gretelai_synthetic_text_to_sql
CREATE TABLE SimulationGame (playerID INT, region VARCHAR(5), level INT); INSERT INTO SimulationGame (playerID, region, level) VALUES (1, 'CA', 12), (2, 'CA', 15), (3, 'CA', 8), (4, 'EU', 20);
What is the average level of 'SimulationGame' for players in 'CA' region?
SELECT AVG(level) FROM SimulationGame WHERE region = 'CA' AND game = 'SimulationGame';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance (region VARCHAR(50), amount FLOAT, sector VARCHAR(50)); INSERT INTO climate_finance (region, amount, sector) VALUES ('Asia', 6000000, 'Mitigation'), ('Africa', 4000000, 'Mitigation'), ('Europe', 7000000, 'Adaptation'), ('South America', 3000000, 'Mitigation');
What is the total climate finance allocation for mitigation projects in all regions?
SELECT SUM(amount) FROM climate_finance WHERE sector = 'Mitigation';
gretelai_synthetic_text_to_sql
CREATE TABLE farmers (id INT PRIMARY KEY, name VARCHAR(50), age INT, ethnicity VARCHAR(20), region VARCHAR(25)); CREATE TABLE certifications (id INT PRIMARY KEY, farmer_id INT, name VARCHAR(50), authority VARCHAR(50)); INSERT INTO farmers (id, name, age, ethnicity, region) VALUES (1, 'Maria Rodriguez', 55, 'Latinx', 'S...
Which farmers in the Southwest have both organic and regenerative certifications and what are their names?
SELECT f.name FROM farmers f INNER JOIN certifications c ON f.id = c.farmer_id WHERE f.region = 'Southwest' AND c.name IN ('Organic', 'Regenerative') GROUP BY f.name HAVING COUNT(DISTINCT c.name) = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE vessels (id INT, type VARCHAR(255)); INSERT INTO vessels (id, type) VALUES (1, 'Tanker'), (2, 'Bulk Carrier'); CREATE TABLE cargo (vessel_id INT, weight INT, month VARCHAR(9)); INSERT INTO cargo (vessel_id, weight, month) VALUES (1, 5000, 'January 2021'), (1, 6000, 'January 2021'), (2, 7000, 'January 2021'...
What was the average cargo weight for each vessel type in January 2021?
SELECT v.type, AVG(c.weight) as avg_weight FROM cargo c JOIN vessels v ON c.vessel_id = v.id WHERE c.month = 'January 2021' GROUP BY v.type;
gretelai_synthetic_text_to_sql
CREATE TABLE mine (id INT, name TEXT, location TEXT, geological_survey TEXT); INSERT INTO mine (id, name, location, geological_survey) VALUES (1, 'Golden Gorge', 'CA', 'Survey 1, Report 123'), (2, 'Silver Ridge', 'NV', 'Survey 2, Report 456'), (3, 'Bronze Basin', 'CO', 'Survey 3, Report 789');
Show geological survey information for a specific mine
SELECT name, geological_survey FROM mine WHERE name = 'Silver Ridge';
gretelai_synthetic_text_to_sql
CREATE TABLE GoldMine (date DATE, quantity INT);INSERT INTO GoldMine (date, quantity) VALUES ('2021-01-01', 150), ('2021-01-05', 200), ('2021-02-10', 180), ('2021-03-20', 250);
What is the total quantity of gold mined in the first quarter of 2021 from the 'GoldMine'?
SELECT SUM(quantity) FROM GoldMine WHERE date < '2021-04-01' AND date >= '2021-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE volunteer_hours (id INT, volunteer_name VARCHAR(50), city VARCHAR(50), hours DECIMAL(5,2));
Find the average number of hours contributed by volunteers from each city in the 'volunteer_hours' table.
SELECT city, AVG(hours) FROM volunteer_hours GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE sea_salinity (id INT, sea TEXT, avg_salinity FLOAT); INSERT INTO sea_salinity (id, sea, avg_salinity) VALUES (1, 'Black Sea', 17.0), (2, 'Mediterranean Sea', 38.0);
What is the average salinity of the Black Sea?
SELECT AVG(avg_salinity) FROM sea_salinity WHERE sea = 'Black Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE regulatory_violations (violation_id INT, country VARCHAR(50), violation_type VARCHAR(50), description TEXT); INSERT INTO regulatory_violations (violation_id, country, violation_type, description) VALUES (1, 'USA', 'Securities Fraud', 'Description 1'), (2, 'Canada', 'Money Laundering', 'Description 2'), (3,...
How many regulatory violations have been reported for each country in the blockchain industry?
SELECT country, COUNT(*) as num_violations FROM regulatory_violations GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE haircare_sales (sale_date DATE, product_natural BOOLEAN, revenue DECIMAL(10,2)); INSERT INTO haircare_sales (sale_date, product_natural, revenue) VALUES ('2022-01-01', TRUE, 40.00), ('2022-01-02', TRUE, 35.00);
What was the average revenue per sale for natural hair care products in 2022?
SELECT AVG(revenue) FROM haircare_sales WHERE product_natural = TRUE AND sale_date BETWEEN '2022-01-01' AND '2022-12-31';
gretelai_synthetic_text_to_sql
CREATE TABLE product_data (id INT PRIMARY KEY, color VARCHAR(10));
How many unique colors are available in the 'product_data' table?
SELECT COUNT(DISTINCT color) FROM product_data;
gretelai_synthetic_text_to_sql
CREATE TABLE studio (studio_id INT, studio_name VARCHAR(50), country VARCHAR(50)); INSERT INTO studio (studio_id, studio_name, country) VALUES (1, 'Studio A', 'USA'), (2, 'Studio B', 'Canada'); CREATE TABLE movie (movie_id INT, title VARCHAR(50), rating DECIMAL(3,2), studio_id INT); INSERT INTO movie (movie_id, title, ...
What's the average rating of movies produced by studios located in the United States?
SELECT AVG(movie.rating) FROM movie JOIN studio ON movie.studio_id = studio.studio_id WHERE studio.country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE Exhibitions (id INT, country VARCHAR(20), exhibition_date DATE, visitor_count INT);
How many visitors attended exhibitions in each country in the last 6 months?
SELECT country, SUM(visitor_count) FROM Exhibitions WHERE exhibition_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours (id INT, hotel_id INT, country TEXT, engagements INT); INSERT INTO virtual_tours (id, hotel_id, country, engagements) VALUES (1, 1, 'Australia', 1500), (2, 2, 'New Zealand', 1200), (3, 3, 'Japan', 1800), (4, 4, 'China', 2000); CREATE TABLE hotels (id INT, name TEXT, region TEXT); INSERT INTO ...
Which hotel in the 'Asia-Pacific' region has the highest engagement rate for virtual tours?
SELECT hotel_id, MAX(engagements * 1.0 / view_count) AS engagement_rate FROM virtual_tours v JOIN virtual_tour_views vv ON v.hotel_id = vv.hotel_id JOIN hotels h ON v.hotel_id = h.id WHERE h.region = 'Asia-Pacific' GROUP BY hotel_id ORDER BY engagement_rate DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE fish_farms (id INT, name VARCHAR(255), region VARCHAR(255), water_temperature FLOAT, water_ph FLOAT); INSERT INTO fish_farms (id, name, region, water_temperature, water_ph) VALUES (1, 'Farm A', 'Oceania', 25.1, 7.8), (2, 'Farm B', 'Oceania', 19.2, 7.5), (3, 'Farm C', 'Oceania', 22.3, 8.0);
What is the average water pH level in fish farms located in Oceania, where the water temperature is above 20 degrees Celsius?
SELECT AVG(water_ph) FROM fish_farms WHERE region = 'Oceania' AND water_temperature > 20;
gretelai_synthetic_text_to_sql
CREATE TABLE Streaming (country VARCHAR(50), year INT, genre VARCHAR(50), streams INT); INSERT INTO Streaming (country, year, genre, streams) VALUES ('France', 2021, 'Electronic', 800000); INSERT INTO Streaming (country, year, genre, streams) VALUES ('France', 2021, 'Electronic', 850000);
What is the average number of streams for Electronic songs in France in 2021?
SELECT AVG(streams) FROM Streaming WHERE country = 'France' AND year = 2021 AND genre = 'Electronic';
gretelai_synthetic_text_to_sql
CREATE TABLE Concerts (id INT, artist VARCHAR(100), city VARCHAR(100), country VARCHAR(100)); CREATE TABLE Artists (id INT, name VARCHAR(100), country VARCHAR(100));
What is the total number of concerts held by artists from the United Kingdom in the city of 'London'?
SELECT COUNT(*) FROM Concerts c JOIN Artists a ON c.artist = a.name WHERE c.city = 'London' AND a.country = 'United Kingdom';
gretelai_synthetic_text_to_sql
CREATE TABLE revenue (id INT, revenue FLOAT, warehouse VARCHAR(20), quarter INT, region VARCHAR(20)); INSERT INTO revenue (id, revenue, warehouse, quarter, region) VALUES (1, 10000.0, 'Tokyo', 2, 'Asia'), (2, 12000.0, 'Berlin', 1, 'Europe'), (3, 15000.0, 'Tokyo', 2, 'Asia'); CREATE TABLE warehouses (id INT, name VARCHA...
What is the total revenue generated from each warehouse in Asia in Q2 2021?
SELECT p.warehouse, SUM(r.revenue) FROM revenue r JOIN warehouses w ON r.warehouse = w.name WHERE r.region = 'Asia' AND r.quarter = 2 GROUP BY p.warehouse;
gretelai_synthetic_text_to_sql
CREATE TABLE digital_divide (initiative_id INT, continent VARCHAR(20), initiatives INT); INSERT INTO digital_divide (initiative_id, continent, initiatives) VALUES (1, 'Asia', 100), (2, 'Europe', 150), (3, 'Asia', 50);
How many digital divide initiatives are there in total for Asia and Europe?
SELECT SUM(initiatives) FROM digital_divide WHERE continent IN ('Asia', 'Europe');
gretelai_synthetic_text_to_sql
CREATE TABLE military_equipment (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), manufacturer VARCHAR(255), year INT); INSERT INTO military_equipment (id, name, type, manufacturer, year) VALUES (1, 'M1 Abrams', 'Tank', 'General Dynamics', 1980), (2, 'F-15 Eagle', 'Fighter', 'McDonnell Douglas', 1976);
Select all records from 'military_equipment' table
SELECT * FROM military_equipment;
gretelai_synthetic_text_to_sql
CREATE TABLE ride_data (ride_id INT, ride_start_time TIMESTAMP, ride_end_time TIMESTAMP, ride_distance FLOAT, vehicle_id INT, ride_type VARCHAR(10));
Calculate the average ride distance for each unique vehicle_id and ride_type in ride_data.
SELECT vehicle_id, ride_type, AVG(ride_distance) AS avg_distance FROM ride_data GROUP BY vehicle_id, ride_type;
gretelai_synthetic_text_to_sql
CREATE TABLE products (id INT, name VARCHAR(255), price DECIMAL(10, 2), category VARCHAR(255)); INSERT INTO products (id, name, price, category) VALUES (1, 'Blush 1', 22.00, 'Blush'), (2, 'Blush 2', 15.00, 'Blush'), (3, 'Blush 3', 30.00, 'Blush'), (4, 'Blush 4', 45.00, 'Blush');
Update the price of all blushes to $20
UPDATE products SET price = 20.00 WHERE category = 'Blush';
gretelai_synthetic_text_to_sql
CREATE TABLE film_directors (director_id INT, director_name VARCHAR(50), director_gender VARCHAR(10), country VARCHAR(50)); INSERT INTO film_directors (director_id, director_name, director_gender, country) VALUES (1, 'Alice Guy-Blaché', 'Female', 'France');
Which countries have the highest number of female film directors?
SELECT country, COUNT(*) as num_female_directors FROM film_directors WHERE director_gender = 'Female' GROUP BY country ORDER BY num_female_directors DESC LIMIT 10;
gretelai_synthetic_text_to_sql
CREATE TABLE Vehicles(type TEXT, in_maintenance BOOLEAN); CREATE TABLE Maintenance(vehicle_id INT, start_date DATE, end_date DATE);
How many bicycles are there in the maintenance schedule for the next month?
SELECT COUNT(*) FROM Maintenance JOIN Vehicles ON Maintenance.vehicle_id = Vehicles.id WHERE type = 'bicycle' AND start_date >= CURDATE() AND end_date < DATE_ADD(CURDATE(), INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE cities (name VARCHAR(255)); INSERT INTO cities (name) VALUES ('San Francisco'), ('Boston'); CREATE TABLE disaster_preparedness_kits (id INT, city VARCHAR(255), quantity INT); INSERT INTO disaster_preparedness_kits (id, city, quantity) VALUES (1, 'San Francisco', 200), (2, 'Boston', 250);
What is the total number of disaster preparedness kits distributed in each city?
SELECT city, SUM(quantity) as total_kits_distributed FROM disaster_preparedness_kits GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE satellite_deployment ( id INT, name VARCHAR(255), country VARCHAR(255), launch_date DATE );
List the names and launch dates of satellites deployed in France.
SELECT name, launch_date FROM satellite_deployment WHERE country = 'France';
gretelai_synthetic_text_to_sql
CREATE TABLE item_inventory (item_id INT, item_name VARCHAR(50), quantity INT, warehouse_id INT);
Update the quantity of item_id 200 to 600 in the item_inventory table if the quantity is currently greater than 500
UPDATE item_inventory SET quantity = 600 WHERE item_id = 200 AND quantity > 500;
gretelai_synthetic_text_to_sql
CREATE TABLE community_development (id INT PRIMARY KEY, aid_organization INT, people_impacted INT, date DATE); INSERT INTO community_development (id, aid_organization, people_impacted, date) VALUES (1, 1, 100, '2022-01-01'); INSERT INTO community_development (id, aid_organization, people_impacted, date) VALUES (2, 3, 2...
What is the average number of people impacted per day by aid_organization 3 in the community_development table?
SELECT AVG(people_impacted) FROM community_development WHERE aid_organization = 3;
gretelai_synthetic_text_to_sql
CREATE TABLE countries (country_name TEXT, conservation_initiative TEXT); CREATE TABLE conservation_budgets (country_name TEXT, budget FLOAT); INSERT INTO countries (country_name, conservation_initiative) VALUES ('Indonesia', 'Yes'), ('Brazil', 'Yes'), ('South Africa', 'No'); INSERT INTO conservation_budgets (country_n...
List all countries with marine conservation initiatives and their respective budgets.
SELECT countries.country_name, conservation_budgets.budget FROM countries INNER JOIN conservation_budgets ON countries.country_name = conservation_budgets.country_name WHERE countries.conservation_initiative = 'Yes';
gretelai_synthetic_text_to_sql
CREATE TABLE FleetCapacity (FleetID int, FleetName varchar(255), MaxCapacity int); INSERT INTO FleetCapacity (FleetID, FleetName, MaxCapacity) VALUES (1, 'Blue', 80), (2, 'Yellow', 60), (3, 'Green', 70);
What is the maximum number of vehicles in the 'Blue' and 'Yellow' fleets?
SELECT MAX(MaxCapacity) FROM FleetCapacity WHERE FleetName IN ('Blue', 'Yellow');
gretelai_synthetic_text_to_sql
CREATE TABLE satellites (id INT, name VARCHAR(255), type VARCHAR(255), operational BOOLEAN); CREATE VIEW sbas_satellites AS SELECT * FROM satellites WHERE type IN ('WAAS', 'EGNOS', 'MSAS', 'GAGAN');
What is the minimum number of operational satellites required for satellite-based augmentation systems?
SELECT MIN(COUNT(*)) FROM sbas_satellites WHERE operational = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE Athletes (AthleteID INT, Name VARCHAR(50), Age INT, Sport VARCHAR(20), Country VARCHAR(50)); INSERT INTO Athletes (AthleteID, Name, Age, Sport, Country) VALUES (1, 'Hanae Shibata', 22, 'Swimming', 'Japan'); INSERT INTO Athletes (AthleteID, Name, Age, Sport, Country) VALUES (2, 'Kenji Sato', 30, 'Gymnastics...
What is the age ranking of athletes from Japan in their respective sports?
SELECT AthleteID, Name, Age, ROW_NUMBER() OVER (PARTITION BY Sport ORDER BY Age) AS AgeRank FROM Athletes WHERE Country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE NutritionData(product_id INT, product_type VARCHAR(50), is_vegan BOOLEAN, calorie_count INT, avg_rating FLOAT);
List the product types and their total calorie count from the NutritionData table that are not vegan and have an average rating above 4.0.
SELECT product_type, SUM(calorie_count) FROM NutritionData WHERE is_vegan = FALSE GROUP BY product_type HAVING AVG(avg_rating) > 4.0;
gretelai_synthetic_text_to_sql
CREATE TABLE SustainableSourcing (restaurant_id INT, year INT, sustainable_cost INT); INSERT INTO SustainableSourcing (restaurant_id, year, sustainable_cost) VALUES (3, 2019, 8000), (3, 2020, 9000);
Show the total sustainable sourcing cost for 'Fancy Fine Dining' in 2019.
SELECT SUM(sustainable_cost) FROM SustainableSourcing WHERE restaurant_id = 3 AND year = 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE agreements (id INT, workplace TEXT, country TEXT, successful_cba BOOLEAN); INSERT INTO agreements (id, workplace, country, successful_cba) VALUES (1, 'XYZ Factory', 'France', true), (2, 'ABC Office', 'France', false), (3, 'LMN Warehouse', 'France', true);
Calculate the percentage of workplaces in France with successful collective bargaining agreements, rounded to the nearest whole number.
SELECT ROUND(100.0 * SUM(CASE WHEN successful_cba THEN 1 ELSE 0 END) / COUNT(*), 0) as percentage_successful_cba FROM agreements WHERE country = 'France';
gretelai_synthetic_text_to_sql
CREATE TABLE concert_ticket_sales (id INT, user_id INT, concert_id INT, quantity INT, revenue INT); INSERT INTO concert_ticket_sales (id, user_id, concert_id, quantity, revenue) VALUES (1, 1, 1, 100, 5000), (2, 2, 2, 200, 8000), (3, 3, 3, 150, 750), (4, 4, 4, 250, 12500);
Which user has the highest sum of revenue for their concert ticket sales?
SELECT user_id, SUM(revenue) as total_revenue, RANK() OVER (ORDER BY SUM(revenue) DESC) as user_rank FROM concert_ticket_sales GROUP BY user_id;
gretelai_synthetic_text_to_sql
CREATE TABLE sales (id INT PRIMARY KEY, transaction_date DATE, quantity_sold INT, payment_method VARCHAR(255), region VARCHAR(255), garment_material VARCHAR(255));
What is the total quantity of garments with 'wool' material sold online, per payment method, in the 'London' region?
SELECT payment_method, SUM(quantity_sold) as total_quantity_sold_online FROM sales WHERE region = 'London' AND garment_material = 'wool' AND transaction_date >= '2022-01-01' AND transaction_date <= '2022-12-31' AND payment_method IS NOT NULL GROUP BY payment_method;
gretelai_synthetic_text_to_sql
CREATE TABLE MineImpact (mine_name VARCHAR(50), country VARCHAR(50), year INT, mineral VARCHAR(50), score INT); INSERT INTO MineImpact (mine_name, country, year, mineral, score) VALUES ('Golden Mine', 'Canada', 2020, 'Gold', 30), ('Silver Mine', 'Mexico', 2020, 'Silver', 40), ('Iron Mine', 'Brazil', 2020, 'Iron', 50);
What is the total environmental impact score for each mine, by mineral type, in 2020?
SELECT context.mine_name, context.mineral, SUM(context.score) as total_score FROM context WHERE context.year = 2020 GROUP BY context.mine_name, context.mineral;
gretelai_synthetic_text_to_sql
CREATE TABLE threat_intelligence_60 (id INT, threat_level INT, threat_date DATE); INSERT INTO threat_intelligence_60 (id, threat_level, threat_date) VALUES (1, 5, '2022-01-01'), (2, 3, '2022-01-02'), (3, 7, '2022-01-03'), (4, 6, '2022-01-04'), (5, 4, '2022-01-05');
Calculate the average threat level for the last 60 days
SELECT AVG(threat_level) FROM threat_intelligence_60 WHERE threat_date >= CURDATE() - INTERVAL 60 DAY;
gretelai_synthetic_text_to_sql
CREATE TABLE water_usage ( id INT, state_id INT, year INT, usage_type VARCHAR(20), water_consumption FLOAT ); INSERT INTO water_usage (id, state_id, year, usage_type, water_consumption) VALUES (1, 1, 2017, 'domestic', 1200), (2, 1, 2018, 'domestic', 1500), (3, 1, 2019, 'domestic', 1700), (4, 2, 2017, 'domestic', 900), ...
What is the total water consumption for municipal usage in Texas and California in 2018?
SELECT SUM(water_consumption) FROM water_usage WHERE state_id IN (1, 2) AND year = 2018 AND usage_type = 'domestic';
gretelai_synthetic_text_to_sql
CREATE TABLE hydrothermal_vents (vent_id INT, name TEXT, temperature FLOAT, depth INT);
What is the minimum temperature ever recorded at hydrothermal vents?
SELECT MIN(temperature) FROM hydrothermal_vents;
gretelai_synthetic_text_to_sql
CREATE TABLE gym_memberships (id INT, member_name VARCHAR(50), start_date DATE, end_date DATE, membership_type VARCHAR(50), price DECIMAL(5,2));
What is the number of members who have been members for more than 1 year?
SELECT COUNT(DISTINCT member_name) AS long_term_members FROM gym_memberships WHERE DATEDIFF(CURDATE(), start_date) > 365;
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Position VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Position, Department, Salary) VALUES (1, 'John', 'Doe', 'Manager', 'Manufacturing', 75000.00); INSERT INTO Emp...
Show the names and positions of employees in the Engineering department who earn a salary above the average salary for the department, but below 80,000.
SELECT FirstName, LastName, Position FROM Employees WHERE Department = 'Engineering' AND Salary > (SELECT AVG(Salary) FROM Employees WHERE Department = 'Engineering') AND Salary < 80000.00;
gretelai_synthetic_text_to_sql
CREATE TABLE Manufacturer (id INT, name VARCHAR(50), country VARCHAR(10), electric_powertrain BOOLEAN); INSERT INTO Manufacturer (id, name, country, electric_powertrain) VALUES (1, 'Tesla', 'USA', true), (2, 'Mercedes', 'Germany', true), (3, 'BMW', 'Germany', true), (4, 'Volkswagen', 'Germany', true), (5, 'Ford', 'USA'...
What is the total number of vehicles sold by manufacturers based in the EU and having an electric powertrain in 2021?
SELECT SUM(Sales.units_sold) FROM Sales INNER JOIN Manufacturer ON Sales.manufacturer_id = Manufacturer.id WHERE Manufacturer.country = 'Germany' AND Manufacturer.electric_powertrain = true;
gretelai_synthetic_text_to_sql
CREATE TABLE volunteers (id INT, program_id INT, total_volunteers INT, quarter INT, year INT); INSERT INTO volunteers (id, program_id, total_volunteers, quarter, year) VALUES (1, 1, 5, 3, 2022), (2, 2, 3, 3, 2022), (3, 1, 6, 4, 2022), (4, 3, 4, 4, 2022);
How many volunteers are needed for each program in the upcoming quarter?
SELECT program_id, SUM(total_volunteers) FROM volunteers WHERE quarter = (SELECT quarter FROM quarters WHERE quarter_name = 'upcoming_quarter') GROUP BY program_id;
gretelai_synthetic_text_to_sql
CREATE TABLE agricultural_innovation (id INT, project_budget INT, project_status TEXT, country TEXT); INSERT INTO agricultural_innovation (id, project_budget, project_status, country) VALUES (1, 60000, 'completed', 'Germany'), (2, 45000, 'in_progress', 'France'), (3, 70000, 'completed', 'Italy');
What is the minimum budget for in-progress agricultural innovation projects in Europe, broken down by country?
SELECT country, MIN(project_budget) FROM agricultural_innovation WHERE project_status = 'in_progress' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_life (life_id INT, life_name VARCHAR(50), region VARCHAR(50), biomass INT); INSERT INTO marine_life (life_id, life_name, region) VALUES (1, 'Whale', 'Atlantic'), (2, 'Jellyfish', 'Atlantic');
What is the maximum biomass of marine life in the Atlantic region?
SELECT MAX(biomass) FROM marine_life WHERE region = 'Atlantic';
gretelai_synthetic_text_to_sql
CREATE TABLE student_mental_health (student_id INT, score INT, year INT); INSERT INTO student_mental_health (student_id, score, year) VALUES (1, 80, 2021), (1, 85, 2022), (2, 70, 2021), (2, 75, 2022), (3, 90, 2021), (3, 95, 2022);
Which students have consistently improved their mental health scores?
SELECT student_id, AVG(score) as avg_score FROM student_mental_health GROUP BY student_id HAVING COUNT(DISTINCT year) > 1;
gretelai_synthetic_text_to_sql
CREATE TABLE products (product_id INT, category VARCHAR(20), quantity INT); INSERT INTO products (product_id, category, quantity) VALUES (1, 'apparel', 50);
Find the total quantity of products in the 'apparel' category
SELECT SUM(quantity) FROM products WHERE category = 'apparel';
gretelai_synthetic_text_to_sql
CREATE TABLE funding (funding_id INT, organization_id INT, source VARCHAR(50), amount INT); CREATE TABLE organizations (organization_id INT, region VARCHAR(50));
What is the percentage of funding received from government sources by region?
SELECT o.region, 100.0 * AVG(CASE WHEN f.source = 'Government' THEN f.amount ELSE 0 END) / SUM(f.amount) as gov_funding_percentage FROM funding f JOIN organizations o ON f.organization_id = o.organization_id GROUP BY o.region;
gretelai_synthetic_text_to_sql
CREATE TABLE subscribers (subscriber_id INT, subscriber_name VARCHAR(50), region_id INT); CREATE TABLE calls (call_id INT, subscriber_id INT, call_type VARCHAR(50), call_duration INT, call_date DATE);
List all subscribers who have made international calls and their total call duration in the last month.
SELECT s.subscriber_name, SUM(c.call_duration) AS total_call_duration FROM subscribers s INNER JOIN calls c ON s.subscriber_id = c.subscriber_id WHERE c.call_type = 'International' AND c.call_date >= DATEADD(month, -1, GETDATE()) GROUP BY s.subscriber_name;
gretelai_synthetic_text_to_sql
CREATE TABLE Cosmetics_Labels(Product_Name VARCHAR(30), Label VARCHAR(20)); INSERT INTO Cosmetics_Labels(Product_Name, Label) VALUES('Product A', 'Cruelty-Free'), ('Product B', 'Not Cruelty-Free'), ('Product C', 'Cruelty-Free'), ('Product D', 'Not Cruelty-Free'), ('Product E', 'Cruelty-Free'), ('Product F', 'Not Cruelt...
What is the percentage of cosmetics products that are cruelty-free?
SELECT (COUNT(*) FILTER (WHERE Label = 'Cruelty-Free') * 100.0 / COUNT(*)) FROM Cosmetics_Labels;
gretelai_synthetic_text_to_sql
CREATE TABLE temperature (location VARCHAR(255), year INT, temperature FLOAT); INSERT INTO temperature (location, year, temperature) VALUES ('Arctic Circle', 2010, -12.3), ('Arctic Circle', 2011, -11.5), ('Arctic Circle', 2012, -12.1), ('Arctic Circle', 2013, -10.9), ('Arctic Circle', 2014, -11.3), ('Arctic Circle', 20...
What is the average temperature change in the Arctic circle between 2010 and 2015?
SELECT AVG(temperature) FROM temperature WHERE location = 'Arctic Circle' AND year BETWEEN 2010 AND 2015;
gretelai_synthetic_text_to_sql
CREATE TABLE cosmetics (product_id INT, product_name TEXT, sales FLOAT, is_cruelty_free BOOLEAN, country TEXT); INSERT INTO cosmetics VALUES (1, 'Lipstick', 500.0, true, 'USA'), (2, 'Foundation', 800.0, true, 'Canada'), (3, 'Mascara', 300.0, false, 'USA');
What are the top 5 cruelty-free cosmetic products by sales in the USA?
SELECT product_name, sales FROM cosmetics WHERE is_cruelty_free = true AND country = 'USA' ORDER BY sales DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE wastewater_plants (id INT, country VARCHAR(50), year INT, capacity FLOAT); INSERT INTO wastewater_plants (id, country, year, capacity) VALUES (1, 'India', 2020, 80.0), (2, 'India', 2019, 85.0), (3, 'India', 2018, 90.0), (4, 'United States', 2020, 95.0), (5, 'United States', 2019, 100.0), (6, 'United States...
List all wastewater treatment plants in India with their treatment capacities for the year 2020.
SELECT capacity FROM wastewater_plants WHERE country = 'India' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE hospitals (state varchar(2), hospital_name varchar(25), num_beds int); INSERT INTO hospitals (state, hospital_name, num_beds) VALUES ('NY', 'NY Presbyterian', 2001), ('CA', 'UCLA Medical', 1012), ('TX', 'MD Anderson', 1543), ('FL', 'Mayo Clinic FL', 1209);
What is the hospital with the highest number of beds per state?
SELECT state, hospital_name, MAX(num_beds) as max_beds FROM hospitals GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE avg_carbon_prices (price_id INT, market VARCHAR(50), price FLOAT); INSERT INTO avg_carbon_prices (price_id, market, price) VALUES (1, 'RGGI', 15.6), (2, 'EU ETS', 25.3);
What is the average price (USD) for carbon emissions in the 'RGGI' market?
SELECT AVG(price) FROM avg_carbon_prices WHERE market = 'RGGI';
gretelai_synthetic_text_to_sql
CREATE TABLE attorneys (attorney_id INT, name TEXT, title TEXT); CREATE TABLE cases (case_id INT, attorney_id INT, verdict TEXT);
How many cases were handled by attorneys with 'Senior Partner' title?
SELECT COUNT(*) FROM cases INNER JOIN attorneys ON cases.attorney_id = attorneys.attorney_id WHERE attorneys.title = 'Senior Partner';
gretelai_synthetic_text_to_sql
CREATE TABLE platform_locations(country VARCHAR(255), location VARCHAR(255), platform_type VARCHAR(255), count INT);INSERT INTO platform_locations(country, location, platform_type, count) VALUES('Brazil','Atlantic Ocean','Offshore',50),('Norway','North Sea','Offshore',30),('United Kingdom','North Sea','Offshore',20),('...
List all countries that have offshore drilling platforms in the Atlantic Ocean and the Pacific Ocean.
SELECT country FROM platform_locations WHERE location IN ('Atlantic Ocean', 'Pacific Ocean') AND platform_type = 'Offshore' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(255), address VARCHAR(255)); CREATE TABLE ingredients (ingredient_id INT, ingredient_name VARCHAR(255), supplier_id INT, quantity DECIMAL(5,2), waste DECIMAL(5,2), purchase_date DATE); INSERT INTO suppliers VALUES (1, 'Green Earth Farms', '123 Farm Lane'); ...
What is the total waste generated by each ingredient supplier in the past year?
SELECT supplier_name, SUM(waste) as total_waste FROM suppliers s JOIN ingredients i ON s.supplier_id = i.supplier_id WHERE purchase_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) GROUP BY supplier_name;
gretelai_synthetic_text_to_sql
CREATE TABLE Military_Equipment_Sales (supplier VARCHAR(255), region VARCHAR(255), equipment VARCHAR(255), quantity INT, sale_price DECIMAL(10,2), sale_year INT);
What is the total value of military equipment sales by ABC Inc to the Middle Eastern region in the year 2022 with a sale price greater than $5,000,000?
SELECT SUM(quantity * sale_price) FROM Military_Equipment_Sales WHERE supplier = 'ABC Inc' AND region = 'Middle East' AND sale_price > 5000000 AND sale_year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE Construction_Labor (Employee_ID INT, Employee_Name VARCHAR(100), Skill VARCHAR(50), Hourly_Wage FLOAT, City VARCHAR(50), State CHAR(2), Zipcode INT); CREATE VIEW CA_Construction_Labor AS SELECT * FROM Construction_Labor WHERE State = 'CA';
What is the average hourly wage for construction workers in California?
SELECT AVG(Hourly_Wage) FROM CA_Construction_Labor;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (satellite_id INT, deployment_year INT, cost FLOAT); INSERT INTO Satellites (satellite_id, deployment_year, cost) VALUES (1, 2022, 20000000.0), (2, 2021, 15000000.0), (3, 2019, 10000000.0), (4, 2018, 8000000.0);
Find the average cost of satellites deployed between 2018 and 2021.
SELECT AVG(cost) FROM Satellites WHERE deployment_year BETWEEN 2018 AND 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE stations (station_id INT, name VARCHAR(255), latitude DECIMAL(9,6), longitude DECIMAL(9,6));
Add a column named "region" to the "stations" table with a default value of 'NYC'.
ALTER TABLE stations ADD region VARCHAR(255) NOT NULL DEFAULT 'NYC';
gretelai_synthetic_text_to_sql
CREATE TABLE Members (MemberID INT, Name VARCHAR(50)); INSERT INTO Members (MemberID, Name) VALUES (1, 'John Doe'); INSERT INTO Members (MemberID, Name) VALUES (2, 'Jane Smith'); CREATE TABLE Workouts (WorkoutID INT, WorkoutDate DATE, WorkoutType VARCHAR(50), MemberID INT, HeartRate INT); INSERT INTO Workouts (WorkoutI...
What is the maximum heart rate recorded for each member during a HIIT workout?
SELECT Members.Name, MAX(Workouts.HeartRate) FROM Workouts INNER JOIN Members ON Workouts.MemberID = Members.MemberID WHERE Workouts.WorkoutType = 'HIIT' GROUP BY Members.Name;
gretelai_synthetic_text_to_sql
CREATE TABLE MilitaryVehicles (id INT, quantity INT, cost FLOAT, country TEXT); INSERT INTO MilitaryVehicles (id, quantity, cost, country) VALUES (1, 100, 5000000, 'China'), (2, 200, 3000000, 'India');
How many military vehicles are present in the Asian region, and what is their total cost?
SELECT SUM(MilitaryVehicles.quantity) as total_vehicles, SUM(MilitaryVehicles.cost) as total_cost FROM MilitaryVehicles WHERE MilitaryVehicles.country IN (SELECT country FROM Countries WHERE Continent = 'Asia');
gretelai_synthetic_text_to_sql
CREATE TABLE PublicSafetyProjects (ProjectID INT, Name VARCHAR(100), Budget DECIMAL(10,2), Year INT); INSERT INTO PublicSafetyProjects (ProjectID, Name, Budget, Year) VALUES (1, 'Police Station Construction', 12000000, 2021), (2, 'Fire Station Construction', 7000000, 2020), (3, 'Emergency Services Equipment', 500000, 2...
What was the maximum budget for any project related to public safety in the year 2021?
SELECT MAX(Budget) FROM PublicSafetyProjects WHERE Year = 2021 AND Name LIKE '%public safety%';
gretelai_synthetic_text_to_sql
CREATE TABLE PublicMeetings ( MeetingId INT, MeetingDate DATE, Department VARCHAR(255) ); INSERT INTO PublicMeetings (MeetingId, MeetingDate, Department) VALUES (1, '2021-01-01', 'Transportation'), (2, '2021-02-01', 'Education'), (3, '2021-03-01', 'Healthcare');
What is the total number of public meetings for each department?
SELECT Department, COUNT(*) OVER (PARTITION BY Department) as TotalMeetings FROM PublicMeetings;
gretelai_synthetic_text_to_sql
CREATE TABLE space_debris (id INT, orbital_altitude INT, debris_count INT); INSERT INTO space_debris (id, orbital_altitude, debris_count) VALUES (1, 300, 125); INSERT INTO space_debris (id, orbital_altitude, debris_count) VALUES (2, 800, 300);
What is the distribution of space debris by orbital altitude?
SELECT orbital_altitude, debris_count FROM space_debris;
gretelai_synthetic_text_to_sql
CREATE TABLE Construction_Labor_Costs (WorkerID INT, State VARCHAR(50), Year INT, HourlyRate FLOAT);
What is the maximum labor cost for construction workers in Texas in 2020?
SELECT MAX(HourlyRate) FROM Construction_Labor_Costs WHERE State = 'Texas' AND Year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE ocean_acidity (ocean VARCHAR(255), location VARCHAR(255), acidity FLOAT); INSERT INTO ocean_acidity (ocean, location, acidity) VALUES ('Arctic', 'Location 1', 7.8), ('Arctic', 'Location 2', 7.9), ('Atlantic', 'Location 3', 8.1), ('Pacific', 'Location 4', 8.2);
What is the maximum ocean acidity level in the Arctic Ocean?
SELECT MAX(acidity) FROM ocean_acidity WHERE ocean = 'Arctic';
gretelai_synthetic_text_to_sql