context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE sales (id INT, strain TEXT, quantity INT, date DATE); INSERT INTO sales (id, strain, quantity, date) VALUES (1, 'Purple Haze', 25, '2022-01-01'), (2, 'Green Crack', 30, '2022-01-02'), (3, 'OG Kush', 20, '2022-01-03'), (4, 'Purple Haze', 35, '2022-01-04'); | What is the total quantity sold for the 'Green Crack' strain? | SELECT SUM(quantity) FROM sales WHERE strain = 'Green Crack'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Harris_Sales (id INT, corporation VARCHAR(20), customer VARCHAR(20), quantity INT, equipment VARCHAR(20)); INSERT INTO Harris_Sales (id, corporation, customer, quantity, equipment) VALUES (1, 'Harris Corporation', 'United Kingdom', 12, 'UAVs'); | What is the total number of unmanned aerial vehicles (UAVs) sold by Harris Corporation in the United Kingdom? | SELECT SUM(quantity) FROM Harris_Sales WHERE corporation = 'Harris Corporation' AND customer = 'United Kingdom' AND equipment = 'UAVs'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inclusive_cities (id INT, city VARCHAR(255), policy_count INT); INSERT INTO inclusive_cities (id, city, policy_count) VALUES (1, 'City X', 3), (2, 'City Y', 2), (3, 'City Z', 1); | Get the number of inclusive policies for each city in inclusive_cities table. | SELECT city, policy_count FROM inclusive_cities; | gretelai_synthetic_text_to_sql |
CREATE TABLE genre_user_streams (genre VARCHAR(10), user_id INT); | Show the number of users who have streamed a song from each genre, excluding the electronic genre, without listing users more than once. | SELECT genre, COUNT(DISTINCT user_id) FROM genre_user_streams WHERE genre != 'electronic' GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_projects (project_id INT, project_name TEXT, leader TEXT, region TEXT, investment_amount INT, year INT); INSERT INTO agricultural_projects (project_id, project_name, leader, region, investment_amount, year) VALUES (1, 'Organic Farming', 'Juana Topan', 'Asia', 1500000, 2021); INSERT INTO agricu... | What is the total investment in 'indigenous women-led' agricultural projects in 'Asia' up to 2022? | SELECT SUM(investment_amount) FROM agricultural_projects WHERE year <= 2022 AND region = 'Asia' AND leader LIKE '%indigenous woman%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT, organization VARCHAR(255), operation VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO peacekeeping_operations (id, organization, operation, start_date, end_date) VALUES (1, 'United Nations', 'Operation Unified Protector', '2011-03-24', '2011-10-31'), (2, 'European... | What is the total number of peacekeeping operations conducted by 'United Nations' and 'European Union'? | SELECT COUNT(*) FROM peacekeeping_operations WHERE organization IN ('United Nations', 'European Union'); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, race VARCHAR(25), therapy_date DATE); INSERT INTO patients (id, race, therapy_date) VALUES (1, 'Black or African American', '2021-01-15'), (2, 'White', '2021-01-20'), (3, 'Hispanic or Latino', '2021-02-03'), (4, 'Asian', '2021-03-10'), (5, 'Black or African American', '2021-01-08'), (6, '... | What is the number of patients who identified as Black or African American and received therapy in Q1 2021? | SELECT COUNT(*) FROM patients WHERE race = 'Black or African American' AND therapy_date >= '2021-01-01' AND therapy_date < '2021-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalHeritageSites (site_id INT, site_name TEXT, country TEXT, has_virtual_tour BOOLEAN); INSERT INTO CulturalHeritageSites (site_id, site_name, country, has_virtual_tour) VALUES (1, 'Site A', 'Germany', TRUE), (2, 'Site B', 'Italy', FALSE), (3, 'Site C', 'Greece', TRUE); | Which countries have no cultural heritage sites with virtual tours? | SELECT country FROM CulturalHeritageSites WHERE has_virtual_tour = FALSE GROUP BY country HAVING COUNT(*) = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, company_name TEXT, state TEXT, contract_value FLOAT); INSERT INTO defense_contracts (contract_id, company_name, state, contract_value) VALUES (1, 'ABC Corp', 'Texas', 5000000), (2, 'DEF Inc', 'California', 7000000); | Calculate the total value of defense contracts for each state | SELECT state, SUM(contract_value) FROM defense_contracts GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_bookings (hotel_id INT, user_id INT, booking_date DATE, price DECIMAL(5,2)); INSERT INTO hotel_bookings (hotel_id, user_id, booking_date, price) VALUES (1, 23, '2022-01-01', 120.00), (2, 45, '2022-01-05', 250.00); CREATE TABLE hotel_ai_usage (hotel_id INT, ai_usage INT); INSERT INTO hotel_ai_usage (h... | Find hotels with below-average AI assistant usage and above-average booking prices | SELECT hotel_id FROM hotel_bookings INNER JOIN hotel_ai_usage ON hotel_bookings.hotel_id = hotel_ai_usage.hotel_id WHERE ai_usage < (SELECT AVG(ai_usage) FROM hotel_ai_usage) AND price > (SELECT AVG(price) FROM hotel_bookings); | gretelai_synthetic_text_to_sql |
CREATE TABLE prices (id INT, event TEXT, category TEXT, price DECIMAL(5,2), quantity INT); INSERT INTO prices (id, event, category, price, quantity) VALUES (1, 'Concert', 'music', 50.00, 100), (2, 'Jazz Festival', 'music', 35.00, 200), (3, 'Theatre Play', 'theatre', 75.00, 150); | What is the average ticket price for each cultural event category, and how many events are there in total for each category? | SELECT category, AVG(price) as avg_price, COUNT(DISTINCT event) as num_events FROM prices GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_sourcing (id INT, item_id INT, fabric TEXT, cost DECIMAL); | What is the average textile sourcing cost for a specific fabric type? | SELECT AVG(cost) FROM textile_sourcing WHERE fabric = 'cotton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_vehicles (vehicle_id INT, city VARCHAR(50), is_ev BOOLEAN); | What is the percentage of electric vehicles by city? | SELECT city, AVG(is_ev) as avg_is_ev FROM city_vehicles GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewables.solar_installations (installation_id int, name varchar(50), capacity int); INSERT INTO renewables.solar_installations (installation_id, name, capacity) VALUES (1, 'Installation X', 250), (2, 'Installation Y', 300); CREATE TABLE energy_storage.solar_storage (storage_id int, installation_id int, c... | What is the number of solar installations in 'renewables' and 'energy_storage' schemas? | SELECT COUNT(DISTINCT r.installation_id) + COUNT(DISTINCT e.installation_id) FROM renewables.solar_installations r JOIN energy_storage.solar_storage e ON r.installation_id = e.installation_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT PRIMARY KEY, name TEXT); INSERT INTO regions (id, name) VALUES (1, 'Andalusia'); CREATE TABLE public_consultations (id INT PRIMARY KEY, region_id INT, year INT, number INT); INSERT INTO public_consultations (id, region_id, year, number) VALUES (1, 1, 2020, 12); INSERT INTO public_consultati... | How many public consultations were conducted in the region of Andalusia in 2020? | SELECT number FROM public_consultations WHERE region_id = (SELECT id FROM regions WHERE name = 'Andalusia') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE CaseBilling (CaseID INT, AttorneyID INT, BillingAmount DECIMAL(10,2)); INSERT INTO CaseBilling (CaseID, AttorneyID, BillingAmount) VALUES (5, 3, 6000.00), (7, 3, 10000.00), (8, 4, 7000.00); | What is the maximum billing amount for cases handled by the attorney with the ID '3'? | SELECT MAX(BillingAmount) FROM CaseBilling WHERE AttorneyID = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryBudget (region VARCHAR(255), program VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO MilitaryBudget (region, program, budget) VALUES ('Asia-Pacific', 'ProgramA', 400000000.00), ('Asia-Pacific', 'ProgramB', 600000000.00), ('Asia-Pacific', 'ProgramC', 50000000.00), ('Europe', 'ProgramD', 300000000.0... | What is the average budget for military technology programs in the Asia-Pacific region, excluding programs with a budget below $200 million? | SELECT AVG(budget) FROM MilitaryBudget WHERE region = 'Asia-Pacific' AND budget >= 200000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ClothingItems (id INT, item VARCHAR(20)); CREATE TABLE SizeDistribution (id INT, item_id INT, size VARCHAR(5), count INT); | What is the distribution of clothing item sizes for each clothing item? | SELECT ClothingItems.item, SizeDistribution.size, COUNT(SizeDistribution.count) as count FROM ClothingItems INNER JOIN SizeDistribution ON ClothingItems.id = SizeDistribution.item_id GROUP BY ClothingItems.item, SizeDistribution.size; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Engines (id INT, name VARCHAR(50), manufacturer VARCHAR(50), num_engines INT); INSERT INTO Aircraft_Engines (id, name, manufacturer, num_engines) VALUES (1, 'A350-900', 'Airbus', 2), (2, 'A350-1000', 'Airbus', 3), (3, '787', 'Boeing', 2); | What is the total number of engines on Airbus A350 aircraft? | SELECT SUM(num_engines) FROM Aircraft_Engines WHERE manufacturer = 'Airbus' AND name LIKE 'A350%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_assistance (id INT, country VARCHAR(255), family_id INT, amount INT); INSERT INTO food_assistance (id, country, family_id, amount) VALUES (1, 'South Sudan', 1, 200), (2, 'South Sudan', 2, 250), (3, 'Kenya', 3, 300), (4, 'Kenya', 4, 350); | What is the average amount of food assistance provided to families in South Sudan and Kenya? | SELECT country, AVG(amount) FROM food_assistance GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, country VARCHAR(50)); INSERT INTO campaigns (campaign_id, country) VALUES (1, 'United States'), (2, 'Canada'), (3, 'Mexico'); | How many mental health campaigns were launched in the United States and Canada combined? | SELECT COUNT(*) FROM campaigns WHERE country IN ('United States', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE infectious_disease (id INT, state VARCHAR(2), disease VARCHAR(50), cases INT); INSERT INTO infectious_disease (id, state, disease, cases) VALUES (1, 'NY', 'Flu', 5000), (2, 'CA', 'Flu', 7000), (3, 'TX', 'Flu', 6000), (4, 'FL', 'Flu', 4000), (5, 'NY', 'Measles', 200), (6, 'CA', 'Measles', 300), (7, 'TX', 'M... | What is the number of infectious disease cases for each state in the US? | SELECT state, SUM(cases) as total_cases FROM infectious_disease GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Age INT, Genre VARCHAR(50)); INSERT INTO Artists VALUES (1, 'Artist1', 35, 'Rock'); INSERT INTO Artists VALUES (2, 'Artist2', 45, 'Rock'); CREATE TABLE Festivals (FestivalID INT, FestivalName VARCHAR(100), ArtistID INT); INSERT INTO Festivals VALUES (1, 'Fest... | What is the average age of all rock artists who have performed at music festivals? | SELECT AVG(A.Age) FROM Artists A INNER JOIN Festivals F ON A.ArtistID = F.ArtistID WHERE A.Genre = 'Rock'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fair_trade_items (item_id INT, category VARCHAR(255), price DECIMAL(10,2)); INSERT INTO fair_trade_items (item_id, category, price) VALUES (1, 'Fair Trade', 50.00), (2, 'Fair Trade', 75.00), (3, 'Fair Trade', 100.00); | What is the minimum price of items in the 'Fair Trade' category? | SELECT category, MIN(price) as min_price FROM fair_trade_items WHERE category = 'Fair Trade' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (ID INT, Name VARCHAR(255), SafetyScore INT, LastSafetyCheck DATETIME); INSERT INTO Vessels (ID, Name, SafetyScore, LastSafetyCheck) VALUES (5, 'Pacific Voyager', 92, '2022-02-18'), (6, 'Marine Marvel', 95, '2022-02-20'); | What is the rank of the vessel 'Pacific Voyager' based on its safety score in the last month? | SELECT Name, SafetyScore, RANK() OVER (ORDER BY SafetyScore DESC) as Rank FROM Vessels WHERE LastSafetyCheck >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (state VARCHAR(255), volume INT); INSERT INTO Production (state, volume) VALUES ('OR', 10000), ('WA', 12000), ('CA', 15000), ('CO', 13000), ('MI', 8000); | What is the total production volume of cannabis in Oregon and Washington combined? | SELECT SUM(volume) FROM Production WHERE state IN ('OR', 'WA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE company_investments (id INT, company_name VARCHAR(50), ethical_ai_investment DECIMAL(5,2), investment_date DATE); INSERT INTO company_investments (id, company_name, ethical_ai_investment, investment_date) VALUES (1, 'Company1', 15000.00, '2021-01-15'); INSERT INTO company_investments (id, company_name, eth... | Who are the top 3 companies in terms of ethical AI investment? | SELECT company_name, SUM(ethical_ai_investment) OVER (PARTITION BY company_name) AS total_investment, RANK() OVER (ORDER BY SUM(ethical_ai_investment) DESC) AS rank FROM company_investments; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), amount INT, year INT); INSERT INTO production (country, amount, year) VALUES ('China', 140000, 2022); INSERT INTO production (country, amount, year) VALUES ('USA', 35000, 2022); | Which countries have the highest REE production in 2022? | SELECT country, SUM(amount) as total_production FROM production WHERE year = 2022 GROUP BY country ORDER BY total_production DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, organization VARCHAR(255), region VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO projects (id, organization, region, start_date, end_date) VALUES (1, 'UNICEF', 'Africa', '2017-01-01', '2017-12-31'), (2, 'World Food Programme', 'Africa', '2017-01-01', '2017-12-31'), (3, 'Save t... | How many community development projects were carried out by each organization in Africa in 2017? | SELECT organization, COUNT(*) as number_of_projects FROM projects WHERE region = 'Africa' AND YEAR(start_date) = 2017 GROUP BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse_data (warehouse_id INT, item_name VARCHAR(100), quantity INT, warehouse_location VARCHAR(50)); INSERT INTO warehouse_data (warehouse_id, item_name, quantity, warehouse_location) VALUES (1, 'Widget', 30, 'California'), (2, 'Gizmo', 50, 'New York'), (3, 'Doodad', 75, 'California'), (4, 'Thingamajig... | Which warehouse locations have more than 100 items in stock? | SELECT warehouse_location FROM warehouse_data GROUP BY warehouse_location HAVING SUM(quantity) > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE museum_events (id INT, name VARCHAR(255), date DATE, museum_name VARCHAR(255), attendance INT); INSERT INTO museum_events (id, name, date, museum_name, attendance) VALUES (1, 'Art Exhibition', '2020-02-01', 'German Museum', 1500), (2, 'History Conference', '2020-03-15', 'German Museum', 1200), (3, 'Science... | What is the total attendance at events organized by museums in Germany? | SELECT SUM(attendance) FROM museum_events WHERE museum_name LIKE '%German%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_games (player_id INT, game VARCHAR(10)); INSERT INTO player_games (player_id, game) VALUES (1, 'Game1'), (1, 'Game1'), (2, 'Game2'), (3, 'Game1'); | What is the number of players who play a game more than once, partitioned by game? | SELECT game, COUNT(DISTINCT player_id) as num_players FROM player_games GROUP BY game HAVING COUNT(DISTINCT player_id) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturing (product_id INT, material VARCHAR(20), quantity INT, manufacturing_date DATE); INSERT INTO Manufacturing (product_id, material, quantity, manufacturing_date) VALUES (1, 'Organic Cotton', 50, '2022-01-01'); | What is the total quantity of sustainable materials used in manufacturing, grouped by quarter? | SELECT DATE_FORMAT(manufacturing_date, '%Y-%m') as quarter, SUM(quantity) as total_quantity FROM Manufacturing WHERE material IN ('Organic Cotton', 'Recycled Polyester') GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonorID INT, DonationDate DATE, Amount DECIMAL(10,2), State TEXT); INSERT INTO Donations (DonorID, DonationDate, Amount, State) VALUES (1, '2021-01-02', 500, 'NY'), (2, '2021-03-15', 250, 'NJ'), (1, '2021-02-28', 300, 'NY'), (3, '2021-01-15', 150, 'CA'); | What was the average donation amount by State in H1 2021? | SELECT State, AVG(Amount) as AvgDonation FROM Donations WHERE DonationDate BETWEEN '2021-01-01' AND '2021-06-30' GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT PRIMARY KEY, title VARCHAR(100), release_year INT, genre VARCHAR(50), network VARCHAR(50)); INSERT INTO tv_shows (id, title, release_year, genre, network) VALUES (1, 'Stranger Things', 2016, 'Sci-fi', 'Netflix'); CREATE TABLE viewership (id INT PRIMARY KEY, tv_show_id INT, viewer_count INT... | What is the total number of viewers for TV shows released after 2015? | SELECT SUM(viewership.viewer_count) FROM tv_shows JOIN viewership ON tv_shows.id = viewership.tv_show_id WHERE tv_shows.release_year > 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (id INT, name VARCHAR(50), agency VARCHAR(50), missions_participated INT); INSERT INTO Astronauts (id, name, agency, missions_participated) VALUES (1, 'Neil Armstrong', 'NASA', 3), (2, 'Buzz Aldrin', 'NASA', 2), (3, 'John Glenn', 'NASA', 2), (4, 'Valentina Tereshkova', 'Roscosmos', 3), (5, 'Yuri... | Which astronauts have participated in missions with astronauts from other agencies? | SELECT a1.name as astronaut1, a2.name as astronaut2 FROM Astronauts a1 CROSS JOIN Astronauts a2 WHERE a1.id != a2.id AND EXISTS (SELECT 1 FROM (SELECT agency FROM Astronauts WHERE id = a1.id) a GROUP BY a.agency HAVING COUNT(DISTINCT a.agency) > 1 AND a.agency = ANY (SELECT agency FROM Astronauts WHERE id = a2.id)); | gretelai_synthetic_text_to_sql |
CREATE TABLE social_impact_bonds (sector VARCHAR(50), investment_amount INT); INSERT INTO social_impact_bonds (sector, investment_amount) VALUES ('Education', 2000000), ('Healthcare', 3000000), ('Housing', 1500000), ('Employment', 1000000), ('Criminal Justice', 1200000); | What is the total investment in social impact bonds in the education sector? | SELECT SUM(investment_amount) as total_investment FROM social_impact_bonds WHERE sector = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (concert_id INT PRIMARY KEY, artist_name VARCHAR(100), concert_date DATE, location VARCHAR(100), tickets_sold INT); INSERT INTO concerts (concert_id, artist_name, concert_date, location, tickets_sold) VALUES (1, 'Taylor Swift', '2023-06-15', 'New York City', 25000); INSERT INTO concerts (concert_i... | Find total tickets sold for all concerts in 'New York City' | SELECT SUM(tickets_sold) FROM concerts WHERE location = 'New York City'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Departments (Department VARCHAR(50), Employee_Count INT); INSERT INTO Departments (Department, Employee_Count) VALUES ('Sales', 15), ('Marketing', 10), ('IT', 8), ('HR', 12); | List all departments that have more employees than the 'IT' department. | SELECT Department FROM Departments WHERE Employee_Count > (SELECT Employee_Count FROM Departments WHERE Department = 'IT') | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); CREATE TABLE sales (id INT PRIMARY KEY, dispensary_id INT, strain_id INT, quantity INT, sale_date DATE); CREATE TABLE strains (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), cultivation_date DATE); | What are the dispensaries with the highest total sales for the current year, and their corresponding top-selling strain? | SELECT dispensaries.name, strains.name, SUM(sales.quantity) as total_sales FROM dispensaries INNER JOIN sales ON dispensaries.id = sales.dispensary_id INNER JOIN strains ON sales.strain_id = strains.id WHERE YEAR(sales.sale_date) = YEAR(CURRENT_DATE) GROUP BY dispensaries.id, strains.id ORDER BY total_sales DESC LIMIT ... | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure (id INT, technology VARCHAR(10), region VARCHAR(10), state VARCHAR(10)); INSERT INTO infrastructure (id, technology, region, state) VALUES (1, '5G', 'remote', 'AK'), (2, '5G', 'remote', 'HI'), (3, '4G', 'remote', 'MT'), (4, '4G', 'remote', 'ND'); | List the total number of 4G and 5G base stations in the "remote" region, grouped by state. | SELECT state, COUNT(*) FROM infrastructure WHERE (technology = '5G' OR technology = '4G') AND region = 'remote' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE FishStock (Species VARCHAR(50), Biomass FLOAT); INSERT INTO FishStock (Species, Biomass) VALUES ('Salmon', 1200.0), ('Tuna', 2000.0), ('Trout', 800.0), ('Carp', 500.0), ('Herring', 300.0); | What is the total biomass of fish in the FishStock table for each species that has a biomass less than 500? | SELECT Species, SUM(Biomass) FROM FishStock WHERE Biomass < 500 GROUP BY Species; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), depth FLOAT, ocean VARCHAR(255)); | What is the minimum depth of all marine protected areas in the Arctic Ocean? | SELECT MIN(depth) FROM marine_protected_areas WHERE ocean = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation_syndey(year INT, material_type VARCHAR(20), amount INT); INSERT INTO waste_generation_syndey VALUES (2019, 'Plastic', 1200), (2020, 'Plastic', 1500), (2021, 'Plastic', 1600), (2019, 'Paper', 1800), (2020, 'Paper', 2000), (2021, 'Paper', 2100), (2019, 'Glass', 1000), (2020, 'Glass', 1200), ... | What is the total waste generation in the last 3 years for each material type in Sydney?' | SELECT material_type, SUM(amount) FROM waste_generation_syndey WHERE city = 'Sydney' GROUP BY material_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(255), location VARCHAR(255), depth FLOAT); INSERT INTO marine_protected_areas (id, name, location, depth) VALUES (1, 'MPA 1', 'Pacific Ocean', 123.4), (2, 'MPA 2', 'Arctic Ocean', 100.0); | Delete all marine protected areas in the Arctic Ocean. | DELETE FROM marine_protected_areas WHERE location = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contracts (id INT, title VARCHAR(100), value FLOAT); INSERT INTO Contracts (id, title, value) VALUES (1, 'Cyber Security Services', 1000000), (2, 'IT Infrastructure Upgrade', 2000000); CREATE TABLE Contract_Details (contract_id INT, description TEXT); INSERT INTO Contract_Details (contract_id, description)... | List all the unique defense contracts that have 'cyber' in their title? | SELECT DISTINCT Contracts.title FROM Contracts JOIN Contract_Details ON Contracts.id = Contract_Details.contract_id WHERE Contract_Details.description LIKE '%cyber%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE garments (id INT, name VARCHAR(50), sustainable BOOLEAN, sale_price DECIMAL(5,2)); INSERT INTO garments (id, name, sustainable, sale_price) VALUES (1, 'sustainable_top', TRUE, 35.99); | What is the maximum sale price for sustainable garments? | SELECT MAX(sale_price) FROM garments WHERE sustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_projects (project_name VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO defense_projects (project_name, start_date, end_date) VALUES ('Project Y', '2022-06-15', '2023-06-14'), ('Project Z', '2021-09-01', '2022-08-31'); | Insert a new record into the defense_projects table for project X with a start date of 2023-01-01 | INSERT INTO defense_projects (project_name, start_date, end_date) VALUES ('Project X', '2023-01-01', NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE budget (state VARCHAR(20), service VARCHAR(20), amount INT); INSERT INTO budget (state, service, amount) VALUES ('Pennsylvania', 'Education', 40000), ('Pennsylvania', 'Healthcare', 70000), ('Michigan', 'Healthcare', 60000), ('Michigan', 'Education', 50000); | What is the budget allocated for healthcare services in 'Pennsylvania' and 'Michigan'? | SELECT amount FROM budget WHERE state IN ('Pennsylvania', 'Michigan') AND service = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_apartments (unit_id INT, num_bedrooms INT, square_footage FLOAT); INSERT INTO green_apartments (unit_id, num_bedrooms, square_footage) VALUES (1, 2, 800.0), (2, 1, 600.0), (3, 2, 900.0); | What is the average square footage of 2-bedroom units in the green_apartments table? | SELECT AVG(square_footage) FROM green_apartments WHERE num_bedrooms = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargos (id INT PRIMARY KEY, name VARCHAR(50), weight INT); | Insert a new cargo with ID 100, name 'New Cargo', and weight 10000 into the 'cargos' table. | INSERT INTO cargos (id, name, weight) VALUES (100, 'New Cargo', 10000); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication_allocations (project_id INT, project_name TEXT, allocation DECIMAL(10, 2), year INT); INSERT INTO climate_communication_allocations (project_id, project_name, allocation, year) VALUES (20, 'Climate Change Documentary T', 1200000, 2022), (21, 'Social Media Campaign U', 1100000, 2022), ... | What is the maximum allocation for a climate communication project in the year 2022? | SELECT MAX(allocation) FROM climate_communication_allocations WHERE year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_approvals (market_approval_id INT, region_id INT, approval_date DATE, region TEXT); CREATE TABLE drugs (drug_id INT, drug_name TEXT, market_approval_id INT); INSERT INTO market_approvals (market_approval_id, region_id, approval_date, region) VALUES (1, 1, '2020-01-01', 'South America'), (2, 2, '2019... | List all market approvals, including those without any drugs approved, for a specific region in the 'market_approvals' and 'drugs' tables in South America? | SELECT ma.approval_date, COALESCE(COUNT(d.drug_id), 0) AS drug_count FROM market_approvals ma LEFT JOIN drugs d ON ma.market_approval_id = d.market_approval_id WHERE ma.region = 'South America' GROUP BY ma.approval_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact (id INT PRIMARY KEY, site_id INT, impact_score INT); | Get total environmental impact for site 1 | SELECT SUM(impact_score) FROM impact WHERE site_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name TEXT, league TEXT, sport TEXT); INSERT INTO teams (team_id, team_name, league, sport) VALUES (1, 'Manchester United', 'Premier League', 'Football'), (2, 'Liverpool', 'Premier League', 'Football'); CREATE TABLE seasons (season_id INT, team_id INT, wins INT, losses INT); INSERT ... | What is the average number of wins per season for the 'Manchester United' football club? | SELECT AVG(wins) FROM seasons JOIN teams ON seasons.team_id = teams.team_id WHERE teams.team_name = 'Manchester United' AND teams.sport = 'Football'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, date DATE, severity VARCHAR(10), ip VARCHAR(15), country VARCHAR(30)); INSERT INTO vulnerabilities (id, date, severity, ip, country) VALUES (1, '2021-01-01', 'high', '192.168.1.100', 'Nigeria'); | What is the average number of daily high severity vulnerabilities in Africa? | SELECT AVG(vulnerability_count) as average_daily_high_severity_vulnerabilities FROM (SELECT COUNT(*) as vulnerability_count FROM vulnerabilities WHERE severity = 'high' AND country = 'Nigeria' AND date >= (CURRENT_DATE - INTERVAL '30' DAY) GROUP BY date) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE stadiums (stadium_id INT, stadium_name VARCHAR(255)); CREATE TABLE games (game_id INT, stadium_id INT, game_date DATE); | How many games have been played in each stadium, from the stadiums and games tables? | SELECT s.stadium_name, COUNT(g.game_id) AS game_count FROM stadiums s JOIN games g ON s.stadium_id = g.stadium_id GROUP BY s.stadium_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name VARCHAR(255), region VARCHAR(255), water_dissolved_oxygen FLOAT); INSERT INTO fish_farms (id, name, region, water_dissolved_oxygen) VALUES (1, 'Farm A', 'North America', 5.5), (2, 'Farm B', 'North America', 6.7), (3, 'Farm C', 'North America', 7.1); | What is the minimum water dissolved oxygen level (in mg/L) in fish farms located in North America? | SELECT MIN(water_dissolved_oxygen) FROM fish_farms WHERE region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(20)); INSERT INTO properties (id, city) VALUES (1, 'Denver'), (2, 'Portland'), (3, 'NYC'), (4, 'Austin'); CREATE TABLE property (id INT, city VARCHAR(20)); INSERT INTO property (id, city) VALUES (1, 'Denver'), (2, 'Portland'), (3, 'NYC'), (4, 'Austin'); CREATE TABLE housing... | What is the total number of properties and the total number of inclusive housing units in each city? | SELECT p.city, COUNT(DISTINCT p.id) as total_properties, SUM(CASE WHEN h.inclusive THEN h.units ELSE 0 END) as total_inclusive_units FROM properties p LEFT JOIN property pr ON p.city = pr.city LEFT JOIN housing h ON p.city = h.city GROUP BY p.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE categories (id INT, name VARCHAR(50)); INSERT INTO categories (id, name) VALUES (1, 'travel'), (2, 'food'), (3, 'fashion'); CREATE TABLE post_metrics (post_id INT, likes INT, comments INT); | What is the average number of likes and comments for posts in the travel category, in the social_media schema? | SELECT c.name AS category, AVG(pml.likes) AS avg_likes, AVG(pml.comments) AS avg_comments FROM post_metrics pml JOIN categories c ON pml.post_id = c.id WHERE c.name = 'travel' GROUP BY c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE IncidentTimes (id INT, incident_id INT, incident_time TIME); CREATE TABLE EmergencyIncidents (id INT, district_id INT, incident_date DATE, region_id INT); INSERT INTO IncidentTimes (id, incident_id, incident_time) VALUES (1, 1, '12:00:00'), (2, 2, '21:00:00'), (3, 3, '06:00:00'), (4, 4, '18:00:00'); INSERT... | Calculate the percentage of emergency incidents in the east region that were responded to within 5 minutes, for each month in the past year. | SELECT EXTRACT(MONTH FROM incident_date) as month, region_id, COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (PARTITION BY EXTRACT(MONTH FROM incident_date), region_id) as pct_incidents_within_5_minutes FROM EmergencyIncidents e JOIN IncidentTimes i ON e.id = i.incident_id WHERE incident_time BETWEEN '00:00:00' AND '05:00:00' A... | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT PRIMARY KEY, Name VARCHAR(100), Country VARCHAR(50)); INSERT INTO Artists (ArtistID, Name, Country) VALUES (1, 'Alice Johnson', 'USA'), (2, 'Pablo Picasso', 'Spain'); CREATE TABLE ArtForms (ArtFormID INT PRIMARY KEY, Name VARCHAR(50), Type VARCHAR(50)); INSERT INTO ArtForms (ArtFormID... | What are the names of all artists who have contributed to traditional art forms? | SELECT Artists.Name FROM Artists JOIN Contributions ON Artists.ArtistID = Contributions.ArtistID JOIN ArtForms ON Contributions.ArtFormID = ArtForms.ArtFormID WHERE ArtForms.Type = 'Traditional'; | gretelai_synthetic_text_to_sql |
CREATE TABLE historical_artifacts (artifact_id INT, artifact_name VARCHAR(50), year_made INT, origin_country VARCHAR(20), description TEXT); | Drop the "historical_artifacts" table from the database. | DROP TABLE historical_artifacts; | gretelai_synthetic_text_to_sql |
CREATE TABLE BlueManufacturingSales(id INT, contractor VARCHAR(255), region VARCHAR(255), equipment VARCHAR(255), quantity INT); | Insert a new record for 'Blue Manufacturing' selling 'Artillery' to 'Asia' with a quantity of 175. | INSERT INTO BlueManufacturingSales(id, contractor, region, equipment, quantity) VALUES (1, 'Blue Manufacturing', 'Asia', 'Artillery', 175); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name TEXT, budget DECIMAL(10,2)); INSERT INTO programs (id, name, budget) VALUES (1, 'Education', 5000.00), (2, 'Healthcare', 7000.00); | Which program has the highest budget in the 'programs' table? | SELECT name, budget FROM programs ORDER BY budget DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE wildlife_habitat (id INT, name VARCHAR(255), area FLOAT); INSERT INTO wildlife_habitat (id, name, area) VALUES (1, 'Habitat1', 50.3), (2, 'Habitat2', 32.7), (3, 'Habitat3', 86.9); | What is the total area of all wildlife habitats in the forestry database, in square kilometers? | SELECT SUM(area) FROM wildlife_habitat; | gretelai_synthetic_text_to_sql |
CREATE TABLE station_emergencies (eid INT, sid INT, time TIMESTAMP, PRIMARY KEY(eid), FOREIGN KEY(sid) REFERENCES stations(sid)); | What is the maximum number of emergencies handled in a single hour by a police station? | SELECT sid, MAX(COUNT(*)) FROM station_emergencies se GROUP BY sid HAVING TIMESTAMPDIFF(HOUR, MIN(time), MAX(time)) = 1; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA donations; CREATE TABLE donations (donation_id INT, amount DECIMAL(10,2), region VARCHAR(255), donation_date DATE); INSERT INTO donations (donation_id, amount, region, donation_date) VALUES (1, 100, 'North', '2022-04-01'), (2, 200, 'South', '2022-05-15'), (3, 50, 'East', '2022-06-05'); | What is the average donation amount by region in the last fiscal year? | SELECT region, AVG(amount) as avg_donation FROM donations WHERE donation_date >= DATEADD(year, -1, GETDATE()) AND donation_date < GETDATE() GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (permit_id INT, permit_date DATE, city TEXT, state TEXT); INSERT INTO building_permits VALUES (1, '2020-01-01', 'Chicago', 'Illinois'), (2, '2019-12-15', 'New York', 'New York'), (3, '2020-06-20', 'Houston', 'Texas'), (4, '2021-02-03', 'Chicago', 'Illinois'), (5, '2020-07-10', 'Denver', 'C... | What is the total number of building permits issued per month in the city of Denver in the year 2020? | SELECT EXTRACT(MONTH FROM permit_date) AS month, COUNT(*) FROM building_permits WHERE city = 'Denver' AND EXTRACT(YEAR FROM permit_date) = 2020 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturers (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO manufacturers (id, name, location) VALUES (1, 'ABC Corp', 'Great Lakes'), (2, 'XYZ Inc', 'Southeast'); CREATE TABLE chemical_productions (id INT, manufacturer_id INT, chemical_code VARCHAR(10), quantity INT); INSERT INTO chemical_p... | What is the total quantity of chemical 'ABC123' produced by each manufacturer in the 'Great Lakes' region? | SELECT m.name, SUM(cp.quantity) as total_quantity FROM manufacturers m JOIN chemical_productions cp ON m.id = cp.manufacturer_id WHERE m.location = 'Great Lakes' AND cp.chemical_code = 'ABC123' GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (id INT, drug VARCHAR(255), country VARCHAR(255), sales DECIMAL(10,2)); INSERT INTO sales_data (id, drug, country, sales) VALUES (1, 'DrugC', 'USA', 1200000.00); INSERT INTO sales_data (id, drug, country, sales) VALUES (2, 'DrugC', 'Mexico', 600000.00); INSERT INTO sales_data (id, drug, country,... | What are the top 5 countries with the highest sales for DrugC? | SELECT drug, country, SUM(sales) FROM sales_data GROUP BY drug, country ORDER BY SUM(sales) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE wastewater_treatment (id INT, state VARCHAR(20), treated_wastewater FLOAT); INSERT INTO wastewater_treatment (id, state, treated_wastewater) VALUES (1, 'Texas', 75000000), (2, 'Texas', 80000000), (3, 'Texas', 85000000); | What is the percentage of wastewater treated in Texas? | SELECT (SUM(treated_wastewater) / (SELECT SUM(treated_wastewater) FROM wastewater_treatment WHERE state = 'Texas') * 100) FROM wastewater_treatment WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tunnels (id INT, name TEXT, region TEXT, length FLOAT); INSERT INTO Tunnels (id, name, region, length) VALUES (1, 'TunnelX', 'Scandinavia', 5000.00), (2, 'TunnelY', 'Oceania', 7000.50), (3, 'TunnelZ', 'Oceania', 6000.25); | Identify the total number of tunnels in 'Scandinavia' and 'Oceania' regions. | SELECT COUNT(*) FROM Tunnels WHERE region IN ('Scandinavia', 'Oceania'); | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriptions (id INT, customer_id INT, start_date DATE); INSERT INTO subscriptions (id, customer_id, start_date) VALUES (1, 1, '2021-01-01'), (2, 2, '2021-06-01'); CREATE TABLE subscribers (id INT, name VARCHAR(50), data_usage FLOAT, subscription_id INT); INSERT INTO subscribers (id, name, data_usage, sub... | What is the total data usage for customers with a subscription older than 6 months? | SELECT SUM(data_usage) FROM subscribers s JOIN subscriptions subs ON s.subscription_id = subs.id WHERE subs.start_date <= DATE_SUB(CURDATE(), INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_technology_training (id INT, participant_name TEXT, hours_spent INT); INSERT INTO legal_technology_training (id, participant_name, hours_spent) VALUES (1, 'Sarah Lee', 12); INSERT INTO legal_technology_training (id, participant_name, hours_spent) VALUES (2, 'James White', 15); | What is the maximum number of hours spent by a participant in a legal technology training? | SELECT MAX(hours_spent) FROM legal_technology_training; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_tech_development (id INT, tech_type TEXT, status TEXT, date_created DATE); | How many biosensor technology development records are there for each technology type? | SELECT tech_type, COUNT(*) FROM biosensor_tech_development GROUP BY tech_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), HasBachelorsDegree BOOLEAN, SpeaksSpanish BOOLEAN); INSERT INTO Employees (EmployeeID, Department, HasBachelorsDegree, SpeaksSpanish) VALUES (1, 'Marketing', true, true), (2, 'IT', false, false), (3, 'Marketing', true, false); | How many employees in the Marketing department have a bachelor's degree and speak Spanish? | SELECT COUNT(*) FROM Employees WHERE Department = 'Marketing' AND HasBachelorsDegree = true AND SpeaksSpanish = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (id INT, bank VARCHAR(20), amount DECIMAL(10,2), is_socially_responsible BOOLEAN); INSERT INTO loans (id, bank, amount, is_socially_responsible) VALUES (1, 'BankOne', 1000.00, true), (2, 'SociallyGood', 1500.00, false), (3, 'BankTwo', 2000.00, true); | Update the bank name to 'SociallyGood' for record with id 1 in the 'loans' table. | UPDATE loans SET bank = 'SociallyGood' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (id INT, city VARCHAR(255), state VARCHAR(255), issue_date DATE); | How many building permits were issued in the state of Florida in the year 2021? | SELECT COUNT(*) FROM building_permits WHERE state = 'Florida' AND YEAR(issue_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, industry TEXT, foundation_date DATE, founder_indigenous BOOLEAN, funding FLOAT); INSERT INTO startups(id, name, industry, foundation_date, founder_indigenous, funding) VALUES (1, 'IndigenousMarket', 'E-commerce', '2019-05-01', true, 5000000); | What is the minimum and maximum funding amount for startups founded by people from indigenous communities in the e-commerce sector? | SELECT MIN(funding), MAX(funding) FROM startups WHERE industry = 'E-commerce' AND founder_indigenous = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_voyages (vessel_name TEXT, voyage_id INTEGER, sea_region TEXT); INSERT INTO vessel_voyages (vessel_name, voyage_id, sea_region) VALUES ('VesselK', 3001, 'Mediterranean sea'); INSERT INTO vessel_voyages (vessel_name, voyage_id, sea_region) VALUES ('VesselK', 3002, 'Mediterranean sea'); | Count the number of voyages made by 'VesselK' in the Mediterranean sea | SELECT COUNT(DISTINCT voyage_id) FROM vessel_voyages WHERE vessel_name = 'VesselK' AND sea_region = 'Mediterranean sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE giving_trends (campaign_id INT, donation_amount DECIMAL(10,2)); INSERT INTO giving_trends (campaign_id, donation_amount) VALUES (1, 50.00), (2, 100.00), (3, 75.00); | What is the minimum donation amount for any campaign in the giving_trends table? | SELECT MIN(donation_amount) as min_donation FROM giving_trends; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(255), sustainability_rating INT, price FLOAT, square_foot FLOAT); INSERT INTO properties (id, city, sustainability_rating, price, square_foot) VALUES (1, 'San Francisco', 3, 800000, 1500), (2, 'San Francisco', 5, 1200000, 2000), (3, 'San Francisco', 4, 900000, 1800); | What is the maximum and minimum sustainable property price per square foot in the city of San Francisco? | SELECT city, MAX(price/square_foot) AS max_price_per_sqft, MIN(price/square_foot) AS min_price_per_sqft FROM properties WHERE city = 'San Francisco' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE investors (investor_id INT, investor_name TEXT, country TEXT); CREATE TABLE investments (investment_id INT, investor_id INT, sector TEXT, amount FLOAT); CREATE TABLE esg_scores (investment_id INT, esg_score INT); INSERT INTO investors (investor_id, investor_name, country) VALUES (1, 'Investor A', 'USA'), (... | Who is the investor with the lowest ESG score in the education sector? | SELECT i.investor_name FROM investors i JOIN investments j ON i.investor_id = j.investor_id JOIN esg_scores e ON j.investment_id = e.investment_id WHERE j.sector = 'Education' GROUP BY i.investor_id ORDER BY MIN(e.esg_score) LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_consumption (hotel_id INT, guests INT, energy_used INT); INSERT INTO energy_consumption (hotel_id, guests, energy_used) VALUES (1, 50, 2000), (2, 75, 3000); | What is the average energy consumption per guest for eco-friendly hotels in London? | SELECT AVG(energy_used/guests) FROM energy_consumption WHERE hotel_id IN (SELECT hotel_id FROM eco_hotels WHERE city = 'London'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (donation_id INT, donor_name VARCHAR(50), location VARCHAR(50), amount DECIMAL(10,2)); INSERT INTO Donations (donation_id, donor_name, location, amount) VALUES (1, 'Emily Wong', 'Parkview Library', 75.00); | Insert a new record into the 'Donations' table for 'Parkview Library' | INSERT INTO Donations (donation_id, donor_name, location, amount) VALUES (2, 'James Chen', 'Parkview Library', 100.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name VARCHAR(50), type VARCHAR(50)); CREATE TABLE menu_items (id INT, name VARCHAR(50), category VARCHAR(50), price DECIMAL(5,2)); CREATE TABLE orders (id INT, menu_item_id INT, quantity INT, order_date DATE); INSERT INTO restaurants (id, name, type) VALUES (1, 'Organic Market', 'Marke... | Find the monthly revenue for 'Organic' menu items in 'Market' type vendors | SELECT SUM(menu_items.price * orders.quantity) AS monthly_revenue FROM orders JOIN menu_items ON orders.menu_item_id = menu_items.id JOIN restaurants ON menu_items.category = restaurants.name WHERE menu_items.category = 'Organic' AND restaurants.type = 'Market' AND MONTH(orders.order_date) = 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_transparency (product_id INT, supplier_id INT, material VARCHAR(50), country_of_origin VARCHAR(50), production_process VARCHAR(50)); | Create a table named 'product_transparency' | CREATE TABLE product_transparency (product_id INT, supplier_id INT, material VARCHAR(50), country_of_origin VARCHAR(50), production_process VARCHAR(50)); | gretelai_synthetic_text_to_sql |
CREATE TABLE fields (id INT, sensor_id INT, temperature DECIMAL(5,2), crop VARCHAR(10)); INSERT INTO fields (id, sensor_id, temperature, crop) VALUES (1, 101, 23.5, 'corn'), (2, 102, 25.7, 'soybean'), (3, 103, 21.8, 'corn'), (4, 104, 19.6, 'soybean'); | What is the average temperature reading for all IoT sensors in the 'fields' table for crop type 'soybean'? | SELECT AVG(temperature) FROM fields WHERE crop = 'soybean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE african_garments (id INT PRIMARY KEY, garment VARCHAR(50), type VARCHAR(50), fair_trade_certified BOOLEAN); INSERT INTO african_garments (id, garment, type, fair_trade_certified) VALUES (1, 'Dashiki', 'Cotton', true), (2, 'Kaftan', 'Silk', false), (3, 'Boubou', 'Wool', false), (4, 'Kitenge', 'Polyester', t... | What is the percentage of fair trade certified garments, by type, in the African ethical fashion market? | SELECT type, 100.0 * SUM(fair_trade_certified) / COUNT(*) as percentage FROM african_garments GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (restaurant_id INT, revenue DECIMAL(10,2), sustainable_sourcing_practices BOOLEAN); INSERT INTO restaurant_revenue (restaurant_id, revenue, sustainable_sourcing_practices) VALUES (1, 10000, true), (2, 8000, false); | What percentage of sustainable sourcing practices do the top 5 revenue-generating restaurants follow? | SELECT AVG(sustainable_sourcing_practices::int) * 100 as sustainable_percentage FROM (SELECT DISTINCT ON (restaurant_id) * FROM restaurant_revenue ORDER BY restaurant_id, revenue DESC LIMIT 5) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE material_costs (id INT, material_type VARCHAR(255), project_type VARCHAR(255), cost FLOAT); INSERT INTO material_costs (id, material_type, project_type, cost) VALUES (1, 'Steel', 'Bridge', 150000.00), (2, 'Asphalt', 'Road', 50000.00), (3, 'Concrete', 'Building', 200000.00); | What is the maximum and minimum cost of each type of construction material used in public works projects? | SELECT material_type, MIN(cost) as min_cost, MAX(cost) as max_cost FROM material_costs GROUP BY material_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE City_Visitors (id INT, city VARCHAR(20), num_visitors INT); INSERT INTO City_Visitors (id, city, num_visitors) VALUES (1, 'Los Angeles', 3000), (2, 'San Francisco', 2500), (3, 'Los Angeles', 2000); CREATE TABLE Total_Visitors (id INT, city VARCHAR(20), total_visitors INT); INSERT INTO Total_Visitors (id, c... | What was the percentage of visitors who attended exhibitions in each city? | SELECT cv.city, (cv.num_visitors * 100.0 / tv.total_visitors) AS pct_visitors FROM City_Visitors cv JOIN Total_Visitors tv ON cv.city = tv.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT PRIMARY KEY, name VARCHAR(50), age INT, sport VARCHAR(20), team VARCHAR(30)); INSERT INTO players (id, name, age, sport, team) VALUES (1, 'Elias Pettersson', 23, 'Hockey', 'Canucks'), (2, 'Bo Horvat', 27, 'Hockey', 'Canucks'); | Delete all records of hockey players from the 'Canucks' team. | DELETE FROM players WHERE team = 'Canucks' AND sport = 'Hockey'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (project_name VARCHAR(255), city VARCHAR(255)); CREATE TABLE green_buildings (building_name VARCHAR(255), city VARCHAR(255)); | Find renewable energy projects that are not located in the same cities as Green building projects. | SELECT project_name FROM renewable_projects RP WHERE city NOT IN (SELECT city FROM green_buildings); | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (id INT, factory_id INT, incident_type VARCHAR(50), date DATE); INSERT INTO safety_incidents (id, factory_id, incident_type, date) VALUES (1, 1, 'Chemical Spill', '2022-01-01'), (2, 2, 'Equipment Malfunction', '2022-03-01'), (3, 1, 'Power Outage', '2022-04-01'); | Calculate the total number of safety incidents reported in each factory for 2022. | SELECT factory_id, COUNT(*) as num_incidents FROM safety_incidents WHERE DATE_FORMAT(date, '%Y') = '2022' GROUP BY factory_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, community_service_hours INT); INSERT INTO cases (id, community_service_hours) VALUES (1, 50), (2, 100), (3, 150); | What is the maximum number of community service hours for a single case? | SELECT MAX(community_service_hours) FROM cases; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INTEGER, name TEXT, operator TEXT); INSERT INTO satellites (id, name, operator) VALUES (1, 'Hubble Space Telescope', 'NASA'), (2, 'Galileo IOV-1', 'ESA'), (3, 'Galileo IOV-2', 'ESA'), (4, 'Galileo IOV-3', 'ESA'), (5, 'Galileo IOV-4', 'ESA'); | List all satellites operated by the European Space Agency. | SELECT name FROM satellites WHERE operator = 'ESA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE offices (office_id INT, office_name VARCHAR(20), city VARCHAR(20), state VARCHAR(20)); INSERT INTO offices (office_id, office_name, city, state) VALUES (1, 'Boston', 'Boston', 'MA'), (2, 'New York', 'New York', 'NY'); | What is the total number of cases handled by attorneys in the 'Boston' office? | SELECT COUNT(*) FROM cases JOIN attorneys ON cases.attorney_id = attorneys.attorney_id JOIN offices ON attorneys.office_id = offices.office_id WHERE offices.city = 'Boston'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_companies (name TEXT, industry TEXT, year_founded INTEGER, location TEXT); INSERT INTO tech_companies (name, industry, year_founded, location) VALUES ('Google', 'Cloud Computing', 1998, 'Mountain View'); INSERT INTO tech_companies (name, industry, year_founded, location) VALUES ('Microsoft', 'Cloud Co... | Update the "location" for the "Apple Inc." record in the "tech_companies" table to "Cupertino" | UPDATE tech_companies SET location = 'Cupertino' WHERE name = 'Apple Inc.'; | 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.