context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE warehouse (id INT PRIMARY KEY, name VARCHAR(255), num_pallets INT); INSERT INTO warehouse (id, name, num_pallets) VALUES (1, 'ABC'), (2, 'XYZ'), (3, 'GHI'); | Get the number of pallets for the 'XYZ' warehouse | SELECT num_pallets FROM warehouse WHERE name = 'XYZ'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Specialization VARCHAR(255), State VARCHAR(255)); INSERT INTO Attorneys (AttorneyID, Specialization, State) VALUES (1, 'Criminal Law', 'California'); INSERT INTO Attorneys (AttorneyID, Specialization, State) VALUES (2, 'Civil Law', 'California'); INSERT INTO Attorneys (AttorneyID... | Count the number of cases lost by attorneys specialized in criminal law in California. | SELECT COUNT(*) FROM Cases JOIN Attorneys ON Cases.AttorneyID = Attorneys.AttorneyID WHERE Attorneys.Specialization = 'Criminal Law' AND Attorneys.State = 'California' AND Outcome = 'Lost'; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget_moscow (region VARCHAR(20), budget DECIMAL(10, 2)); INSERT INTO budget_moscow VALUES ('Moscow', 500000.00); CREATE TABLE population (region VARCHAR(20), citizens INT); INSERT INTO population VALUES ('Moscow', 12000000); | What is the total budget allocation per citizen in Moscow? | SELECT region, (SUM(budget) / (SELECT citizens FROM population WHERE region = 'Moscow')) as avg_allocation_per_citizen FROM budget_moscow GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_access_nm (id INT, county VARCHAR(50), insured BOOLEAN, population INT); INSERT INTO healthcare_access_nm (id, county, insured, population) VALUES (1, 'Bernalillo', false, 400000); INSERT INTO healthcare_access_nm (id, county, insured, population) VALUES (2, 'Santa Fe', true, 200000); INSERT INT... | What is the percentage of uninsured individuals in each county, in New Mexico? | SELECT county, (SUM(CASE WHEN insured = false THEN population ELSE 0 END) / SUM(population)) * 100 as uninsured_percentage FROM healthcare_access_nm WHERE state = 'NM' GROUP BY county; | gretelai_synthetic_text_to_sql |
CREATE TABLE Region (RegionID int, RegionName varchar(50)); INSERT INTO Region (RegionID, RegionName) VALUES (1, 'Africa'), (2, 'Europe'), (3, 'Asia'); CREATE TABLE VirtualTourism (VTID int, RegionID int, Revenue int, Quarter varchar(10), Year int); CREATE TABLE LocalEconomy (LEID int, RegionID int, Impact int); INSERT... | What was the local economic impact of virtual tourism in Q2 2022 in Africa? | SELECT LocalEconomy.Impact FROM LocalEconomy JOIN Region ON LocalEconomy.RegionID = Region.RegionID JOIN VirtualTourism ON Region.RegionID = VirtualTourism.RegionID WHERE VirtualTourism.Quarter = 'Q2' AND VirtualTourism.Year = 2022 AND Region.RegionName = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, data_usage FLOAT, state VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id, data_usage, state) VALUES (1, 3.5, 'New York'), (2, 4.2, 'New York'), (3, 3.8, 'California'); | What is the maximum monthly data usage for prepaid mobile customers in the state of New York? | SELECT MAX(data_usage) FROM mobile_subscribers WHERE state = 'New York' AND subscription_type = 'prepaid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, dish_id INT, sale_price DECIMAL(5,2), country VARCHAR(255)); INSERT INTO sales (sale_id, dish_id, sale_price, country) VALUES (1, 1, 9.99, 'USA'), (2, 3, 7.99, 'Mexico'), (3, 2, 12.99, 'USA'), (4, 3, 11.99, 'Mexico'), (5, 1, 10.99, 'USA'); CREATE TABLE dishes (dish_id INT, dish_name VAR... | Calculate the average sale price for each cuisine | SELECT c.cuisine, AVG(s.sale_price) as avg_sale_price FROM sales s INNER JOIN dishes d ON s.dish_id = d.dish_id INNER JOIN (SELECT cuisine FROM dishes GROUP BY cuisine) c ON d.cuisine = c.cuisine GROUP BY c.cuisine; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmI (species VARCHAR(20), country VARCHAR(20), quantity INT, farming_method VARCHAR(20)); INSERT INTO FarmI (species, country, quantity, farming_method) VALUES ('Salmon', 'Canada', 7000, 'Sustainable'); INSERT INTO FarmI (species, country, quantity, farming_method) VALUES ('Trout', 'Canada', 4000, 'Susta... | List the types of fish and their quantities that are farmed in each country using sustainable methods, excluding fish from Canada. | SELECT country, species, SUM(quantity) FROM FarmI WHERE farming_method = 'Sustainable' AND country != 'Canada' GROUP BY country, species; | gretelai_synthetic_text_to_sql |
CREATE TABLE r_and_d_expenditures (drug_name TEXT, expenditures INTEGER); INSERT INTO r_and_d_expenditures (drug_name, expenditures) VALUES ('DrugA', 5000000); INSERT INTO r_and_d_expenditures (drug_name, expenditures) VALUES ('DrugB', 6000000); INSERT INTO r_and_d_expenditures (drug_name, expenditures) VALUES ('DrugC'... | What is the number of drugs approved in each market that have R&D expenditures greater than 5000000? | SELECT drug_approval.market, COUNT(DISTINCT drug_approval.drug_name) FROM drug_approval JOIN r_and_d_expenditures ON drug_approval.drug_name = r_and_d_expenditures.drug_name WHERE r_and_d_expenditures.expenditures > 5000000 GROUP BY drug_approval.market; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (author_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50)); | Add a new author, 'Sofia Rodriguez', to the 'authors' table | INSERT INTO authors (first_name, last_name) VALUES ('Sofia', 'Rodriguez'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Test_Flights (id INT, name VARCHAR(50), manufacturer VARCHAR(50), test_date DATE); INSERT INTO Test_Flights (id, name, manufacturer, test_date) VALUES (1, 'New Shepard', 'Blue Origin', '2019-01-11'), (2, 'New Glenn', 'Blue Origin', '2020-01-11'), (3, 'Test Flight', 'NASA', '2021-01-11'); | How many test flights were conducted by Blue Origin in 2019? | SELECT COUNT(*) FROM Test_Flights WHERE manufacturer = 'Blue Origin' AND YEAR(test_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductCategories (ProductID INT, Category VARCHAR(50)); INSERT INTO ProductCategories (ProductID, Category) VALUES (1, 'Tops'), (2, 'Bottoms'), (3, 'Accessories'); | For each store, what is the percentage of garments sold that are from a specific category (e.g., 'Tops')? | SELECT StoreID, (SUM(CASE WHEN Category = 'Tops' THEN QuantitySold ELSE 0 END) * 100.0 / SUM(QuantitySold)) AS PercentageOfTopsSold FROM Sales JOIN ProductCategories ON Sales.ProductID = ProductCategories.ProductID GROUP BY StoreID; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceAgencies (id INT, name VARCHAR(255), successful_missions INT, total_missions INT); INSERT INTO SpaceAgencies (id, name, successful_missions, total_missions) VALUES (1, 'NASA', 100, 105); INSERT INTO SpaceAgencies (id, name, successful_missions, total_missions) VALUES (2, 'ESA', 80, 85); | What is the success rate of each space agency in terms of successful space missions? | SELECT name, (successful_missions * 100 / total_missions) AS success_rate FROM SpaceAgencies; | gretelai_synthetic_text_to_sql |
CREATE TABLE sea_temperature (id INT, year INT, month INT, region TEXT, temperature FLOAT); INSERT INTO sea_temperature (id, year, month, region, temperature) VALUES (1, 2017, 1, 'South Pacific Ocean', 27.2); INSERT INTO sea_temperature (id, year, month, region, temperature) VALUES (2, 2017, 2, 'South Pacific Ocean', 2... | What is the average sea surface temperature in the South Pacific Ocean in the last 5 years? | SELECT AVG(temperature) FROM sea_temperature WHERE region = 'South Pacific Ocean' AND year BETWEEN 2017 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE publisher_counts (publisher TEXT, article_count INT); | Get the names of publishers with more than 500 articles in 2021 and their respective counts. | SELECT publisher, article_count FROM publisher_counts WHERE article_count > 500 AND YEAR(publisher_counts.publisher) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, verdict TEXT, billing_amount INT, case_year INT); | What is the total billing amount for cases with a verdict of 'Not Guilty' in the year 2021? | SELECT SUM(billing_amount) FROM cases WHERE verdict = 'Not Guilty' AND case_year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_probes (id INT, probe_name VARCHAR(255), mission_duration INT, max_temperature FLOAT); INSERT INTO space_probes (id, probe_name, mission_duration, max_temperature) VALUES (1, 'SpaceProbe1', 365, 200.0), (2, 'SpaceProbe2', 730, 300.0); | What is the maximum temperature recorded by each space probe during its mission? | SELECT probe_name, MAX(max_temperature) FROM space_probes GROUP BY probe_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (visitor_id INT, name VARCHAR(255), birthdate DATE, city VARCHAR(255)); CREATE TABLE Visits (visit_id INT, visitor_id INT, event_id INT, visit_date DATE); CREATE TABLE Events (event_id INT, name VARCHAR(255), date DATE); | How many visitors attended events in the last 3 months from 'CityY'? | SELECT COUNT(DISTINCT V.visitor_id) FROM Visitors V JOIN Visits IV ON V.visitor_id = IV.visitor_id JOIN Events E ON IV.event_id = E.event_id WHERE V.city = 'CityY' AND E.date >= DATE(CURRENT_DATE) - INTERVAL 3 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, company VARCHAR(255), value FLOAT, date DATE); INSERT INTO defense_contracts (contract_id, company, value, date) VALUES (1, 'ABC Corp', 500000, '2020-01-01'); INSERT INTO defense_contracts (contract_id, company, value, date) VALUES (2, 'XYZ Inc', 750000, '2020-01-05'); | What is the total value of defense contracts signed by company 'ABC Corp' in Q2 2020? | SELECT SUM(value) FROM defense_contracts WHERE company = 'ABC Corp' AND date BETWEEN '2020-04-01' AND '2020-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity(year INT, state VARCHAR(255), capacity INT); INSERT INTO landfill_capacity VALUES (2021, 'Texas', 4000), (2022, 'Texas', 0); | Update the landfill capacity for Texas in 2022 to 5000. | UPDATE landfill_capacity SET capacity = 5000 WHERE year = 2022 AND state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE return_shipments (id INT PRIMARY KEY, status VARCHAR(255)); INSERT INTO return_shipments (id, status) VALUES (1, 'pending'), (2, 'processing'); | Update the status of all return shipments to 'delivered' | UPDATE return_shipments SET status = 'delivered' WHERE status IN ('pending', 'processing'); | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (restaurant_id INT, name VARCHAR(255)); INSERT INTO restaurants (restaurant_id, name) VALUES (21, 'Sushi House'); CREATE TABLE menu_items (menu_item_id INT, name VARCHAR(255), price DECIMAL(5,2)); INSERT INTO menu_items (menu_item_id, name, price) VALUES (22, 'Spicy Tuna Roll', 7.99); CREATE TA... | What is the total revenue for 'Spicy Tuna Roll' at 'Sushi House' on '2022-01-05'? | SELECT SUM(price * quantity) FROM orders o JOIN menu_items mi ON o.menu_item_id = mi.menu_item_id WHERE mi.name = 'Spicy Tuna Roll' AND o.order_date = '2022-01-05' AND o.restaurant_id = 21; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(50), min_depth FLOAT, max_depth FLOAT, ocean VARCHAR(50)); INSERT INTO marine_species (species_id, species_name, min_depth, max_depth, ocean) VALUES (1, 'Spinner Dolphin', 250, 500, 'Pacific'), (2, 'Clownfish', 10, 30, 'Pacific'), (3, 'Shark', 100, 600, ... | What is the average depth for marine species in the Pacific Ocean? | SELECT AVG(avg_depth) FROM (SELECT (min_depth + max_depth) / 2 AS avg_depth FROM marine_species WHERE ocean = 'Pacific') AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Temperature (id INT, sensor_id INT, temperature DECIMAL(5,2), location VARCHAR(255)); INSERT INTO Temperature (id, sensor_id, temperature, location) VALUES (1, 1004, 35.2, 'IN-MH'); | What is the maximum temperature reading for all IoT sensors in "IN-MH" and "PK-PB"? | SELECT MAX(temperature) FROM Temperature WHERE location IN ('IN-MH', 'PK-PB'); | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50));CREATE TABLE athletes (athlete_id INT, athlete_name VARCHAR(50), team_id INT); INSERT INTO teams (team_id, team_name) VALUES (1, 'Atlanta Hawks'), (2, 'Boston Celtics'); INSERT INTO athletes (athlete_id, athlete_name, team_id) VALUES (1, 'Player1', 1), (2, 'Player... | How many athletes are there in each team? | SELECT t.team_name, COUNT(a.athlete_id) FROM teams t JOIN athletes a ON t.team_id = a.team_id GROUP BY t.team_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name VARCHAR(50), location VARCHAR(50), budget INT); | List campaigns with budgets over $10,000 | SELECT name FROM campaigns WHERE budget > 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_grid (id INT PRIMARY KEY, city VARCHAR(50), power_sources VARCHAR(50), renewable_energy_percentage INT); | Update 'renewable_energy_percentage' in 'smart_grid' for 'San Francisco' | UPDATE smart_grid SET renewable_energy_percentage = 75 WHERE city = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE parts (id INT, name VARCHAR(50), material VARCHAR(20)); INSERT INTO parts (id, name, material) VALUES (1, 'Part 1', 'recyclable'), (2, 'Part 2', 'non-recyclable'), (3, 'Part 3', 'recyclable'); | What is the total number of parts in the 'recyclable' material category? | SELECT COUNT(*) FROM parts WHERE material = 'recyclable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students_lifelong_learning (student_id INT, school_id INT, completed_course INT); INSERT INTO students_lifelong_learning VALUES (1, 1, 1); INSERT INTO students_lifelong_learning VALUES (2, 1, 0); INSERT INTO students_lifelong_learning VALUES (3, 2, 1); INSERT INTO students_lifelong_learning VALUES (4, 2, 1... | What is the percentage of students who have completed a lifelong learning course in each school? | SELECT s.school_name, 100.0 * SUM(CASE WHEN sl.completed_course = 1 THEN 1 ELSE 0 END) / COUNT(sr.student_id) AS completion_percentage FROM school_roster sr INNER JOIN students_lifelong_learning sl ON sr.student_id = sl.student_id INNER JOIN schools s ON sr.school_id = s.school_id GROUP BY s.school_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE precincts (precinct_id INT, precinct_name TEXT, total_population INT); INSERT INTO precincts (precinct_id, precinct_name, total_population) VALUES (1, '1st Precinct', 50000), (2, '2nd Precinct', 60000), (3, '3rd Precinct', 40000); CREATE TABLE fire_incidents (incident_id INT, precinct_id INT, response_time... | What is the average response time for fire incidents in each precinct? | SELECT precinct_name, AVG(response_time) FROM fire_incidents JOIN precincts ON fire_incidents.precinct_id = precincts.precinct_id GROUP BY precinct_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE CustomerSizes (CustomerID INT, TopSize VARCHAR(10), BottomSize VARCHAR(10)); INSERT INTO CustomerSizes (CustomerID, TopSize, BottomSize) VALUES (1, 'M', 'L'), (2, 'S', 'M'), (3, 'L', 'XL'), (4, 'XL', 'L'), (5, 'XXL', 'XL'); | How many customers have a top size larger than a specific value? | SELECT COUNT(*) AS CustomerCount FROM CustomerSizes WHERE TopSize > 'L'; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (country VARCHAR(50), emissions INT); INSERT INTO co2_emissions (country, emissions) VALUES ('Australia', 400), ('Japan', 1100), ('South Korea', 600); | What are the total CO2 emissions for Australia, Japan, and South Korea? | SELECT country, emissions FROM co2_emissions WHERE country IN ('Australia', 'Japan', 'South Korea'); | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage (id INT, system_name VARCHAR(255), state VARCHAR(255), energy_capacity FLOAT); INSERT INTO energy_storage (id, system_name, state, energy_capacity) VALUES (1, 'SystemA', 'California', 1234.56), (2, 'SystemB', 'California', 678.90), (3, 'SystemC', 'California', 3456.78); | What is the total energy storage capacity in California, and the number of energy storage systems in California? | SELECT SUM(energy_capacity) as total_capacity, COUNT(*) as num_systems FROM energy_storage WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE producers (id INT, name VARCHAR(50), gender VARCHAR(10), country VARCHAR(50)); | Which countries have the least and most number of female producers in the producers table? | SELECT country, gender, COUNT(*) as count FROM producers GROUP BY country, gender ORDER BY country, count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_compounds (id INT PRIMARY KEY, name VARCHAR(255), safety_rating INT); | Add a new column 'last_updated_date' to the 'chemical_compounds' table | ALTER TABLE chemical_compounds ADD last_updated_date DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_content (id INTEGER, title TEXT, type TEXT, genre TEXT, duration INTEGER, release_date DATE, popularity INTEGER); INSERT INTO media_content (id, title, type, genre, duration, release_date, popularity) VALUES (1, 'Tech Talk', 'Podcast', 'Technology', 30, '2021-02-01', 5000), (2, 'Arts and Culture', 'P... | Show the number of podcasts in the media_content table by genre, ordered by the number of podcasts in descending order. | SELECT genre, COUNT(*) AS podcasts_count FROM media_content WHERE type = 'Podcast' GROUP BY genre ORDER BY podcasts_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE tickets (ticket_id INT, game_id INT, quantity INT, price DECIMAL(5,2)); INSERT INTO tickets VALUES (1, 1, 50, 25.99); INSERT INTO tickets VALUES (2, 2, 30, 19.99); CREATE TABLE games (game_id INT, team VARCHAR(20), location VARCHAR(20)); INSERT INTO games VALUES (1, 'Cowboys', 'Dallas'); INSERT INTO games ... | What is the total number of tickets sold for all games of the football team in Texas? | SELECT SUM(tickets.quantity) FROM tickets INNER JOIN games ON tickets.game_id = games.game_id WHERE games.location LIKE 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductIngredients (productID INT, ingredient VARCHAR(50), organic BOOLEAN); INSERT INTO ProductIngredients (productID, ingredient, organic) VALUES (1, 'Aloe Vera', true), (2, 'Chamomile', true), (3, 'Retinol', false), (4, 'Hyaluronic Acid', false); | Delete all records in the ProductIngredients table with organic ingredients. | DELETE FROM ProductIngredients WHERE organic = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(region VARCHAR(20), quarter INT, revenue FLOAT); INSERT INTO sales(region, quarter, revenue) VALUES('Asia-Pacific', 1, 5000), ('Asia-Pacific', 2, 7000), ('Asia-Pacific', 3, 8000), ('Asia-Pacific', 4, 6000); | What is the total revenue for the Asia-Pacific region in the last quarter? | SELECT SUM(revenue) FROM sales WHERE region = 'Asia-Pacific' AND quarter IN (3, 4) | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, department VARCHAR(255), race_ethnicity VARCHAR(255)); INSERT INTO faculty (id, department, race_ethnicity) VALUES (1, 'Computer Science', 'Asian'), (2, 'Mathematics', 'White'), (3, 'Computer Science', 'Hispanic'), (4, 'Physics', 'White'), (5, 'Computer Science', 'Black'); | What percentage of faculty members in each department are from underrepresented racial or ethnic groups? | SELECT department, 100.0 * COUNT(CASE WHEN race_ethnicity IN ('Black', 'Hispanic') THEN 1 ELSE NULL END) / COUNT(*) as underrepresented_percentage FROM faculty GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_donations_time (program_category VARCHAR(20), donation_date DATE);INSERT INTO program_donations_time VALUES ('Arts', '2022-09-01'), ('Education', '2022-10-01'), ('Health', '2022-11-01'), ('Science', NULL); | Which program categories received donations in the last month, excluding categories that have never received donations before? | SELECT program_category FROM program_donations_time WHERE donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND program_category IN (SELECT program_category FROM program_donations_time WHERE donation_date IS NOT NULL GROUP BY program_category); | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT, city VARCHAR(20), capacity INT); INSERT INTO warehouse (id, city, capacity) VALUES (1, 'Chicago', 1000), (2, 'Houston', 1500), (3, 'Miami', 800); | Remove the warehouse in Miami | DELETE FROM warehouse WHERE city = 'Miami'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RetailStores (StoreID INT, StoreName VARCHAR(50), State VARCHAR(50)); INSERT INTO RetailStores (StoreID, StoreName, State) VALUES (1, 'RetailStoreA', 'California'), (2, 'RetailStoreB', 'California'), (3, 'RetailStoreC', 'New York'); CREATE TABLE Sales (SaleID INT, StoreID INT, ProductID INT, Quantity INT, ... | What is the total quantity of organic products sold by retail stores located in California? | SELECT SUM(Quantity) FROM Sales JOIN RetailStores ON Sales.StoreID = RetailStores.StoreID JOIN Products ON Sales.ProductID = Products.ProductID WHERE RetailStores.State = 'California' AND Products.IsOrganic = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE fleet_management (id INT, name VARCHAR(50), type VARCHAR(50), capacity INT); | Which vessels in the 'fleet_management' table have a capacity greater than 10000? | SELECT name FROM fleet_management WHERE capacity > 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_plants (id INT, name VARCHAR(255), state VARCHAR(50)); INSERT INTO solar_plants (id, name, state) VALUES (1, 'Solar Plant A', 'California'), (2, 'Solar Plant B', 'Texas'), (3, 'Solar Plant C', 'California'); | How many solar power plants are there in California and Texas, and what are their names? | SELECT s.state, COUNT(*), s.name FROM solar_plants s WHERE s.state IN ('California', 'Texas') GROUP BY s.state, s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance (id INT, funding_source VARCHAR(255), country VARCHAR(255), amount FLOAT); | Update the 'amount' column in the 'climate_finance' table where the 'funding_source' is 'Bilateral' and 'country' is 'Bangladesh' | UPDATE climate_finance SET amount = amount * 1.1 WHERE funding_source = 'Bilateral' AND country = 'Bangladesh'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, gender VARCHAR(50), name VARCHAR(255)); INSERT INTO donors (id, gender, name) VALUES (1, 'Female', 'Gender Equality Donor'); | Add a new donor named 'AAPI Giving Circle' who identifies as Asian. | INSERT INTO donors (id, gender, name) VALUES (2, 'Asian', 'AAPI Giving Circle'); | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_instruments (instrument_id INT, name VARCHAR(255), country VARCHAR(255), issuance_date DATE); INSERT INTO shariah_compliant_instruments (instrument_id, name, country, issuance_date) VALUES (1, 'Sukuk', 'Germany', '2022-01-01'); INSERT INTO shariah_compliant_instruments (instrument_id, nam... | List all Shariah-compliant financial instruments offered in Germany with their respective issuance dates. | SELECT * FROM shariah_compliant_instruments WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure_projects (id INT, country VARCHAR(50), project_name VARCHAR(100), start_date DATE, end_date DATE, budget DECIMAL(10,2)); | What was the total budget for all rural infrastructure projects initiated in Kenya in 2020? | SELECT SUM(budget) FROM rural_infrastructure_projects WHERE country = 'Kenya' AND YEAR(start_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (threat_id INT, threat_level INT, region TEXT, threat_date DATE); | What is the average threat level for the Middle East in the last 6 months? | SELECT AVG(threat_level) FROM threat_intelligence WHERE region = 'Middle East' AND threat_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Intelligence_Budgets (budget_id INT, year INT, region_id INT, amount DECIMAL(10,2)); INSERT INTO Intelligence_Budgets (budget_id, year, region_id, amount) VALUES (1, 2020, 4, 8000000.00), (2, 2021, 4, 8500000.00); | What is the minimum budget allocated for intelligence operations in the Asian region in 2021? | SELECT MIN(amount) FROM Intelligence_Budgets WHERE year = 2021 AND region_id = (SELECT region_id FROM Regions WHERE region_name = 'Asian'); | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (year INT, region VARCHAR(50), material VARCHAR(50), volume FLOAT); INSERT INTO WasteGeneration (year, region, material, volume) VALUES (2020, 'North America', 'Organic', 12000), (2020, 'Europe', 'Organic', 15000), (2020, 'Asia', 'Organic', 30000), (2020, 'South America', 'Organic', 10000),... | What is the total volume of organic waste generated in 2020, only considering data from Asia? | SELECT SUM(volume) FROM WasteGeneration WHERE year = 2020 AND region = 'Asia' AND material = 'Organic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, DonorType TEXT, Country TEXT); INSERT INTO Donors (DonorID, DonorName, DonorType, Country) VALUES (1, 'John Doe', 'Individual', 'Canada'); INSERT INTO Donors (DonorID, DonorName, DonorType, Country) VALUES (2, 'ABC Corp', 'Organization', 'Canada'); | What is the total amount donated by individual donors based in Canada, excluding donations made by organizations? | SELECT SUM(DonationAmount) FROM Donations d JOIN Donors don ON d.DonorID = don.DonorID WHERE don.DonorType = 'Individual' AND don.Country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), manufacturer VARCHAR(255), country VARCHAR(255), launch_date DATE); INSERT INTO satellites (id, name, manufacturer, country, launch_date) VALUES (1, 'FalconSat', 'SpaceX', 'USA', '2020-01-01'), (2, 'Cubesat', 'Blue Origin', 'USA', '2019-01-01'), (3, 'Electron', 'Rocke... | Display the total number of satellites deployed by each country, such as 'USA', 'China', and 'India'. | SELECT country, COUNT(*) FROM satellites GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy (policy_number INT, coverage_amount INT, policyholder_address VARCHAR(50)); INSERT INTO policy VALUES (1, 50000, 'São Paulo'); INSERT INTO policy VALUES (2, 75000, 'Los Angeles'); | What is the policy number, coverage amount, and effective date for policies with a policyholder address in 'São Paulo'? | SELECT policy_number, coverage_amount, effective_date FROM policy INNER JOIN address ON policy.policyholder_address = address.address_line1 WHERE address.city = 'São Paulo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (Id INT, Name VARCHAR(50), Type VARCHAR(50), Flag VARCHAR(50), TotalWeight INT); INSERT INTO Vessels (Id, Name, Type, Flag, TotalWeight) VALUES (5, 'VesselE', 'Tanker', 'Canada', 20000), (6, 'VesselF', 'Bulk Carrier', 'Canada', 25000); | What is the maximum cargo weight for vessels from Canada? | SELECT MAX(TotalWeight) FROM Vessels WHERE Flag = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mines (MineID INT, MineName VARCHAR(50), Location VARCHAR(50)); INSERT INTO Mines (MineID, MineName, Location) VALUES (1, 'ABC Mine', 'Colorado'), (2, 'DEF Mine', 'Alaska'), (3, 'GHI Mine', 'Australia'); CREATE TABLE Operations (OperationID INT, MineID INT, OperationType VARCHAR(50), StartDate DATE, EndDat... | What is the total water usage for each mine? | SELECT Mines.MineName, SUM(EnvironmentalImpact.WaterUsage) FROM Mines INNER JOIN Operations ON Mines.MineID = Operations.MineID INNER JOIN EnvironmentalImpact ON Operations.OperationID = EnvironmentalImpact.OperationID GROUP BY Mines.MineName; | gretelai_synthetic_text_to_sql |
CREATE TABLE region_deliveries (delivery_id INT, item_count INT, delivery_date DATE, region VARCHAR(50)); INSERT INTO region_deliveries (delivery_id, item_count, delivery_date, region) VALUES (1, 10, '2022-01-01', 'Asia'), (2, 20, '2022-01-02', 'Asia'); | What is the maximum number of items delivered per day for 'region_deliveries' table for 'Asia' in the year 2022? | SELECT MAX(item_count) FROM region_deliveries WHERE EXTRACT(YEAR FROM delivery_date) = 2022 AND region = 'Asia' GROUP BY delivery_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (id INT, mission_name VARCHAR(255), astronaut_name VARCHAR(255), duration INT); INSERT INTO space_missions (id, mission_name, astronaut_name, duration) VALUES (1, 'Apollo 11', 'Neil Armstrong', 195), (2, 'Apollo 12', 'Jane Foster', 244), (3, 'Ares 3', 'Mark Watney', 568), (4, 'Apollo 18', 'A... | Who are the astronauts that have participated in space missions longer than 250 days? | SELECT astronaut_name FROM space_missions WHERE duration > 250; | gretelai_synthetic_text_to_sql |
CREATE TABLE CrewRequirements (CrewID INT, SpaceCraft VARCHAR(50), MinCrew INT); | What is the minimum number of crew members required to operate the Space Shuttle? | SELECT MIN(MinCrew) FROM CrewRequirements WHERE SpaceCraft = 'Space Shuttle'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SmartBuildings (id INT, city VARCHAR(20), type VARCHAR(20), capacity INT); | Insert a new record into the "SmartBuildings" table for a new "Wind" type building in "Tokyo" with a capacity of 800 | INSERT INTO SmartBuildings (city, type, capacity) VALUES ('Tokyo', 'Wind', 800); | gretelai_synthetic_text_to_sql |
CREATE TABLE local_production (product_id INT, category VARCHAR(255), year INT); INSERT INTO local_production (product_id, category, year) VALUES (1, 'Local', 2021), (2, 'Local', 2022), (3, 'Local', 2021), (4, 'Local', 2022); | What is the number of items produced in the 'Local' category in each year? | SELECT year, COUNT(*) as items_produced FROM local_production WHERE category = 'Local' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE treatment_costs (cost_id INT, treatment_approach VARCHAR(255), cost DECIMAL(10, 2)); INSERT INTO treatment_costs (cost_id, treatment_approach, cost) VALUES (1, 'CBT', 150.00), (2, 'DBT', 200.00), (3, 'EMDR', 250.00), (4, 'Medication', 50.00); | What is the total cost of treatment for each unique treatment_approach in the 'treatment_costs' schema? | SELECT treatment_approach, SUM(cost) AS total_cost FROM treatment_costs GROUP BY treatment_approach; | gretelai_synthetic_text_to_sql |
CREATE TABLE WaterSupply(location VARCHAR(255), material VARCHAR(255), cost FLOAT); INSERT INTO WaterSupply VALUES('SiteA','Concrete',120.5),('SiteA','Steel',350.0),('SiteA','Wood',200.0),('SiteB','Concrete',140.0),('SiteB','Steel',380.0),('SiteB','Wood',220.0); | What is the total cost of concrete and steel materials in 'WaterSupply' table? | SELECT SUM(cost) FROM WaterSupply WHERE material IN ('Concrete', 'Steel'); | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (id INT PRIMARY KEY, name VARCHAR(100), gender VARCHAR(10), age INT, favorite_team VARCHAR(50)); | What is the most popular team among fans in the 'fans' table? | SELECT favorite_team, COUNT(*) as fan_count FROM fans GROUP BY favorite_team ORDER BY fan_count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyProtocols (Id INT PRIMARY KEY, ChemicalName VARCHAR(100), SafetyMeasures TEXT); INSERT INTO SafetyProtocols (Id, ChemicalName, SafetyMeasures) VALUES (2, 'Hydrochloric Acid', 'Always wear protective gloves and a lab coat when handling.'); | What safety measures are in place for Hydrochloric Acid? | SELECT SafetyMeasures FROM SafetyProtocols WHERE ChemicalName = 'Hydrochloric Acid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CircularEconomyInitiatives (CEIID INT, Location VARCHAR(50), Initiative VARCHAR(50), StartDate DATE, EndDate DATE); INSERT INTO CircularEconomyInitiatives (CEIID, Location, Initiative, StartDate, EndDate) VALUES (15, 'Mumbai', 'Food Waste Reduction', '2019-01-01', '2023-12-31'); INSERT INTO CircularEconomy... | Which circular economy initiatives were launched in Mumbai and Paris between 2018 and 2020? | SELECT C.Location, C.Initiative FROM CircularEconomyInitiatives C WHERE C.Location IN ('Mumbai', 'Paris') AND C.StartDate BETWEEN '2018-01-01' AND '2020-12-31' GROUP BY C.Location, C.Initiative; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_publications (id INT, student_id INT, journal_name VARCHAR(255), publication_year INT); INSERT INTO student_publications (id, student_id, journal_name, publication_year) VALUES (1, 123, 'Journal A', 2018), (2, 456, 'Journal B', 2019), (3, 789, 'Journal C', 2020), (4, 321, 'Journal A', 2017), (5, 65... | How many graduate students have published in each of the top 3 academic journals in the past 5 years? | SELECT journal_name, COUNT(*) as publications, ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) as rank FROM student_publications WHERE publication_year BETWEEN 2016 AND 2021 GROUP BY journal_name HAVING rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (incident_id INT, incident_time TIMESTAMP, region VARCHAR(50), severity VARCHAR(10)); INSERT INTO incidents (incident_id, incident_time, region, severity) VALUES (1, '2022-06-01 10:00:00', 'region_1', 'medium'), (2, '2022-06-02 14:30:00', 'region_2', 'high'), (3, '2022-06-03 08:15:00', 'region_3'... | How many security incidents have been recorded per region in the 'incidents' table for the last 30 days? | SELECT region, COUNT(*) as incident_count FROM incidents WHERE incident_time >= NOW() - INTERVAL '30 days' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibit_visitors (visitor_id INT, exhibit_id INT, age INT, gender VARCHAR(50)); INSERT INTO exhibit_visitors (visitor_id, exhibit_id, age, gender) VALUES (1, 2, 30, 'Non-binary'), (2, 2, 35, 'Female'), (3, 2, 45, 'Male'); | How many visitors identified as 'Non-binary' in Exhibit B? | SELECT exhibit_id, COUNT(*) FROM exhibit_visitors WHERE exhibit_id = 2 AND gender = 'Non-binary' GROUP BY exhibit_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_demographics (student_id INT, ethnicity VARCHAR(50), mental_health_score INT); INSERT INTO student_demographics (student_id, ethnicity, mental_health_score) VALUES (1, 'Hispanic', 75), (2, 'Asian', 80), (3, 'African American', 60), (4, 'Caucasian', 65), (5, 'Native American', 85), (6, 'Pacific Isla... | What is the average mental health score for students in each ethnic group? | SELECT ethnicity, AVG(mental_health_score) AS avg_score FROM student_demographics GROUP BY ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE SecurityIncidents (id INT, incident_name VARCHAR(255), cause VARCHAR(255), date DATE); INSERT INTO SecurityIncidents (id, incident_name, cause, date) VALUES (5, 'Data Breach', 'Outdated Software', '2021-03-12'); | What is the total number of security incidents caused by outdated software in the first half of 2021? | SELECT SUM(incidents) FROM (SELECT COUNT(*) AS incidents FROM SecurityIncidents WHERE cause = 'Outdated Software' AND date >= '2021-01-01' AND date < '2021-07-01' GROUP BY cause) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (GameID INT, Genre VARCHAR(10), Rating INT); INSERT INTO Games (GameID, Genre, Rating) VALUES (1, 'Action', 8); INSERT INTO Games (GameID, Genre, Rating) VALUES (2, 'RPG', 9); INSERT INTO Games (GameID, Genre, Rating) VALUES (3, 'Strategy', 7); INSERT INTO Games (GameID, Genre, Rating) VALUES (4, 'Si... | What is the distribution of games by genre and rating? | SELECT Games.Genre, AVG(Games.Rating) FROM Games GROUP BY Games.Genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_site_environmental_scores (site_id INT, score FLOAT, score_date DATE); INSERT INTO mining_site_environmental_scores (site_id, score, score_date) VALUES (1, 80.0, '2022-01-01'), (1, 85.0, '2022-02-01'), (2, 90.0, '2022-01-01'), (2, 95.0, '2022-02-01'), (3, 70.0, '2022-01-01'), (3, 75.0, '2022-02-01')... | What is the average environmental impact score for each mining site in the past year? | SELECT site_id, AVG(score) FROM mining_site_environmental_scores WHERE score_date >= '2022-01-01' AND score_date < '2023-01-01' GROUP BY site_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_beds(id INT, hospital_name TEXT, state TEXT, num_beds INT); INSERT INTO hospital_beds(id, hospital_name, state, num_beds) VALUES (1, 'UCLA Medical Center', 'California', 500), (2, 'Stanford Health Care', 'California', 600), (3, 'Rural Health Clinic', 'California', 50), (4, 'Texas Medical Center', ... | Find the number of hospital beds in each state | SELECT state, SUM(num_beds) FROM hospital_beds GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(50), recycling_rate DECIMAL(5,2)); INSERT INTO regions (id, name, recycling_rate) VALUES (1, 'North', 0.62), (2, 'South', 0.58), (3, 'East', 0.45), (4, 'West', 0.70); | Which regions have a recycling rate above 60%? | SELECT name FROM regions WHERE recycling_rate > 0.6; | gretelai_synthetic_text_to_sql |
CREATE TABLE Kpop_Concerts (year INT, artist VARCHAR(50), revenue FLOAT); INSERT INTO Kpop_Concerts (year, artist, revenue) VALUES (2018, 'BTS', 1000000), (2019, 'BLACKPINK', 1500000), (2020, 'TWICE', 800000), (2021, 'SEVENTEEN', 1200000), (2019, 'BTS', 1500000); | What was the total revenue for a K-pop artist's concert ticket sales in 2019? | SELECT artist, SUM(revenue) FROM Kpop_Concerts WHERE year = 2019 AND artist = 'BTS' GROUP BY artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE LegalAid (case_id INT, case_type VARCHAR(10), case_status VARCHAR(10)); INSERT INTO LegalAid (case_id, case_type, case_status) VALUES (1, 'civil', 'open'), (2, 'criminal', 'closed'), (3, 'civil', 'closed'); | Show the 'case_type' and 'case_status' for cases in the 'LegalAid' table where the 'case_type' is 'civil' | SELECT case_type, case_status FROM LegalAid WHERE case_type = 'civil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Green_Buildings (Project_ID INT, Project_Name VARCHAR(255), Country VARCHAR(255), Square_Footage INT); INSERT INTO Green_Buildings (Project_ID, Project_Name, Country, Square_Footage) VALUES (1, 'Wind Turbine Park', 'Canada', 750000), (2, 'Solar Farm', 'Canada', 500000); | What is the total number of green building projects in Canada? | SELECT Country, COUNT(*) FROM Green_Buildings WHERE Country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE supplies (id INT, hospital_id INT, type VARCHAR(20), quantity INT); | What is the total number of medical supplies available in Asian hospitals? | SELECT SUM(quantity) FROM supplies JOIN hospitals ON supplies.hospital_id = hospitals.id WHERE hospitals.location LIKE '%Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name VARCHAR(100), is_organic BOOLEAN, category VARCHAR(50), country VARCHAR(50), price DECIMAL(5,2)); INSERT INTO products (product_id, name, is_organic, category, country, price) VALUES (1, 'Cleanser', true, 'Skincare', 'Australia', 24.99); INSERT INTO products (product_id, name... | Find the average price of organic skincare products in Australia. | SELECT AVG(price) FROM products WHERE is_organic = true AND category = 'Skincare' AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorID int, DonationDate date, DonationAmount numeric(10,2)); INSERT INTO Donations (DonationID, DonorID, DonationDate, DonationAmount) VALUES (1, 1, '2021-03-15', 800), (2, 2, '2021-06-28', 350), (3, 3, '2021-08-02', 700); | Which donors donated more than $500 in a single donation? | SELECT DonorID, MAX(DonationAmount) as LargestDonation FROM Donations GROUP BY DonorID HAVING MAX(DonationAmount) > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolicyImpact(Date DATE, Region VARCHAR(20), Department VARCHAR(20), Quantity INT); INSERT INTO PolicyImpact(Date, Region, Department, Quantity) VALUES ('2021-01-01', 'East', 'Education', 20), ('2021-01-05', 'East', 'Education', 15), ('2021-02-10', 'East', 'Education', 12); | What is the total number of policy impact reports for 'Education' in the 'East' region in 2021? | SELECT SUM(Quantity) FROM PolicyImpact WHERE Region = 'East' AND Department = 'Education' AND Year(Date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT, stars FLOAT); INSERT INTO hotels (hotel_id, hotel_name, country, stars) VALUES (1, 'Hotel Royal', 'USA', 4.5), (2, 'Hotel Paris', 'France', 5.0), (3, 'Hotel Tokyo', 'Japan', 4.7), (4, 'Hotel Rome', 'Italy', 4.2), (5, 'Hotel Beijing', 'China', 4.8); | Which countries have the highest and lowest hotel star ratings? | SELECT country, MAX(stars) as max_stars, MIN(stars) as min_stars FROM hotels GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Construction_Permits (id INT, permit_number VARCHAR(20), issue_date DATE, state VARCHAR(20)); INSERT INTO Construction_Permits (id, permit_number, issue_date, state) VALUES (1, 'CP12345', '2020-01-01', 'Florida'); | What was the total number of construction permits issued in the state of Florida in 2020? | SELECT COUNT(permit_number) FROM Construction_Permits WHERE issue_date >= '2020-01-01' AND issue_date < '2021-01-01' AND state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE purchase_data (purchase_date DATE, equipment_type VARCHAR(50)); INSERT INTO purchase_data (purchase_date, equipment_type) VALUES ('2021-01-05', 'Auto-steer system'), ('2021-02-10', 'Variable rate technology'), ('2021-03-15', 'Precision planting system'), ('2021-04-20', 'Yield monitor'), ('2021-05-25', 'Pre... | Identify the number of precision farming equipment purchases by month in 2021 | SELECT DATE_FORMAT(purchase_date, '%Y-%m') AS month, COUNT(*) FROM purchase_data WHERE YEAR(purchase_date) = 2021 AND equipment_type = 'precision farming equipment' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours(id INT, name TEXT, city TEXT, revenue FLOAT); INSERT INTO virtual_tours(id, name, city, revenue) VALUES (1, 'NYC Virtual Landmarks Tour', 'New York', 15000.0); | What is the total revenue generated by virtual tours in New York? | SELECT SUM(revenue) FROM virtual_tours WHERE city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exoplanets (name TEXT, temperature REAL); INSERT INTO Exoplanets (name, temperature) VALUES ('Kepler-438b', 40.3), ('Kepler-90c', 71.2), ('55 Cancri e', 2362.5); | What is the average temperature of the three hottest exoplanets? | SELECT AVG(temperature) FROM (SELECT temperature FROM Exoplanets ORDER BY temperature DESC LIMIT 3) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE Player (player_id INT, country VARCHAR(20)); CREATE TABLE GamePerformance (player_id INT, score INT); INSERT INTO Player (player_id, country) VALUES (1, 'FR'), (2, 'DE'), (3, 'GB'), (4, 'US'), (5, 'CA'); INSERT INTO GamePerformance (player_id, score) VALUES (1, 85), (2, 90), (3, 75), (4, 95), (5, 80); | What is the average game performance score for players from Europe? | SELECT AVG(GamePerformance.score) as avg_score FROM Player JOIN GamePerformance ON Player.player_id = GamePerformance.player_id WHERE Player.country LIKE 'EU%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organization (org_id INT, org_name VARCHAR(255)); CREATE TABLE donation (don_id INT, donor_id INT, org_id INT, donation_amount INT, donation_date DATE); | Calculate the percentage of donations that each organization has received in the current month, for organizations that have received at least one donation in the current month. | SELECT org_id, ROUND(100.0 * SUM(donation_amount) / (SELECT SUM(donation_amount) FROM donation WHERE EXTRACT(MONTH FROM donation_date) = EXTRACT(MONTH FROM CURRENT_DATE) AND EXTRACT(YEAR FROM donation_date) = EXTRACT(YEAR FROM CURRENT_DATE))::DECIMAL, 2) AS pct_donations_current_month FROM donation WHERE EXTRACT(MONTH ... | gretelai_synthetic_text_to_sql |
CREATE TABLE ExplainableAI (model_name TEXT, fairness_score FLOAT); INSERT INTO ExplainableAI (model_name, fairness_score) VALUES ('ModelA', 0.85), ('ModelB', 0.90), ('ModelC', 0.80), ('ModelD', 0.88), ('ModelE', 0.92); | What is the rank of explainable AI models by fairness score? | SELECT model_name, RANK() OVER (ORDER BY fairness_score DESC) rank FROM ExplainableAI; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_heritage_sites (site_id INT, site_name TEXT, city TEXT, rating INT); INSERT INTO cultural_heritage_sites (site_id, site_name, city, rating) VALUES (1, 'Colosseum', 'Rome', 5), (2, 'Roman Forum', 'Rome', 4), (3, 'Pantheon', 'Rome', 5); | How many cultural heritage sites are in Rome and have more than 3 stars? | SELECT COUNT(*) FROM cultural_heritage_sites WHERE city = 'Rome' AND rating > 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest_inventory (tree_id INT, diameter_class VARCHAR(50)); CREATE TABLE dangerous_diameter_classes (diameter_class VARCHAR(50)); | What is the total number of trees in the forest_inventory table that have a diameter class that is present in the dangerous_diameter_classes table? | SELECT COUNT(*) FROM forest_inventory WHERE diameter_class IN (SELECT diameter_class FROM dangerous_diameter_classes); | gretelai_synthetic_text_to_sql |
CREATE TABLE aquaculture_farms (id INT, name VARCHAR(255)); INSERT INTO aquaculture_farms (id, name) VALUES (1, 'Farm A'), (2, 'Farm B'); CREATE TABLE fish_biomass (id INT, farm_id INT, species VARCHAR(255), biomass DECIMAL(5,2)); INSERT INTO fish_biomass (id, farm_id, species, biomass) VALUES (1, 1, 'Tilapia', 120.5),... | What is the total biomass of fish in farm A? | SELECT SUM(biomass) FROM fish_biomass WHERE farm_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_data (id INT, customer_id INT, account_balance DECIMAL(10, 2), transaction_volume INT, region VARCHAR(255)); INSERT INTO customer_data (id, customer_id, account_balance, transaction_volume, region) VALUES (1, 1, 10000, 50, 'Northeast'), (2, 2, 15000, 100, 'Southeast'), (3, 3, 8000, 75, 'Northeast'... | What is the average account balance and transaction volume for customers in the Northeast region? | SELECT AVG(cd.account_balance) AS avg_account_balance, AVG(cd.transaction_volume) AS avg_transaction_volume FROM customer_data cd WHERE cd.region = 'Northeast'; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, membership_type VARCHAR(10)); INSERT INTO members VALUES (1,'Premium'),(2,'Basic'),(3,'Premium'),(4,'Standard'); | How many unique members have a membership type of "premium"? | SELECT COUNT(DISTINCT member_id) FROM members WHERE membership_type = 'Premium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (model VARCHAR(255), manufacturer VARCHAR(255), units_manufactured INT); INSERT INTO aircraft (model, manufacturer, units_manufactured) VALUES ('737', 'Boeing', 10000), ('A320', 'Airbus', 8000), ('787', 'Boeing', 700); | List all aircraft models with more than 500 units manufactured by Boeing and Airbus. | SELECT model, manufacturer FROM aircraft WHERE manufacturer IN ('Boeing', 'Airbus') GROUP BY model HAVING SUM(units_manufactured) > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (country_id INT, country VARCHAR(50), certification VARCHAR(50)); INSERT INTO Countries (country_id, country, certification) VALUES (1, 'India', 'Fair Trade'), (2, 'Bangladesh', 'Certified Organic'), (3, 'China', 'Fair Trade'), (4, 'India', 'Fair Trade'), (5, 'Indonesia', 'Fair Trade'); | Which countries have the most fair trade certified factories? | SELECT country, COUNT(*) as num_fair_trade_factories FROM Countries WHERE certification = 'Fair Trade' GROUP BY country ORDER BY num_fair_trade_factories DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Yellow_Fund (id INT, quarter VARCHAR(10), social_investment VARCHAR(30), roi FLOAT); INSERT INTO Yellow_Fund (id, quarter, social_investment, roi) VALUES (1, 'Q2 2021', 'Education', 0.15), (2, 'Q2 2021', 'Healthcare', 0.12); | Which social impact investments by Yellow Fund in Q2 2021 had the highest ROI? | SELECT social_investment, MAX(roi) FROM Yellow_Fund WHERE quarter = 'Q2 2021' GROUP BY social_investment; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, country VARCHAR(50), sector VARCHAR(50), amount FLOAT); INSERT INTO investments (id, country, sector, amount) VALUES (1, 'Canada', 'Gender Equality', 500000), (2, 'Mexico', 'Renewable Energy', 750000), (3, 'Canada', 'Gender Equality', 600000); | Which countries have the most investments in gender equality? | SELECT country, COUNT(*) as num_investments FROM investments WHERE sector = 'Gender Equality' GROUP BY country ORDER BY num_investments DESC; | 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.