context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE co2_emissions (quarter INT, source VARCHAR(255), emissions FLOAT); INSERT INTO co2_emissions (quarter, source, emissions) VALUES (1, 'Solar', 12.3), (1, 'Wind', 10.5), (1, 'Hydro', 7.8), (2, 'Solar', 12.5), (2, 'Wind', 10.7), (2, 'Hydro', 7.9), (3, 'Solar', 12.7), (3, 'Wind', 10.9), (3, 'Hydro', 8.1), (4, ... | Average CO2 emissions per MWh for renewable energy sources in Q1 2021? | SELECT AVG(emissions) AS avg_emissions, source FROM co2_emissions WHERE quarter = 1 AND source IN ('Solar', 'Wind', 'Hydro') GROUP BY source; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_products (id INT, name TEXT, category TEXT); CREATE TABLE safety_protocols (id INT, product_id INT, plant_id INT, protocol TEXT); | Add a new chemical product 'Product G' to the chemical_products table and its corresponding safety protocol 'Protocol 6' to the safety_protocols table. | INSERT INTO chemical_products (id, name, category) VALUES (1, 'Product G', 'Category X'); INSERT INTO safety_protocols (id, product_id, plant_id, protocol) VALUES (1, 1, 1, 'Protocol 6'); | gretelai_synthetic_text_to_sql |
CREATE TABLE research_vessels ( id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), year INT, carbon_emissions INT ); INSERT INTO research_vessels (id, name, region, year, carbon_emissions) VALUES (1, 'Arctic Tern', 'Arctic', 2015, 500), (2, 'Polar Explorer', 'Antarctic', 2016, 800); | Find the total carbon emissions for all research vessels operating in the Arctic region since 2015. | SELECT SUM(carbon_emissions) FROM research_vessels WHERE region = 'Arctic' AND year >= 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE shark_species (species_name TEXT, region TEXT); CREATE TABLE protection_status (species_name TEXT, status TEXT); INSERT INTO shark_species (species_name, region) VALUES ('Whale Shark', 'Indian Ocean'), ('Tiger Shark', 'Indian Ocean'); INSERT INTO protection_status (species_name, status) VALUES ('Whale Shar... | List all shark species and their protection status in the Indian Ocean. | SELECT shark_species.species_name, protection_status.status FROM shark_species INNER JOIN protection_status ON shark_species.species_name = protection_status.species_name WHERE region = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (concert_id INT, concert_name VARCHAR(100), artist_id INT, country VARCHAR(50), continent VARCHAR(50)); INSERT INTO concerts VALUES (1, 'Concert A', 3, 'USA', 'North America'); INSERT INTO concerts VALUES (2, 'Concert B', 4, 'Canada', 'North America'); INSERT INTO concerts VALUES (3, 'Concert C', ... | How many concerts have been held in total for each continent? | SELECT continent, COUNT(concert_id) AS total_concerts FROM concerts GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_mammals (id INT, species VARCHAR(255), population INT); | Count the number of marine mammals in 'ocean_mammals' table. | SELECT COUNT(*) FROM ocean_mammals WHERE species LIKE '%mammal%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (vehicle_id INT, vehicle_type TEXT, capacity INT); INSERT INTO public_transportation (vehicle_id, vehicle_type, capacity) VALUES (1, 'Bus', 50), (2, 'Tram', 150); | What is the maximum number of passengers that can be carried by a single public transportation vehicle in Sydney? | SELECT MAX(capacity) FROM public_transportation WHERE vehicle_type = 'Tram'; | gretelai_synthetic_text_to_sql |
CREATE TABLE flight_safety (id INT PRIMARY KEY, aircraft_model VARCHAR(100), manufacturer VARCHAR(100), severity VARCHAR(50), report_date DATE); | Show the total number of safety incidents for aircraft models manufactured by Airbus from the flight_safety table | SELECT manufacturer, COUNT(*) as total_incidents FROM flight_safety WHERE manufacturer = 'Airbus' GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, hotel_name VARCHAR(50), rating DECIMAL(2,1), country VARCHAR(50)); INSERT INTO eco_hotels VALUES (1, 'Eco-Retreat', 4.7, 'Japan'), (2, 'Green Vacations', 4.3, 'Japan'), (3, 'Eco-Lodge', 4.5, 'France'); | What is the average rating of eco-friendly hotels in Japan? | SELECT AVG(rating) FROM eco_hotels WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CulturalCompetency (IssueID INT, Issue VARCHAR(255), ReportedBy VARCHAR(255)); | Find the top 3 most common cultural competency issues reported in the 'CulturalCompetency' table. | SELECT Issue, COUNT(*) as CountOfIssues FROM CulturalCompetency GROUP BY Issue ORDER BY CountOfIssues DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state VARCHAR(255), population INT, water_consumption INT); INSERT INTO states (state, population, water_consumption) VALUES ('New South Wales', 8000000, 1200000000), ('Victoria', 6000000, 800000000); | What is the average water consumption per capita in Australian states? | SELECT state, water_consumption / population AS avg_water_consumption FROM states; | gretelai_synthetic_text_to_sql |
CREATE TABLE doctor_visit (patient_id INT, visit_year INT, number_of_visits INT); INSERT INTO doctor_visit (patient_id, visit_year, number_of_visits) VALUES (1, 2022, 3); | How many doctor visits were there in 2022 for female patients in urban Texas? | SELECT SUM(number_of_visits) FROM doctor_visit WHERE patient_id = 1 AND visit_year = 2022 AND gender = 'Female' AND location = 'urban Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FoodItem (ItemID INT, FarmID INT, ItemName VARCHAR(50), IsSustainable BOOLEAN); INSERT INTO FoodItem (ItemID, FarmID, ItemName, IsSustainable) VALUES (1, 1, 'Carrots', TRUE), (2, 2, 'Potatoes', FALSE), (3, 3, 'Cabbages', TRUE); CREATE TABLE Inventory (ItemID INT, Quantity INT); INSERT INTO Inventory (ItemI... | Total quantity of sustainable food items | SELECT SUM(i.Quantity) FROM FoodItem f INNER JOIN Inventory i ON f.ItemID = i.ItemID WHERE f.IsSustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_villages (id INT, property_price FLOAT, num_bedrooms INT); INSERT INTO urban_villages (id, property_price, num_bedrooms) VALUES (1, 700000, 3), (2, 800000, 4), (3, 900000, 2); | What is the number of properties with more than 2 bedrooms in the urban_villages table? | SELECT COUNT(*) FROM urban_villages WHERE num_bedrooms > 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Innovation (id INT, country VARCHAR(50), project VARCHAR(50), year INT); INSERT INTO Military_Innovation (id, country, project, year) VALUES (1, 'United States', 'Project A', 2019), (2, 'United States', 'Project B', 2020), (3, 'United Kingdom', 'Project C', 2019), (4, 'Canada', 'Project D', 2020),... | What is the total number of military innovation projects for each country in the last 2 years? | SELECT country, COUNT(project) FROM Military_Innovation WHERE year BETWEEN YEAR(CURRENT_DATE)-2 AND YEAR(CURRENT_DATE) GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Disability VARCHAR(10), Training VARCHAR(30)); INSERT INTO Employees (EmployeeID, Disability, Training) VALUES (1, 'Yes', 'Accessibility'), (2, 'No', 'Accessibility'); | What is the percentage of employees who identify as disabled and have completed accessibility training? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Employees)) FROM Employees WHERE Disability = 'Yes' AND Training = 'Accessibility'; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_activity (id INT, user_id INT, virtual_tour_id INT, activity_date DATE); INSERT INTO user_activity (id, user_id, virtual_tour_id, activity_date) VALUES (1, 1, 1, '2022-03-01'), (2, 1, 2, '2022-03-02'), (3, 2, 3, '2022-03-03'), (4, 2, 4, '2022-03-04'); | How many users engaged with virtual tours in 'March'? | SELECT COUNT(DISTINCT user_id) FROM user_activity WHERE EXTRACT(MONTH FROM activity_date) = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE ninety_one_calls (id INT, call_time TIMESTAMP, neighborhood VARCHAR(20)); INSERT INTO ninety_one_calls (id, call_time, neighborhood) VALUES (1, '2022-01-01 12:30:00', 'eastside'), (2, '2022-01-01 15:10:00', 'northside'), (3, '2022-01-02 09:45:00', 'eastside'); | What is the maximum number of 911 calls received in a single hour for the 'eastside' neighborhood? | SELECT neighborhood, MAX(COUNT(*)) OVER (PARTITION BY neighborhood) AS max_calls_per_hour FROM ninety_one_calls GROUP BY neighborhood, DATE_TRUNC('hour', call_time); | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_residents (id INT, state VARCHAR(2), has_insurance BOOLEAN); INSERT INTO rural_residents (id, state, has_insurance) VALUES (1, 'AL', FALSE); CREATE TABLE states (state_abbr VARCHAR(2), state_name VARCHAR(20), pop_rural INT); INSERT INTO states (state_abbr, state_name, pop_rural) VALUES ('AL', 'Alabam... | Find the state with the highest percentage of rural residents without health insurance. | SELECT r.state, (COUNT(*)::FLOAT / s.pop_rural::FLOAT) * 100 AS pct_uninsured FROM rural_residents r JOIN states s ON r.state = s.state_abbr WHERE NOT r.has_insurance GROUP BY r.state ORDER BY pct_uninsured DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturing (id INT, fabric VARCHAR(20), trend VARCHAR(20), quantity INT); INSERT INTO Manufacturing (id, fabric, trend, quantity) VALUES (1, 'organic cotton', 'minimalism', 500), (2, 'recycled polyester', 'vintage', 700); | What is the total quantity of sustainable fabric used in manufacturing for each fashion trend? | SELECT trend, SUM(quantity) FROM Manufacturing WHERE fabric LIKE '%sustainable%' GROUP BY trend; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation_projects (project_id INT, project_name VARCHAR(255), allocation DECIMAL(10,2), year INT, month INT, region VARCHAR(255)); INSERT INTO climate_mitigation_projects (project_id, project_name, allocation, year, month, region) VALUES (1, 'Caribbean Solar Farm Project', 4500000, 2021, 1, 'Cari... | What is the maximum allocation for a climate mitigation project in the Caribbean region in the first half of 2021? | SELECT MAX(allocation) FROM climate_mitigation_projects WHERE year = 2021 AND month BETWEEN 1 AND 6 AND region = 'Caribbean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_production_new (id INT PRIMARY KEY, chemical_name VARCHAR(50), quantity INT, production_date DATE); | Find the chemical with the highest quantity produced in the last 30 days. | SELECT chemical_name, MAX(quantity) as max_quantity FROM chemical_production_new WHERE production_date > CURDATE() - INTERVAL 30 DAY GROUP BY chemical_name LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (name VARCHAR(50), cultural_competency_score INT); INSERT INTO hospitals (name, cultural_competency_score) VALUES ('Hospital A', 80), ('Hospital B', 95); | Update the cultural competency score of 'Hospital A' to 90. | UPDATE hospitals SET cultural_competency_score = 90 WHERE name = 'Hospital A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (policyholder_id INT, claim_amount DECIMAL(10,2), policyholder_state VARCHAR(20)); INSERT INTO claims (policyholder_id, claim_amount, policyholder_state) VALUES (1, 500.00, 'Oregon'), (2, 300.00, 'Oregon'), (3, 700.00, 'Oregon'); | What is the minimum claim amount paid to policyholders in 'Oregon'? | SELECT MIN(claim_amount) FROM claims WHERE policyholder_state = 'Oregon'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (project_id INT, state VARCHAR(255)); INSERT INTO renewable_energy_projects (project_id, state) VALUES (1, 'CA'), (2, 'CA'), (3, 'CA'), (4, 'CA'), (5, 'CA'), (6, 'TX'), (7, 'TX'), (8, 'TX'), (9, 'TX'), (10, 'NY'), (11, 'NY'), (12, 'NY'), (13, 'NY'), (14, 'NY'), (15, 'CA'), (16, 'C... | How many renewable energy projects have been implemented in the state of California? | SELECT COUNT(*) FROM renewable_energy_projects WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Gender VARCHAR(10), HireDate DATE); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Gender, HireDate) VALUES (1, 'John', 'Doe', 'IT', 'Male', '2020-01-01'), (2, 'Jane', 'Doe', 'HR', 'Female',... | Who is the oldest employee in the company? | SELECT * FROM Employees ORDER BY HireDate LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_expeditions_indian (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO deep_sea_expeditions_indian (id, name, region) VALUES (1, 'Indian Ocean Deep-Sea Exploration 2015', 'Indian'); INSERT INTO deep_sea_expeditions_indian (id, name, region) VALUES (2, 'Indian Ocean Deep-Sea Exploration 2... | What is the total number of deep-sea exploration expeditions conducted in the Indian Ocean? | SELECT COUNT(DISTINCT name) FROM deep_sea_expeditions_indian WHERE region = 'Indian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WP_Investigative(id INT, name VARCHAR(20), job VARCHAR(20));CREATE TABLE BG_Investigative(id INT, name VARCHAR(20), job VARCHAR(20)); | How many investigative journalists are there in 'Washington Post' and 'Boston Globe'? | SELECT COUNT(*) FROM (SELECT * FROM WP_Investigative WHERE job = 'investigative journalist' INTERSECT SELECT * FROM BG_Investigative WHERE job = 'investigative journalist') t; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_policing (id INT, district_id INT, initiative_name VARCHAR(255)); INSERT INTO community_policing (id, district_id, initiative_name) VALUES (1, 1, 'Neighborhood Watch'), (2, 2, 'Bike Patrol'), (3, 3, 'Foot Patrol'); | What is the total number of community policing initiatives implemented in districts 1 and 3? | SELECT district_id, COUNT(*) as initiatives_per_district FROM community_policing WHERE district_id IN (1, 3) GROUP BY district_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Archaeological_Tools (id INT PRIMARY KEY, name VARCHAR(255), type TEXT, age INT); | Create a new table for storing information about archaeological tools | CREATE TABLE Archaeological_Tools (id INT PRIMARY KEY, name VARCHAR(255), type TEXT, age INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE mars_landings (id INT, mission VARCHAR(255), success BOOLEAN); INSERT INTO mars_landings (id, mission, success) VALUES (1, 'Viking 1', TRUE), (2, 'Viking 2', TRUE), (3, 'Mars Pathfinder', TRUE), (4, 'Spirit', TRUE), (5, 'Opportunity', TRUE), (6, 'Phoenix', TRUE), (7, 'Curiosity', TRUE), (8, 'Perseverance',... | What is the total number of space missions that have had successful landings on Mars? | SELECT COUNT(*) FROM mars_landings WHERE success = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (shipment_id INT, customer_id INT, shipped_date TIMESTAMP, shipped_time TIME, delivered_date TIMESTAMP, delivered_time TIME, status TEXT, delay DECIMAL(3,2)); | List all the shipments that were delayed by more than 2 hours from the 'shipments' table. | SELECT shipment_id, customer_id, shipped_date, shipped_time, delivered_date, delivered_time, status, delay FROM shipments WHERE delay > 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_founding (company_name VARCHAR(255), founder_gender VARCHAR(10), founder_lgbtq INT); INSERT INTO company_founding (company_name, founder_gender, founder_lgbtq) VALUES ('Delta Enterprises', 'Female', 1), ('Echo Startups', 'Male', 0), ('Foxtrot LLC', 'Female', 1), ('Golf Inc', 'Male', 0), ('Hotel Inc... | List the number of unique industries for companies founded by people who identify as LGBTQ+ | SELECT COUNT(DISTINCT industry) FROM company_industry WHERE company_name IN (SELECT company_name FROM company_founding WHERE founder_lgbtq = 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (ArtworkID INT, Title VARCHAR(255), Period VARCHAR(255), MuseumID INT, Price INT); INSERT INTO Artworks VALUES (1, 'The Persistence of Memory', 'Surrealism', 4, 20000000); CREATE TABLE Museums (MuseumID INT, Name VARCHAR(255), Location VARCHAR(255)); INSERT INTO Museums VALUES (4, 'Los Angeles Cou... | What is the total price of artworks in the 'Impressionist' period and in the 'Post-Impressionist' period in the 'Los Angeles' museum? | SELECT SUM(Artworks.Price) FROM Artworks INNER JOIN Museums ON Artworks.MuseumID = Museums.MuseumID WHERE (Artworks.Period = 'Impressionist' OR Artworks.Period = 'Post-Impressionist') AND Museums.Location = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthStatistics (ID INT, State TEXT, County TEXT, Population INT, AverageIncome FLOAT); INSERT INTO CommunityHealthStatistics (ID, State, County, Population, AverageIncome) VALUES (1, 'TX', 'Harris', 4500000, 60000), (2, 'CA', 'LA', 2500000, 70000); | update the AverageIncome for the record with ID 1 in the CommunityHealthStatistics table to 65000 | UPDATE CommunityHealthStatistics SET AverageIncome = 65000 WHERE ID = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (id INT, name VARCHAR(50), data_usage FLOAT, plan_type VARCHAR(10), region VARCHAR(15)); INSERT INTO mobile_subscribers (id, name, data_usage, plan_type, region) VALUES (1, 'Li Wen', 3.5, 'prepaid', 'Asia-Pacific'); INSERT INTO mobile_subscribers (id, name, data_usage, plan_type, region)... | What is the minimum mobile data usage for prepaid customers in the 'Asia-Pacific' region? | SELECT MIN(data_usage) FROM mobile_subscribers WHERE plan_type = 'prepaid' AND region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_zip TEXT); INSERT INTO donors (donor_id, donor_zip) VALUES (1, '12345'), (2, '67890'), (3, '12345'), (4, '98765'), (5, '12345'); | Identify the top 3 most common zip codes of donors. | SELECT donor_zip, COUNT(*) AS donor_count FROM donors GROUP BY donor_zip ORDER BY donor_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteer_events (volunteer_event_id INT, volunteer_id INT, event_type VARCHAR(255), event_date DATE); INSERT INTO volunteer_events (volunteer_event_id, volunteer_id, event_type, event_date) VALUES (1, 1, 'fundraising', '2021-02-01'), (2, 2, 'capacity building', '2021-03-15'), (3, 3, 'fundraising', '2021-0... | What is the total number of volunteers who participated in fundraising events in 2021, broken down by the month of the event? | SELECT MONTH(event_date) as event_month, COUNT(*) as total_volunteers FROM volunteer_events WHERE event_type = 'fundraising' AND YEAR(event_date) = 2021 GROUP BY event_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name VARCHAR(255), region VARCHAR(255), water_temperature FLOAT); INSERT INTO fish_farms (id, name, region, water_temperature) VALUES (1, 'Farm A', 'Americas', 22.5), (2, 'Farm B', 'Americas', 18.2), (3, 'Farm C', 'Europe', 12.9); | How many fish species are present in fish farms located in the Americas, where the water temperature is above 20 degrees Celsius? | SELECT COUNT(DISTINCT fish_species) FROM fish_farms WHERE region = 'Americas' AND water_temperature > 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE Brands (BrandID INT, BrandName VARCHAR(255));CREATE TABLE Garments (GarmentID INT, BrandID INT, SalePrice DECIMAL(10,2));CREATE TABLE Sales (SaleID INT, GarmentID INT, SaleDate DATE, Quantity INT); | What is the moving average of sales revenue for each brand of garment, partitioned by the brand and ordered by the date of the sales? | SELECT b.BrandName, AVG(g.SalePrice * s.Quantity) OVER (PARTITION BY b.BrandName ORDER BY s.SaleDate ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) AS MovingAverageRevenue FROM Brands b JOIN Garments g ON b.BrandID = g.BrandID JOIN Sales s ON g.GarmentID = s.GarmentID ORDER BY s.SaleDate; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_demographics (teacher_id INT, age INT, gender TEXT); | List all unique genders in the teacher demographics table | SELECT DISTINCT gender FROM teacher_demographics; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmpowermentBank (id INT, customer_age INT, financial_wellbeing_score INT); INSERT INTO EmpowermentBank (id, customer_age, financial_wellbeing_score) VALUES (1, 55, 60), (2, 65, 55); | What is the minimum financial wellbeing score for customers aged 50+ in Empowerment Bank? | SELECT MIN(financial_wellbeing_score) FROM EmpowermentBank WHERE customer_age >= 50; | gretelai_synthetic_text_to_sql |
CREATE TABLE interest_free_loans (loan_id INT, amount DECIMAL(10, 2), loan_date DATE); INSERT INTO interest_free_loans (loan_id, amount, loan_date) VALUES (1, 5000, '2022-04-01'); INSERT INTO interest_free_loans (loan_id, amount, loan_date) VALUES (2, 6000, '2022-05-15'); | What was the total amount of interest-free loans issued in 2022? | SELECT SUM(amount) FROM interest_free_loans WHERE loan_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (product_id INT, brand VARCHAR(255), revenue FLOAT); INSERT INTO sales (product_id, brand, revenue) VALUES (1, 'Lush', 100), (2, 'The Body Shop', 120), (3, 'Sephora', 150), (4, 'Lush', 175), (5, 'The Body Shop', 200); | What are the top 3 brands by total revenue? | SELECT brand, SUM(revenue) as total_revenue FROM sales GROUP BY brand ORDER BY total_revenue DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_performance (id INT, vessel_name VARCHAR(50), fuel_efficiency DECIMAL(3,2)); | Update the vessel_performance table to set the fuel_efficiency as 4.5 for the vessel with id 2 | UPDATE vessel_performance SET fuel_efficiency = 4.5 WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT, type VARCHAR(255), animal_count INT); | What is the average animal count for each habitat type, excluding habitats with a count of 0? | SELECT type, AVG(animal_count) as avg_animal_count FROM habitats WHERE animal_count > 0 GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_states (state TEXT, drought_frequency INTEGER); INSERT INTO drought_states (state, drought_frequency) VALUES ('California', 4), ('Texas', 3), ('Arizona', 5), ('Nevada', 6), ('Colorado', 2), ('New_Mexico', 7), ('Utah', 8); CREATE TABLE industrial_water_usage (state TEXT, population INTEGER, consumpt... | Identify the states with the highest drought frequency that also have the lowest per capita water consumption in the industrial sector. | SELECT ds.state FROM drought_states ds JOIN industrial_water_usage iwu ON ds.state = iwu.state ORDER BY drought_frequency, (iwu.consumption / iwu.population); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Name VARCHAR(50), Department VARCHAR(50), Age INT); | What is the average age of all employees working in the 'Mining Operations' department? | SELECT AVG(Age) FROM Employees WHERE Department = 'Mining Operations'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (restaurant_id INT, name TEXT, city TEXT, revenue FLOAT); INSERT INTO Restaurants (restaurant_id, name, city, revenue) VALUES (1, 'Asian Fusion', 'New York', 50000.00), (2, 'Bella Italia', 'Los Angeles', 60000.00), (3, 'Sushi House', 'New York', 70000.00), (4, 'Pizzeria La Rosa', 'Chicago', 800... | Find the number of restaurants in each city. | SELECT city, COUNT(*) FROM Restaurants GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (item_id INT, name TEXT, category TEXT, is_vegetarian BOOLEAN, price FLOAT, popularity INT); INSERT INTO menu (item_id, name, category, is_vegetarian, price, popularity) VALUES (1, 'Chickpea Curry', 'Lunch', true, 10.5, 50), (2, 'Chicken Tikka Masala', 'Lunch', false, 13.0, 75), (3, 'Quinoa Salad', 'S... | What is the most popular dish in the dinner category? | SELECT name, MAX(popularity) as max_popularity FROM menu WHERE category = 'Dinner' GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE lifelong_learning_courses (id INT, course_name VARCHAR(50), school_id INT, student_id INT, hours_spent INT); CREATE TABLE students (id INT, name VARCHAR(50), age INT, school_id INT); CREATE TABLE schools (id INT, school_name VARCHAR(50), PRIMARY KEY(id)); | What is the total number of hours spent on lifelong learning courses by students in each school? | SELECT s.school_name, SUM(llc.hours_spent) as total_hours_spent FROM lifelong_learning_courses llc JOIN students st ON llc.student_id = st.id JOIN schools s ON st.school_id = s.id GROUP BY s.school_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodation (accommodation_id INT, accommodation_name TEXT, disability_type TEXT); INSERT INTO accommodation (accommodation_id, accommodation_name, disability_type) VALUES (1, 'Wheelchair Ramp', 'Mobility'); INSERT INTO accommodation (accommodation_id, accommodation_name, disability_type) VALUES (2, 'Sig... | How many disability accommodations have been made for each disability type? | SELECT disability_type, COUNT(*) FROM accommodation GROUP BY disability_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE regulatory_frameworks (framework_id INT, framework_name VARCHAR(255)); CREATE TABLE smart_contracts_frameworks (contract_id INT, framework_id INT); | Display the number of transactions for each regulatory framework, along with the number of smart contracts associated with each framework. If there are no associated smart contracts, display '0'. | SELECT rf.framework_name, COUNT(rf.framework_id) as num_frameworks, SUM(CASE WHEN scf.contract_id IS NOT NULL THEN 1 ELSE 0 END) as num_contracts FROM regulatory_frameworks rf LEFT JOIN smart_contracts_frameworks scf ON rf.framework_id = scf.framework_id GROUP BY rf.framework_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_demographics (company_id INT, patent_count INT, female_percent FLOAT, minority_percent FLOAT); INSERT INTO company_demographics (company_id, patent_count, female_percent, minority_percent) VALUES (1, 3, 0.4, 0.3), (2, 1, 0.5, 0.2), (3, 2, 0.35, 0.45), (4, 4, 0.6, 0.1), (5, 0, 0.7, 0.2); | List diversity metrics for companies with a patent count greater than 2. | SELECT patent_count, female_percent, minority_percent FROM company_demographics WHERE patent_count > 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (mine_id INT, name TEXT, location TEXT, productivity FLOAT); INSERT INTO mines (mine_id, name, location, productivity) VALUES (1, 'ABC Mine', 'USA', 1200), (2, 'DEF Mine', 'Canada', 1500); | Which mine has the highest labor productivity? | SELECT name, MAX(productivity) FROM mines; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_id INT, product_id INT, name VARCHAR(255), vegan BOOLEAN); INSERT INTO ingredients (ingredient_id, product_id, name, vegan) VALUES (1, 1, 'Beeswax', false), (2, 1, 'Carmine', false), (3, 2, 'Lanolin', false), (4, 2, 'Guanine', false), (5, 3, 'Squalane', true); | Which non-vegan ingredients are most commonly used in the cosmetics database? | SELECT name, COUNT(*) FROM ingredients WHERE vegan = false GROUP BY name ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), residence VARCHAR(50), first_transaction_date DATE);CREATE TABLE transactions (transaction_id INT, client_id INT, transaction_date DATE); | How many clients residing in Tokyo have made a transaction in Q1 2023? | SELECT COUNT(*) FROM clients c INNER JOIN transactions t ON c.client_id = t.client_id WHERE c.residence = 'Tokyo' AND t.transaction_date BETWEEN '2023-01-01' AND '2023-03-31' | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT, country_name VARCHAR(255)); INSERT INTO countries (id, country_name) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); CREATE TABLE mining_sites (id INT, site_name VARCHAR(255), country_id INT); INSERT INTO mining_sites (id, site_name, country_id) VALUES (1, 'Site A', 1), (2, 'Site B', 1)... | How many mining sites are there in each country, along with the number of employees at those sites? | SELECT co.country_name, COUNT(ms.id) as mining_sites_count, COUNT(e.id) as total_employees FROM countries co INNER JOIN mining_sites ms ON co.id = ms.country_id INNER JOIN employees e ON ms.id = e.mining_site_id GROUP BY co.country_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, sector VARCHAR(20), date DATE, value FLOAT); INSERT INTO investments (id, sector, date, value) VALUES (1, 'Technology', '2018-01-01', 100000.0), (2, 'Finance', '2016-01-01', 75000.0), (3, 'Healthcare', '2017-01-01', 125000.0); | What is the total value of investments made since 2016? | SELECT SUM(value) FROM investments WHERE date >= '2016-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TraditionalArtEvents (ID INT, Country VARCHAR(50), EventName VARCHAR(100), Date DATE); INSERT INTO TraditionalArtEvents (ID, Country, EventName, Date) VALUES (1, 'Japan', 'Kabuki Performance', '2022-01-01'); INSERT INTO TraditionalArtEvents (ID, Country, EventName, Date) VALUES (2, 'Mexico', 'Dia de los Mu... | What is the total number of traditional art events in each country? | SELECT Country, COUNT(*) OVER (PARTITION BY Country) AS TotalEvents FROM TraditionalArtEvents; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_data_v3 (chemical_id INT, category VARCHAR(255), production_date DATE, quantity INT); INSERT INTO production_data_v3 (chemical_id, category, production_date, quantity) VALUES (1, 'Flammable Liquids', '2020-01-01', 500), (2, 'Corrosive Materials', '2020-01-01', 600), (3, 'Flammable Gases', '2020-... | What is the total quantity of a specific chemical produced in each quarter? | SELECT category, DATE_FORMAT(production_date, '%Y-%m') AS Month, SUM(quantity) FROM production_data_v3 WHERE category = 'Flammable Liquids' GROUP BY MONTH(STR_TO_DATE(Month, '%Y-%m')), QUARTER(STR_TO_DATE(Month, '%Y-%m')); | gretelai_synthetic_text_to_sql |
CREATE TABLE budgets (id INT, program_id INT, budget_amount DECIMAL(10,2)); INSERT INTO budgets (id, program_id, budget_amount) VALUES (1, 1, 1000.00), (2, 2, 2000.00), (3, 3, 1500.00), (4, 4, 500.00); CREATE TABLE programs (id INT, name VARCHAR(255)); INSERT INTO programs (id, name) VALUES (1, 'Education'), (2, 'Healt... | What is the total budget for the 'Education' program? | SELECT SUM(b.budget_amount) as total_budget FROM budgets b JOIN programs p ON b.program_id = p.id WHERE p.name = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (post_id INT, user_id INT, post_date DATE, content TEXT); INSERT INTO posts (post_id, user_id, post_date, content) VALUES (1, 1, '2021-01-01', 'Hello World'), (2, 2, '2021-01-02', 'This is a post'), (3, 3, '2021-01-03', 'Another post'); | Show the total number of posts and users in the social_media schema's posts and users tables. | SELECT COUNT(*) as total_posts, (SELECT COUNT(*) FROM users) as total_users FROM posts; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS defense_security; CREATE TABLE IF NOT EXISTS military_bases (id INT PRIMARY KEY, name TEXT, region TEXT); INSERT INTO military_bases (id, name, region) VALUES (1, 'Fort Bragg', 'US'), (2, 'Camp H.M. Smith', 'US'), (3, 'Peterson AFB', 'US'); | What is the total number of military bases in the 'US' region? | SELECT COUNT(*) FROM defense_security.military_bases WHERE region = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetic_brands (brand_name VARCHAR(100), is_vegan BOOLEAN); INSERT INTO cosmetic_brands (brand_name, is_vegan) VALUES ('Kat Von D', true), ('Milani', false), ('Cover FX', true); | What is the most preferred vegan cosmetic brand among consumers? | SELECT brand_name FROM (SELECT brand_name, ROW_NUMBER() OVER (ORDER BY is_vegan DESC) as rank FROM cosmetic_brands) subquery WHERE rank = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE pacific_ocean_salinity (id INT, date DATE, salinity FLOAT); INSERT INTO pacific_ocean_salinity (id, date, salinity) VALUES (1, '2021-02-01', 34.5), (2, '2021-02-02', 34.0), (3, '2021-02-03', 34.8); | What is the minimum salinity level in the Pacific Ocean in February? | SELECT MIN(salinity) FROM pacific_ocean_salinity WHERE EXTRACT(MONTH FROM date) = 2 AND EXTRACT(YEAR FROM date) = 2021 AND ocean_name = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism (visitor_country VARCHAR(50), host_country VARCHAR(50), duration INT); INSERT INTO tourism (visitor_country, host_country, duration) VALUES ('United Kingdom', 'Greece', 7), ('United Kingdom', 'Greece', 10), ('United Kingdom', 'Greece', 8); | What is the median duration of stays in Greece for tourists from the United Kingdom? | SELECT AVG(duration) as median_duration FROM (SELECT DISTINCT ON (duration) duration FROM tourism WHERE visitor_country = 'United Kingdom' AND host_country = 'Greece' ORDER BY duration) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE innovation_initiatives (initiative VARCHAR(50), budget INT, region VARCHAR(20)); INSERT INTO innovation_initiatives (initiative, budget, region) VALUES ('initiative1', 200000, 'Asia-Pacific'), ('initiative2', 250000, 'Asia-Pacific'), ('initiative3', 180000, 'Asia-Pacific'); | List the names of the top 2 agricultural innovation initiatives with the highest budget in the 'Asia-Pacific' region. | SELECT initiative FROM innovation_initiatives WHERE region = 'Asia-Pacific' ORDER BY budget DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (id INT PRIMARY KEY, name VARCHAR(50), age INT, gender VARCHAR(10), state VARCHAR(50)); | Show fan demographics from the "fans" table for fans who bought tickets for events in California | SELECT * FROM fans WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sensors (sensor_id INT, location VARCHAR(50)); INSERT INTO sensors (sensor_id, location) VALUES (006, 'Field F'); CREATE TABLE temps (sensor_id INT, temp FLOAT, timestamp TIMESTAMP); INSERT INTO temps (sensor_id, temp, timestamp) VALUES (006, 23.5, '2022-02-01 10:00:00'); INSERT INTO temps (sensor_id, temp... | What is the average temperature in 'Field F' for the month of February 2022? | SELECT AVG(temp) FROM temps WHERE sensor_id = 006 AND timestamp BETWEEN '2022-02-01 00:00:00' AND '2022-02-28 23:59:59'; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts (id INT, art_form VARCHAR(255), region VARCHAR(255), country VARCHAR(255), category VARCHAR(255)); INSERT INTO traditional_arts (id, art_form, region, country, category) VALUES (1, 'Uzbek Suzani', 'Central Asia', 'Uzbekistan', 'Textiles'), (2, 'Kilim Weaving', 'Middle East', 'Turkey', 'Tex... | What is the distribution of traditional arts by country and category? | SELECT country, category, art_count FROM traditional_arts_by_country_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE TrainStations (id INT, city VARCHAR(255), station_type VARCHAR(255), accessible BOOLEAN); | What is the percentage of accessible train stations in Los Angeles? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM TrainStations WHERE city = 'Los Angeles')) AS percentage FROM TrainStations WHERE city = 'Los Angeles' AND accessible = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, case_name VARCHAR(255), restorative_justice BOOLEAN, victim_participation BOOLEAN); INSERT INTO cases (id, case_name, restorative_justice, victim_participation) VALUES (1, 'Case 1', TRUE, TRUE), (2, 'Case 2', TRUE, FALSE), (3, 'Case 3', FALSE, TRUE), (4, 'Case 4', TRUE, TRUE), (5, 'Case 5', ... | What is the percentage of cases in which the victim chose not to participate in restorative justice? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM cases WHERE restorative_justice = TRUE)) as percentage FROM cases WHERE victim_participation = FALSE AND restorative_justice = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, type VARCHAR(20), species INT); INSERT INTO forests (id, type, species) VALUES (1, 'Boreal', 50), (2, 'Boreal', 60); | Identify the number of distinct tree species in boreal forests | SELECT COUNT(DISTINCT species) FROM forests WHERE type = 'Boreal'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_projects (id INT, project_name TEXT, location TEXT, cost INT, completion_date DATE, project_type TEXT); INSERT INTO transportation_projects (id, project_name, location, cost, completion_date, project_type) VALUES (1, 'Los Angeles Freeway Expansion', 'California', 12000000, '2019-12-20', 'tra... | How many transportation projects were completed in 'California' or 'Texas'? | SELECT COUNT(*) FROM transportation_projects WHERE location IN ('California', 'Texas') AND project_type = 'transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_test_data (id INT, make VARCHAR(20), model VARCHAR(20), acceleration DECIMAL(5,2)); INSERT INTO vehicle_test_data (id, make, model, acceleration) VALUES (1, 'Tesla', 'Model 3', 4.6), (2, 'Ford', 'Mustang', 5.1), (3, 'Chevrolet', 'Camaro', 4.5); | What are the maximum and minimum accelerations of the cars in the vehicle_test_data table? | SELECT MAX(acceleration), MIN(acceleration) FROM vehicle_test_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE Department (id INT, name VARCHAR(255), college VARCHAR(255)); INSERT INTO Department (id, name, college) VALUES (1, 'Biology', 'College of Science'), (2, 'Chemistry', 'College of Science'), (3, 'Physics', 'College of Science'); CREATE TABLE Faculty (id INT, name VARCHAR(255), department_id INT, minority VA... | What is the percentage of women and underrepresented minorities in each department, and the average number of research grants per faculty member? | SELECT d.name AS Department, AVG(rg.num_grants) AS AvgGrantsPerFaculty, COUNT(CASE WHEN f.gender = 'Female' THEN 1 ELSE NULL END) * 100.0 / COUNT(f.id) AS PercentageFemale, COUNT(CASE WHEN f.minority = 'Yes' THEN 1 ELSE NULL END) * 100.0 / COUNT(f.id) AS PercentageUnderrepresented FROM Department d JOIN Faculty f ON d.... | gretelai_synthetic_text_to_sql |
CREATE TABLE matches (id INT, home_team TEXT, away_team TEXT, attendance INT, match_date DATE); INSERT INTO matches (id, home_team, away_team, attendance, match_date) VALUES (1, 'Team G', 'Team H', 75000, '2019-07-15'); INSERT INTO matches (id, home_team, away_team, attendance, match_date) VALUES (2, 'Team I', 'Team J'... | What is the highest attendance for a single match in 2019? | SELECT home_team, MAX(attendance) FROM matches WHERE match_date >= DATE('2019-01-01') AND match_date < DATE('2020-01-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(50)); CREATE TABLE transactions (transaction_id INT, customer_id INT, amount DECIMAL(10,2), transaction_date DATE); | Who are the top 5 customers with the highest transaction amounts in the past week? | SELECT c.name, SUM(t.amount) as total_amount FROM customers c INNER JOIN transactions t ON c.customer_id = t.customer_id WHERE t.transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) GROUP BY c.name ORDER BY total_amount DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_timelines (id INT PRIMARY KEY, project_name VARCHAR(255), state VARCHAR(255), start_date DATE, end_date DATE); | What was the average project timeline for all construction projects in Texas in 2020? | SELECT AVG(DATEDIFF(end_date, start_date)) FROM project_timelines WHERE state = 'Texas' AND YEAR(start_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transfers (route VARCHAR(20), transfer VARCHAR(20)); INSERT INTO Transfers (route, transfer) VALUES ('1', 'Red Line'), ('9', 'Red Line'); | Insert a new record for a route transfer from the 73 bus to the Red Line. | INSERT INTO Transfers (route, transfer) VALUES ('73', 'Red Line'); | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, campaign_name VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO campaigns (campaign_id, campaign_name, revenue) VALUES (1, 'Campaign A', 5000.00), (2, 'Campaign B', 7000.00), (3, 'Campaign C', 6000.00); | What is the total revenue generated from each advertising campaign in the past month? | SELECT campaign_name, SUM(revenue) AS total_revenue FROM campaigns WHERE date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY campaign_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE donation_time (donor_id INT, donation_date DATE);INSERT INTO donation_time VALUES (1, '2022-01-01'), (2, '2022-02-01'), (3, '2022-03-01'), (1, '2022-04-01'), (4, '2022-05-01'), (4, '2022-06-01'), (5, '2022-07-01'), (5, '2022-08-01'), (5, '2022-09-01'); | How many donors made donations in the last quarter, including those who made multiple donations during the same time period? | SELECT COUNT(DISTINCT donor_id) FROM donation_time WHERE donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseContracts (contract_id INT, contractor_name VARCHAR(255), state VARCHAR(255), contract_date DATE, contract_value DECIMAL(10,2)); INSERT INTO DefenseContracts (contract_id, contractor_name, state, contract_date, contract_value) VALUES (1, 'TechCo', 'Texas', '2020-01-15', 50000), (2, 'GreenTech', 'Cal... | Identify defense contracts awarded to historically underrepresented businesses in Texas in 2020. | SELECT contract_id, contractor_name, state, contract_date, contract_value FROM DefenseContracts WHERE contractor_name IN (SELECT contractor_name FROM ContractorInfo WHERE diversity_status = 'underrepresented') AND state = 'Texas' AND contract_date BETWEEN '2020-01-01' AND '2020-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (id INT, name VARCHAR(255)); INSERT INTO Country (id, name) VALUES (1, 'Canada'), (2, 'Mexico'), (3, 'Brazil'); CREATE TABLE Crop (id INT, name VARCHAR(255), country_id INT, yield INT); INSERT INTO Crop (id, name, country_id, yield) VALUES (1, 'Corn', 1, 20), (2, 'Soybean', 2, 30), (3, 'Corn', 3, 1... | What is the minimum yield of corn crops by country? | SELECT MIN(Crop.yield) FROM Crop INNER JOIN Country ON Crop.country_id = Country.id WHERE Crop.name = 'Corn'; | gretelai_synthetic_text_to_sql |
CREATE TABLE auto_show_attendance (id INT, show_name VARCHAR(50), location VARCHAR(50), attendance INT); INSERT INTO auto_show_attendance (id, show_name, location, attendance) VALUES (1, 'LA Auto Show', 'Los Angeles', 100000), (2, 'Detroit Auto Show', 'Detroit', 80000), (3, 'Geneva Motor Show', 'Geneva', 120000), (4, '... | Identify the auto shows with the highest attendance | SELECT show_name, location, attendance FROM auto_show_attendance ORDER BY attendance DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), REE VARCHAR(255), amount INT, year INT); INSERT INTO production (country, REE, amount, year) VALUES ('Indonesia', 'Neodymium', 1000, 2018); | Delete REE production data for Indonesia in 2018. | DELETE FROM production WHERE country = 'Indonesia' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (accommodation_id INT, destination_id INT, name TEXT, is_eco BOOLEAN); INSERT INTO accommodations (accommodation_id, destination_id, name, is_eco) VALUES (1, 1, 'Hotel Costa Rica', true), (2, 1, 'Hotel Arenal', false), (3, 2, 'Hotel Ubud', true), (4, 2, 'Hotel Seminyak', true), (5, 2, 'Hotel... | What is the total number of eco-friendly accommodations in Costa Rica and Bali? | SELECT SUM(is_eco) FROM accommodations WHERE destination_id IN (1, 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, region TEXT); CREATE TABLE ai_solutions (solution_id INT, hotel_id INT, implemented_date DATE); CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, engagement_score INT); INSERT INTO hotels (hotel_id, hotel_name, region) VALUES (1, 'Tropical Resort', 'APAC'), (2, '... | What are the total number of AI-powered solutions implemented for hotels with a virtual tour engagement score of at least 80 in APAC? | SELECT COUNT(DISTINCT ai_solutions.solution_id) AS total_solutions FROM ai_solutions INNER JOIN hotels ON ai_solutions.hotel_id = hotels.hotel_id INNER JOIN virtual_tours ON hotels.hotel_id = virtual_tours.hotel_id WHERE hotels.region = 'APAC' AND virtual_tours.engagement_score >= 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE VESSEL_CONTAINER_CARGO (ID INT, VESSEL_ID INT, WEIGHT INT); INSERT INTO VESSEL_CONTAINER_CARGO VALUES (1, 1, 2500); INSERT INTO VESSEL_CONTAINER_CARGO VALUES (2, 1, 3000); INSERT INTO VESSEL_CONTAINER_CARGO VALUES (3, 2, 1500); | Display the average cargo weight per vessel for container cargo, ranked in descending order. | SELECT V.NAME, AVG(VC.WEIGHT) AS AVG_WEIGHT, ROW_NUMBER() OVER(ORDER BY AVG(VC.WEIGHT) DESC) AS RANK FROM VESSEL_CONTAINER_CARGO VC JOIN VESSELS V ON VC.VESSEL_ID = V.ID WHERE VC.CARGO_TYPE = 'Container' GROUP BY V.ID, V.NAME | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials_data_2 (drug_name VARCHAR(50), trial_outcome VARCHAR(50)); INSERT INTO clinical_trials_data_2 (drug_name, trial_outcome) VALUES ('DrugZ', 'Approved'), ('DrugW', 'Rejected'); | What are the clinical trial outcomes for drug 'DrugZ'? | SELECT drug_name, trial_outcome FROM clinical_trials_data_2 WHERE drug_name = 'DrugZ'; | gretelai_synthetic_text_to_sql |
CREATE TABLE pilates_classes (id INT, class_id INT, duration FLOAT, class_date DATE); | What is the total duration of all Pilates classes in the last month? | SELECT SUM(duration) FROM pilates_classes WHERE class_date >= DATE(NOW()) - INTERVAL 1 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (tech VARCHAR(255)); INSERT INTO military_tech (tech) VALUES ('cyber_defense'), ('firewall'), ('encryption'), ('intrusion_detection'), ('AI'); | What are the military technologies related to cybersecurity in the 'military_tech' table? | SELECT tech FROM military_tech WHERE tech LIKE '%cyber%' OR tech LIKE '%security%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_biomass (id INT, country VARCHAR(255), biomass FLOAT); INSERT INTO country_biomass (id, country, biomass) VALUES (1, 'Norway', 4000.0), (2, 'Chile', 5000.0), (3, 'China', 7000.0), (4, 'Scotland', 3500.0); | Identify the top three countries with the highest biomass of farmed fish. | SELECT country, biomass FROM (SELECT country, biomass, ROW_NUMBER() OVER (ORDER BY biomass DESC) AS rn FROM country_biomass) tmp WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (nation VARCHAR(50), year INT, spending FLOAT); INSERT INTO DefenseDiplomacy (nation, year, spending) VALUES ('Poland', 2017, 25000000), ('Romania', 2017, 30000000), ('Ukraine', 2017, 35000000), ('Hungary', 2017, 22000000), ('Czech Republic', 2017, 28000000); | What was the total defense diplomacy spending for East European nations in 2017? | SELECT SUM(spending) FROM DefenseDiplomacy WHERE nation IN ('Poland', 'Romania', 'Ukraine', 'Hungary', 'Czech Republic') AND year = 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE platformJ (genre TEXT, revenue INT); CREATE TABLE platformK (genre TEXT, revenue INT); CREATE TABLE platformL (genre TEXT, revenue INT); | Show the total revenue for the "hip-hop" genre from all platforms, excluding any platforms that have a revenue lower than $8,000 for that genre. | SELECT genre, SUM(revenue) FROM (SELECT genre, revenue FROM platformJ WHERE genre = 'hip-hop' AND revenue >= 8000 UNION ALL SELECT genre, revenue FROM platformK WHERE genre = 'hip-hop' AND revenue >= 8000 UNION ALL SELECT genre, revenue FROM platformL WHERE genre = 'hip-hop' AND revenue >= 8000) AS combined_platforms G... | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (region_id INT, region_name VARCHAR(50)); INSERT INTO regions (region_id, region_name) VALUES (1, 'North'), (2, 'South'), (3, 'East'), (4, 'West'); CREATE TABLE sales (sale_id INT, region_id INT, sale_amount DECIMAL(10,2), sale_date DATE); INSERT INTO sales (sale_id, region_id, sale_amount, sale_da... | What is the total revenue generated per region for the year 2022? | SELECT region_name, SUM(sale_amount) as total_revenue FROM sales JOIN regions ON sales.region_id = regions.region_id WHERE sale_date >= '2022-01-01' AND sale_date < '2023-01-01' GROUP BY region_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE High_Risk_Customers (customer_id INT, strategy_name VARCHAR(30), account_balance DECIMAL(10,2)); INSERT INTO High_Risk_Customers (customer_id, strategy_name, account_balance) VALUES (1, 'Equity', 5000.00), (2, 'Fixed Income', 3000.00), (3, 'Equity', 8000.00), (4, 'Alternatives', 6000.00); | What is the total number of high-risk customers and their combined account balance for each investment strategy? | SELECT strategy_name, COUNT(customer_id) AS total_customers, SUM(account_balance) AS total_balance FROM High_Risk_Customers GROUP BY strategy_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE LaborHours (project_id INT, hours FLOAT, sustainability VARCHAR(255)); INSERT INTO LaborHours (project_id, hours, sustainability) VALUES (1, 500.5, 'sustainable'), (2, 300.2, 'not sustainable'); | How many labor hours were reported for sustainable construction projects? | SELECT SUM(hours) FROM LaborHours WHERE sustainability = 'sustainable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_services (state VARCHAR(20), service VARCHAR(20), budget INT); INSERT INTO state_services (state, service, budget) VALUES ('California', 'Waste Management', 20000000); | What is the maximum budget allocated for waste management in the state of California? | SELECT MAX(budget) FROM state_services WHERE state = 'California' AND service = 'Waste Management'; | 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.