context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE intelligence_operations (id INT, operation TEXT, region TEXT, operation_date DATE); INSERT INTO intelligence_operations (id, operation, region, operation_date) VALUES (1, 'Operation Red Falcon', 'Asia-Pacific', '2021-07-08'), (2, 'Operation Iron Fist', 'Asia-Pacific', '2021-08-12'), (3, 'Operation Black Sw... | What is the count of intelligence operations conducted in the 'Asia-Pacific' region in the last month? | SELECT COUNT(*) FROM intelligence_operations WHERE region = 'Asia-Pacific' AND operation_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infra_proj (id INT, name VARCHAR(255), region VARCHAR(255), budget FLOAT, status VARCHAR(255)); INSERT INTO rural_infra_proj (id, name, region, budget, status) VALUES (1, 'Bridge Construction', 'Southeast Asia', 120000.00, 'completed'); | Calculate the average budget for completed rural infrastructure projects in Southeast Asia. | SELECT AVG(budget) FROM rural_infra_proj WHERE region = 'Southeast Asia' AND status = 'completed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE voyage (voyage_id INT, ship_id INT, voyage_date DATE, total_cargo_weight INT); INSERT INTO voyage VALUES (1, 1, '2022-02-10', 6000); INSERT INTO voyage VALUES (2, 2, '2022-03-25', 8000); CREATE TABLE ship_capacity (ship_id INT, max_cargo_capacity INT); INSERT INTO ship_capacity VALUES (1, 10000); INSERT IN... | Identify the 10 ships with the highest average cargo weight per voyage in 2022. | SELECT s.ship_name, AVG(v.total_cargo_weight) as avg_cargo_weight FROM ship s JOIN ship_capacity sc ON s.ship_id = sc.ship_id JOIN voyage v ON s.ship_id = v.ship_id WHERE v.voyage_date >= '2022-01-01' AND v.voyage_date < '2023-01-01' GROUP BY s.ship_name ORDER BY avg_cargo_weight DESC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE fields (id INT, field_name VARCHAR(255), area FLOAT, soil_type VARCHAR(255)); INSERT INTO fields (id, field_name, area, soil_type) VALUES (1, 'field1', 10.5, 'loamy'), (2, 'field2', 12.3, 'sandy'), (3, 'field3', 8.9, 'loamy'); | What is the total area of fields with soil type 'loamy'? | SELECT SUM(area) FROM fields WHERE soil_type = 'loamy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT, name VARCHAR(255), material VARCHAR(255), quantity INT, country VARCHAR(255)); INSERT INTO Suppliers (id, name, material, quantity, country) VALUES (1, 'Supplier A', 'Organic Cotton', 5000, 'India'); INSERT INTO Suppliers (id, name, material, quantity, country) VALUES (2, 'Supplier B', '... | Who are the top 3 suppliers of organic cotton in India? | SELECT name, SUM(quantity) FROM Suppliers WHERE country = 'India' AND material = 'Organic Cotton' GROUP BY name ORDER BY SUM(quantity) DESC LIMIT 3 | gretelai_synthetic_text_to_sql |
CREATE TABLE military_vehicles (id INT, manufacturer VARCHAR(50), year INT, quantity INT); INSERT INTO military_vehicles (id, manufacturer, year, quantity) VALUES (1, 'ABC Corp', 2015, 500); INSERT INTO military_vehicles (id, manufacturer, year, quantity) VALUES (2, 'XYZ Inc', 2018, 800); | Identify the total number of military vehicles manufactured in the last 5 years. | SELECT SUM(quantity) FROM military_vehicles WHERE year >= (SELECT YEAR(CURRENT_DATE) - 5); | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(20), green_certified BOOLEAN, co_owned BOOLEAN); INSERT INTO properties (id, city, green_certified, co_owned) VALUES (1, 'Berkeley', true, true), (2, 'Berkeley', false, false), (3, 'Berkeley', true, false); | What is the total number of properties in the city of Berkeley that are both green-certified and co-owned? | SELECT COUNT(*) FROM properties WHERE city = 'Berkeley' AND green_certified = true AND co_owned = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE FitnessMembers (member_id INT, name VARCHAR(50), age INT, gender VARCHAR(10)); INSERT INTO FitnessMembers (member_id, name, age, gender) VALUES (1, 'John Doe', 25, 'Male'); INSERT INTO FitnessMembers (member_id, name, age, gender) VALUES (2, 'Jane Smith', 30, 'Female'); INSERT INTO FitnessMembers (member_i... | What is the average age of male members from the FitnessMembers table? | SELECT AVG(age) FROM FitnessMembers WHERE gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT PRIMARY KEY, region VARCHAR(50), size INT); INSERT INTO customers (customer_id, region, size) VALUES (1, 'Asia-Pacific', 14), (2, 'North America', 12), (3, 'Europe', 16); | Delete the record of a customer from the North America region with size 12? | DELETE FROM customers WHERE region = 'North America' AND size = 12; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft (ID INT, Model VARCHAR(50), FlightHours INT); INSERT INTO Aircraft (ID, Model, FlightHours) VALUES (1, 'B747', 120000), (2, 'A320', 90000), (3, 'A380', 150000), (4, 'B777', 200000); | Insert new aircraft model data with specific flight hours | INSERT INTO Aircraft (ID, Model, FlightHours) VALUES (5, 'Dreamliner', 180000); | gretelai_synthetic_text_to_sql |
CREATE TABLE well_production (well_name TEXT, production_quantity INT); INSERT INTO well_production (well_name, production_quantity) VALUES ('Well A', 6000), ('Well B', 5000), ('Well C', 5500), ('Well D', 6500); | Which wells have a production quantity greater than 5500? | SELECT well_name FROM well_production WHERE production_quantity > 5500; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_costs (worker_id INT, city VARCHAR(20), sector VARCHAR(20), hourly_wage DECIMAL(5,2), hours_worked INT, record_date DATE); INSERT INTO labor_costs (worker_id, city, sector, hourly_wage, hours_worked, record_date) VALUES (3, 'Toronto', 'Electrical', 35.5, 180, '2020-01-01'); INSERT INTO labor_costs (w... | Calculate the sum of labor costs for 'Electrical' workers in 'Toronto' for the year 2020. | SELECT SUM(hourly_wage * hours_worked) FROM labor_costs WHERE city = 'Toronto' AND sector = 'Electrical' AND EXTRACT(YEAR FROM record_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet_management (id INT, name VARCHAR(50), type VARCHAR(50), capacity INT); | What is the total capacity of vessels in the 'fleet_management' table by type? | SELECT type, SUM(capacity) FROM fleet_management GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, name VARCHAR(50), species VARCHAR(50), population_size INT); INSERT INTO animals (id, name, species, population_size) VALUES (1, 'Lion', 'Felidae', 550); | What is the total number of animals (in the 'animals' table) that have a population size greater than 500? | SELECT COUNT(*) FROM animals WHERE population_size > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (violation_type VARCHAR(50), violations INT); | What is the total number of mental health parity violations for each type of violation? | SELECT violation_type, SUM(violations) FROM mental_health_parity GROUP BY violation_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), location VARCHAR(255), avg_depth FLOAT); CREATE TABLE atlantic_region (name VARCHAR(255), region_type VARCHAR(255)); INSERT INTO marine_protected_areas (name, location, avg_depth) VALUES ('MPA1', 'Pacific', 1234.56), ('MPA2', 'Atlantic', 2500.67); INSERT INTO... | Which marine protected areas in the Atlantic region have a higher average depth than 2000 meters? | SELECT mpa.name FROM marine_protected_areas mpa INNER JOIN atlantic_region ar ON mpa.name = ar.name WHERE mpa.avg_depth > 2000; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA space; USE space; CREATE TABLE agency (name VARCHAR(50), country VARCHAR(50), missions INT); INSERT INTO agency (name, country, missions) VALUES ('ESA', 'Europe', 120), ('NASA', 'USA', 230), ('ROSCOSMOS', 'Russia', 150); | What is the total number of space missions for each space agency? | SELECT s.name, SUM(s.missions) FROM space.agency s GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics; USE genetics; CREATE TABLE if not exists research_projects (id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO research_projects (id, name, country) VALUES (1, 'Project X', 'Africa'), (2, 'Project Y', 'USA'), (3, 'Project Z', 'Europe'); | How many genetic research projects were completed in Africa? | SELECT COUNT(*) FROM genetics.research_projects WHERE country = 'Africa' AND id IN (SELECT project_id FROM genetics.research_status WHERE status = 'Completed'); | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_id INT, state_name TEXT); INSERT INTO states VALUES (1, 'California'); | How many unique volunteers have participated in events organized by nonprofits in the education sector in the US? | SELECT COUNT(DISTINCT v.volunteer_id) as total_volunteers FROM volunteers v JOIN nonprofit_events ne ON v.city = ne.city JOIN events e ON ne.event_id = e.event_id JOIN nonprofits n ON ne.nonprofit_id = n.nonprofit_id JOIN states s ON v.city = s.state_name WHERE n.sector = 'education' AND s.state_name = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students_time (student_id INT, student_name VARCHAR(50), school_id INT, mental_health_score INT, measurement_date DATE); INSERT INTO students_time (student_id, student_name, school_id, mental_health_score, measurement_date) VALUES (1, 'John Doe', 1001, 75, '2022-01-01'), (2, 'Jane Smith', 1001, 82, '2022-0... | Which students have shown improvement in mental health scores compared to the last measurement? | SELECT student_id, school_id, mental_health_score, LAG(mental_health_score) OVER (PARTITION BY student_id ORDER BY measurement_date) as previous_mental_health_score, (mental_health_score - LAG(mental_health_score) OVER (PARTITION BY student_id ORDER BY measurement_date)) as mental_health_improvement FROM students_time; | gretelai_synthetic_text_to_sql |
CREATE TABLE Models (ModelId INT, Name TEXT, ExplainabilityScore FLOAT, Year INT, Country TEXT); INSERT INTO Models (ModelId, Name, ExplainabilityScore, Year, Country) VALUES (1, 'ModelX', 0.7, 2018, 'South Africa'), (2, 'ModelY', 0.8, 2020, 'Egypt'), (3, 'ModelZ', 0.9, 2019, 'Nigeria'); | Calculate the minimum explainability score of models in Africa after 2018 | SELECT MIN(ExplainabilityScore) FROM Models WHERE Country = 'Africa' AND Year > 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE crops (id INT PRIMARY KEY, name VARCHAR(255), production_metric_tons FLOAT, country VARCHAR(255)); INSERT INTO crops (id, name, production_metric_tons, country) VALUES (1, 'Quinoa', 85.2, 'Bolivia'), (2, 'Potatoes', 400.5, 'Bolivia'), (3, 'Corn', 200.0, 'Bolivia'); | Insert a new crop 'Rice' with production of 500 metric tons in Indonesia. | INSERT INTO crops (name, production_metric_tons, country) VALUES ('Rice', 500, 'Indonesia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name TEXT, country TEXT); INSERT INTO organizations VALUES (1, 'WFP', 'Kenya'); CREATE TABLE donations (id INT, organization_id INT, sector TEXT, amount INT, donation_date DATE); INSERT INTO donations VALUES (1, 1, 'food security', 5000, '2020-01-01'); | What's the total amount of donations received by each organization for the 'food security' sector in Kenya in 2020? | SELECT o.name, SUM(d.amount) FROM organizations o INNER JOIN donations d ON o.id = d.organization_id WHERE o.country = 'Kenya' AND d.sector = 'food security' AND d.donation_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY o.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (country VARCHAR(20), num_hospitals INT); INSERT INTO hospitals (country, num_hospitals) VALUES ('Russia', 3000), ('Japan', 2500); | How many hospitals are there in Russia and Japan? | SELECT SUM(num_hospitals) FROM hospitals WHERE country IN ('Russia', 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_turbines (id INT PRIMARY KEY, manufacturer VARCHAR(50), installed_year INT, capacity FLOAT); | Delete records in the 'wind_turbines' table where the 'manufacturer' is 'XYZ Windpower' and the 'installed_year' is before 2010 | DELETE FROM wind_turbines WHERE manufacturer = 'XYZ Windpower' AND installed_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_healthcare_workers (id INT, name VARCHAR(50), title VARCHAR(50), location VARCHAR(50)); | Add a new record for a healthcare worker in the 'rural_healthcare_workers' table | INSERT INTO rural_healthcare_workers (id, name, title, location) VALUES (1, 'Jane Doe', 'Physician Assistant', 'Eureka'); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO community_health_workers (id, name, region) VALUES (1, 'Community Health Worker A', 'Region A'); INSERT INTO community_health_workers (id, name, region) VALUES (2, 'Community Health Worker B', 'Region B'); | What is the count of community health workers by region in the public health database? | SELECT region, COUNT(*) FROM community_health_workers GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, year INT, country VARCHAR(255), equipment_type VARCHAR(255), revenue FLOAT); | Update the sales record of naval vessels to the US | UPDATE sales SET revenue = 15000000 WHERE country = 'United States' AND equipment_type = 'Naval Vessels'; | gretelai_synthetic_text_to_sql |
CREATE TABLE retail_sales (id INT, garment_type VARCHAR(50), garment_material VARCHAR(50), price DECIMAL(5, 2), country VARCHAR(50)); INSERT INTO retail_sales (id, garment_type, garment_material, price, country) VALUES (1, 'T-Shirt', 'Organic Cotton', 25.99, 'USA'); INSERT INTO retail_sales (id, garment_type, garment_m... | What is the average retail price of men's organic cotton t-shirts sold in the USA? | SELECT AVG(price) FROM retail_sales WHERE garment_type = 'T-Shirt' AND garment_material = 'Organic Cotton' AND country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name VARCHAR(255), material VARCHAR(255), price DECIMAL(5,2)); INSERT INTO products (id, name, material, price) VALUES (1, 'T-Shirt', 'Recycled Polyester', 25.00), (2, 'Hoodie', 'Recycled Polyester', 75.00); | What is the maximum price of recycled polyester products? | SELECT MAX(price) FROM products WHERE material = 'Recycled Polyester'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition (id INT, name TEXT, ticket_price INT); CREATE TABLE Ticket_Sales (exhibition_id INT, visitor_count INT); INSERT INTO Exhibition (id, name, ticket_price) VALUES (1, 'Exhibition1', 10), (2, 'Exhibition2', 15); INSERT INTO Ticket_Sales (exhibition_id, visitor_count) VALUES (1, 50), (2, 75); | Find the total revenue from ticket sales for each exhibition | SELECT Exhibition.name, SUM(Exhibition.ticket_price * Ticket_Sales.visitor_count) FROM Exhibition JOIN Ticket_Sales ON Exhibition.id = Ticket_Sales.exhibition_id GROUP BY Exhibition.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas_indian (area_name VARCHAR(255), depth FLOAT); INSERT INTO marine_protected_areas_indian (area_name, depth) VALUES ('Gulf of Kutch', 50.0), ('Andaman and Nicobar Islands', 3000.0), ('Lakshadweep Islands', 200.0); | What is the maximum and minimum depth of all marine protected areas in the Indian Ocean? | SELECT MIN(depth), MAX(depth) FROM marine_protected_areas_indian; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (id INT, country VARCHAR(50), year INT, contract_count INT); INSERT INTO defense_contracts (id, country, year, contract_count) VALUES (1, 'UK', 2021, 350); INSERT INTO defense_contracts (id, country, year, contract_count) VALUES (2, 'UK', 2021, 400); INSERT INTO defense_contracts (id, cou... | How many defense contracts were signed in the UK in 2021? | SELECT SUM(contract_count) FROM defense_contracts WHERE country = 'UK' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO customers (customer_id, name, region) VALUES (1, 'John Doe', 'South Asia'); INSERT INTO customers (customer_id, name, region) VALUES (2, 'Jane Smith', 'North America'); CREATE TABLE transactions (transaction_id INT, customer_id ... | Find the average transaction value for the 'South Asia' region. | SELECT AVG(transaction_value) FROM transactions JOIN customers ON transactions.customer_id = customers.customer_id WHERE customers.region = 'South Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE nba_games (game_id INT, home_team VARCHAR(50), away_team VARCHAR(50), home_score INT, away_score INT); INSERT INTO nba_games (game_id, home_team, away_team, home_score, away_score) VALUES (1, 'Golden State Warriors', 'Los Angeles Lakers', 115, 105); | What is the average score difference between the home team and the away team in the NBA? | SELECT AVG(home_score - away_score) AS avg_score_difference FROM nba_games; | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccine_records (patient_id INT, vaccine_name VARCHAR(20), age INT, state VARCHAR(20)); INSERT INTO vaccine_records VALUES (1, 'Moderna', 35, 'Texas'), (2, 'Moderna', 42, 'Texas'), (3, 'Moderna', 50, 'Florida'); INSERT INTO vaccine_records VALUES (4, 'Moderna', 25, 'New York'), (5, 'Moderna', 30, 'New York... | How many patients received the Moderna vaccine in each state? | SELECT state, COUNT(*) FROM vaccine_records WHERE vaccine_name = 'Moderna' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLOAT); INSERT INTO wind_farms (id, name, region, capacity, efficiency) VALUES (1, 'Windfarm A', 'North', 130.6, 0.29); CREATE TABLE solar_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLO... | How many renewable energy farms (wind and solar) are there in total? | SELECT COUNT(*) AS total_farms FROM wind_farms UNION SELECT COUNT(*) AS total_farms FROM solar_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, name VARCHAR(100), location VARCHAR(50), start_date DATE); INSERT INTO Exhibitions (id, name, location, start_date) VALUES (1, 'Exhibition 1', 'Germany', '2010-01-01'), (2, 'Exhibition 2', 'France', '2009-01-01'), (3, 'Exhibition 3', 'Germany', '2011-01-01'); | Count the number of exhibitions held in Germany since 2010. | SELECT COUNT(*) FROM Exhibitions WHERE location = 'Germany' AND start_date >= '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_data(id INT, vessel_name VARCHAR(50), destination VARCHAR(50), cargo_weight DECIMAL(5,2)); CREATE TABLE vessels(id INT, name VARCHAR(50), country VARCHAR(50), average_speed DECIMAL(5,2)); INSERT INTO vessels(id, name, country, average_speed) VALUES (1, 'Vessel C', 'Japan', 18.2), (2, 'Vessel D', 'Jap... | What is the total cargo weight transported by vessels from Japan to Port B? | SELECT SUM(cargo_weight) FROM cargo_data JOIN vessels ON cargo_data.vessel_name = vessels.name WHERE vessels.country = 'Japan' AND destination = 'Port B'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (code INT, name VARCHAR(50), type VARCHAR(50), manufacturer VARCHAR(50), last_updated TIMESTAMP); | What are the names of the military technologies with the highest and lowest code values in the 'military_tech' table? | SELECT name, code FROM military_tech WHERE code = (SELECT MAX(code) FROM military_tech) OR code = (SELECT MIN(code) FROM military_tech); | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), job_title VARCHAR(50), salary INT); | Insert a new record into the "employees" table with the following details: first name "Alex", last name "Smith", job_title "Engineer", and salary 50000 | INSERT INTO employees (first_name, last_name, job_title, salary) VALUES ('Alex', 'Smith', 'Engineer', 50000); | gretelai_synthetic_text_to_sql |
CREATE TABLE NonGMOIngredients (id INT, name VARCHAR(50), quantity INT); INSERT INTO NonGMOIngredients (id, name, quantity) VALUES (1, 'Spinach', 500), (2, 'Carrots', 700), (3, 'Garlic', 300); | Find the total quantity of non-GMO ingredients in our inventory. | SELECT SUM(quantity) FROM NonGMOIngredients; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates_seoul (city VARCHAR(50), recycling_rate DECIMAL(5,2), date DATE); INSERT INTO recycling_rates_seoul (city, recycling_rate, date) VALUES ('Seoul', 0.70, '2022-01-01'), ('Seoul', 0.71, '2022-02-01'), ('Seoul', 0.72, '2022-03-01'), ('Seoul', 0.73, '2022-04-01'), ('Seoul', 0.74, '2022-05-01'), ... | What is the average recycling rate in Seoul for the last 6 months? | SELECT AVG(recycling_rate) FROM recycling_rates_seoul WHERE city = 'Seoul' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE game_scores (user_id INT, game_name VARCHAR(10), score INT); INSERT INTO game_scores (user_id, game_name, score) VALUES (1, 'A', 50), (2, 'B', 100), (3, 'D', 150), (4, 'C', 200), (4, 'C', 250), (6, 'D', 300), (6, 'A', 350); | Calculate the average score of user 6 for all games played | SELECT AVG(score) FROM game_scores WHERE user_id = 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipment (id INT, source_country VARCHAR(255), destination_country VARCHAR(255), items_quantity INT, shipment_date DATE); INSERT INTO Shipment (id, source_country, destination_country, items_quantity, shipment_date) VALUES (1, 'Canada', 'India', 100, '2021-01-01'), (2, 'Canada', 'India', 200, '2021-02-01')... | What are the total items shipped between Canada and India, excluding items shipped in January 2021? | SELECT SUM(items_quantity) FROM Shipment WHERE (source_country = 'Canada' AND destination_country = 'India') OR (source_country = 'India' AND destination_country = 'Canada') AND shipment_date NOT BETWEEN '2021-01-01' AND '2021-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment_maintenance (id INT PRIMARY KEY, equipment_name VARCHAR(50), last_maintenance_date DATE, next_maintenance_date DATE, maintenance_type VARCHAR(50), maintenance_status VARCHAR(50)); | Delete military equipment maintenance records older than 5 years | DELETE FROM military_equipment_maintenance WHERE last_maintenance_date < (CURRENT_DATE - INTERVAL '5 years'); | gretelai_synthetic_text_to_sql |
CREATE TABLE inclusive_housing (project_id INT, property_id INT, price FLOAT, city_id INT, PRIMARY KEY (project_id)); INSERT INTO inclusive_housing (project_id, property_id, price, city_id) VALUES (1, 1, 500000.0, 1), (2, 2, 600000.0, 1), (3, 3, 400000.0, 1); CREATE TABLE cities (city_id INT, city_name TEXT, PRIMARY KE... | What is the minimum and maximum property price for inclusive housing projects in the city of "Boston"? | SELECT MIN(price), MAX(price) FROM inclusive_housing JOIN cities ON inclusive_housing.city_id = cities.city_id WHERE cities.city_name = 'Boston'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, region VARCHAR(20)); CREATE TABLE transactions (id INT, customer_id INT, transaction_date DATE); INSERT INTO customers (id, region) VALUES (1, 'Asia-Pacific'); INSERT INTO transactions (id, customer_id, transaction_date) VALUES (1, 1, '2022-05-10'); | Count the number of customers from the 'Asia-Pacific' region who have made a transaction in the last month. | SELECT COUNT(DISTINCT customers.id) FROM customers JOIN transactions ON customers.id = transactions.customer_id WHERE customers.region = 'Asia-Pacific' AND transactions.transaction_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE maritime_safety (vessel_id INT, name VARCHAR(255), type VARCHAR(255)); INSERT INTO maritime_safety (vessel_id, name, type) VALUES (1, 'Queen Mary 2', 'Passenger'), (2, 'Seabed Worker', 'Research'), (3, 'Tanker', 'Cargo'); | What is the total number of vessels in the maritime safety database? | SELECT COUNT(*) FROM maritime_safety; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, name VARCHAR(50), location VARCHAR(50), production FLOAT); INSERT INTO wells (well_id, name, location, production) VALUES (1, 'A1', 'North Sea', 10000), (2, 'A2', 'North Sea', 11000), (3, 'A3', 'North Sea', 12000); | What is the production of wells in the North Sea with a well_id greater than 1? | SELECT production FROM wells WHERE location = 'North Sea' AND well_id > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, age INT, country VARCHAR(50), vrgames BOOLEAN); INSERT INTO players (id, age, country, vrgames) VALUES (1, 25, 'Canada', true), (2, 30, 'USA', false); | What is the average age of players who have played Virtual Reality games? | SELECT AVG(age) FROM players WHERE vrgames = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_activity (id INT, user_id INT, country VARCHAR(255), activity_date DATE); | Find the number of unique users who have accessed the network from each country in the 'user_activity' table. | SELECT country, COUNT(DISTINCT user_id) as unique_users FROM user_activity GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (building_id INT, num_units INT, is_green_certified BOOLEAN); INSERT INTO green_buildings (building_id, num_units, is_green_certified) VALUES (1, 20, true), (2, 30, false), (3, 40, true), (4, 50, true), (5, 60, false); | What is the total number of units in green-certified buildings? | SELECT SUM(num_units) FROM green_buildings WHERE is_green_certified = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft_Mission_Timeline (id INT, spacecraft_id INT, mission_name VARCHAR(100), mission_date DATE, launch_order INT); INSERT INTO Spacecraft_Mission_Timeline (id, spacecraft_id, mission_name, mission_date, launch_order) VALUES (1, 1, 'Apollo 11', '1969-07-16', 1); | Determine the difference in days between the launch dates of the first and last missions for each spacecraft. | SELECT spacecraft_id, DATEDIFF(MAX(mission_date), MIN(mission_date)) as mission_duration_days FROM Spacecraft_Mission_Timeline GROUP BY spacecraft_id | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends (year INT, element VARCHAR(10), price FLOAT); INSERT INTO market_trends VALUES (2015, 'Neodymium', 50), (2016, 'Neodymium', 55), (2015, 'Terbium', 200), (2016, 'Terbium', 250); | Compare the market trends of Neodymium and Terbium | SELECT element, price FROM market_trends WHERE year = 2015 UNION SELECT element, price FROM market_trends WHERE year = 2016 ORDER BY element, price; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (product_id INT, store_id INT, in_stock INT, ethical_product BOOLEAN, product_price DECIMAL); INSERT INTO inventory (product_id, store_id, in_stock, ethical_product, product_price) VALUES (1, 1, 50, true, 15.99), (2, 1, 75, false, 25.49), (3, 2, 30, true, 12.99), (4, 2, 80, false, 18.99), (5, 3, ... | What is the average price of ethical products in each country? | SELECT i.country, AVG(i.product_price) as avg_price FROM (SELECT store_id, country, product_price FROM inventory i JOIN stores s ON i.store_id = s.store_id WHERE ethical_product = true) i GROUP BY i.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, region VARCHAR(20), water_usage FLOAT); INSERT INTO customers (customer_id, region, water_usage) VALUES (1, 'Sacramento', 5000), (2, 'San_Diego', 4000), (3, 'Sacramento', 7000), (4, 'Los_Angeles', 6000), (5, 'San_Francisco', 3000), (6, 'Los_Angeles', 8000), (7, 'Sacramento', 900... | What is the average water usage for all customers in the top 3 regions with the highest water usage? | SELECT AVG(customers.water_usage) FROM customers JOIN (SELECT region FROM regions JOIN customers ON regions.region = customers.region GROUP BY region ORDER BY SUM(customers.water_usage) DESC LIMIT 3) AS top_regions ON customers.region = top_regions.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE employee (employee_id INT, name VARCHAR(50), position VARCHAR(20)); | Delete records in the 'employee' table where the 'position' is 'field worker' | DELETE FROM employee WHERE position = 'field worker'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, mine_id INT, year INT, element TEXT, production_quantity INT); INSERT INTO production (id, mine_id, year, element, production_quantity) VALUES (1, 1, 2020, 'Dysprosium', 250), (2, 2, 2020, 'Dysprosium', 300), (3, 3, 2020, 'Dysprosium', 350), (4, 1, 2020, 'Terbium', 150), (5, 2, 2020, 'T... | List the top 3 producers of Dysprosium by total production quantity for the year 2020. | SELECT mine_id, SUM(production_quantity) FROM production WHERE year = 2020 AND element = 'Dysprosium' GROUP BY mine_id ORDER BY SUM(production_quantity) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE heart_rate_times (user_id INT, heart_rate INT, measurement_time TIME); INSERT INTO heart_rate_times (user_id, heart_rate, measurement_time) VALUES (1, 80, '13:00:00'), (2, 85, '14:00:00'), (3, 90, '15:00:00'), (4, 95, '16:00:00'); | What is the maximum heart rate recorded for users in the afternoon? | SELECT MAX(heart_rate) FROM heart_rate_times WHERE EXTRACT(HOUR FROM measurement_time) BETWEEN 12 AND 17; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, Department varchar(20), Salary decimal(10,2)); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (1, 'IT', 75000.00), (2, 'IT', 80000.00), (3, 'Marketing', 90000.00), (4, 'Sales', 85000.00), (5, 'Sales', 95000.00); | What is the maximum salary for employees in the largest department? | SELECT MAX(Salary) FROM Employees WHERE Department = (SELECT Department FROM Employees GROUP BY Department ORDER BY COUNT(*) DESC LIMIT 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (post_id INT, post_country VARCHAR(255), post_topic VARCHAR(255), post_date DATE); CREATE TABLE user_interactions (interaction_id INT, user_id INT, post_id INT, interaction_type VARCHAR(10)); INSERT INTO posts (post_id, post_country, post_topic, post_date) VALUES (1, 'USA', 'vegan food', '2022-07-01'... | How many users from the USA and Japan liked or commented on posts about vegan food in the past month? | SELECT SUM(interaction_type = 'like') + SUM(interaction_type = 'comment') AS total_interactions FROM user_interactions WHERE post_id IN (SELECT post_id FROM posts WHERE post_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE AND post_country IN ('USA', 'Japan') AND post_topic = 'vegan food'); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, sector VARCHAR(255), ESG_score FLOAT); INSERT INTO companies (id, sector, ESG_score) VALUES (1, 'energy', 55.3); | What is the average ESG score of companies in the energy sector? | SELECT AVG(ESG_score) FROM companies WHERE sector = 'energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, name VARCHAR(255), type VARCHAR(255), cost INT); INSERT INTO projects (id, name, type, cost) VALUES (789, 'Seawall123', 'Resilience', 2000000), (101, 'RoadRepair456', 'Infrastructure', 1000000); CREATE TABLE regions (id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO regions (i... | Show the total cost of all resilience projects in the 'California' region | SELECT SUM(projects.cost) FROM projects INNER JOIN regions ON TRUE WHERE projects.type = 'Resilience' AND regions.name = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, founding_year INT, founder_gender TEXT, num_employees INT, num_funding_rounds INT); | Calculate the average number of employees for companies founded by non-binary individuals in the renewable energy sector with at least one funding round. | SELECT AVG(num_employees) FROM company WHERE industry = 'Renewable Energy' AND founder_gender = 'Non-binary' AND num_funding_rounds >= 1 | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (operation_id INT PRIMARY KEY, operation_name VARCHAR(50), country VARCHAR(50), operation_year INT); INSERT INTO peacekeeping_operations (operation_id, operation_name, country, operation_year) VALUES (1, 'Operation Peaceful Sky', 'Cyprus', 2019), (2, 'Operation Ocean Shield', 'Somal... | Update the "peacekeeping_operations" table, setting the "operation_name" to 'Operation Blue Helmet' for records where the "operation_year" is 2020 | UPDATE peacekeeping_operations SET operation_name = 'Operation Blue Helmet' WHERE operation_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (id INT, name VARCHAR(255)); | Add a new team 'Los Angeles Lakers' with id 3 | INSERT INTO teams (id, name) VALUES (3, 'Los Angeles Lakers'); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (campaign_name TEXT, start_date DATE, end_date DATE); INSERT INTO climate_communication (campaign_name, start_date, end_date) VALUES ('Climate Action', '2021-01-01', '2021-12-31'), ('Green Tomorrow', '2022-01-01', '2022-12-31'); | Update the name of the communication campaign in the 'climate_communication' table to 'Green Horizons' if its name is 'Green Tomorrow'. | UPDATE climate_communication SET campaign_name = 'Green Horizons' WHERE campaign_name = 'Green Tomorrow'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ZipCodes (ZipCodeID INT, Zip VARCHAR(10));CREATE TABLE Buildings (BuildingID INT, ZipCodeID INT, GreenCertified BOOLEAN, SquareFootage INT); | What is the total square footage of green-certified buildings in each zip code? | SELECT Z.Zip, SUM(B.SquareFootage) as TotalSqFt FROM Buildings B JOIN ZipCodes Z ON B.ZipCodeID = Z.ZipCodeID WHERE B.GreenCertified = TRUE GROUP BY Z.Zip; | gretelai_synthetic_text_to_sql |
CREATE TABLE TraditionalMusicCountry (id INT, piece VARCHAR(255), country VARCHAR(255), duration INT); INSERT INTO TraditionalMusicCountry (id, piece, country, duration) VALUES (1, 'Inuit Throat Singing', 'Canada', 120), (2, 'Kecak', 'Indonesia', 180), (3, 'Danzas Folklóricas', 'Mexico', 150); | How many traditional music pieces were created in each country and their average duration? | SELECT country, piece, COUNT(*) as total_pieces, AVG(duration) as avg_duration FROM TraditionalMusicCountry GROUP BY country, piece; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (id INT, name VARCHAR(50), state VARCHAR(50), offset_quantity INT, start_year INT); | What is the total carbon offset achieved by all carbon offset programs in the state of Oregon since 2015? | SELECT SUM(offset_quantity) FROM carbon_offset_programs WHERE state = 'Oregon' AND start_year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE dapps (id INT, name VARCHAR(50), country VARCHAR(50), regulatory_status VARCHAR(50)); INSERT INTO dapps VALUES (1, 'App1', 'Germany', 'Regulated'); INSERT INTO dapps VALUES (2, 'App2', 'Germany', 'Unregulated'); INSERT INTO dapps VALUES (3, 'App3', 'Germany', 'Under Review'); | What is the regulatory status of decentralized applications in Germany? | SELECT country, regulatory_status FROM dapps WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), amount INT, year INT); INSERT INTO production (country, amount, year) VALUES ('Malaysia', 7000, 2021); | Update the production amount for Malaysia in 2021 to 7500 tons. | UPDATE production SET amount = 7500 WHERE country = 'Malaysia' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence_cyber (metric_id INT, agency VARCHAR(255), category VARCHAR(255));INSERT INTO threat_intelligence_cyber (metric_id, agency, category) VALUES (1, 'NSA', 'Cyber Attacks'), (2, 'CIA', 'Foreign Spy Activity'), (3, 'NSA', 'Cyber Attacks'), (4, 'FBI', 'Domestic Terrorism'); | Report the number of threat intelligence metrics collected by each agency for the category 'Cyber Attacks'. | SELECT agency, COUNT(*) as cyber_attack_metrics FROM threat_intelligence_cyber WHERE category = 'Cyber Attacks' GROUP BY agency; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT, name TEXT, continent TEXT, life_expectancy FLOAT); INSERT INTO countries (id, name, continent, life_expectancy) VALUES (1, 'Country A', 'Europe', 80.5), (2, 'Country B', 'Asia', 72.3), (3, 'Country C', 'Europe', 78.7), (4, 'Country D', 'Africa', 65.1); | What is the average life expectancy for each country in Europe, along with the number of countries? | SELECT continent, AVG(life_expectancy) as avg_life_expectancy, COUNT(name) as num_countries FROM countries WHERE continent = 'Europe' GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, tour_name TEXT, location TEXT, start_date DATETIME, updated_at DATETIME); INSERT INTO virtual_tours (tour_id, tour_name, location, start_date, updated_at) VALUES (1, 'Louvre VR Experience', 'Paris', '2023-06-01 10:00:00', NOW()), (2, 'Gondola Tour in Venice', 'Venice', '2023-07-... | Add new virtual tours with their respective starting dates and updated timestamps. | INSERT INTO virtual_tours (tour_id, tour_name, location, start_date, updated_at) VALUES (4, 'Machu Picchu Virtual Tour', 'Peru', '2023-09-01 13:00:00', NOW()), (5, 'Petra Virtual Experience', 'Jordan', '2023-10-01 14:00:00', NOW()); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, price DECIMAL, labor_practices VARCHAR(20)); INSERT INTO products (product_id, price, labor_practices) VALUES (1, 15.99, 'ethical'), (2, 25.49, 'unethical'), (3, 12.99, 'ethical'); | What is the average product price for items produced using ethical labor practices? | SELECT AVG(price) FROM products WHERE labor_practices = 'ethical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_data (location TEXT, pollution_level INTEGER); INSERT INTO pollution_data (location, pollution_level) VALUES ('Mariana Trench', 3); INSERT INTO pollution_data (location, pollution_level) VALUES ('Atlantic Ocean', 2); | Delete all records of pollution data in the Mariana Trench. | DELETE FROM pollution_data WHERE location = 'Mariana Trench'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(255), category VARCHAR(255), price DECIMAL(10,2), is_vegan BOOLEAN); INSERT INTO menus (menu_id, menu_name, category, price, is_vegan) VALUES (1, 'Quinoa Salad', 'Lunch', 12.99, FALSE), (2, 'Vegan Scramble', 'Breakfast', 7.99, TRUE); | What is the average price of vegan menu items in the breakfast category? | SELECT AVG(price) FROM menus WHERE category = 'Breakfast' AND is_vegan = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (permit_id INT, building_type VARCHAR(50), state VARCHAR(50), issue_date DATE); INSERT INTO building_permits (permit_id, building_type, state, issue_date) VALUES (1, 'Commercial', 'New York', '2022-01-01'); INSERT INTO building_permits (permit_id, building_type, state, issue_date) VALUES (... | What is the total number of building permits issued for residential buildings in the state of New York in 2022? | SELECT COUNT(*) FROM building_permits WHERE building_type = 'Residential' AND state = 'New York' AND issue_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name TEXT, location TEXT, num_beds INT, country TEXT); INSERT INTO hospitals (id, name, location, num_beds, country) VALUES (1, 'Hospital A', 'Rural Mexico', 50, 'Mexico'), (2, 'Hospital B', 'Rural Guatemala', 75, 'Guatemala'); CREATE TABLE clinics (id INT, name TEXT, location TEXT, num_... | What is the average bed count for rural hospitals and clinics in each country, and the total number of rural healthcare facilities in each? | SELECT c.country, AVG(h.num_beds) AS avg_bed_count, AVG(c.num_beds) AS avg_clinic_bed_count, COUNT(h.id) + COUNT(c.id) AS total_facilities FROM hospitals h INNER JOIN clinics c ON h.country = c.country GROUP BY c.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), certification VARCHAR(255)); | List all suppliers that have a fair labor certification. | SELECT name FROM suppliers WHERE certification = 'Fair Labor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycled_materials (id INT, region VARCHAR(255), material VARCHAR(255), price DECIMAL(10,2)); INSERT INTO recycled_materials VALUES (1, 'North America', 'Recycled Plastic', 1.50), (2, 'North America', 'Recycled Paper', 2.00), (3, 'Europe', 'Recycled Textiles', 3.00), (4, 'Europe', 'Recycled Plastic', 1.80)... | What is the average price of recycled materials used in production per region? | SELECT region, AVG(price) FROM recycled_materials GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE OceanFloor (feature_name VARCHAR(50), feature_type VARCHAR(50), depth_m INT, PRIMARY KEY(feature_name)); INSERT INTO OceanFloor (feature_name, feature_type, depth_m) VALUES ('Pacific Canyon 1', 'Underwater Canyon', 7500), ('Atlantic Ridge', 'Mid-Ocean Ridge', 4000); | What is the maximum depth recorded for underwater canyons in the Pacific Ocean? | SELECT MAX(OceanFloor.depth_m) FROM OceanFloor WHERE OceanFloor.feature_type = 'Underwater Canyon' AND OceanFloor.region = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (MenuID int, ItemName varchar(50), Category varchar(50)); | Insert a new sustainable menu item "Impossible Burger" in the "Sustainable" category with a MenuID of 2003. | INSERT INTO Menu (MenuID, ItemName, Category) VALUES (2003, 'Impossible Burger', 'Sustainable'); | gretelai_synthetic_text_to_sql |
CREATE TABLE education_resources (id INT, resource TEXT, quantity INT, country TEXT, quarter INT, year INT); INSERT INTO education_resources (id, resource, quantity, country, quarter, year) VALUES (1, 'Textbooks', 500, 'South Sudan', 4, 2021), (2, 'School Supplies', 300, 'South Sudan', 4, 2021), (3, 'Laptops', 200, 'So... | Which education resources were distributed in South Sudan in Q4 2021? | SELECT DISTINCT resource FROM education_resources WHERE country = 'South Sudan' AND quarter = 4 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (id INT, name TEXT, location TEXT, Gadolinium_monthly_production FLOAT, timestamp TIMESTAMP); INSERT INTO mine (id, name, location, Gadolinium_monthly_production, timestamp) VALUES (1, 'Australian Mine', 'Australia', 120.5, '2019-03-01'), (2, 'Californian Mine', 'USA', 150.3, '2019-03-01'), (3, 'Brazi... | Delete the production data for Gadolinium from the Australian mine in 2019. | DELETE FROM mine WHERE name = 'Australian Mine' AND EXTRACT(YEAR FROM timestamp) = 2019 AND EXISTS (SELECT * FROM mine WHERE name = 'Australian Mine' AND Gadolinium_monthly_production IS NOT NULL AND EXTRACT(YEAR FROM timestamp) = 2019); | gretelai_synthetic_text_to_sql |
CREATE TABLE team_performances_table (team_id INT, team_name VARCHAR(50), sport VARCHAR(20), wins INT, losses INT); INSERT INTO team_performances_table (team_id, team_name, sport, wins, losses) VALUES (1, 'Blue Lions', 'Basketball', 25, 15); INSERT INTO team_performances_table (team_id, team_name, sport, wins, losses) ... | List all unique sports in 'team_performances_table' | SELECT DISTINCT sport FROM team_performances_table; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmployeeWorkHours(id INT, employee_id INT, work_date DATE, role VARCHAR(50), department VARCHAR(50), work_hours INT); | What is the maximum number of work hours, grouped by the employee's role, who were working simultaneously in the 'Environmental Compliance' department in the past 2 months? | SELECT role, MAX(COUNT(*)) as max_employees FROM EmployeeWorkHours WHERE department = 'Environmental Compliance' AND work_date >= DATE(NOW()) - INTERVAL 2 MONTH GROUP BY role; | gretelai_synthetic_text_to_sql |
CREATE TABLE yttrium_suppliers (country VARCHAR(255), has_certification BOOLEAN); INSERT INTO yttrium_suppliers (country, has_certification) VALUES ('Germany', true), ('France', false), ('UK', true); | How many suppliers in Europe have a certification for Yttrium? | SELECT COUNT(*) FROM yttrium_suppliers WHERE country IN ('Germany', 'UK') AND has_certification = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE system_types (id INT, system_type TEXT, severity TEXT); INSERT INTO system_types (id, system_type, severity) VALUES (1, 'Type1', 'High'), (2, 'Type2', 'Medium'), (3, 'Type3', 'Low'); CREATE TABLE system_vulnerabilities (system_id INT, system_type TEXT, vulnerability_id INT, severity TEXT); INSERT INTO syst... | What is the maximum severity of vulnerabilities for each system type? | SELECT system_type, MAX(severity) as max_severity FROM system_vulnerabilities JOIN system_types ON system_types.system_type = system_vulnerabilities.system_type GROUP BY system_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE divide_init (name VARCHAR(50), location VARCHAR(50), initiatives INT); INSERT INTO divide_init (name, location, initiatives) VALUES ('Connect South', 'South America', 10), ('Digital Inclusion', 'South America', 15); | What is the total number of digital divide initiatives in South America? | SELECT SUM(initiatives) FROM divide_init WHERE location = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Player (PlayerID INT, Name VARCHAR(50), Country VARCHAR(50), Score INT); | What is the minimum score of players from Oceania? | SELECT MIN(Score) FROM Player WHERE Country IN ('Australia', 'New Zealand'); | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_visits (id INT, patient_id INT, visit_date DATE, rural_mt BOOLEAN); INSERT INTO medical_visits (id, patient_id, visit_date, rural_mt) VALUES (1, 1, '2019-06-01', true), (2, 1, '2019-07-01', true); | Identify patients who had a decrease in medical visits in the last 6 months compared to the previous 6 months in rural Montana. | SELECT patient_id, COUNT(*) as last_6_months, LAG(COUNT(*)) OVER (PARTITION BY patient_id ORDER BY visit_date) as previous_6_months FROM medical_visits WHERE rural_mt = true GROUP BY patient_id, visit_date HAVING last_6_months < previous_6_months; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, building_name VARCHAR(50), city VARCHAR(50), certification VARCHAR(50)); INSERT INTO green_buildings (id, building_name, city, certification) VALUES (1, 'Empire State Building', 'New York', 'Gold'), (2, 'Sears Tower', 'Chicago', 'Silver'); | Delete green building records with a certification level lower than 'gold' from the 'green_buildings' table. | DELETE FROM green_buildings WHERE certification NOT IN ('Gold', 'Platinum'); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_mitigation_projects (project_id INT, sector TEXT, region TEXT, amount FLOAT); INSERT INTO climate_finance_mitigation_projects (project_id, sector, region, amount) VALUES (1, 'Climate Mitigation', 'Europe', 2000000); INSERT INTO climate_finance_mitigation_projects (project_id, sector, region... | Find the average climate finance investment in mitigation projects in Europe. | SELECT AVG(amount) FROM climate_finance_mitigation_projects WHERE sector = 'Climate Mitigation' AND region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_viewership (id INT, title VARCHAR(255), season INT, viewership INT); INSERT INTO tv_viewership (id, title, season, viewership) VALUES (1, 'Show1', 1, 1000000), (2, 'Show2', 1, 1200000), (3, 'Show1', 2, 1100000); | Which TV shows have the highest viewership by season? | SELECT title, season, MAX(viewership) as max_viewership FROM tv_viewership GROUP BY title; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (id INT PRIMARY KEY, year INT, month INT, temperature DECIMAL(5,2)); INSERT INTO temperature_data (id, year, month, temperature) VALUES (1, 2015, 1, -20.5), (2, 2015, 2, -25.3), (3, 2015, 3, -18.7), (4, 2015, 4, -12.2), (5, 2015, 5, 0.1), (6, 2015, 6, 5.6), (7, 2015, 7, 10.2), (8, 2015, 8,... | Calculate the maximum temperature for each year in the 'temperature_data' table | SELECT year, MAX(temperature) FROM temperature_data GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS events (id INT, name VARCHAR(255), type VARCHAR(255), year INT, visitors INT); INSERT INTO events (id, name, type, year, visitors) VALUES (1, 'EventA', 'Jazz', 2021, 300), (2, 'EventB', 'Jazz', 2021, 450), (3, 'EventC', 'Jazz', 2021, 500); | What is the minimum number of visitors for jazz events in 2021? | SELECT MIN(visitors) FROM events WHERE type = 'Jazz' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (Farmer_ID INT, Farmer_Name TEXT, Location TEXT, Sustainable_Practices_Adopted INT, Year INT); INSERT INTO Farmers (Farmer_ID, Farmer_Name, Location, Sustainable_Practices_Adopted, Year) VALUES (1, 'Jean-Claude', 'Haiti', 1, 2020); | How many farmers in Haiti adopted sustainable agricultural practices in 2020? | SELECT SUM(Sustainable_Practices_Adopted) FROM Farmers WHERE Year = 2020 AND Location = 'Haiti'; | gretelai_synthetic_text_to_sql |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.