context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE WasteGeneration (waste_id INT, business_type VARCHAR(255), waste_amount DECIMAL(10,2), generation_date DATE); INSERT INTO WasteGeneration (waste_id, business_type, waste_amount, generation_date) VALUES (1, 'Small Business', 500, '2021-01-01'), (2, 'Medium Business', 800, '2021-01-01'), (3, 'Large Business'... | What is the total waste generated by small businesses in the last year? | SELECT SUM(waste_amount) FROM WasteGeneration WHERE business_type = 'Small Business' AND generation_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founder_continent TEXT, founder_industry TEXT); INSERT INTO startups VALUES (1, 'Acme Inc', 'Latin America', 'Fintech'); INSERT INTO startups VALUES (2, 'Beta Corp', 'Europe', 'E-commerce'); CREATE TABLE funding_rounds(startup_id INT, amount_raised INT); INSERT INTO funding_roun... | What is the total funding raised by startups founded by individuals from Latin America in the fintech industry? | SELECT SUM(funding_rounds.amount_raised) FROM startups INNER JOIN funding_rounds ON startups.id = funding_rounds.startup_id WHERE startups.founder_continent = 'Latin America' AND startups.founder_industry = 'Fintech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicle_Range (make VARCHAR(50), model VARCHAR(50), range FLOAT, year INT, country VARCHAR(50)); INSERT INTO Vehicle_Range (make, model, range, year, country) VALUES ('Toyota', 'Prius Prime', 630, 2017, 'Japan'); INSERT INTO Vehicle_Range (make, model, range, year, country) VALUES ('Nissan', 'Leaf', 530, 2... | What is the average electric vehicle range in Japan over the last 5 years? | SELECT AVG(range) FROM Vehicle_Range WHERE country = 'Japan' AND year BETWEEN 2017 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE esg_investments (id INT, country VARCHAR(255), amount FLOAT, strategy_id INT); INSERT INTO esg_investments (id, country, amount, strategy_id) VALUES (1, 'Argentina', 1500000, 3), (2, 'Argentina', 2000000, 2); | Update the amount of investment with strategy_id 3 in the table 'esg_investments' to 4000000. | UPDATE esg_investments SET amount = 4000000 WHERE strategy_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT PRIMARY KEY, name VARCHAR(50), species VARCHAR(50), population INT); CREATE TABLE habitats (id INT PRIMARY KEY, name VARCHAR(50), location VARCHAR(50), size FLOAT, animal_id INT); | What is the average size of habitats for each animal species? | SELECT animals.species, AVG(habitats.size) AS avg_size FROM animals INNER JOIN habitats ON animals.id = habitats.animal_id GROUP BY animals.species; | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditures (company TEXT, year INT, amount FLOAT); INSERT INTO rd_expenditures (company, year, amount) VALUES ('Pfizer', 2020, 18000000), ('Merck', 2020, 14000000); | Find the difference in R&D expenditures between two companies, 'Pfizer' and 'Merck'. | SELECT Pfizer - Merck FROM (SELECT SUM(amount) AS Pfizer FROM rd_expenditures WHERE company = 'Pfizer' AND year = 2020) AS Pfizer_2020, (SELECT SUM(amount) AS Merck FROM rd_expenditures WHERE company = 'Merck' AND year = 2020) AS Merck_2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farm (id INT, name VARCHAR(255), cost FLOAT); INSERT INTO wind_farm (id, name, cost) VALUES (1, 'Sample Wind Farm', 10000000); | What is the total cost of wind_farm projects? | SELECT SUM(cost) FROM wind_farm; | gretelai_synthetic_text_to_sql |
CREATE TABLE RegulatoryActions (country VARCHAR(255), action_date DATE); INSERT INTO RegulatoryActions (country, action_date) VALUES ('USA', '2021-01-01'), ('USA', '2021-03-01'), ('China', '2021-02-01'); | List the total number of regulatory actions taken in each country | SELECT country, COUNT(*) as total_actions FROM RegulatoryActions GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (name TEXT, depth FLOAT); INSERT INTO marine_trenches (name, depth) VALUES ('Mariana Trench', 36000); INSERT INTO marine_trenches (name, depth) VALUES ('Tonga Trench', 35000); INSERT INTO marine_trenches (name, depth) VALUES ('Kermadec Trench', 32000); | What is the maximum depth of any marine trench? | SELECT MAX(depth) FROM marine_trenches; | gretelai_synthetic_text_to_sql |
CREATE TABLE visual_arts_programs (program_id INT PRIMARY KEY, program_name VARCHAR(50), program_type VARCHAR(50), start_date DATE, end_date DATE); CREATE TABLE visual_arts_participants (participant_id INT PRIMARY KEY, participant_name VARCHAR(50), age INT, gender VARCHAR(50), program_id INT, FOREIGN KEY (program_id) R... | How many participants joined each visual arts program by age group? | SELECT visual_arts_programs.program_name, visual_arts_participants.age, COUNT(visual_arts_participants.participant_id) AS total_participants FROM visual_arts_programs INNER JOIN visual_arts_participants ON visual_arts_programs.program_id = visual_arts_participants.program_id GROUP BY visual_arts_programs.program_name, ... | gretelai_synthetic_text_to_sql |
CREATE TABLE INTELLIGENCE_OPERATIONS (id INT PRIMARY KEY, operation VARCHAR(255), city VARCHAR(255), country VARCHAR(255), year INT); | Which intelligence operations have been conducted in 'CityA' in the INTELLIGENCE_OPERATIONS table? | SELECT operation FROM INTELLIGENCE_OPERATIONS WHERE city = 'CityA' AND year = (SELECT MAX(year) FROM INTELLIGENCE_OPERATIONS WHERE city = 'CityA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (site_id INT, site_name VARCHAR(50), country VARCHAR(50)); INSERT INTO excavation_sites (site_id, site_name, country) VALUES (1, 'Site A', 'USA'); CREATE TABLE artifacts (artifact_id INT, site_id INT, category VARCHAR(50)); | What was the most common artifact category per site? | SELECT e.site_name, a.category, COUNT(*) as category_count FROM excavation_sites e JOIN artifacts a ON e.site_id = a.site_id GROUP BY e.site_id, e.site_name, a.category ORDER BY site_id, category_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE MaxPlayerScores (player_id INT, game_id INT, player_score INT); INSERT INTO MaxPlayerScores (player_id, game_id, player_score) VALUES (2, 1, 1800), (4, 2, 1900), (6, 3, 1600); | What is the maximum player score for each game? | SELECT G.game_name, MAX(MPS.player_score) as max_score FROM MaxPlayerScores MPS JOIN Games G ON MPS.game_id = G.game_id GROUP BY G.game_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE IndigenousCommunities (community VARCHAR(255), region VARCHAR(255)); INSERT INTO IndigenousCommunities (community, region) VALUES ('Inuit', 'Canada'), ('Inuit', 'Greenland'), ('Sami', 'Norway'), ('Sami', 'Sweden'), ('Nenets', 'Russia'); | What is the total number of indigenous communities in the Arctic regions? | SELECT region, COUNT(DISTINCT community) as num_communities FROM IndigenousCommunities GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_id INT, product_id INT, sourcing_distance FLOAT); INSERT INTO ingredients VALUES (1, 1, 250.5), (2, 1, 350.2), (3, 2, 150.8), (4, 2, 450.9); | What is the average sourcing distance for a given ingredient? | SELECT AVG(sourcing_distance) FROM ingredients WHERE ingredient_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ingredients (ingredient_id INT, ingredient_name VARCHAR(255), ingredient_category VARCHAR(255), quantity INT, purchase_price DECIMAL(5,2)); INSERT INTO Ingredients (ingredient_id, ingredient_name, ingredient_category, quantity, purchase_price) VALUES (1, 'Chickpeas', 'Legumes', 50, 1.25), (2, 'Chicken Brea... | Determine the inventory turnover rate for each ingredient category | SELECT ingredient_category, SUM(quantity) AS total_quantity, AVG(quantity) AS avg_quantity_sold, SUM(quantity) / (SELECT SUM(quantity) * purchase_price FROM Ingredients, Sales WHERE Ingredients.ingredient_id = Sales.ingredient_id GROUP BY Ingredients.ingredient_id) AS inventory_turnover_rate FROM Ingredients, Sales WHE... | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (id INT, initiative_type TEXT, region_id INT); CREATE TABLE regions (id INT, region TEXT); INSERT INTO initiatives (id, initiative_type, region_id) VALUES (1, 'Mitigation', 1), (2, 'Adaptation', 2), (3, 'Mitigation', 3); INSERT INTO regions (id, region) VALUES (1, 'Americas'), (2, 'Europe'), (3... | List all climate mitigation initiatives in 'Asia'. | SELECT initiatives.initiative_type FROM initiatives INNER JOIN regions ON initiatives.region_id = regions.id WHERE regions.region = 'Asia' AND initiatives.initiative_type = 'Mitigation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_incidents (id INT, district VARCHAR(20), type VARCHAR(20), date DATE); INSERT INTO emergency_incidents (id, district, type, date) VALUES (1, 'Downtown', 'Fire', '2022-01-01'); INSERT INTO emergency_incidents (id, district, type, date) VALUES (2, 'Uptown', 'Medical', '2022-01-02'); INSERT INTO eme... | What is the earliest date a medical emergency was recorded in the South district? | SELECT MIN(date) FROM emergency_incidents WHERE district = 'South' AND type = 'Medical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (faculty_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); INSERT INTO faculty VALUES (1, 'John Doe', 'Male', 'Computer Science'), (2, 'Jane Smith', 'Female', 'Computer Science'); CREATE TABLE grants (grant_id INT, faculty_id INT, amount FLOAT); INSERT INTO grants VALUES (1, 1,... | What is the total amount of research grants awarded to female faculty members in the Computer Science department? | SELECT SUM(amount) FROM grants JOIN faculty ON grants.faculty_id = faculty.faculty_id WHERE faculty.gender = 'Female' AND faculty.department = 'Computer Science'; | gretelai_synthetic_text_to_sql |
CREATE TABLE engineers (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), department VARCHAR(20)); | How many female engineers are there in the 'engineers' table? | SELECT COUNT(*) FROM engineers WHERE gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (id INT, dish_id INT, name TEXT, cost FLOAT, is_vegan BOOLEAN); INSERT INTO ingredients (id, dish_id, name, cost, is_vegan) VALUES (1, 1, 'Quinoa', 2.00, true), (2, 1, 'Olive Oil', 1.50, true), (3, 2, 'Chickpeas', 2.75, true), (4, 2, 'Coconut Milk', 3.00, true), (5, 3, 'Beef', 8.00, false); | What is the total cost of ingredients for vegan dishes in the sustainable menu? | SELECT SUM(cost) FROM ingredients WHERE is_vegan = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE olympic_medals (id INT, country VARCHAR(100), medal VARCHAR(10), olympics BOOLEAN); INSERT INTO olympic_medals (id, country, medal, olympics) VALUES (1, 'USA', 'Gold', true), (2, 'China', 'Silver', true), (3, 'Russia', 'Bronze', true); | How many medals were won by each country in the 2020 Olympics? | SELECT country, COUNT(*) FROM olympic_medals WHERE olympics = true GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE case_details(case_id INT, case_type VARCHAR(20), opened_date DATE, region VARCHAR(20)); INSERT INTO case_details(case_id, case_type, opened_date, region) VALUES (101, 'personal_injury', '2022-04-15', 'Northeast'), (102, 'divorce', '2021-09-28', 'Northeast'), (103, 'civil', '2022-02-14', 'Northeast'), (104,... | List all distinct case types that were opened in the 'Northeast' region in 2022. | SELECT DISTINCT case_type FROM case_details WHERE region = 'Northeast' AND YEAR(opened_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_visits (cargo_ship_id INT, port_id INT, visited DATE); CREATE TABLE cargo_ships (id INT, name TEXT, capacity INT); CREATE TABLE ports (id INT, name TEXT); INSERT INTO cargo_visits (cargo_ship_id, port_id, visited) VALUES (1, 2, DATE('2022-02-20')), (2, 3, DATE('2022-03-05')); INSERT INTO cargo_ships ... | List the names and capacities of cargo ships that have never visited 'Port of Tokyo'. | SELECT cargo_ships.name, cargo_ships.capacity FROM cargo_ships LEFT JOIN cargo_visits ON cargo_ships.id = cargo_visits.cargo_ship_id LEFT JOIN ports ON cargo_visits.port_id = ports.id WHERE ports.name IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Player (Player_ID INT, Name VARCHAR(50), Date_Joined DATE); INSERT INTO Player (Player_ID, Name, Date_Joined) VALUES (1, 'John Doe', '2019-06-15'), (2, 'Jane Smith', '2020-03-08'), (3, 'Alice Johnson', '2021-02-22'); | Update player records to set the name 'Alex Brown' if the Player_ID is 3 in the 'Player' table | UPDATE Player SET Name = 'Alex Brown' WHERE Player_ID = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE banks (id INT, name TEXT); CREATE TABLE shariah_loans (bank_id INT, amount DECIMAL, date DATE); INSERT INTO banks (id, name) VALUES (1, 'Bank A'), (2, 'Bank B'); INSERT INTO shariah_loans (bank_id, amount, date) VALUES (1, 5000, '2021-01-01'), (1, 7000, '2021-04-01'), (2, 6000, '2021-03-15'), (2, 8000, '20... | What is the total amount of Shariah-compliant loans issued by each bank in the last quarter? | SELECT b.name, SUM(sl.amount) as total_loans FROM banks b JOIN shariah_loans sl ON b.id = sl.bank_id WHERE sl.date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) GROUP BY b.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (productID INT, productName VARCHAR(50), productType VARCHAR(50), price DECIMAL(10,2), upcycled BOOLEAN, country VARCHAR(50)); CREATE TABLE Sales (saleID INT, productID INT, saleDate DATE); | What is the total revenue generated from upcycled clothing sales in the US for Q3 2022? | SELECT SUM(P.price) FROM Products P INNER JOIN Sales S ON P.productID = S.productID WHERE P.productType = 'clothing' AND P.upcycled = TRUE AND S.saleDate BETWEEN '2022-07-01' AND '2022-09-30' AND P.country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE department (id INT, name VARCHAR(255), college VARCHAR(255));CREATE TABLE grant (id INT, department_id INT, title VARCHAR(255), amount DECIMAL(10,2)); | What is the maximum amount of a research grant awarded to a department in the College of Science? | SELECT MAX(amount) FROM grant g JOIN department d ON g.department_id = d.id WHERE d.college = 'College of Science'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RouteDetails (route_id INT, shipment_id INT, distance FLOAT, delivery_date DATE); INSERT INTO RouteDetails (route_id, shipment_id, distance, delivery_date) VALUES (1, 1, 100, '2022-01-01'), (2, 2, 200, '2022-02-01'), (3, 3, 150, '2022-03-01'); | What is the total distance traveled for all shipments in the freight forwarding data? | SELECT SUM(distance) as total_distance FROM RouteDetails; | gretelai_synthetic_text_to_sql |
CREATE TABLE engineers (id INT, name VARCHAR(50), age INT, country VARCHAR(50), specialization VARCHAR(50)); INSERT INTO engineers (id, name, age, country, specialization) VALUES (1, 'Alice', 35, 'USA', 'Bioprocess Engineering'); INSERT INTO engineers (id, name, age, country, specialization) VALUES (2, 'Bob', 32, 'Cana... | Calculate the average age of bioprocess engineers in the engineers table | SELECT AVG(age) FROM engineers WHERE specialization = 'Bioprocess Engineering'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID INT, MenuItemID INT, Quantity INT, SaleDate DATETIME); INSERT INTO Sales (SaleID, MenuItemID, Quantity, SaleDate) VALUES (1, 1, 3, '2022-01-01 10:00:00'); INSERT INTO Sales (SaleID, MenuItemID, Quantity, SaleDate) VALUES (2, 2, 1, '2022-01-02 12:00:00'); INSERT INTO Sales (SaleID, MenuItemID,... | Which vegetarian menu items generate the most revenue? | SELECT MenuItems.MenuItemName, SUM(MenuItems.Price * Sales.Quantity) as Revenue FROM MenuItems JOIN Sales ON MenuItems.MenuItemID = Sales.MenuItemID WHERE MenuItems.Category = 'Vegetarian' GROUP BY MenuItems.MenuItemName ORDER BY Revenue DESC | gretelai_synthetic_text_to_sql |
CREATE TABLE exploration_data (data_id INT, well_id INT, date DATE, gas_production FLOAT, oil_production FLOAT); INSERT INTO exploration_data (data_id, well_id, date, gas_production, oil_production) VALUES (6, 6, '2020-01-01', 80.3, 250.2), (7, 7, '2020-02-15', 90.1, 300.5), (8, 8, '2019-12-10', 75.8, 275.3); | What is the average gas production for wells in Siberia? | SELECT well_id, AVG(gas_production) FROM exploration_data WHERE location = 'Siberia' GROUP BY well_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (usage_id INT, usage_type VARCHAR(20), state VARCHAR(20), volume FLOAT, usage_date DATE); INSERT INTO water_usage (usage_id, usage_type, state, volume, usage_date) VALUES (1, 'Agriculture', 'Texas', 10000, '2021-01-01'), (2, 'Agriculture', 'Texas', 12000, '2021-01-02'); | What is the total volume of water used for agricultural purposes in the state of Texas in the past year? | SELECT SUM(volume) FROM water_usage WHERE usage_type = 'Agriculture' AND state = 'Texas' AND usage_date >= DATEADD(year, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE SupplyChainSafety (safety_training BOOLEAN, country VARCHAR(255), year INT); | How many workers in the supply chain were provided with safety training in 2019, by each country? | SELECT country, COUNT(*) FROM SupplyChainSafety WHERE safety_training = TRUE AND year = 2019 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_companies (company VARCHAR(50), department VARCHAR(50), employee_name VARCHAR(50), salary INTEGER, company_location VARCHAR(50)); | List all tech companies in 'tech_companies' table located in 'California'. | SELECT company FROM tech_companies WHERE company_location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE grants (id INT, department VARCHAR(20), amount FLOAT); INSERT INTO grants (id, department, amount) VALUES (1, 'Arts and Humanities', 50000.0), (2, 'Sciences', 75000.0); | Find the total number of grants awarded by the 'Arts and Humanities' department | SELECT SUM(amount) FROM grants WHERE department = 'Arts and Humanities'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_reservations (reservation_id INT, hotel_id INT, guest_name TEXT, arrival_date DATE, departure_date DATE, num_guests INT, payment_amount FLOAT, is_cancelled BOOLEAN); | Show the number of reservations cancelled for each hotel | SELECT hotel_id, SUM(is_cancelled) FROM hotel_reservations GROUP BY hotel_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE arctic_biodiversity (id INTEGER, species_name TEXT, habitat TEXT, region TEXT); CREATE TABLE arctic_regions (id INTEGER, region TEXT); INSERT INTO arctic_regions (id, region) VALUES (1, 'north_arctic'), (2, 'south_arctic'); | How many species are present in the 'arctic_biodiversity' table for each type of habitat in the 'north_arctic' region? | SELECT habitat, COUNT(species_name) as species_count FROM arctic_biodiversity INNER JOIN arctic_regions ON arctic_biodiversity.region = arctic_regions.region WHERE arctic_regions.region = 'north_arctic' GROUP BY habitat; | gretelai_synthetic_text_to_sql |
CREATE TABLE UnionMembers (id INT, department VARCHAR(50), salary FLOAT); INSERT INTO UnionMembers (id, department, salary) VALUES (1, 'Accounting', 60000.0), (2, 'Marketing', 55000.0), (3, 'Accounting', 65000.0); | List the average salary for each department in the 'UnionMembers' table | SELECT department, AVG(salary) as avg_salary FROM UnionMembers GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), TotalSculptures INT); INSERT INTO Artists (ArtistID, ArtistName, TotalSculptures) VALUES (1, 'Auguste Rodin', 500), (2, 'Constantin Brancusi', 200), (3, 'Henry Moore', 300), (4, 'Barbara Hepworth', 150), (5, 'Alexander Calder', 400); | List the top 5 artists with the most sculptures in their portfolio. | SELECT ArtistName FROM (SELECT ArtistName, ROW_NUMBER() OVER (ORDER BY TotalSculptures DESC) as rank FROM Artists) AS subquery WHERE rank <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_demographics (fan_id INT PRIMARY KEY, name VARCHAR(100), age INT, gender VARCHAR(10), location VARCHAR(100), ethnicity VARCHAR(50)); INSERT INTO fan_demographics (fan_id, name, age, gender, location, ethnicity) VALUES (1, 'John Doe', 30, 'Male', 'NY', 'Hispanic'), (2, 'Jane Smith', 25, 'Female', 'LA', ... | Create a view named 'vw_fan_ethnicity_distribution' to display ethnicity distribution | CREATE VIEW vw_fan_ethnicity_distribution AS SELECT ethnicity, COUNT(*) as count FROM fan_demographics GROUP BY ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name TEXT, handling_time INT); INSERT INTO ports (id, name, handling_time) VALUES (1, 'Port of Santos', 120), (2, 'Port of Oakland', 90), (3, 'Port of Singapore', 100); | What is the average cargo handling time for 'Port of Santos'? | SELECT AVG(handling_time) FROM ports WHERE name = 'Port of Santos'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism (visitor_country VARCHAR(50), destination VARCHAR(50), is_sustainable BOOLEAN); INSERT INTO tourism (visitor_country, destination, is_sustainable) VALUES ('Japan', 'Galapagos Islands', true), ('Japan', 'Machu Picchu', false), ('Brazil', 'Iguazu Falls', true); | What is the total number of tourists from Japan visiting sustainable tourism destinations in South America? | SELECT COUNT(*) FROM tourism WHERE visitor_country = 'Japan' AND destination IN ('Galapagos Islands', 'Amazon Rainforest', 'Patagonia') AND is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_investments (id INT, client_id INT, country VARCHAR(50), investment_type VARCHAR(50)); INSERT INTO socially_responsible_investments (id, client_id, country, investment_type) VALUES (1, 401, 'Canada', 'Green Bonds'), (2, 402, 'Canada', 'Sustainable Equities'); | What is the distribution of socially responsible investment types in Canada? | SELECT country, investment_type, COUNT(*) as num_investments, 100.0 * COUNT(*) / (SELECT COUNT(*) FROM socially_responsible_investments WHERE country = 'Canada') as percentage FROM socially_responsible_investments WHERE country = 'Canada' GROUP BY country, investment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, financial_capability_score INT); CREATE TABLE shariah_finance (customer_id INT, product VARCHAR(255)); | List all customers with their financial capability score and corresponding Shariah-compliant finance product | SELECT customers.customer_id, customers.financial_capability_score, shariah_finance.product FROM customers INNER JOIN shariah_finance ON customers.customer_id = shariah_finance.customer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest_management (id INT, country VARCHAR(255), site_name VARCHAR(255), area FLOAT, population INT); INSERT INTO forest_management (id, country, site_name, area, population) VALUES (1, 'Canada', 'Site I', 50000.0, 38000000), (2, 'Brazil', 'Site J', 60000.0, 212000000), (3, 'Indonesia', 'Site K', 70000.0, ... | What is the total area of all forest management sites, in hectares, that are located in countries with a population of over 100 million? | SELECT SUM(area) FROM forest_management WHERE population > 100000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (policyholder_id INT, claim_amount DECIMAL(10,2), policyholder_state VARCHAR(20), claim_date DATE); INSERT INTO claims (policyholder_id, claim_amount, policyholder_state, claim_date) VALUES (1, 500.00, 'California', '2020-06-01'), (2, 300.00, 'Colorado', '2020-06-15'), (3, 700.00, 'California', '202... | Calculate the total claim amount paid to policyholders in 'California' and 'Colorado' in June 2020. | SELECT SUM(claim_amount) FROM claims WHERE policyholder_state IN ('California', 'Colorado') AND claim_date BETWEEN '2020-06-01' AND '2020-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (StudentID INT, Name VARCHAR(50), MentalHealthScore INT, GradeLevel INT); INSERT INTO Students (StudentID, Name, MentalHealthScore, GradeLevel) VALUES (3, 'Jim Brown', 82, 12); INSERT INTO Students (StudentID, Name, MentalHealthScore, GradeLevel) VALUES (4, 'Sara White', 78, 11); | What is the names and mental health scores of students who are in grade 12 and have a mental health score greater than 80? | SELECT Name, MentalHealthScore FROM Students WHERE GradeLevel = 12 INTERSECT SELECT Name, MentalHealthScore FROM Students WHERE MentalHealthScore > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (id INT PRIMARY KEY, project_name VARCHAR(255), project_location VARCHAR(255), project_type VARCHAR(255), capacity_mw FLOAT, carbon_offsets INT); CREATE VIEW german_projects AS SELECT * FROM renewable_projects WHERE project_location = 'Germany'; | Get the average carbon offsets for projects in Germany. | SELECT AVG(carbon_offsets) FROM german_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE GeostationarySatellites (id INT, satellite_name VARCHAR(50), operational_hours INT); | What is the minimum number of operational hours for a geostationary satellite? | SELECT MIN(operational_hours) FROM GeostationarySatellites WHERE operational_hours IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE households (household_id INT, customer_id INT); CREATE TABLE customers (customer_id INT, broadband_download_speed FLOAT); INSERT INTO households (household_id, customer_id) VALUES (1, 1), (1, 2); INSERT INTO customers (customer_id, broadband_download_speed) VALUES (1, 100), (2, 150); | What is the maximum and minimum broadband download speed for customers living in the same household? | SELECT MAX(c.broadband_download_speed), MIN(c.broadband_download_speed) FROM customers c JOIN households h ON c.customer_id = h.customer_id WHERE h.household_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE AnimalPopulation (animal_id INT, species VARCHAR(50), habitat_type VARCHAR(50), animal_count INT); | Find the number of animals in 'AnimalPopulation' grouped by 'habitat_type' | SELECT habitat_type, COUNT(*) as animal_count FROM AnimalPopulation GROUP BY habitat_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue_by_date (date DATE, restaurant VARCHAR(50), revenue INT); INSERT INTO revenue_by_date (date, restaurant, revenue) VALUES ('2022-01-01', 'Restaurant A', 3000), ('2022-01-01', 'Restaurant B', 4000), ('2022-01-01', 'Restaurant C', 5000), ('2022-01-02', 'Restaurant A', 4000), ('2022-01-02', 'Restaurant... | What is the total revenue for each restaurant on a specific day of the week? | SELECT restaurant, SUM(revenue) FROM revenue_by_date WHERE DATE_FORMAT(date, '%W') = 'Monday' GROUP BY restaurant; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_sales (id INT, country VARCHAR(50), vehicle_type VARCHAR(50), sales INT); | What is the number of hybrid vehicles sold in the US and Canada? | SELECT country, SUM(sales) FROM vehicle_sales WHERE country IN ('US', 'Canada') AND vehicle_type = 'hybrid' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(50), Gender VARCHAR(10), Salary FLOAT); INSERT INTO Employees (EmployeeID, Department, Gender, Salary) VALUES (1, 'IT', 'Male', 75000), (2, 'HR', 'Female', 65000), (3, 'IT', 'Female', 70000), (4, 'IT', 'Male', 80000), (5, 'Finance', 'Male', 90000), (6, 'Finance... | What is the minimum salary for employees in the Marketing department? | SELECT MIN(Salary) FROM Employees WHERE Department = 'Marketing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, name TEXT);CREATE TABLE projects (project_id INT, name TEXT, sector TEXT);CREATE TABLE donations (donation_id INT, donor_id INT, project_id INT, amount FLOAT);INSERT INTO donors VALUES (1, 'Ivan Black'), (2, 'Julia White'), (3, 'Karen Gray'), (4, 'Luke Brown');INSERT INTO projects VAL... | Which donors have donated to projects in both the 'education' and 'technology' sectors? | SELECT donors.donor_id, donors.name FROM donors INNER JOIN donations ON donors.donor_id = donations.donor_id INNER JOIN projects ON donations.project_id = projects.project_id WHERE projects.sector IN ('education', 'technology') GROUP BY donors.donor_id HAVING COUNT(DISTINCT projects.sector) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT PRIMARY KEY, city VARCHAR(255));CREATE TABLE complaints (id INT PRIMARY KEY, user_id INT, title VARCHAR(255)); | Identify the top 3 cities with the highest number of citizen complaints submitted, including the number of complaints submitted in each city. | SELECT u.city, COUNT(c.id) AS num_complaints FROM complaints c JOIN users u ON c.user_id = u.id GROUP BY u.city ORDER BY num_complaints DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (half INT, region VARCHAR(255), service VARCHAR(255), amount INT); INSERT INTO Budget (half, region, service, amount) VALUES (1, 'East', 'Healthcare', 5000000), (1, 'East', 'Healthcare', 5500000), (2, 'East', 'Healthcare', 6000000), (2, 'East', 'Healthcare', 6500000); | What was the total budget allocated for healthcare in the East region in the first half of 2022? | SELECT SUM(amount) FROM Budget WHERE half IN (1, 2) AND region = 'East' AND service = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Interviews (InterviewID int, InterviewDate date, CandidateName varchar(50), CandidateGender varchar(10), JobTitle varchar(50), Location varchar(50)); INSERT INTO Interviews (InterviewID, InterviewDate, CandidateName, CandidateGender, JobTitle, Location) VALUES (1, '2023-02-01', 'David Kim', 'Male', 'Softwa... | List the top 5 locations with the highest number of candidates interviewed for a job in the past month, including their respective job titles and the number of candidates interviewed? | SELECT Location, JobTitle, COUNT(*) AS num_candidates FROM Interviews WHERE InterviewDate >= DATEADD(month, -1, GETDATE()) GROUP BY Location, JobTitle ORDER BY num_candidates DESC, Location DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_treatment_plants (id INT, province VARCHAR(255), build_year INT); INSERT INTO wastewater_treatment_plants (id, province, build_year) VALUES (1, 'Quebec', 1985), (2, 'Quebec', 1995), (3, 'Quebec', 1988); | How many wastewater treatment plants are in the province of Quebec, Canada, that were built before 1990? | SELECT COUNT(*) FROM wastewater_treatment_plants WHERE province = 'Quebec' AND build_year < 1990; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_providers (id INT, name TEXT, specialty TEXT, location TEXT, population INT); INSERT INTO mental_health_providers (id, name, specialty, location, population) VALUES (1, 'Dr. Garcia', 'Mental Health', 'urban', 30000), (2, 'Dr. Kim', 'Mental Health', 'rural', 5000); | What is the average number of mental health providers per capita in urban areas, ordered by the highest average? | SELECT AVG(population / NULLIF(specialty = 'Mental Health', 0)) FROM mental_health_providers WHERE location = 'urban' GROUP BY location ORDER BY AVG(population / NULLIF(specialty = 'Mental Health', 0)) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT PRIMARY KEY, name VARCHAR(255), population INT, conservation_status VARCHAR(255)); | Add a column to 'species' | ALTER TABLE species ADD COLUMN last_sighting DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_recycling (city VARCHAR(255), recycling_rate DECIMAL(5,2), total_waste INT, day INT); INSERT INTO city_recycling (city, recycling_rate, total_waste, day) VALUES ('Berlin', 0.25, 80000, 3); | What is the daily recycling rate for the city of Berlin? | SELECT recycling_rate FROM city_recycling WHERE city='Berlin' AND day=3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Mine (MineID int, MineName varchar(50), Location varchar(50), Nationality varchar(50), EmployeeCount int, CoalQuantity int, IronQuantity int, GoldQuantity int); INSERT INTO Mine VALUES (1, 'ABC Mine', 'Colorado', 'American', 20, 1000, 1600, 2400), (2, 'DEF Mine', 'Wyoming', 'Canadian', 15, 1200, 1800, 3000... | What is the number of employees of each nationality working at each mine and their total quantity of resources mined? | SELECT MineName, Nationality, EmployeeCount, SUM(CoalQuantity + IronQuantity + GoldQuantity) as TotalResources FROM Mine GROUP BY MineName, Nationality; | gretelai_synthetic_text_to_sql |
CREATE TABLE PublicTransportation (TransportID INT, City VARCHAR(255), Type VARCHAR(255), AllocationDate DATE, Budget DECIMAL(10,2)); INSERT INTO PublicTransportation (TransportID, City, Type, AllocationDate, Budget) VALUES (1, 'Dallas', 'Bus', '2010-01-01', 100000.00), (2, 'Dallas', 'Train', '2015-01-01', 200000.00); | What is the total budget allocated for public transportation in the city of Dallas since its inception? | SELECT SUM(Budget) FROM PublicTransportation WHERE City = 'Dallas' AND Type = 'Public Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE extraction_extended (id INT, region TEXT, mineral TEXT, year INT, quantity INT, hour INT); INSERT INTO extraction_extended (id, region, mineral, year, quantity, hour) VALUES (1, 'north', 'X', 2021, 500, 8), (2, 'north', 'X', 2020, 550, 9), (3, 'south', 'X', 2021, 600, 10); | Which region extracted the most mineral X in the year 2021?' | SELECT region, SUM(quantity) AS total_quantity FROM extraction_extended WHERE mineral = 'X' AND year = 2021 GROUP BY region ORDER BY total_quantity DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE tangible_heritage (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO tangible_heritage (id, name, region) VALUES (1, 'Historic Centre of Salvador de Bahia', 'Amazon'); CREATE TABLE intangible_heritage (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO intangible_heritage (id, name, re... | How many heritage sites (tangible and intangible) are there in the Amazon region? | SELECT COUNT(*) FROM (SELECT 'tangible' as type, t.name FROM tangible_heritage t WHERE t.region = 'Amazon' UNION ALL SELECT 'intangible' as type, i.name FROM intangible_heritage i WHERE i.region = 'Amazon') AS h; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (ID VARCHAR(10), Name VARCHAR(20), Type VARCHAR(20), Safety_Score INT); INSERT INTO Vessels (ID, Name, Type, Safety_Score) VALUES ('1', 'Vessel A', 'Cargo', 95), ('2', 'Vessel B', 'Tanker', 88), ('3', 'Vessel C', 'Bulk Carrier', 92), ('4', 'Vessel D', 'Container', 85); CREATE TABLE Inspections (ID ... | List all vessels that have a safety inspection score above 90. | SELECT Vessels.Name FROM Vessels INNER JOIN Inspections ON Vessels.ID = Inspections.Vessel_ID WHERE Vessels.Safety_Score > 90; | gretelai_synthetic_text_to_sql |
CREATE TABLE sanctuary_e (animal_id INT, animal_name VARCHAR(50), population INT); INSERT INTO sanctuary_e VALUES (1, 'tiger', 25); INSERT INTO sanctuary_e VALUES (2, 'elephant', 30); INSERT INTO sanctuary_e VALUES (3, 'monkey', 35); | What are the names of the animals in 'sanctuary_e' and their respective populations? | SELECT animal_name, population FROM sanctuary_e; | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings (id INT, state VARCHAR(255), energy_efficiency_rating FLOAT); INSERT INTO buildings (id, state, energy_efficiency_rating) VALUES (1, 'CA', 90.5), (2, 'NY', 85.0), (3, 'FL', 95.0), (4, 'TX', 88.0), (5, 'CA', 92.0), (6, 'NY', 87.5), (7, 'FL', 94.5), (8, 'TX', 89.5); | What is the maximum energy efficiency rating for buildings in each of the following states: CA, NY, FL, TX? | SELECT state, MAX(energy_efficiency_rating) as max_rating FROM buildings WHERE state IN ('CA', 'NY', 'FL', 'TX') GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (patient_id INT, age INT, gender VARCHAR(10), state VARCHAR(10), disease VARCHAR(20)); INSERT INTO patient (patient_id, age, gender, state, disease) VALUES (1, 65, 'Male', 'rural India', 'Diabetes'); | How many patients with diabetes are there in rural communities in India? | SELECT COUNT(*) FROM patient WHERE gender = 'Male' AND state = 'rural India' AND disease = 'Diabetes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGameData (PlayerID INT, Game VARCHAR(20), Playtime INT); INSERT INTO PlayerGameData (PlayerID, Game, Playtime) VALUES (1, 'Adventure', 50), (2, 'Shooter', 30), (3, 'Adventure', 70); | What is the total playtime for all players who have played the game 'Adventure'? | SELECT SUM(Playtime) FROM PlayerGameData WHERE Game = 'Adventure'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_research_projects (id INT, name TEXT, location TEXT); INSERT INTO marine_research_projects (id, name, location) VALUES (1, 'Coral Reef Study', 'Mediterranean Sea'), (2, 'Turtle Migration Research', 'Atlantic Ocean'), (3, 'Plastic Pollution Analysis', 'Pacific Ocean'); | What is the total number of marine research projects in the Mediterranean Sea? | SELECT COUNT(*) FROM marine_research_projects WHERE location = 'Mediterranean Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, mental_health_score INT); | Show all students with a mental health score above 80 | SELECT * FROM student_mental_health WHERE mental_health_score > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (customer_id INT, customer_name VARCHAR(50), halal_purchase_value DECIMAL(10,2)); INSERT INTO Customers (customer_id, customer_name, halal_purchase_value) VALUES (1, 'Sara', 300.50), (2, 'Aisha', 450.25), (3, 'John', 0), (4, 'Fatima', 560.75), (5, 'David', 0), (6, 'Maryam', 600.00), (7, 'Ahmed', ... | Who are the top 5 customers based on their purchases of halal cosmetics? | SELECT customer_name FROM Customers ORDER BY halal_purchase_value DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (player_id INTEGER, name TEXT, three_pointers INTEGER); INSERT INTO Players (player_id, name, three_pointers) VALUES (1, 'Player 1', 200), (2, 'Player 2', 250), (3, 'Player 3', 300); | Find the basketball player with the most three-pointers made in a season? | SELECT name FROM Players WHERE three_pointers = (SELECT MAX(three_pointers) FROM Players); | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (product_id INT, material_id INT, quantity INT); | Delete a product's material from the "inventory" table | DELETE FROM inventory WHERE product_id = 1001 AND material_id = 3001; | gretelai_synthetic_text_to_sql |
CREATE TABLE CaseTypeBilling (CaseType VARCHAR(50), TotalAmount DECIMAL(10,2)); INSERT INTO CaseTypeBilling (CaseType, TotalAmount) VALUES ('Civil', 0); INSERT INTO CaseTypeBilling (CaseType, TotalAmount) VALUES ('Criminal', 0); | What is the total billing amount for cases of each type? | UPDATE CaseTypeBilling SET TotalAmount = (SELECT SUM(B.Amount) FROM Billing B JOIN CaseBilling CB ON B.BillingID = CB.BillingID JOIN Cases C ON CB.CaseID = C.CaseID WHERE C.CaseType = CaseTypeBilling.CaseType); | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovations (id INT, innovation_name VARCHAR(255), country VARCHAR(255), sector VARCHAR(255)); | Insert new records into the 'agricultural_innovations' table for a new crop variety in India | INSERT INTO agricultural_innovations (id, innovation_name, country, sector) VALUES (1, 'Drought-resistant Maize', 'India', 'Agriculture'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtMovements (MovementID int, MovementName varchar(100), YearStart int, YearEnd int, CulturalImpact int); INSERT INTO ArtMovements (MovementID, MovementName, YearStart, YearEnd, CulturalImpact) VALUES (1, 'Romanticism', 1800, 1850, 90), (2, 'Realism', 1848, 1890, 85), (3, 'Impressionism', 1860, 1890, 80); | What are the names of the art movements that had the most significant cultural impact in the 19th century? | SELECT MovementName FROM ArtMovements WHERE YearStart BETWEEN 1800 AND 1899 AND CulturalImpact = (SELECT MAX(CulturalImpact) FROM ArtMovements WHERE YearStart BETWEEN 1800 AND 1899); | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT PRIMARY KEY, name VARCHAR(100), age INT, state VARCHAR(2), income FLOAT); | Update the age of donor with id 1 to 30 | UPDATE donors SET age = 30 WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_research (id INT, species TEXT, location TEXT, year INT, population INT); INSERT INTO marine_species_research (id, species, location, year, population) VALUES (1, 'Whale Shark', 'Atlantic Ocean', 2010, 12000), (2, 'Dolphin', 'Atlantic Ocean', 2005, 5000), (3, 'Turtle', 'Atlantic Ocean', 2018... | How many marine species have been researched in the Atlantic Ocean that have a population greater than 10000? | SELECT COUNT(*) FROM marine_species_research WHERE location = 'Atlantic Ocean' AND population > 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryVehicles (Id INT, Country VARCHAR(50), VehicleType VARCHAR(50), Quantity INT);INSERT INTO MilitaryVehicles (Id, Country, VehicleType, Quantity) VALUES (1, 'USA', 'Tank', 3000), (2, 'Canada', 'Armored Personnel Carrier', 1500), (3, 'Mexico', 'Artillery', 1000); | What is the average quantity of military vehicles per country in the North American region? | SELECT AVG(Quantity) AS AverageQuantity FROM (SELECT Country, SUM(Quantity) Quantity FROM MilitaryVehicles WHERE Country IN ('USA', 'Canada', 'Mexico') GROUP BY Country) AS Subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name TEXT, country TEXT); INSERT INTO farmers (id, name, country) VALUES (1, 'John', 'Kenya'), (2, 'Jane', 'Uganda'); CREATE TABLE initiatives (id INT, name TEXT, location TEXT); INSERT INTO initiatives (id, name, location) VALUES (1, 'Training', 'Kenya'), (2, 'Workshop', 'Uganda'); CREATE... | What is the total number of farmers who have participated in community development initiatives in Kenya and Uganda? | SELECT COUNT(DISTINCT f.id) FROM farmers f INNER JOIN participation p ON f.id = p.farmer_id INNER JOIN initiatives i ON p.initiative_id = i.id WHERE f.country IN ('Kenya', 'Uganda'); | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_emissions (country VARCHAR(50), emissions INT); INSERT INTO carbon_emissions (country, emissions) VALUES ('CN', 10000), ('IN', 7000), ('US', 5000); | What are the carbon emissions (in metric tons) for each country? | SELECT country, emissions FROM carbon_emissions; | gretelai_synthetic_text_to_sql |
CREATE TABLE Research (id INT, title VARCHAR(100), country VARCHAR(100), year INT, cost FLOAT); INSERT INTO Research (id, title, country, year, cost) VALUES (1, 'Project A', 'US', 2010, 100000), (2, 'Project B', 'US', 2011, 120000); | What is the total cost of astrophysics research conducted in the US in 2010? | SELECT SUM(cost) FROM Research WHERE country = 'US' AND year = 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stores (StoreID INT, StoreName VARCHAR(50));CREATE TABLE Menu (MenuID INT, MenuItem VARCHAR(50), IsVegetarian BIT);CREATE TABLE Sales (SaleID INT, StoreID INT, MenuID INT, QuantitySold INT, SaleDate DATE); | What is the total quantity of vegetarian dishes sold per store, per day? | SELECT SaleDate, StoreName, SUM(QuantitySold) AS TotalQuantity FROM Sales JOIN Menu ON Sales.MenuID = Menu.MenuID JOIN Stores ON Sales.StoreID = Stores.StoreID WHERE IsVegetarian = 1 GROUP BY SaleDate, StoreName; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (animal_id INT, species VARCHAR(50), num_animals INT, education_program BOOLEAN); | What is the total number of animals in the 'animal_population' table, grouped by species, that were part of community education programs? | SELECT species, SUM(num_animals) FROM animal_population WHERE education_program = TRUE GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (id INT, name VARCHAR(50)); INSERT INTO ports (id, name) VALUES (1, 'Oakland'), (2, 'Long Beach'), (3, 'Los Angeles'); CREATE TABLE cargo (id INT, port_id INT, cargo_type VARCHAR(50), temperature_type VARCHAR(50), quantity INT); INSERT INTO cargo (id, port_id, cargo_type, temperature_type, quantity) ... | What was the total quantity of refrigerated cargo unloaded at the port of Long Beach in August 2021, grouped by cargo type? | SELECT cargo_type, SUM(quantity) as total_quantity FROM cargo WHERE port_id = 2 AND temperature_type = 'Refrigerated' AND MONTH(date) = 8 GROUP BY cargo_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE product (product_id INT, name VARCHAR(50), rating DECIMAL(3,2), num_ratings INT); INSERT INTO product VALUES (1, 'Product A', 4.5, 100), (2, 'Product B', 3.5, 200), (3, 'Product C', 5.0, 50); | What is the average rating for each product, and the number of ratings for each product, ordered by the average rating in descending order? | SELECT name, AVG(rating) as avg_rating, num_ratings FROM product GROUP BY name ORDER BY avg_rating DESC, num_ratings DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (id INT, name TEXT, industry TEXT, location TEXT); INSERT INTO Companies (id, name, industry, location) VALUES (1, 'GreenTech Inc.', 'Renewable Energy', 'Texas'), (2, 'EcoPower LLC.', 'Energy Efficiency', 'Texas'); CREATE TABLE EnergyEfficiency (company_id INT, year INT, efficiency_score INT); IN... | What are the energy efficiency stats for companies in Texas? | SELECT Companies.name, EnergyEfficiency.efficiency_score FROM Companies INNER JOIN EnergyEfficiency ON Companies.id = EnergyEfficiency.company_id WHERE Companies.location = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CoOwnershipProperties (PropertyID INT, OwnerID INT); CREATE TABLE Owners (OwnerID INT, OwnerName VARCHAR(255)); | What is the total number of properties owned by each owner in co-ownership properties? | SELECT O.OwnerName, COUNT(COP.PropertyID) as TotalPropertiesOwned FROM Owners O JOIN CoOwnershipProperties COP ON O.OwnerID = COP.OwnerID GROUP BY O.OwnerName; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (id INT, name TEXT, category TEXT, assets FLOAT); CREATE TABLE investments (id INT, client_id INT, product_code TEXT); INSERT INTO clients (id, name, category, assets) VALUES (1, 'John Doe', 'Medium-Risk', 50000.00), (2, 'Jane Smith', 'Low-Risk', 75000.00), (3, 'Alice Johnson', 'High-Risk', 100000.... | What is the minimum assets value for clients in the 'High-Risk' category who own investment product 'GOOG'? | SELECT MIN(assets) FROM clients c JOIN investments i ON c.id = i.client_id WHERE c.category = 'High-Risk' AND i.product_code = 'GOOG'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PeacekeepingOperations (OperationID INT, OperationName VARCHAR(100), OperationType VARCHAR(50), StartDate DATE, EndDate DATE); | What is the number of peacekeeping operations conducted by the UN in the Middle East region? | SELECT COUNT(OperationID) FROM PeacekeepingOperations WHERE OperationType = 'Peacekeeping' AND (StartDate BETWEEN '2000-01-01' AND '2022-12-31') AND (EndDate BETWEEN '2000-01-01' AND '2022-12-31') AND (OperationName LIKE '%Middle East%'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Streams (song_genre VARCHAR(255), city VARCHAR(255), stream_count INT, stream_date DATE); INSERT INTO Streams (song_genre, city, stream_count, stream_date) VALUES ('pop', 'New York', 500, '2022-01-01'), ('hip-hop', 'Los Angeles', 600, '2022-01-02'); | What is the average number of streams per day for pop songs in New York last month? | SELECT AVG(stream_count/1.0) FROM Streams WHERE song_genre = 'pop' AND city = 'New York' AND stream_date >= DATEADD(MONTH, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE ManufacturingDates (ManufacturingDate DATE, GarmentID INT); INSERT INTO ManufacturingDates (ManufacturingDate, GarmentID) VALUES ('2022-10-01', 1), ('2022-11-01', 2), ('2022-12-01', 3); CREATE TABLE Garments (GarmentID INT, GarmentType VARCHAR(20), ManufacturerID INT, Country VARCHAR(50)); INSERT INTO Garm... | How many garments were produced in 'France' for each month in the 'Autumn 2022' season? | SELECT EXTRACT(MONTH FROM ManufacturingDate) as Month, COUNT(*) as TotalGarments FROM ManufacturingDates M JOIN Garments G ON M.GarmentID = G.GarmentID WHERE Country = 'France' AND ManufacturingDate BETWEEN '2022-10-01' AND '2022-12-31' GROUP BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs_2(drug_name TEXT, approval_year INT, rd_expenditure FLOAT); INSERT INTO drugs_2(drug_name, approval_year, rd_expenditure) VALUES('DrugA', 2017, 5000000), ('DrugB', 2018, 7000000), ('DrugC', 2019, 8000000), ('DrugD', 2019, 6000000), ('DrugE', 2018, 4000000); | Find the maximum and minimum R&D expenditure for the drugs approved in 2018 and 2019. | SELECT MAX(rd_expenditure), MIN(rd_expenditure) FROM drugs_2 WHERE approval_year IN (2018, 2019); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(255), ocean_basin VARCHAR(50)); INSERT INTO marine_species (species_id, species_name, ocean_basin) VALUES (1, 'Green Sea Turtle', 'Pacific'), (2, 'Humpback Whale', 'Atlantic'); | How many marine species are there in each ocean basin? | SELECT ocean_basin, COUNT(*) FROM marine_species GROUP BY ocean_basin; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name TEXT, country TEXT, transaction_amount DECIMAL); INSERT INTO clients (client_id, name, country, transaction_amount) VALUES (1, 'John Doe', 'Australia', 500.00); INSERT INTO clients (client_id, name, country, transaction_amount) VALUES (2, 'Jane Smith', 'United States', 350.00);... | What is the count of transactions for clients living in Australia? | SELECT COUNT(*) FROM clients WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT); CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount DECIMAL(10,2)); INSERT INTO Donors (DonorID, DonorName) VALUES (1, 'John Doe'), (2, 'Jane Smith'), (3, 'Alice Johnson'); INSERT INTO Donations (DonationID, DonorID, DonationAmount) VALUES (1, 1, 500.00... | What is the percentage of donations made by each donor compared to the total donations? | SELECT DonorName, SUM(DonationAmount) AS TotalDonation, SUM(DonationAmount) OVER () AS TotalDonations, (SUM(DonationAmount) / SUM(DonationAmount) OVER ()) * 100.0 AS DonationPercentage FROM Donors dn JOIN Donations d ON dn.DonorID = d.DonorID GROUP BY DonorName; | 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.