context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE TraditionalArts (id INT, name VARCHAR(50), category VARCHAR(50), country VARCHAR(50)); INSERT INTO TraditionalArts (id, name, category, country) VALUES (1, 'Ukiyo-e', 'Printmaking', 'Japan'); INSERT INTO TraditionalArts (id, name, category, country) VALUES (2, 'Thangka', 'Painting', 'Nepal'); | What are the traditional arts categories in Asia? | SELECT DISTINCT TraditionalArts.category FROM TraditionalArts WHERE TraditionalArts.country IN ('Afghanistan', 'Armenia', 'Azerbaijan', 'Bahrain', 'Bangladesh', 'Bhutan', 'Brunei', 'Cambodia', 'China', 'Cyprus', 'Georgia', 'India', 'Indonesia', 'Iran', 'Iraq', 'Israel', 'Japan', 'Jordan', 'Kazakhstan', 'Kuwait', 'Kyrgy... | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (id INT, country VARCHAR(255), items_quantity INT); INSERT INTO Warehouse (id, country, items_quantity) VALUES (1, 'Australia', 300), (2, 'New Zealand', 200), (3, 'USA', 400); | What are the total items in the warehouse in Australia and New Zealand combined? | SELECT SUM(items_quantity) FROM Warehouse WHERE country = 'Australia' INTERSECT SELECT SUM(items_quantity) FROM Warehouse WHERE country = 'New Zealand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(255)); CREATE TABLE natural_disasters (id INT, region_id INT, response_time INT); INSERT INTO regions (id, name) VALUES (1, 'Central'); INSERT INTO natural_disasters (id, region_id, response_time) VALUES (1, 1, 10); | What is the average response time for natural disasters in the 'Central' region? | SELECT AVG(response_time) FROM natural_disasters WHERE region_id = (SELECT id FROM regions WHERE name = 'Central'); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_projects (project_id INT, project_type VARCHAR(50), location VARCHAR(50), budget FLOAT); CREATE TABLE communication_strategies (strategy_id INT, strategy_name VARCHAR(50), project_id INT); INSERT INTO climate_projects (project_id, project_type, location, budget) VALUES (1, 'Climate Research', 'Cent... | Identify the communication strategies used in climate change projects in Central America, along with the project type and the total budget. | SELECT cp.project_type, cs.strategy_name, SUM(cp.budget) as total_budget FROM climate_projects cp INNER JOIN communication_strategies cs ON cp.project_id = cs.project_id WHERE cp.location = 'Central America' GROUP BY cp.project_type, cs.strategy_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_incident_data (id INT, incident_category VARCHAR(50), country VARCHAR(50), resolution_time INT); INSERT INTO global_incident_data (id, incident_category, country, resolution_time) VALUES (1, 'Malware', 'USA', 480), (2, 'Phishing', 'Canada', 240), (3, 'Malware', 'Mexico', 720), (4, 'Phishing', 'Brazi... | What are the top 5 countries with the longest average resolution times for security incidents in the 'global_incident_data' table? | SELECT country, AVG(resolution_time) as avg_resolution_time, COUNT(*) as count FROM global_incident_data GROUP BY country HAVING count > 4 ORDER BY avg_resolution_time DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE tx_menu_items (menu_item_id INT, restaurant_id INT, dish_type VARCHAR(255), food_cost DECIMAL(5,2)); INSERT INTO tx_menu_items (menu_item_id, restaurant_id, dish_type, food_cost) VALUES (1, 1, 'Gluten-free', 3.50), (2, 2, 'Vegetarian', 2.50), (3, 3, 'Gluten-free', 1.50); | What is the average food cost for gluten-free menu items in TX? | SELECT AVG(food_cost) FROM tx_menu_items WHERE dish_type = 'Gluten-free'; | gretelai_synthetic_text_to_sql |
CREATE TABLE crimes (id INT, crime_date DATE, district VARCHAR(20), crime_count INT); | What is the total number of crimes committed in the "north" district, for the year 2020? | SELECT SUM(crime_count) FROM crimes WHERE district = 'north' AND EXTRACT(YEAR FROM crime_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget (id INT, category VARCHAR(255), region VARCHAR(255), amount INT); INSERT INTO budget (id, category, region, amount) VALUES (1, 'Policy Advocacy', 'North America', 100000), (2, 'Policy Advocacy', 'Europe', 120000), (3, 'Support Programs', 'North America', 150000), (4, 'Support Programs', 'Europe', 18... | What is the total budget allocated for support programs in North America and Europe? | SELECT SUM(amount) as total_support_program_budget FROM budget WHERE category = 'Support Programs' AND region IN ('North America', 'Europe'); | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, country VARCHAR(255), launch_date DATE); INSERT INTO satellites (id, country, launch_date) VALUES (1, 'USA', '2000-01-01'), (2, 'Russia', '2005-01-01'), (3, 'USA', '2010-01-01'), (4, 'Russia', '2015-01-01'), (5, 'China', '2001-01-01'), (6, 'China', '2011-01-01'), (7, 'China', '2016-01-0... | List all satellites launched by China in descending order by launch date. | SELECT * FROM satellites WHERE country = 'China' ORDER BY launch_date DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE assistive_tech (id INT, device VARCHAR(50), type VARCHAR(50), description TEXT, users INT, country VARCHAR(50)); INSERT INTO assistive_tech (id, device, type, description, users, country) VALUES (2, 'Voice Assistant', 'Software', 'A software that provides voice assistance for disabled users.', 30000, 'Aust... | What is the total number of users for accessibility devices in Australia and New Zealand? | SELECT country, SUM(users) as total_users FROM assistive_tech WHERE country IN ('Australia', 'New Zealand') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists animal_population (id INT, animal VARCHAR(255), country VARCHAR(255), population INT); INSERT INTO animal_population (id, animal, country, population) VALUES (1, 'Tiger', 'India', 2500), (2, 'Tiger', 'Bangladesh', 150), (3, 'Tiger', 'Nepal', 300), (4, 'Tiger', 'Bhutan', 100); | Identify countries with less than 500 tigers | SELECT country FROM animal_population WHERE animal = 'Tiger' GROUP BY country HAVING SUM(population) < 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtInsurance (PolicyID int, PolicyPrice int, ArtworkID int, ArtworkType varchar(50)); INSERT INTO ArtInsurance (PolicyID, PolicyPrice, ArtworkID, ArtworkType) VALUES (1, 2500000, 1, 'Sculpture'); CREATE TABLE Artworks (ArtworkID int, ArtworkName varchar(100), ArtistID int, GalleryID int); INSERT INTO Artwo... | What is the average insurance policy price for sculptures in the Tate Modern gallery? | SELECT AVG(ArtInsurance.PolicyPrice) AS AveragePolicyPrice FROM ArtInsurance INNER JOIN Artworks ON ArtInsurance.ArtworkID = Artworks.ArtworkID INNER JOIN Galleries ON Artworks.GalleryID = Galleries.GalleryID WHERE Artworks.ArtworkType = 'Sculpture' AND Galleries.GalleryName = 'Tate Modern'; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title TEXT, publication_date DATE, publisher TEXT); | Get the number of articles published in the first quarter of each year by 'The New York Times'. | SELECT YEAR(publication_date) AS year, COUNT(*) AS count FROM articles WHERE publisher = 'The New York Times' AND MONTH(publication_date) <= 3 GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name TEXT, speed FLOAT, departed_port TEXT, departed_date DATE); INSERT INTO vessels (id, name, speed, departed_port, departed_date) VALUES (1, 'VesselA', 15.2, 'Oakland', '2020-01-01'); INSERT INTO vessels (id, name, speed, departed_port, departed_date) VALUES (2, 'VesselB', 17.8, 'Oaklan... | Increase the speed of the vessel 'VesselI' by 2.5. | UPDATE vessels SET speed = speed + 2.5 WHERE name = 'VesselI'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, account_id INT, amount DECIMAL(10, 2)); INSERT INTO transactions (transaction_id, account_id, amount) VALUES (1, 1, 1000.00); INSERT INTO transactions (transaction_id, account_id, amount) VALUES (2, 2, 500.00); INSERT INTO transactions (transaction_id, account_id, amount) ... | What is the average transaction value for accounts in the 'Standard' category? | SELECT AVG(amount) FROM transactions JOIN customer_accounts ON transactions.account_id = customer_accounts.account_id WHERE customer_accounts.account_type = 'Standard'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabric_usage (id INT, supplier VARCHAR(50), fabric_type VARCHAR(50), quantity INT, sustainability_rating INT); INSERT INTO fabric_usage (id, supplier, fabric_type, quantity, sustainability_rating) VALUES (1, 'Supplier1', 'Cotton', 500, 80); INSERT INTO fabric_usage (id, supplier, fabric_type, quantity, sus... | get the total quantity of sustainable fabrics used | SELECT SUM(quantity) FROM fabric_usage WHERE sustainability_rating >= 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE industrial_water_usage_ny (state VARCHAR(20), year INT, sector VARCHAR(30), usage FLOAT); INSERT INTO industrial_water_usage_ny (state, year, sector, usage) VALUES ('New York', 2021, 'Agriculture', 12345.6), ('New York', 2021, 'Manufacturing', 23456.7), ('New York', 2021, 'Mining', 34567.8); CREATE TABLE i... | Compare the average water usage by industrial sectors in New York and Ontario in 2021. | SELECT AVG(industrial_water_usage_ny.usage) FROM industrial_water_usage_ny WHERE state = 'New York' AND year = 2021; SELECT AVG(industrial_water_usage_ont.usage) FROM industrial_water_usage_ont WHERE state = 'Ontario' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user VARCHAR(50), content TEXT, likes INT, timestamp DATETIME); | What is the average number of likes on posts containing the hashtag "#sustainability" in the past month? | SELECT AVG(likes) FROM posts WHERE content LIKE '%#sustainability%' AND timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 1 MONTH) AND NOW(); | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, EventDate DATE, TotalAttendees INT, Program VARCHAR(255)); INSERT INTO Events (EventID, EventDate, TotalAttendees, Program) VALUES (1, '2022-01-01', 50, 'Dance'), (2, '2022-04-01', 75, 'Dance'); | What is the percentage change in attendance for dance programs between Q1 and Q2 2022? | SELECT ((Q2Attendance - Q1Attendance) * 100.0 / Q1Attendance) AS PercentageChange FROM (SELECT SUM(CASE WHEN QUARTER(EventDate) = 1 AND YEAR(EventDate) = 2022 THEN TotalAttendees ELSE 0 END) AS Q1Attendance, SUM(CASE WHEN QUARTER(EventDate) = 2 AND YEAR(EventDate) = 2022 THEN TotalAttendees ELSE 0 END) AS Q2Attendance ... | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, name TEXT, rating FLOAT, country TEXT); INSERT INTO eco_hotels (hotel_id, name, rating, country) VALUES (1, 'Eco Lodge', 4.5, 'Germany'), (2, 'Green Hotel', 4.2, 'Germany'), (3, 'Nachhaltiges Hotel', 4.7, 'Austria'); | What is the average rating of eco-friendly hotels in Germany and Austria? | SELECT AVG(rating) FROM eco_hotels WHERE country IN ('Germany', 'Austria'); | gretelai_synthetic_text_to_sql |
CREATE TABLE SmartContract (ContractID INT, ContractValue FLOAT, ContractPlatform VARCHAR(50), ContractDate DATE); INSERT INTO SmartContract (ContractID, ContractValue, ContractPlatform, ContractDate) VALUES (1, 5000, 'Ethereum', '2022-01-01'), (2, 3000, 'Solana', '2022-01-02'), (3, 7000, 'Tezos', '2022-01-03'); ALTER ... | What is the average total value locked in smart contracts for each blockchain platform, for the last month? | SELECT ContractPlatform, AVG(ContractValue) as AverageValue FROM SmartContract WHERE ContractDate >= DATEADD(month, -1, GETDATE()) GROUP BY ContractPlatform; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, join_year INT); CREATE TABLE cases (case_id INT, attorney_id INT, billing_amount INT); | What is the total billing amount for cases handled by attorneys who joined the firm in 2010? | SELECT SUM(cases.billing_amount) FROM cases INNER JOIN attorneys ON cases.attorney_id = attorneys.attorney_id WHERE attorneys.join_year = 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE Region (Region TEXT, ParityStatus TEXT); INSERT INTO Region (Region, ParityStatus) VALUES ('Northeast', 'Parity'); INSERT INTO Region (Region, ParityStatus) VALUES ('Midwest', 'Non-Parity'); INSERT INTO Region (Region, ParityStatus) VALUES ('South', 'Parity'); | List the mental health parity status for each region, in alphabetical order. | SELECT Region, ParityStatus FROM Region ORDER BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_hours (labor_hour_id INT, project_id INT, city VARCHAR(20), hours INT, year INT); INSERT INTO labor_hours (labor_hour_id, project_id, city, hours, year) VALUES (1, 201, 'Dallas', 100, 2020), (2, 201, 'Dallas', 200, 2019), (3, 202, 'Houston', 150, 2020); | How many construction labor hours were spent on projects in Texas in the year 2020? | SELECT SUM(hours) FROM labor_hours WHERE city IN ('Dallas', 'Houston') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, country VARCHAR(255)); INSERT INTO patients (id, country) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); CREATE TABLE therapy (patient_id INT, therapy_type VARCHAR(255)); INSERT INTO therapy (patient_id, therapy_type) VALUES (1, 'Teletherapy'), (2, 'In-person'), (3, 'Teletherapy'); | Count of patients who received teletherapy in each country? | SELECT country, COUNT(*) as teletherapy_count FROM patients JOIN therapy ON patients.id = therapy.patient_id WHERE therapy.therapy_type = 'Teletherapy' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE algorithmic_fairness (model_name TEXT, fairness_score INTEGER); INSERT INTO algorithmic_fairness (model_name, fairness_score) VALUES ('modelX', 87), ('modelY', 84), ('modelZ', 89); | Which model has the highest fairness score in the 'algorithmic_fairness' table? | SELECT model_name, fairness_score FROM algorithmic_fairness WHERE fairness_score = (SELECT MAX(fairness_score) FROM algorithmic_fairness); | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue (revenue_id INT, region VARCHAR(50), sector VARCHAR(50), revenue FLOAT); INSERT INTO revenue (revenue_id, region, sector, revenue) VALUES (1, 'Southern', 'Residential', 3000000); | What is the total construction revenue for each sector in the Southern region? | SELECT sector, SUM(revenue) AS total_revenue FROM revenue WHERE region = 'Southern' GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE Language_Preservation_Programs (id INT, program VARCHAR(100), establishment_year INT); INSERT INTO Language_Preservation_Programs (id, program, establishment_year) VALUES (1, 'Breath of Life', 1992), (2, 'Rising Voices', 2007), (3, 'Living Tongues Institute', 2006), (4, 'Endangered Languages Project', 2011... | Display the language preservation programs that have been active for more than 15 years, along with the year they were established. | SELECT program, establishment_year FROM Language_Preservation_Programs WHERE establishment_year <= YEAR(CURRENT_DATE) - 15; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, industry TEXT, type TEXT, employees_count INT, avg_salary FLOAT); INSERT INTO companies (id, name, industry, type, employees_count, avg_salary) VALUES (1, 'ABC Corp', 'Technology', 'Public', 500, 80000.00), (2, 'XYZ Inc', 'Renewable Energy', 'Public', 300, 70000.00); | What is the average salary of employees working in renewable energy companies? | SELECT AVG(avg_salary) FROM companies WHERE industry = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name TEXT, state TEXT); INSERT INTO customers (customer_id, name, state) VALUES (1, 'Customer A', 'Michigan'), (2, 'Customer B', 'Michigan'), (3, 'Customer C', 'Michigan'); CREATE TABLE purchases (purchase_id INT, customer_id INT, product_category_id INT); INSERT INTO purchases ... | What is the total number of customers who have purchased a specific product category in Michigan, grouped by product category and customer? | SELECT p.product_category_id, c.name, COUNT(*) AS purchase_count FROM customers c JOIN purchases p ON c.customer_id = p.customer_id WHERE c.state = 'Michigan' GROUP BY p.product_category_id, c.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_strategies (investment_id INT, sector VARCHAR(20), strategy VARCHAR(50), esg_score FLOAT); INSERT INTO investment_strategies (investment_id, sector, strategy, esg_score) VALUES (1, 'Healthcare', 'Microfinance', 86.2), (2, 'Finance', 'Sustainable Agriculture', 72.3), (3, 'Healthcare', 'Green Ener... | List all unique investment strategies in the 'Healthcare' sector with an ESG score above 85. | SELECT DISTINCT strategy FROM investment_strategies WHERE sector = 'Healthcare' AND esg_score > 85; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_institutions (id INT, name VARCHAR(255), type VARCHAR(255), country VARCHAR(255)); INSERT INTO financial_institutions (id, name, type, country) VALUES (1, 'Bank Rakyat Indonesia', 'Shariah-compliant Bank', 'Indonesia'); CREATE TABLE loans (id INT, financial_institution_id INT, loan_type VARCHAR(2... | What are the names of financial institutions that offer socially responsible loans in Indonesia? | SELECT financial_institutions.name FROM financial_institutions INNER JOIN loans ON financial_institutions.id = loans.financial_institution_id WHERE loans.is_socially_responsible = true AND financial_institutions.country = 'Indonesia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (id INT, regulation VARCHAR(100), effective_date DATE); INSERT INTO mental_health_parity (id, regulation, effective_date) VALUES (1, 'Regulation 1', '2010-01-01'), (2, 'Regulation 2', '2015-01-01'), (3, 'Regulation 3', '2018-01-01'); | What is the average effective date of mental health parity regulations? | SELECT AVG(effective_date) FROM mental_health_parity; | gretelai_synthetic_text_to_sql |
CREATE TABLE ratings (item_name VARCHAR(50), category VARCHAR(50), rating NUMERIC(3, 2)); INSERT INTO ratings (item_name, category, rating) VALUES ('Bruschetta', 'Appetizers', 4.5), ('Chicken Caesar Salad', 'Salads', 3.5), ('Veggie Burger', 'Entrees', 4.0); | What is the average rating for each menu category? | SELECT category, AVG(rating) AS avg_rating FROM ratings GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameSales (GameID INT PRIMARY KEY, GameType VARCHAR(20), Region VARCHAR(10), SalesYear INT); INSERT INTO GameSales (GameID, GameType, Region, SalesYear) VALUES (1, 'FPS', 'EU', 2021); INSERT INTO GameSales (GameID, GameType, Region, SalesYear) VALUES (2, 'RPG', 'NA', 2020); | How many FPS games were sold in the EU region in 2021? | SELECT COUNT(*) FROM GameSales WHERE GameType = 'FPS' AND Region = 'EU' AND SalesYear = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (game_id INT, game_name VARCHAR(100), genre VARCHAR(50), revenue INT); INSERT INTO Games (game_id, game_name, genre, revenue) VALUES (1, 'GameA', 'Action', 50000), (2, 'GameB', 'Adventure', 40000), (3, 'GameC', 'Strategy', 45000), (4, 'GameD', 'Action', 60000), (5, 'GameE', 'Adventure', 55000); | Show the total revenue for each genre of games | SELECT genre, SUM(revenue) AS total_revenue FROM Games GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_projects (year INT, region VARCHAR(255), type VARCHAR(255), count INT); INSERT INTO climate_projects (year, region, type, count) VALUES (2015, 'Africa', 'climate mitigation', 120); INSERT INTO climate_projects (year, region, type, count) VALUES (2016, 'Africa', 'climate mitigation', 150); INSERT IN... | How many climate mitigation projects were initiated in African countries between 2015 and 2018? | SELECT SUM(count) FROM climate_projects WHERE year BETWEEN 2015 AND 2018 AND region = 'Africa' AND type = 'climate mitigation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouses (WarehouseID int, WarehouseName varchar(50)); CREATE TABLE Shipments (ShipmentID int, WarehouseID int, CargoWeight int); INSERT INTO Warehouses VALUES (1, 'WarehouseA'), (2, 'WarehouseB'), (3, 'WarehouseC'); INSERT INTO Shipments VALUES (12345, 1, 5000), (67890, 1, 7000), (11121, 2, 6000), (2223... | What are the names and total cargo weights for all shipments that share a warehouse with shipment ID 12345? | SELECT Warehouses.WarehouseName, SUM(Shipments.CargoWeight) as TotalCargoWeight FROM Warehouses INNER JOIN Shipments ON Warehouses.WarehouseID = Shipments.WarehouseID WHERE Shipments.ShipmentID <> 12345 AND Warehouses.WarehouseID = (SELECT WarehouseID FROM Shipments WHERE ShipmentID = 12345) GROUP BY Warehouses.Warehou... | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (id INT, transaction_hash VARCHAR(255), gas_price INT, timestamp TIMESTAMP); INSERT INTO transactions (id, transaction_hash, gas_price, timestamp) VALUES (1, '0x123...', 10, '2022-02-01 00:00:00'), (2, '0x456...', 12, '2022-02-02 12:34:56'), (3, '0x789...', 8, '2022-02-09 14:23:01'); | What is the minimum gas price for transactions in the last 7 days? | SELECT MIN(gas_price) as min_gas_price FROM transactions WHERE timestamp >= DATE_SUB(NOW(), INTERVAL 7 DAY); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, age INT, gender VARCHAR(50), sexual_orientation VARCHAR(50), therapy_date DATE, improvement BOOLEAN); | What is the percentage of patients who identified as LGBTQ+ and experienced improvement after therapy? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM patients WHERE sexual_orientation LIKE '%LGBTQ%' AND therapy_date IS NOT NULL)) as percentage FROM patients WHERE sexual_orientation LIKE '%LGBTQ%' AND improvement = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSitesEurope (site_name VARCHAR(50), country VARCHAR(50), visitors INT); INSERT INTO HeritageSitesEurope (site_name, country, visitors) VALUES ('Acropolis', 'Greece', 2000000), ('Colosseum', 'Italy', 4000000), ('Tower of London', 'England', 3000000); | What is the average number of visitors to heritage sites in European countries? | SELECT AVG(visitors) FROM HeritageSitesEurope WHERE country IN ('Greece', 'Italy', 'England') AND region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(50), oil_production FLOAT, gas_production FLOAT, location VARCHAR(50)); INSERT INTO wells (well_id, well_name, oil_production, gas_production, location) VALUES (1, 'Well A', 1500, 2000, 'North Sea'), (2, 'Well B', 1200, 1800, 'North Sea'); | What was the total oil production in Q1 2020 for wells in the North Sea? | SELECT SUM(oil_production) FROM wells WHERE location = 'North Sea' AND EXTRACT(MONTH FROM timestamp) BETWEEN 1 AND 3 AND EXTRACT(YEAR FROM timestamp) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(50), founding_date DATE, industry VARCHAR(20)); CREATE TABLE investment_rounds (id INT, company_id INT, round_type VARCHAR(20), funding_amount INT); | What is the average funding amount per round for startups in the healthcare industry? | SELECT AVG(funding_amount) FROM investment_rounds ir JOIN companies c ON ir.company_id = c.id WHERE c.industry = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_content (id INT, title VARCHAR(255), release_year INT, runtime INT, genre VARCHAR(255), format VARCHAR(50), country VARCHAR(255)); | What is the number of movies and TV shows produced in each country, and the total runtime for each, in 2018? | SELECT country, format, COUNT(*), SUM(runtime) FROM media_content WHERE release_year = 2018 GROUP BY country, format; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operation (operation_id INT, operation_name TEXT, year INT, co2_emission INT); | What is the annual CO2 emission for each mining operation? | SELECT operation_name, co2_emission, year FROM mining_operation; | gretelai_synthetic_text_to_sql |
CREATE TABLE adaptation_projects (id INT, region VARCHAR(255), year INT, type VARCHAR(255), cost FLOAT); INSERT INTO adaptation_projects (id, region, year, type, cost) VALUES (1, 'Middle East', 2010, 'climate change adaptation', 300000); | What is the average number of climate change adaptation projects per year in the Middle East from 2010 to 2020? | SELECT AVG(cost) FROM adaptation_projects WHERE region = 'Middle East' AND type = 'climate change adaptation' AND year BETWEEN 2010 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, stars INT, is_sustainable BOOLEAN); CREATE TABLE countries (country_id INT, name TEXT, region TEXT); | Display the number of 5-star hotels and their sustainable certifications in Oceania. | SELECT h.country, SUM(h.stars = 5) AS five_star_hotels, SUM(h.is_sustainable) AS sustainable_certifications FROM hotels h WHERE h.country IN (SELECT name FROM countries WHERE region = 'Oceania') GROUP BY h.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Seattle_Neighborhoods (Neighborhood VARCHAR(255), IsEcoFriendly BOOLEAN); INSERT INTO Seattle_Neighborhoods (Neighborhood, IsEcoFriendly) VALUES ('Ballard', true), ('Fremont', false), ('Capitol Hill', true), ('West Seattle', false); CREATE TABLE Properties (Neighborhood VARCHAR(255), Price INT); INSERT INT... | What is the average property price in eco-friendly neighborhoods in Seattle? | SELECT AVG(Properties.Price) FROM Properties INNER JOIN Seattle_Neighborhoods ON Properties.Neighborhood = Seattle_Neighborhoods.Neighborhood WHERE Seattle_Neighborhoods.IsEcoFriendly = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_manufacturers (manufacturer_id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO chemical_manufacturers (manufacturer_id, name, country) VALUES (1, 'ManufacturerA', 'USA'), (2, 'ManufacturerB', 'Canada'), (3, 'ManufacturerC', 'USA'); CREATE TABLE emissions (emission_id INT, manufacturer_i... | What are the total greenhouse gas emissions of chemical manufacturers in the US and Canada? | SELECT cm.name, SUM(e.amount) FROM chemical_manufacturers cm JOIN emissions e ON cm.manufacturer_id = e.manufacturer_id WHERE cm.country IN ('USA', 'Canada') AND e.gas_type = 'CO2' GROUP BY cm.name | gretelai_synthetic_text_to_sql |
CREATE TABLE Station (sid INT, name VARCHAR(255), type VARCHAR(255)); CREATE TABLE Employee (eid INT, sid INT, role VARCHAR(255)); | What is the total number of police officers in each station? | SELECT Station.name, SUM(CASE WHEN Employee.role = 'police officer' THEN 1 ELSE 0 END) as total_police FROM Station INNER JOIN Employee ON Station.sid = Employee.sid GROUP BY Station.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), supplier_type VARCHAR(255), sales FLOAT, sale_date DATE); INSERT INTO products (product_id, product_name, supplier_type, sales, sale_date) VALUES (1, 'Organic Cotton Shirt', 'Fair Trade', 50, '2022-01-01'), (2, 'Recycled Tote Bag', 'Fair Trade', 30, '202... | What is the total sales revenue for products sourced from fair trade suppliers in the last year? | SELECT SUM(sales) FROM products WHERE supplier_type = 'Fair Trade' AND sale_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (state VARCHAR(2), violations INT); INSERT INTO mental_health_parity (state, violations) VALUES ('CA', 25), ('NY', 30), ('TX', 15); | Update the number of mental health parity violations in Texas to 18. | UPDATE mental_health_parity SET violations = 18 WHERE state = 'TX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AquaticFarm (date DATE, temperature FLOAT); | Insert a new record with date '2022-03-01' and temperature 24.0 in the AquaticFarm table. | INSERT INTO AquaticFarm (date, temperature) VALUES ('2022-03-01', 24.0); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(100), sentiment FLOAT, domain VARCHAR(50)); INSERT INTO articles (id, title, sentiment, domain) VALUES (1, 'Algorithmic Fairness: Achieving Equity in AI', 0.8, 'Algorithmic Fairness'), (2, 'The Challenges of AI Safety', 0.6, 'AI Safety'), (3, 'The Future of Creative AI', 0.9... | What is the maximum sentiment score of an article in the algorithmic fairness domain? | SELECT MAX(articles.sentiment) FROM articles WHERE articles.domain = 'Algorithmic Fairness'; | gretelai_synthetic_text_to_sql |
CREATE TABLE museums (id INT, name TEXT, city TEXT);CREATE TABLE museum_visitors (id INT, visitor_id INT, museum_id INT, country TEXT);CREATE TABLE visitors (id INT, name TEXT); | What are the top 5 most visited museums by international tourists? | SELECT m.name, COUNT(mv.visitor_id) as num_visitors FROM museums m JOIN museum_visitors mv ON m.id = mv.museum_id JOIN visitors v ON mv.visitor_id = v.id WHERE v.country != 'USA' GROUP BY m.name ORDER BY num_visitors DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE membership (member_id INT, join_date DATE, region VARCHAR(20), PRIMARY KEY (member_id)); INSERT INTO membership (member_id, join_date, region) VALUES (1, '2021-01-01', 'East'), (2, '2021-01-02', 'West'), (3, '2021-02-01', 'North'); | List the number of new members acquired per week for the first half of 2021, excluding members from the "West" region. | SELECT DATE_FORMAT(join_date, '%Y-%u') as week, COUNT(*) as new_members FROM membership WHERE region != 'West' AND join_date >= '2021-01-01' AND join_date < '2021-07-01' GROUP BY week; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name TEXT, type TEXT, price DECIMAL, inventory INT); INSERT INTO dishes (id, name, type, price, inventory) VALUES (1, 'Pizza Margherita', 'Veg', 7.50, 50), (2, 'Chicken Alfredo', 'Non-Veg', 12.00, 30), (3, 'Veggie Delight Sandwich', 'Veg', 6.50, 75); CREATE TABLE sales (id INT, dish_id INT,... | What is the total inventory value of non-vegetarian dishes sold on a given date? | SELECT SUM(d.price * d.inventory * s.quantity) as total_inventory_value FROM dishes d INNER JOIN sales s ON d.id = s.dish_id WHERE d.type = 'Non-Veg' AND s.date = '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species VARCHAR(50), ocean VARCHAR(50), feeding_habits VARCHAR(50)); | Update the feeding habits of the 'Basking Shark' to 'Filter Feeder' in the North Atlantic. | UPDATE marine_species SET feeding_habits = 'Filter Feeder' WHERE species = 'Basking Shark' AND ocean = 'North Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment_rates (state VARCHAR(255), year INT, employment_rate FLOAT); INSERT INTO veteran_employment_rates (state, year, employment_rate) VALUES ('CA', 2021, 0.8); INSERT INTO veteran_employment_rates (state, year, employment_rate) VALUES ('NY', 2021, 0.7); INSERT INTO veteran_employment_rates (s... | Find the top 3 states with the highest veteran employment rate in 2021 | SELECT state, employment_rate FROM veteran_employment_rates WHERE year = 2021 ORDER BY employment_rate DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media (user_id INT, post_id INT, post_date DATE, likes INT); | What is the average number of likes per post for the 'social_media' table, assuming the 'likes' column is of type INTEGER? | SELECT AVG(likes) FROM social_media; | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (id INT PRIMARY KEY, name VARCHAR(255), origin VARCHAR(255), recyclability_rating FLOAT); INSERT INTO materials (id, name, origin, recyclability_rating) VALUES (1, 'Recycled Plastic', 'Mexico', 4.6), (2, 'Reused Metal', 'Canada', 4.5), (3, 'Eco-Friendly Paper', 'Mexico', 4.7); | What is the total recyclability rating of materials from Mexico and Canada? | SELECT SUM(recyclability_rating) FROM materials WHERE origin IN ('Mexico', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_seafood_trends_3 (fishing_method VARCHAR(255), biomass FLOAT); INSERT INTO sustainable_seafood_trends_3 (fishing_method, biomass) VALUES ('Line Fishing', 600), ('Trawling', 800), ('Potting', 700); | Find the total biomass of fish in the sustainable_seafood_trends_3 table for each fishing_method. | SELECT fishing_method, SUM(biomass) FROM sustainable_seafood_trends_3 GROUP BY fishing_method; | gretelai_synthetic_text_to_sql |
CREATE TABLE ThreatIntel (id INT, vulnerability VARCHAR(255), frequency INT); INSERT INTO ThreatIntel (id, vulnerability, frequency) VALUES (1, 'CVE-2019-12345', 25), (2, 'CVE-2020-67890', 18), (3, 'CVE-2021-09876', 15), (4, 'CVE-2018-32100', 14), (5, 'CVE-2022-23456', 13); | What are the top 5 most common vulnerabilities in the ThreatIntel database? | SELECT vulnerability, frequency FROM (SELECT vulnerability, frequency, ROW_NUMBER() OVER (ORDER BY frequency DESC) AS rank FROM ThreatIntel) AS ranked_vulnerabilities WHERE rank <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR(50)); CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10,2)); | List all donors who have donated more than $1000 in total | SELECT d.name FROM donors d JOIN donations don ON d.id = donations.donor_id GROUP BY d.name HAVING SUM(donations.amount) > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), brand VARCHAR(255), price DECIMAL(10, 2)); INSERT INTO products VALUES (1, 'ProductA', 'BrandX', 50), (2, 'ProductB', 'BrandX', 75), (3, 'ProductC', 'BrandY', 60); | What is the average product price per brand, ordered by the average price? | SELECT brand, AVG(price) as avg_price FROM products GROUP BY brand ORDER BY avg_price DESC; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; CREATE TABLE if not exists biotech.startups (id INT, name VARCHAR(50), location VARCHAR(50), funding DECIMAL(10, 2)); INSERT INTO biotech.startups (id, name, location, funding) VALUES (1, 'Genentech', 'California', 5000000.00), (2, 'Celgene', 'New Jersey', 7000000.00), (3, 'Ambry Ge... | What is the total funding received by biotech startups in California, Texas, and New York? | SELECT SUM(funding) FROM biotech.startups WHERE location IN ('California', 'Texas', 'New York'); | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, country VARCHAR(50)); INSERT INTO wells (well_id, country) VALUES (1, 'Canada'), (2, 'USA'), (3, 'Norway'); | Compare the number of wells drilled in the USA and Canada. | SELECT 'Canada' as country, COUNT(*) as num_wells FROM wells WHERE country = 'Canada' UNION ALL SELECT 'USA' as country, COUNT(*) as num_wells FROM wells WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinics (id INT, name TEXT, diabetes_treatment BOOLEAN); INSERT INTO clinics VALUES (1, 'Rural Clinic A', FALSE); INSERT INTO clinics VALUES (2, 'Rural Clinic B', TRUE); INSERT INTO clinics VALUES (3, 'Rural Clinic C', FALSE); | What are the names of clinics that do not offer diabetes treatment? | SELECT name FROM clinics WHERE diabetes_treatment = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE tours (id INT, name TEXT, city TEXT, rating FLOAT); INSERT INTO tours (id, name, city, rating) VALUES (1, 'Paris Tour 1', 'Paris', 4.7), (2, 'Paris Tour 2', 'Paris', 4.3); | What are the names of virtual tours in Paris with a rating above 4.5? | SELECT name FROM tours WHERE city = 'Paris' AND rating > 4.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_energy (project_id INT, project_name VARCHAR(255), country VARCHAR(255), installed_capacity FLOAT); | Insert a new wind energy project 'Windfarm 2' in Germany with an installed capacity of 200 MW. | INSERT INTO wind_energy (project_name, country, installed_capacity) VALUES ('Windfarm 2', 'Germany', 200); | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_temperature (id INT PRIMARY KEY, location VARCHAR(255), temperature FLOAT); INSERT INTO ocean_temperature (id, location, temperature) VALUES (1, 'Pacific Ocean', 28.5); INSERT INTO ocean_temperature (id, location, temperature) VALUES (2, 'Atlantic Ocean', 29.8); | Delete all records from the "ocean_temperature" table where the temperature is above 30 degrees Celsius | DELETE FROM ocean_temperature WHERE temperature > 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_projects (id INT, country VARCHAR(50), capacity FLOAT); | What is the total installed capacity of wind energy projects in each country, sorted by the total capacity in descending order? | SELECT country, SUM(capacity) as total_capacity FROM wind_projects GROUP BY country ORDER BY total_capacity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendee_demographics (attendee_id INT, attendee_name VARCHAR(50), attendee_age INT); INSERT INTO attendee_demographics (attendee_id, attendee_name, attendee_age) VALUES (1, 'Jane Smith', 25), (2, 'Michael Johnson', 17), (3, 'Sophia Rodriguez', 16), (4, 'David Kim', 22); CREATE TABLE event_attendance (atte... | Find the number of unique attendees who attended both 'Music Festival' and 'Music Concert'. | SELECT COUNT(DISTINCT attendee_id) FROM event_attendance WHERE event_name IN ('Music Festival', 'Music Concert') GROUP BY attendee_id HAVING COUNT(DISTINCT event_name) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Grants (GrantID INT, AwardYear INT, Department VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO Grants (GrantID, AwardYear, Department, Amount) VALUES (1, 2020, 'Mathematics', 50000), (2, 2021, 'Physics', 60000), (3, 2020, 'Mathematics', 55000), (4, 2021, 'Computer Science', 70000); | How many grants were awarded to faculty members in the Mathematics department in 2020 and 2021? | SELECT COUNT(*) FROM Grants WHERE Department = 'Mathematics' AND AwardYear IN (2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_incident (id INT, vessel_id INT, incident_date DATE); | List all the vessels that have had an incident in the last 5 years. | SELECT v.name FROM vessel_incident vi JOIN vessel v ON vi.vessel_id = v.id WHERE vi.incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (incident_id INT, incident_date DATE); INSERT INTO safety_incidents (incident_id, incident_date) VALUES (1, '2021-02-01'), (2, '2021-05-15'), (3, '2021-08-20'), (4, '2020-12-10'); | How many safety incidents were reported in the chemical plant last year? | SELECT COUNT(*) FROM safety_incidents WHERE incident_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_health_metrics (site_id INT, site_type VARCHAR(50), metric_name VARCHAR(50), value FLOAT); INSERT INTO ocean_health_metrics VALUES (1, 'Freshwater', 'pH', 7.8), (2, 'Marine', 'pH', 8.1), (3, 'Freshwater', 'Salinity', 1.2), (4, 'Marine', 'Salinity', 3.5), (5, 'Freshwater', 'Temperature', 15.5), (6, 'M... | What is the difference in ocean health metrics between freshwater and marine aquaculture sites? | SELECT site_type, metric_name, AVG(value) AS avg_value FROM ocean_health_metrics GROUP BY site_type, metric_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT, business_name TEXT, city TEXT, waste_quantity INT); INSERT INTO waste_generation (id, business_name, city, waste_quantity) VALUES (1, 'Business A', 'San Francisco', 500), (2, 'Business B', 'San Francisco', 750); | What is the total waste generation by businesses in the city of San Francisco? | SELECT SUM(waste_quantity) FROM waste_generation WHERE city = 'San Francisco' AND business_name IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, volunteer VARCHAR(50), program VARCHAR(50), gender VARCHAR(10), volunteer_date DATE); INSERT INTO Volunteers (id, volunteer, program, gender, volunteer_date) VALUES (1, 'Jane Doe', 'Human Rights', 'Female', '2020-01-01'); | How many volunteers participated in the "Human Rights" program in each month of 2020, broken down by gender? | SELECT EXTRACT(MONTH FROM volunteer_date) AS Month, gender, COUNT(volunteer) AS Volunteer_Count FROM Volunteers WHERE program = 'Human Rights' AND YEAR(volunteer_date) = 2020 GROUP BY Month, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_access (patient_id INT, community VARCHAR(20), distance FLOAT); INSERT INTO healthcare_access (patient_id, community, distance) VALUES (1, 'Indigenous', 50.5); INSERT INTO healthcare_access (patient_id, community, distance) VALUES (2, 'Non-Indigenous', 20.3); | What is the average distance traveled for healthcare access for Indigenous communities in Canada? | SELECT AVG(distance) FROM healthcare_access WHERE community = 'Indigenous'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_menu (dish VARCHAR(255), category VARCHAR(255), price DECIMAL(10, 2)); INSERT INTO restaurant_menu (dish, category, price) VALUES ('Veg Samosas', 'Indian Cuisine', 5.50); INSERT INTO restaurant_menu (dish, category, price) VALUES ('Chicken Tikka Masala', 'Indian Cuisine', 12.99); | Insert a new record in the restaurant_menu table for 'Vegetarian Biryani' dish under 'Indian Cuisine' category. | INSERT INTO restaurant_menu (dish, category, price) VALUES ('Vegetarian Biryani', 'Indian Cuisine', 10.99); | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, event_name TEXT, location_id INT); CREATE TABLE locations (location_id INT, district_id INT, location_text TEXT); | List all disaster preparedness events and their corresponding locations in the 'Northside' district. | SELECT e.event_name, l.location_text FROM events e INNER JOIN locations l ON e.location_id = l.location_id WHERE l.district_id = (SELECT district_id FROM districts WHERE district_name = 'Northside'); | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS hotels (id INT PRIMARY KEY, name TEXT, country TEXT, is_green BOOLEAN, capacity INT); INSERT INTO hotels (id, name, country, is_green, capacity) VALUES (1, 'EcoHotel', 'India', true, 200), (2, 'LuxuryHotel', 'UAE', false, 500), (3, 'GreenResort', 'India', true, 300); | What is the total capacity of green hotels in India? | SELECT SUM(capacity) FROM hotels WHERE is_green = true AND country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(50), hire_date DATE); | Insert a new employee record into the 'employees' table | INSERT INTO employees (id, first_name, last_name, department, hire_date) VALUES (101, 'Jamila', 'Garcia', 'Marketing', '2022-04-11'); | gretelai_synthetic_text_to_sql |
CREATE TABLE imports (id INT, product TEXT, is_organic BOOLEAN, country TEXT); INSERT INTO imports (id, product, is_organic, country) VALUES (1, 'Apples', true, 'Egypt'); INSERT INTO imports (id, product, is_organic, country) VALUES (2, 'Oranges', false, 'Egypt'); INSERT INTO imports (id, product, is_organic, country) ... | What is the percentage of organic fruits imported from Egypt? | SELECT (COUNT(*) FILTER (WHERE is_organic = true) * 100.0 / (SELECT COUNT(*) FROM imports WHERE country = 'Egypt')) FROM imports WHERE product = 'Apples' OR product = 'Bananas' AND country = 'Egypt'; | gretelai_synthetic_text_to_sql |
CREATE TABLE covid_data (state VARCHAR(255), cases INT); INSERT INTO covid_data (state, cases) VALUES ('State A', 1000), ('State B', 2000), ('State C', 1500), ('State D', 2500), ('State E', 3000); | Find the top 3 states with the highest number of COVID-19 cases? | SELECT state, cases, RANK() OVER (ORDER BY cases DESC) as rank FROM covid_data WHERE rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR, age INT, ethnicity VARCHAR); | Insert a new record for a community health worker with ethnicity 'Asian'. | INSERT INTO community_health_workers (name, age, ethnicity) VALUES ('Mike Lee', 30, 'Asian'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Union_Members (union_id INT, member_id INT, safety_rating FLOAT); INSERT INTO Union_Members (union_id, member_id, safety_rating) VALUES (1, 101, 8.75), (1, 102, 9.25), (2, 201, 7.50), (2, 202, 8.75); | Count the total number of members in each union having a safety_rating greater than 8.5. | SELECT union_id, COUNT(member_id) FROM Union_Members WHERE safety_rating > 8.5 GROUP BY union_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donation_amount DECIMAL(10,2), donation_year INT, gender VARCHAR(10)); INSERT INTO donors (donor_id, donation_amount, donation_year, gender) VALUES (1, 5000.00, 2020, 'female'), (2, 3000.00, 2019, 'male'), (3, 7000.00, 2020, 'non-binary'), (4, 8000.00, 2021, 'non-binary'); | Update the donation amount to $9000 for donor_id 4. | UPDATE donors SET donation_amount = 9000 WHERE donor_id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name TEXT, budget INT, start_date DATE, state TEXT); INSERT INTO campaigns (id, name, budget, start_date, state) VALUES (1, 'EndStigma', 50000, '2019-03-01', 'New York'); INSERT INTO campaigns (id, name, budget, start_date, state) VALUES (2, 'HealthyMinds', 75000, '2018-06-15', 'Californ... | List all campaigns in New York that started after 2018 | SELECT name FROM campaigns WHERE state = 'New York' AND start_date > '2018-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure (id INT, project VARCHAR(50), year INT, budget INT); INSERT INTO infrastructure (id, project, year, budget) VALUES (1, 'Road Construction', 2018, 300000), (2, 'Bridge Building', 2020, 400000); | Find the top 3 rural infrastructure projects with the highest budgets and their completion years. | SELECT project, year, budget FROM infrastructure ORDER BY budget DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Space_Satellites (Satellite_ID INT, Satellite_Name VARCHAR(100), Launch_Date DATE, Country_Name VARCHAR(50), Agency_Name VARCHAR(50)); INSERT INTO Space_Satellites (Satellite_ID, Satellite_Name, Launch_Date, Country_Name, Agency_Name) VALUES (1, 'Sat1', '2000-01-01', 'USA', 'NASA'), (2, 'Sat2', '2001-01-01... | How many satellites were launched in each year by agency? | SELECT EXTRACT(YEAR FROM Launch_Date) as Launch_Year, Agency_Name, COUNT(*) as Total_Satellites FROM Space_Satellites GROUP BY Launch_Year, Agency_Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteProduction (SiteID INT, MineType VARCHAR(10), Waste INT); INSERT INTO WasteProduction (SiteID, MineType, Waste) VALUES (1, 'Coal', 1000), (2, 'Coal', 1500), (3, 'Gold', 500); | What is the total amount of waste produced by coal mines? | SELECT SUM(Waste) FROM WasteProduction WHERE MineType = 'Coal'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainability (id INT, brand VARCHAR(50), score INT, category VARCHAR(50)); | Delete records from sustainability table where brand='XYZ' | DELETE FROM sustainability WHERE brand = 'XYZ'; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO faculty (id, name, department) VALUES (1, 'Irene', 'Arts'); INSERT INTO faculty (id, name, department) VALUES (2, 'Jack', 'Engineering'); CREATE TABLE grants (id INT, faculty_id INT, amount DECIMAL(10, 2), year INT); INSERT INTO grants... | What is the total amount of research grants awarded to faculty members in the Arts department for each year? | SELECT g.year, SUM(g.amount) AS total_grant_amount FROM grants g JOIN faculty f ON g.faculty_id = f.id WHERE f.department = 'Arts' GROUP BY g.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarterly_chemicals (manufacturer_id INT, chemical_id INT, chemical_type VARCHAR(50), quarter INT, weight FLOAT); INSERT INTO quarterly_chemicals (manufacturer_id, chemical_id, chemical_type, quarter, weight) VALUES (1, 1, 'Acid', 1, 150.5), (1, 1, 'Acid', 2, 155.6), (1, 1, 'Acid', 3, 160.3), (1, 1, 'Acid'... | Calculate the percentage change in weight of each chemical produced by the same manufacturer, between the second and third quarters of the year | SELECT a.manufacturer_id, a.chemical_id, a.chemical_type, a.quarter, a.weight, b.weight, ((a.weight - b.weight) / b.weight) * 100 as percentage_change FROM quarterly_chemicals a JOIN quarterly_chemicals b ON a.manufacturer_id = b.manufacturer_id AND a.chemical_id = b.chemical_id WHERE a.quarter = 3 AND b.quarter = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_scores (score_id INT, student_id INT, score_date DATE, mental_health_score INT, gender VARCHAR(10), age_group VARCHAR(20)); INSERT INTO mental_health_scores (score_id, student_id, score_date, mental_health_score, gender, age_group) VALUES (1, 1, '2022-01-01', 75, 'Male', '10-14'), (2, 2, '202... | What is the average mental health score by gender and age group? | SELECT gender, age_group, AVG(mental_health_score) FROM mental_health_scores GROUP BY gender, age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INTEGER, name TEXT);CREATE TABLE region (id INTEGER, country_id INTEGER, name TEXT, type TEXT);CREATE TABLE iot_sensor (id INTEGER, region_id INTEGER, installed_date DATE); | How many IoT sensors were installed in rural and urban areas in each country in the past quarter? | SELECT co.name as country, r.type as area_type, COUNT(s.id) as num_sensors FROM country co INNER JOIN region r ON co.id = r.country_id INNER JOIN iot_sensor s ON r.id = s.region_id WHERE s.installed_date >= DATEADD(quarter, -1, CURRENT_DATE) GROUP BY co.name, r.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_production (well_id INT, measurement_date DATE, production_rate FLOAT); INSERT INTO well_production (well_id, measurement_date, production_rate) VALUES (1, '2022-01-01', 500), (1, '2022-02-01', 550), (2, '2022-01-01', 700), (2, '2022-02-01', 650); | What is the percentage change in production rate for each well between January and February? | SELECT a.well_id, (b.production_rate - a.production_rate) * 100.0 / a.production_rate AS Percentage_Change FROM well_production a JOIN well_production b ON a.well_id = b.well_id WHERE a.measurement_date = '2022-01-01' AND b.measurement_date = '2022-02-01' | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name VARCHAR(255), category VARCHAR(255), rating FLOAT); | List all products with a rating higher than the average rating for their respective category, ordered by category in ascending order. | SELECT * FROM products WHERE rating > (SELECT AVG(rating) FROM products p2 WHERE p2.category = products.category) ORDER BY category ASC; | 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.