context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Accommodations (ID INT PRIMARY KEY, Country VARCHAR(50), AccommodationType VARCHAR(50), Quantity INT); INSERT INTO Accommodations (ID, Country, AccommodationType, Quantity) VALUES (1, 'USA', 'Sign Language Interpretation', 300), (2, 'Canada', 'Wheelchair Ramp', 250), (3, 'Mexico', 'Assistive Listening Devi... | What is the total number of accommodations provided, by accommodation type, for each country? | SELECT Country, AccommodationType, SUM(Quantity) as Total FROM Accommodations GROUP BY Country, AccommodationType; | gretelai_synthetic_text_to_sql |
CREATE TABLE department (name VARCHAR(255), id INT);CREATE TABLE professor (name VARCHAR(255), department_id INT, grant_amount DECIMAL(10,2), publication_year INT); | What is the minimum research grant amount awarded to a professor in the Chemistry department who has published at least one paper? | SELECT MIN(grant_amount) FROM professor WHERE department_id IN (SELECT id FROM department WHERE name = 'Chemistry') AND publication_year IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (supplier_id INTEGER, supplier_name TEXT, safety_rating INTEGER); INSERT INTO Suppliers (supplier_id, supplier_name, safety_rating) VALUES (123, 'Acme Corp', 90), (234, 'Beta Inc', 85), (345, 'Gamma Ltd', 95), (456, 'Delta Co', 80), (567, 'Epsilon plc', 92); | What are the names and safety ratings for suppliers with a supplier ID between 300 and 500? | SELECT s.supplier_name, s.safety_rating FROM Suppliers s WHERE s.supplier_id BETWEEN 300 AND 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_trips (id INT, trip_date DATE, passengers INT); INSERT INTO bus_trips (id, trip_date, passengers) VALUES (1, '2022-01-01', 50), (2, '2022-01-01', 60), (3, '2022-02-01', 40); | What is the average number of passengers per bus trip, partitioned by month and ranked by the highest average? | SELECT AVG(passengers) OVER (PARTITION BY DATEPART(mm, trip_date) ORDER BY AVG(passengers) DESC) as avg_passengers, trip_date FROM bus_trips WHERE trip_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT PRIMARY KEY, contracting_agency VARCHAR(255), contract_status VARCHAR(255), contract_amount DECIMAL(10,2)); | Update the 'contract_amount' field in the 'defense_contracts' table for records where 'contracting_agency' is 'Department of the Navy' and 'contract_status' is 'active' by setting the 'contract_amount' to 'contract_amount' + 0.10 * 'contract_amount' | UPDATE defense_contracts SET contract_amount = contract_amount + 0.10 * contract_amount WHERE contracting_agency = 'Department of the Navy' AND contract_status = 'active'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GarmentInventory (garment_id INT, size INT, quantity INT); INSERT INTO GarmentInventory VALUES (1, 8, 200), (2, 10, 150), (3, 12, 300); | What is the total number of size 8 and size 10 garments in stock? | SELECT SUM(quantity) FROM GarmentInventory WHERE size IN (8, 10); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, patient_name TEXT, condition TEXT, therapist_id INT, treatment TEXT); INSERT INTO patients (patient_id, patient_name, condition, therapist_id, treatment) VALUES (1, 'James Johnson', 'PTSD', 1, 'Meditation'); INSERT INTO patients (patient_id, patient_name, condition, therapist_id, ... | How many patients have been treated with meditation for PTSD in California? | SELECT COUNT(*) FROM patients JOIN therapists ON patients.therapist_id = therapists.therapist_id WHERE patients.condition = 'PTSD' AND patients.treatment = 'Meditation' AND therapists.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(255), conservation_status VARCHAR(50)); CREATE TABLE conservation_efforts (effort_id INT, species_id INT, ocean VARCHAR(50), effort_description VARCHAR(255)); INSERT INTO marine_species (species_id, species_name, conservation_status) VALUES (1, 'Mediterr... | What are the conservation efforts for endangered marine species in the Mediterranean Sea? | SELECT conservation_efforts.effort_description FROM marine_species INNER JOIN conservation_efforts ON marine_species.species_id = conservation_efforts.species_id WHERE marine_species.conservation_status = 'Endangered' AND conservation_efforts.ocean = 'Mediterranean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_fabric (id INT PRIMARY KEY, fabric VARCHAR(25), country_of_origin VARCHAR(20)); INSERT INTO sustainable_fabric (id, fabric, country_of_origin) VALUES (1, 'Organic Cotton', 'India'), (2, 'Tencel', 'Austria'), (3, 'Hemp', 'China'), (4, 'Recycled Polyester', 'Japan'); | Insert data into sustainable_fabric | INSERT INTO sustainable_fabric (id, fabric, country_of_origin) VALUES (1, 'Organic Cotton', 'India'), (2, 'Tencel', 'Austria'), (3, 'Hemp', 'China'), (4, 'Recycled Polyester', 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id VARCHAR(20), name VARCHAR(20)); INSERT INTO vessels (id, name) VALUES ('VES011', 'VESSEL011'), ('VES012', 'VESSEL012'); CREATE TABLE fuel_consumption (vessel_id VARCHAR(20), consumption_rate DECIMAL(5,2)); INSERT INTO fuel_consumption (vessel_id, consumption_rate) VALUES ('VES011', 4.5), ('VES0... | What is the maximum fuel consumption rate for VESSEL011? | SELECT MAX(consumption_rate) FROM fuel_consumption WHERE vessel_id = 'VES011'; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers(id INT, city VARCHAR(20), last_data_usage_date DATE, monthly_data_usage DECIMAL(5,2)); INSERT INTO subscribers(id, city, last_data_usage_date, monthly_data_usage) VALUES (1, 'New York', '2022-01-15', 3.5), (2, 'New York', '2022-02-10', 4.2), (3, 'Chicago', '2022-03-05', 0.0); | List all cities with mobile subscribers who have not used any data in the last month. | SELECT city FROM subscribers WHERE monthly_data_usage = 0 AND last_data_usage_date < DATE_SUB(CURDATE(), INTERVAL 1 MONTH) GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (region VARCHAR(10), year INT, rate DECIMAL(3,2)); INSERT INTO recycling_rates (region, year, rate) VALUES ('North', 2018, 0.55), ('North', 2019, 0.58), ('North', 2020, 0.61), ('South', 2018, 0.60), ('South', 2019, 0.63), ('South', 2020, 0.66), ('East', 2018, 0.65), ('East', 2019, 0.68), ('... | What is the recycling rate for the 'South' region in 2019? | SELECT rate FROM recycling_rates WHERE region = 'South' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE PT_Usage (id INT, system_type VARCHAR(20), country VARCHAR(50), users INT, market_share FLOAT); INSERT INTO PT_Usage (id, system_type, country, users, market_share) VALUES (1, 'Tokyo Metro', 'Japan', 2500000, 0.35), (2, 'Osaka Municipal Subway', 'Japan', 900000, 0.12), (3, 'Nagoya Municipal Subway', 'Japan... | What is the market share of public transportation systems in Japan? | SELECT AVG(market_share) as avg_market_share FROM PT_Usage WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_id INT, name VARCHAR(50), depth FLOAT, ocean VARCHAR(10)); INSERT INTO marine_protected_areas (area_id, name, depth, ocean) VALUES (1, 'Great Barrier Reef', 34, 'Pacific'), (2, 'Galapagos Islands', 170, 'Pacific'), (3, 'Azores', 500, 'Atlantic'); | Delete the marine protected area with the minimum depth | DELETE FROM marine_protected_areas WHERE depth = (SELECT MIN(depth) FROM marine_protected_areas); | gretelai_synthetic_text_to_sql |
CREATE TABLE papers (paper_id INT, title VARCHAR(100), author_id INT, published_date DATE, category VARCHAR(50)); INSERT INTO papers (paper_id, title, author_id, published_date, category) VALUES (1, 'Fairness in AI', 1, '2021-06-01', 'Algorithmic Fairness'); INSERT INTO papers (paper_id, title, author_id, published_dat... | Delete the papers related to 'Algorithmic Fairness' category. | DELETE FROM papers WHERE category = 'Algorithmic Fairness'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_papers (paper_id INT, title VARCHAR(100), publication_year INT, author_id INT, num_citations INT); | Identify the top 3 AI research papers in terms of citations, published in the last 2 years, along with their authors and the number of citations they have received. | SELECT title, author_id, num_citations FROM ai_papers WHERE publication_year >= YEAR(CURRENT_DATE) - 2 GROUP BY paper_id ORDER BY num_citations DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_certifications (certification_id INT, destination TEXT, certification_type TEXT, certification_date DATE); INSERT INTO sustainable_certifications (certification_id, destination, certification_type, certification_date) VALUES (1, 'Bali', 'Green Globe', '2022-01-01'), (2, 'Paris', 'EarthCheck', '... | List all destinations with more than 1 sustainable certification, ordered by the number of certifications in descending order. | SELECT destination FROM sustainable_certifications GROUP BY destination HAVING COUNT(*) > 1 ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, region TEXT, num_founders INT, funding FLOAT); INSERT INTO companies (id, name, region, num_founders, funding) VALUES (1, 'Startup A', 'west_coast', 2, 5000000), (2, 'Startup B', 'east_coast', 1, 3000000), (3, 'Startup C', 'west_coast', 3, 7000000), (4, 'Startup D', 'east_coas... | Calculate the total funding for startups that have more than one founder | SELECT SUM(funding) FROM companies WHERE num_founders > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_consumption (city VARCHAR(50), consumption FLOAT, month INT, year INT); INSERT INTO water_consumption (city, consumption, month, year) VALUES ('New York', 120.2, 1, 2021), ('New York', 130.5, 2, 2021), ('New York', 100.8, 3, 2021); | Determine the month with the lowest water consumption for the city of New York. | SELECT month, MIN(consumption) FROM water_consumption WHERE city = 'New York' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (menu_category VARCHAR(50), transaction_date DATE, revenue NUMERIC(10,2)); INSERT INTO restaurant_revenue (menu_category, transaction_date, revenue) VALUES ('Appetizers', '2023-03-01', 1500.00), ('Entrees', '2023-03-03', 2500.00), ('Desserts', '2023-03-02', 1200.00); | Find the top 3 menu categories with the highest revenue in the last 7 days. | SELECT menu_category, SUM(revenue) AS total_revenue FROM restaurant_revenue WHERE transaction_date >= CURRENT_DATE - INTERVAL '7 days' GROUP BY menu_category ORDER BY total_revenue DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE readers (id INT, age INT, gender VARCHAR(10), country VARCHAR(50), news_preference VARCHAR(50)); INSERT INTO readers (id, age, gender, country, news_preference) VALUES (1, 30, 'Male', 'India', 'Technology'), (2, 40, 'Female', 'India', 'Technology'); | What is the average age of readers who prefer technology news in India, partitioned by gender? | SELECT AVG(age) avg_age, gender FROM readers WHERE country = 'India' AND news_preference = 'Technology' GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media (user_id INT, post_id INT, post_date DATE); | Count the number of users who have made a post on January 1, 2022 in the 'social_media' table. | SELECT COUNT(*) FROM social_media WHERE post_date = '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Clients (id INT, name VARCHAR(50), attorney_id INT, paid DECIMAL(5,2)); CREATE TABLE Bills (id INT, client_id INT, amount DECIMAL(5,2)); INSERT INTO Clients (id, name, attorney_id, paid) VALUES (1, 'Client1', 1, 600.00), (2, 'Client2', 1, NULL), (3, 'Client3', 2, 1000.00); INSERT INTO Bills (id, client_id,... | What are the names of clients who have not paid their bills? | SELECT Clients.name FROM Clients LEFT JOIN Bills ON Clients.id = Bills.client_id WHERE Clients.paid IS NULL OR Bills.amount - Clients.paid > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE OceanFloorMapping (location TEXT, depth INTEGER, map_date DATE); INSERT INTO OceanFloorMapping (location, depth, map_date) VALUES ('Pacific Ocean', 6000, '2022-01-01'); | What is the maximum depth mapped in the Pacific Ocean? | SELECT OceanFloorMapping.location, MAX(depth) FROM OceanFloorMapping WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_access (strategy VARCHAR(255), success_rate FLOAT); INSERT INTO market_access (strategy, success_rate) VALUES ('Direct to consumer', 0.75), ('Physician recommendation', 0.85), ('Pharmacy sales', 0.65); | List the market access strategies and their respective success rates. | SELECT strategy, success_rate FROM market_access; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, cause VARCHAR(50), donation DECIMAL(10, 2), donation_date DATE); | What is the total donation amount for each cause in the first quarter of 2022? | SELECT cause, SUM(donation) FROM donations WHERE donation_date >= '2022-01-01' AND donation_date < '2022-04-01' GROUP BY cause; | gretelai_synthetic_text_to_sql |
CREATE TABLE billing (attorney_id INT, client_id INT, hours FLOAT, rate FLOAT); INSERT INTO billing (attorney_id, client_id, hours, rate) VALUES (1, 101, 10, 300), (2, 102, 8, 350), (3, 103, 12, 250); | List clients and their total billing hours in the 'billing' table? | SELECT client_id, SUM(hours) FROM billing GROUP BY client_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), role VARCHAR(50)); INSERT INTO employees (id, name, department, role) VALUES (1, 'John Doe', 'hr', 'employee'), (2, 'Jane Smith', 'hr', 'manager'), (3, 'Bob Johnson', 'operations', 'employee'), (4, 'Alice', 'it', 'employee'); | Update the role of employee with id 3 to 'senior employee'. | UPDATE employees SET role = 'senior employee' WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Max_Altitude (rocket VARCHAR(50), altitude INT); INSERT INTO Max_Altitude (rocket, altitude) VALUES ('Falcon Heavy', 20000000), ('Falcon 9', 15000000); | What is the maximum altitude reached by SpaceX's Falcon Heavy rocket? | SELECT altitude FROM Max_Altitude WHERE rocket = 'Falcon Heavy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE staff_categories (id INT, name VARCHAR(255)); CREATE TABLE staff (id INT, country_id INT, category_id INT, hired_date DATE); | What is the total number of disaster response and community development staff members in each country? | SELECT countries.name, COUNT(staff.id) FROM staff JOIN countries ON staff.country_id = countries.id WHERE staff.category_id IN (SELECT id FROM staff_categories WHERE name IN ('disaster response', 'community development')) GROUP BY staff.country_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE co_ownership (property_id INT, owner VARCHAR(255), percentage INT); INSERT INTO co_ownership (property_id, owner, percentage) VALUES (1, 'Alice', 50), (1, 'Bob', 50), (2, 'Carol', 75), (2, 'Dave', 25), (3, 'Eve', 60), (3, 'Frank', 40); | List the names and average co-owner percentages for all properties in the 'co_ownership' table where the co-owner percentage is greater than 50. | SELECT owner, AVG(percentage) FROM co_ownership WHERE percentage > 50 GROUP BY owner; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_health (donor_id INTEGER, donation_amount INTEGER, organization_name TEXT); INSERT INTO global_health (donor_id, donation_amount, organization_name) VALUES (1, 5000, 'Malaria Consortium'), (2, 4000, 'Schistosomiasis Control Initiative'); | Which organizations have received donations in the 'global_health' sector? | SELECT DISTINCT organization_name FROM global_health WHERE organization_name LIKE '%global_health%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, country VARCHAR(50), name VARCHAR(100), visitor_count INT); INSERT INTO heritage_sites (id, country, name, visitor_count) VALUES (1, 'Japan', 'Site A', 2000), (2, 'Japan', 'Site B', 3000), (3, 'Italy', 'Site C', 4000); | How many heritage sites are there in Japan and their average visitor count? | SELECT country, AVG(visitor_count) FROM heritage_sites WHERE country = 'Japan' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_chichen_itza (artifact_id INTEGER, artifact_name TEXT, analysis_status TEXT); INSERT INTO artifact_chichen_itza (artifact_id, artifact_name, analysis_status) VALUES (1, 'Temple of Kukulcan', 'Analyzed'), (2, 'Great Ball Court', 'Not Analyzed'), (3, 'Platform of Venus', 'Analyzed'), (4, 'Observator... | list all artifacts from site 'Chichen Itza' with their analysis status | SELECT * FROM artifact_chichen_itza WHERE artifact_name = 'Chichen Itza'; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (id INT, product_id INT, quantity INT, price DECIMAL(5,2)); CREATE TABLE products (id INT, name VARCHAR(50), natural BOOLEAN); | Calculate the total revenue from natural hair care products | SELECT SUM(orders.quantity * products.price) FROM orders JOIN products ON orders.product_id = products.id WHERE products.natural = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturers (name VARCHAR(50), satellites INT); INSERT INTO Manufacturers (name, satellites) VALUES ('SpaceX', 200), ('Boeing', 100), ('Lockheed Martin', 75); | What is the total number of satellites deployed by each manufacturer? | SELECT name, SUM(satellites) FROM Manufacturers GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_events (event_id INT, event_date DATE, event_topic VARCHAR(255)); | How many policy advocacy events were held in the last 12 months for mental health? | SELECT COUNT(*) FROM policy_events WHERE event_topic = 'Mental Health' AND event_date >= DATEADD(month, -12, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT, event_name VARCHAR(255), team VARCHAR(255), quarter VARCHAR(255), price DECIMAL(5,2)); INSERT INTO Events VALUES (1, 'Tournament 1', 'E-Sports', 'Q1', 25.00), (2, 'Tournament 2', 'E-Sports', 'Q1', 30.00); | What is the average ticket price for 'E-Sports' events in 'Q1'? | SELECT AVG(price) FROM Events WHERE team = 'E-Sports' AND quarter = 'Q1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(50)); INSERT INTO regions (id, name) VALUES (1, 'RegionA'), (2, 'RegionB'), (3, 'RegionC'), (4, 'RegionD'); CREATE TABLE budget (id INT, region_id INT, department VARCHAR(50), amount INT); INSERT INTO budget (id, region_id, department, amount) VALUES (1, 1, 'Education', 500000... | What is the total budget allocated for transportation in 'RegionD'? | SELECT SUM(amount) FROM budget WHERE department = 'Transportation' AND region_id IN (SELECT id FROM regions WHERE name = 'RegionD'); | gretelai_synthetic_text_to_sql |
CREATE TABLE comm_history (id INT, ip_address VARCHAR(255), domain VARCHAR(255), communication_date DATE); INSERT INTO comm_history (id, ip_address, domain, communication_date) VALUES (1, '192.168.1.1', 'example.com', '2021-01-01'), (2, '192.168.1.2', 'example.com', '2021-01-01'), (3, '192.168.1.1', 'example.com', '202... | How many unique IP addresses communicated with a specific domain in the last month? | SELECT COUNT(DISTINCT ip_address) as unique_ips FROM comm_history WHERE domain = 'example.com' AND communication_date >= DATEADD(day, -30, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_manufacturing (id INT AUTO_INCREMENT, company_name VARCHAR(50), location VARCHAR(50), ethical_certification VARCHAR(50), PRIMARY KEY(id)); | Show all records from the 'ethical_manufacturing' table | SELECT * FROM ethical_manufacturing; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (user_id INT, service VARCHAR(50), subscription_date DATE); INSERT INTO subscribers (user_id, service, subscription_date) VALUES (1, 'Netflix', '2022-03-23'), (2, 'Disney+', '2022-03-18'); | Determine the number of users who started using a streaming service in the last month, by service. | SELECT service, COUNT(*) as new_subscribers FROM subscribers WHERE subscription_date >= DATEADD(month, -1, GETDATE()) GROUP BY service; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (id INT, name VARCHAR(255), company VARCHAR(255), launch_date DATE, country VARCHAR(255)); INSERT INTO digital_assets (id, name, company, launch_date, country) VALUES (1, 'Asset 1', 'Company A', '2021-01-01', 'USA'), (2, 'Asset 2', 'Company B', '2021-02-15', 'Canada'); | What is the total number of digital assets launched by companies based in the United States and Canada? | SELECT COUNT(*) FROM digital_assets WHERE country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id VARCHAR(10), well_location VARCHAR(20)); INSERT INTO wells (well_id, well_location) VALUES ('B02', 'Alaska'); CREATE TABLE production (well_id VARCHAR(10), production_count INT); INSERT INTO production (well_id, production_count) VALUES ('B02', 5000); | Update the production count for well 'B02' in 'Alaska' to 6500. | UPDATE production SET production_count = 6500 WHERE well_id = 'B02'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Incidents (facility VARCHAR(20), year INT, incidents INT); INSERT INTO Incidents (facility, year, incidents) VALUES ('Northern', 2021, 4), ('Northern', 2022, 2); | How many safety incidents were reported at the facility located in the Northern region in 2021? | SELECT incidents FROM Incidents WHERE facility = 'Northern' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE vendor_shipments (id INT, vendor_id INT, store_id INT, shipment_date DATE, quantity INT); CREATE TABLE stores (id INT, name VARCHAR(50), city VARCHAR(50), region VARCHAR(50)); | List all the vendors that have supplied products to a particular store in the last six months, along with the quantities of products supplied. | SELECT vendors.name, vendor_shipments.product_id, vendor_shipments.quantity FROM vendors JOIN vendor_shipments ON vendors.id = vendor_shipments.vendor_id JOIN stores ON vendor_shipments.store_id = stores.id WHERE stores.name = 'Specific Store Name' AND vendor_shipments.shipment_date >= DATE(NOW()) - INTERVAL 6 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE policyholders (id INT, name VARCHAR(255), state VARCHAR(255), policy_type VARCHAR(255), premium FLOAT); INSERT INTO policyholders (id, name, state, policy_type, premium) VALUES (1, 'John Doe', 'New York', 'Auto', 1200), (2, 'Jane Smith', 'California', 'Home', 2000), (3, 'Bob Johnson', 'California', 'Auto',... | What is the number of policies issued for each policy type? | SELECT policy_type, COUNT(*) FROM policyholders GROUP BY policy_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE businesses (id INT, sector VARCHAR(255), employee_count INT); INSERT INTO businesses (id, sector, employee_count) VALUES (1, 'technology', 150), (2, 'finance', 50), (3, 'retail', 200); CREATE TABLE ad_spend (business_id INT, amount DECIMAL(10,2)); INSERT INTO ad_spend (business_id, amount) VALUES (1, 5000.... | What is the average ad spend for businesses in the technology sector with more than 100 employees? | SELECT AVG(amount) FROM ad_spend INNER JOIN businesses ON ad_spend.business_id = businesses.id WHERE businesses.sector = 'technology' AND businesses.employee_count > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE PatientConditions (PatientID INT, Age INT, Condition VARCHAR(50)); | What is the most common mental health condition among patients aged 18-24? | SELECT Condition, COUNT(*) FROM PatientConditions WHERE Age BETWEEN 18 AND 24 GROUP BY Condition ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (City VARCHAR(255), WaitingTime INT); INSERT INTO Cities (City, WaitingTime) VALUES ('Calgary', 10), ('Vancouver', 15), ('Toronto', 20), ('Montreal', 25); | What is the average waiting time for public transportation in each city, ordered by the average waiting time in ascending order? | SELECT City, AVG(WaitingTime) AS AvgWaitingTime FROM Cities GROUP BY City ORDER BY AvgWaitingTime ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (artwork_id INT, movement VARCHAR(255), sale_year INT, revenue DECIMAL(10, 2)); | What was the total revenue for all artworks sold by the 'Impressionist' movement in the year 2010? | SELECT SUM(revenue) FROM Artworks WHERE movement = 'Impressionist' AND sale_year = 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE shelters (shelter_id INT, shelter_name VARCHAR(255), location VARCHAR(255), sector VARCHAR(255)); INSERT INTO shelters (shelter_id, shelter_name, location, sector) VALUES (1, 'Shelter A', 'City A', 'Education'); | What is the total number of shelters in 'disaster_response' schema and their types? | SELECT SUM(shelter_id) as total_shelters, sector FROM shelters GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityGreenBuildings (city TEXT, building_count INT); INSERT INTO CityGreenBuildings (city, building_count) VALUES ('CityA', 200), ('CityB', 300), ('CityC', 400); | What is the total number of green buildings in the 'GreenBuildings' table for each city? | SELECT city, SUM(building_count) FROM CityGreenBuildings GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_protocols (id INT, implemented_date DATE); INSERT INTO safety_protocols (id, implemented_date) VALUES (1, '2021-10-01'), (2, '2021-12-15'), (3, '2021-09-30'); | Which safety protocols were implemented in the last quarter of 2021? | SELECT * FROM safety_protocols WHERE implemented_date >= '2021-10-01' AND implemented_date < '2022-01-01' | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Nationality VARCHAR(50)); INSERT INTO Artists (ArtistID, ArtistName, Nationality) VALUES (1, 'Pablo Picasso', 'Spanish'); INSERT INTO Artists (ArtistID, ArtistName, Nationality) VALUES (2, 'Georges Braque', 'French'); INSERT INTO Artists (ArtistID, ArtistName... | Who are the painters that created works in the Cubism style? | SELECT A.ArtistName FROM Artists A JOIN ArtWorks AW ON A.ArtistID = AW.ArtistID WHERE AW.Category = 'Cubism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, DonationAmount DECIMAL(10,2), DonationDate DATE); | What is the average donation amount per day? | SELECT AVG(D.DonationAmount) FROM Donations D; | gretelai_synthetic_text_to_sql |
CREATE TABLE disability_types (disability_id INT, disability_type VARCHAR(50), state VARCHAR(50), frequency INT); INSERT INTO disability_types (disability_id, disability_type, state, frequency) VALUES (1, 'Mobility', 'Texas', 3000), (2, 'Vision', 'Texas', 2000), (3, 'Hearing', 'Texas', 1500); | What is the third most common disability type in 'Texas'? | SELECT disability_type FROM (SELECT disability_type, ROW_NUMBER() OVER (PARTITION BY state ORDER BY frequency DESC) as rn FROM disability_types WHERE state = 'Texas') t WHERE rn = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id VARCHAR(20), name VARCHAR(20)); INSERT INTO vessels (id, name) VALUES ('VES001', 'VESSEL001'), ('VES003', 'VESSEL003'); CREATE TABLE safety_incidents (id INT, vessel_id VARCHAR(20), incident_type VARCHAR(50)); INSERT INTO safety_incidents (id, vessel_id, incident_type) VALUES (1, 'VES001', 'Col... | List safety incidents for VESSEL003 | SELECT incident_type FROM safety_incidents WHERE vessel_id = 'VES003'; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_expeditions (expedition_id INT, organization VARCHAR(255), year INT); INSERT INTO deep_sea_expeditions (expedition_id, organization, year) VALUES (1, 'NOAA', 2018), (2, 'WHOI', 2019), (3, 'NASA', 2020), (4, 'NOAA', 2021), (5, 'WHOI', 2021); | What is the number of deep-sea expeditions conducted by each organization in the last 5 years, grouped by the year the expedition was conducted? | SELECT year, organization, COUNT(*) as expeditions_in_last_5_years FROM deep_sea_expeditions WHERE year >= 2017 GROUP BY year, organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, department VARCHAR(10), budget DECIMAL(5,2), gender VARCHAR(10)); INSERT INTO teacher_pd (teacher_id, department, budget, gender) VALUES (1, 'Math', 500.00, 'Female'), (1, 'English', 600.00, 'Female'), (2, 'Math', 550.00, 'Male'), (2, 'English', 650.00, 'Male'), (3, 'Math', 450.... | What is the average professional development budget per teacher for each gender? | SELECT gender, AVG(budget) as avg_budget FROM teacher_pd GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies_revenue (movie_id INT, title VARCHAR(255), release_year INT, revenue INT); INSERT INTO movies_revenue (movie_id, title, release_year, revenue) VALUES (1, 'Inception', 2010, 825), (2, 'Avatar', 2009, 2788), (3, 'Parasite', 2019, 258), (4, 'The Lion King', 2019, 1657), (5, 'Mulan', 2020, 60), (6, 'Won... | What is the total revenue of movies released in 2020? | SELECT SUM(revenue) as total_revenue FROM movies_revenue WHERE release_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE garments (id INT, name VARCHAR(100), price DECIMAL(5,2), category VARCHAR(50)); | Insert a new garment into the garments table with the following details: ID 5, name 'Cotton Shirt', price 20.50, category 'Tops' | INSERT INTO garments (id, name, price, category) VALUES (5, 'Cotton Shirt', 20.50, 'Tops'); | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), location VARCHAR(255), sustainable_practices BOOLEAN); CREATE TABLE garments (id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2), quantity INT, supplier_id INT); CREATE TABLE manufacturing_costs (id INT, garment_id INT, labor_cost DECIMAL(5,2), materi... | What is the average labor cost for manufacturing in Africa? | SELECT AVG(manufacturing_costs.labor_cost) FROM manufacturing_costs JOIN suppliers ON manufacturing_costs.supplier_id = suppliers.id WHERE suppliers.location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intel (report_id INT, report_date DATE, region TEXT); INSERT INTO threat_intel (report_id, report_date, region) VALUES (1, '2020-01-01', 'Asia-Pacific'), (2, '2020-02-15', 'Europe'); | How many threat intelligence reports were generated for the Asia-Pacific region in 2020? | SELECT COUNT(*) FROM threat_intel WHERE region = 'Asia-Pacific' AND report_date >= '2020-01-01' AND report_date < '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_name VARCHAR(255), ocean VARCHAR(255)); CREATE TABLE oceans (ocean_name VARCHAR(255), ocean_id INTEGER); | What is the total number of marine protected areas in the Pacific Ocean? | SELECT COUNT(area_name) FROM marine_protected_areas WHERE ocean = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget (state VARCHAR(20), service VARCHAR(20), amount INT); INSERT INTO budget (state, service, amount) VALUES ('Florida', 'Education', 40000), ('Florida', 'Healthcare', 60000), ('Florida', 'Transportation', 30000); | What is the total budget allocated for all services in 'Florida'? | SELECT SUM(amount) FROM budget WHERE state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE train_routes (id INT, route_name VARCHAR(255), fare DECIMAL(5, 2)); INSERT INTO train_routes (id, route_name, fare) VALUES (1, 'Route A', 2.75), (2, 'Route B', 3.50), (3, 'Route C', 2.25); | Identify train routes in the NYC subway system with fares higher than Route A but lower than Route C. | SELECT route_name, fare FROM train_routes WHERE fare > 2.75 AND fare < 2.25; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (garment VARCHAR(50), category VARCHAR(50), sale_date DATE); INSERT INTO sales (garment, category, sale_date) VALUES ('Shirt', 'Tops', '2021-01-05'), ('Pants', 'Bottoms', '2021-01-05'), ('Dress', 'Tops', '2021-01-10'), ('Shirt', 'Tops', '2022-01-05'), ('Pants', 'Bottoms', '2022-01-05'), ('Dress', 'To... | Find the first and last sale dates for each garment, partitioned by category and ordered by date. | SELECT garment, category, MIN(sale_date) OVER (PARTITION BY garment) as first_sale_date, MAX(sale_date) OVER (PARTITION BY garment) as last_sale_date FROM sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE montreal.metro_fares (id INT, trip_type VARCHAR, fare DECIMAL); INSERT INTO montreal.metro_fares (id, trip_type, fare) VALUES (1, 'single', 3.5), (2, 'round', 6.5), (3, 'weekly', 25); | What is the maximum fare for a single trip on the 'montreal' schema's metro system? | SELECT MAX(fare) FROM montreal.metro_fares WHERE trip_type = 'single'; | gretelai_synthetic_text_to_sql |
CREATE TABLE charging_stations (id INT, station_name VARCHAR(255), station_type VARCHAR(255), location VARCHAR(255)); | Update 'vehicle_type' to 'EV' for records in the 'charging_stations' table where 'station_type' is 'fast_charger' | UPDATE charging_stations SET vehicle_type = 'EV' WHERE station_type = 'fast_charger'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Species (id INT PRIMARY KEY, species_name VARCHAR(50), population INT, region VARCHAR(50)); INSERT INTO Species (id, species_name, population, region) VALUES (1, 'Polar Bear', 25000, 'Arctic'), (2, 'Beluga Whale', 15000, 'Arctic'); | What is the population of the Beluga Whale in the Arctic? | SELECT species_name, population FROM Species WHERE species_name = 'Beluga Whale' AND region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(50), location VARCHAR(50), join_date DATE); CREATE TABLE posts (id INT, user_id INT, post_date DATE); INSERT INTO users (id, name, location, join_date) VALUES (1, 'Alice', 'Canada', '2021-01-01'); INSERT INTO users (id, name, location, join_date) VALUES (2, 'Bob', 'USA', '2020-0... | How many users are there in each country, and what is the total number of posts for users in each country who joined in 2021? | SELECT u.location, COUNT(DISTINCT u.id) as user_count, COUNT(p.id) as post_count FROM users u JOIN posts p ON u.id = p.user_id WHERE u.join_date >= '2021-01-01' GROUP BY u.location; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founder_race TEXT, funding_amount INT); INSERT INTO company (id, name, founder_race, funding_amount) VALUES (1, 'Kappa Inc', 'Latinx', 1500000); INSERT INTO company (id, name, founder_race, funding_amount) VALUES (2, 'Lambda Corp', 'Asian', 2000000); INSERT INTO company (id, nam... | What is the maximum funding amount received by companies founded by Latinx entrepreneurs? | SELECT MAX(funding_amount) FROM company WHERE founder_race = 'Latinx'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_vulnerabilities (product_id INT, vulnerability_id INT, risk_score INT, detection_date DATE); INSERT INTO product_vulnerabilities (product_id, vulnerability_id, risk_score, detection_date) VALUES (1, 1001, 7, '2022-01-05'); INSERT INTO product_vulnerabilities (product_id, vulnerability_id, risk_scor... | What is the average risk score of vulnerabilities for each product in the last month? | SELECT product_id, AVG(risk_score) as avg_risk_score FROM product_vulnerabilities WHERE detection_date >= DATEADD(month, -1, CURRENT_DATE) GROUP BY product_id ORDER BY avg_risk_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (id INT, patientID INT, condition VARCHAR(50), treatment VARCHAR(50), cost DECIMAL(5,2)); INSERT INTO MentalHealthParity (id, patientID, condition, treatment, cost) VALUES (1, 1001, 'Anxiety', 'Counseling', 80.00), (2, 1002, 'Depression', 'Medication', 100.00); | What is the total cost of mental health treatments for patients with depression? | SELECT patientID, SUM(cost) as 'TotalCost' FROM MentalHealthParity WHERE condition = 'Depression'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Bridges (id INT, name TEXT, state TEXT, constructionDate DATE); | How many bridges were built in the last 5 years in the state of California? | SELECT COUNT(*) FROM Bridges WHERE state = 'California' AND constructionDate >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, age INT, condition TEXT, state TEXT); INSERT INTO patients (id, name, age, condition, state) VALUES (1, 'John Doe', 35, 'Depression', 'NY'), (2, 'Jane Smith', 40, 'Anxiety', 'NY'); | What is the most common mental health condition among patients from New York? | SELECT condition, COUNT(*) AS count FROM patients WHERE state = 'NY' GROUP BY condition ORDER BY count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE quality_control (id INT, test_type VARCHAR(255), test_result VARCHAR(255), defect_count INT, shift VARCHAR(255)); | Insert a new record into the 'quality_control' table with id 201, 'test_type' 'Visual Inspection', 'test_result' 'Passed', 'defect_count' 0, and 'shift' 'Morning' | INSERT INTO quality_control (id, test_type, test_result, defect_count, shift) VALUES (201, 'Visual Inspection', 'Passed', 0, 'Morning'); | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (id INT, name VARCHAR(100), position VARCHAR(50), age INT, world_cup_2018 BOOLEAN); | What is the average age of athletes who played in the FIFA World Cup 2018, grouped by their position? | SELECT position, AVG(age) as avg_age FROM athletes WHERE world_cup_2018 = true GROUP BY position; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT, name VARCHAR(255), calories INT, cuisine_type VARCHAR(255)); INSERT INTO dishes (dish_id, name, calories, cuisine_type) VALUES (1, 'Pizza', 300, 'Italian'), (2, 'Pasta', 400, 'Italian'), (3, 'Salad', 200, 'Salad'), (4, 'Burger', 500, 'American'), (5, 'Sushi', 250, 'Japanese'), (6, 'Cur... | Find the bottom 2 cuisine types with the lowest average calories per dish, excluding the 'Salad' type. | SELECT cuisine_type, AVG(calories) AS avg_calories FROM dishes WHERE cuisine_type != 'Salad' GROUP BY cuisine_type ORDER BY avg_calories LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_loans (id INT, value DECIMAL(10, 2), date DATE); INSERT INTO socially_responsible_loans (id, value, date) VALUES (1, 5000, '2022-04-01'); INSERT INTO socially_responsible_loans (id, value, date) VALUES (2, 7000, '2022-04-15'); | What is the average transaction value for socially responsible loans in Q2 2022? | SELECT AVG(value) FROM socially_responsible_loans WHERE date BETWEEN '2022-04-01' AND '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, segment VARCHAR(20), price DECIMAL(5,2)); INSERT INTO products (product_id, segment, price) VALUES (1, 'Natural', 15.99), (2, 'Organic', 20.99), (3, 'Natural', 12.49); | What is the most expensive product in the Organic segment? | SELECT segment, MAX(price) FROM products WHERE segment = 'Organic' GROUP BY segment; | gretelai_synthetic_text_to_sql |
CREATE TABLE BusStations (id INT, borough VARCHAR(255), station_name VARCHAR(255)); CREATE TABLE TrainStations (id INT, district VARCHAR(255), station_name VARCHAR(255)); | Show the number of bus and train stations in each borough or district. | SELECT 'Bus' as transportation, borough, COUNT(*) as station_count FROM BusStations GROUP BY borough UNION ALL SELECT 'Train', district, COUNT(*) FROM TrainStations GROUP BY district; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteData (WasteID INT, Material VARCHAR(255), Quantity DECIMAL(10,2), GenerationDate DATE); INSERT INTO WasteData (WasteID, Material, Quantity, GenerationDate) VALUES (1, 'Plastic', 1200, '2021-01-01'), (2, 'Glass', 3000, '2021-01-03'), (3, 'Paper', 4500, '2021-01-05'); | What is the total waste generation in gram for each material type in the first quarter of 2021, grouped by material type, and only showing those with a total generation greater than 5000 grams? | SELECT Material, SUM(Quantity) AS TotalWaste FROM WasteData WHERE GenerationDate BETWEEN '2021-01-01' AND '2021-03-31' GROUP BY Material HAVING SUM(Quantity) > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (id INT, name VARCHAR(50), industry VARCHAR(50), founding_year INT); INSERT INTO Company (id, name, industry, founding_year) VALUES (1, 'Acme Inc', 'Tech', 2010); INSERT INTO Company (id, name, industry, founding_year) VALUES (2, 'Bravo Corp', 'Finance', 2005); CREATE TABLE Diversity (id INT, compa... | What is the representation percentage of each gender and minority group per company? | SELECT company_id, gender, minority, SUM(percentage_representation) as total_percentage FROM Diversity GROUP BY company_id, gender, minority; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, country TEXT, founding_date DATE, founder_race TEXT); INSERT INTO company (id, name, country, founding_date, founder_race) VALUES (1, 'Delta Startups', 'Canada', '2018-01-01', 'South Asian'); INSERT INTO company (id, name, country, founding_date, founder_race) VALUES (2, 'Epsilo... | What percentage of companies were founded by underrepresented racial or ethnic groups in Canada? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM company)) FROM company WHERE founder_race IN ('Black', 'Hispanic', 'Indigenous', 'South Asian', 'Middle Eastern') AND country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Beverages (id INT, is_fair_trade BOOLEAN, category VARCHAR(20), serving_size INT); INSERT INTO Beverages (id, is_fair_trade, category, serving_size) VALUES (1, true, 'coffee', 8), (2, false, 'coffee', 12), (3, true, 'tea', 16); | What is the minimum serving size for fair-trade coffee? | SELECT MIN(serving_size) FROM Beverages WHERE is_fair_trade = true AND category = 'coffee'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (customer_id INT, transaction_amount DECIMAL(10,2), country VARCHAR(50)); INSERT INTO transactions (customer_id, transaction_amount, country) VALUES (1, 120.50, 'Mexico'), (2, 75.30, 'Mexico'), (3, 50.00, 'Mexico'), (4, 150.00, 'Mexico'); | List all customers and their transaction amounts who have made a transaction over 100 in Mexico. | SELECT customer_id, transaction_amount FROM transactions WHERE country = 'Mexico' AND transaction_amount > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE donor_type (id INT, type VARCHAR(20)); INSERT INTO donor_type (id, type) VALUES (1, 'Individual'), (2, 'Corporate'), (3, 'Foundation'); CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10,2)); | What is the total donation amount per donor type? | SELECT dt.type, SUM(d.amount) as total_donation FROM donations d JOIN donor_type dt ON d.donor_id = dt.id GROUP BY dt.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (line VARCHAR(10), station VARCHAR(20)); INSERT INTO routes (line, station) VALUES ('Red', 'Station X'), ('Red', 'Station Y'), ('Red', 'Station Z'); CREATE TABLE fares (route VARCHAR(10), revenue DECIMAL(10, 2)); INSERT INTO fares (route, revenue) VALUES ('Red', 2000), ('Red', 2500), ('Red', 3000); | Delete the 'Red' line's data from the 'fares' and 'routes' tables. | DELETE FROM routes WHERE line = 'Red'; DELETE FROM fares WHERE route IN (SELECT line FROM routes WHERE line = 'Red'); | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityMediation (CenterID INT, CenterName VARCHAR(50), CaseID INT); INSERT INTO CommunityMediation (CenterID, CenterName, CaseID) VALUES (1, 'Boston Community Mediation', 100), (2, 'Chicago Community Justice Center', 150), (3, 'Seattle Neighborhood Mediation', 120), (4, 'Denver Community Mediation', 80)... | What is the number of cases handled by each community mediation center, ordered by the total number of cases, descending? | SELECT CenterName, COUNT(*) AS TotalCases FROM CommunityMediation GROUP BY CenterName ORDER BY TotalCases DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Production (ProductionID INT, WellID INT, ProductionDate DATE, ProductionRate FLOAT, Country VARCHAR(50)); INSERT INTO Production (ProductionID, WellID, ProductionDate, ProductionRate, Country) VALUES (1, 1, '2021-01-01', 500, 'USA'), (2, 2, '2021-01-15', 600, 'Canada'), (3, 3, '2022-02-01', 700, 'Mexico')... | What is the total production for each country in the last year? | SELECT Country, SUM(ProductionRate) AS TotalProduction FROM Production WHERE ProductionDate >= DATEADD(year, -1, GETDATE()) GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE YogaHeartRate (MemberID INT, YogaHeartRate INT); CREATE TABLE CyclingHeartRate (MemberID INT, CyclingHeartRate INT); INSERT INTO YogaHeartRate (MemberID) VALUES (1), (2); INSERT INTO CyclingHeartRate (MemberID) VALUES (1, 60), (2, 50); | Find the number of members who have a higher heart rate during cycling than during yoga. | SELECT COUNT(*) FROM (SELECT MemberID, CyclingHeartRate, YogaHeartRate FROM CyclingHeartRate JOIN YogaHeartRate ON CyclingHeartRate.MemberID = YogaHeartRate.MemberID) WHERE CyclingHeartRate > YogaHeartRate; | gretelai_synthetic_text_to_sql |
CREATE TABLE Citizens (citizen_id INT, name VARCHAR(50), age INT, city VARCHAR(50)); | Insert a new record of a new citizen in the 'Citizens' table | INSERT INTO Citizens (citizen_id, name, age, city) VALUES (1, 'Alex Garcia', 34, 'Los Angeles'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species_name VARCHAR(255), ocean VARCHAR(255), depth INT); INSERT INTO marine_species (id, species_name, ocean, depth) VALUES (1, 'Southern Ocean Squid', 'Southern', 3000); INSERT INTO marine_species (id, species_name, ocean, depth) VALUES (2, 'Southern Ocean Crab', 'Southern', 2500... | How many marine species were observed in the Southern ocean with a depth greater than 2000 meters? | SELECT COUNT(*) FROM marine_species WHERE ocean = 'Southern' AND depth > 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE education_programs (id INT, program_name VARCHAR(255), community_type VARCHAR(255), num_participants INT); INSERT INTO education_programs (id, program_name, community_type, num_participants) VALUES (1, 'Wildlife Awareness', 'Indigenous', 500), (2, 'Conservation Workshops', 'Urban', 300), (3, 'Nature Camps'... | List community education programs in Indigenous communities and the number of participants | SELECT program_name, community_type, num_participants FROM education_programs WHERE community_type = 'Indigenous'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, region TEXT, product_id INT, is_gluten_free BOOLEAN, revenue INT); INSERT INTO sales (id, region, product_id, is_gluten_free, revenue) VALUES (1, 'Northeast', 1, true, 200), (2, 'Northeast', 2, false, 150), (3, 'Southeast', 3, true, 250), (4, 'Southeast', 4, false, 180), (5, 'Midwest', 5, tr... | What is the distribution of gluten-free product sales by region? | SELECT region, is_gluten_free, AVG(revenue) FROM sales GROUP BY region, is_gluten_free; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, incident_date DATE, region VARCHAR(255), incident_type VARCHAR(255), threat_actor VARCHAR(255)); INSERT INTO security_incidents (id, incident_date, region, incident_type, threat_actor) VALUES (1, '2022-01-05', 'JP', 'Phishing', 'Threat Actor 1'), (2, '2022-02-10', 'JP', 'Malware... | What is the total number of security incidents caused by each threat actor in the JP region? | SELECT threat_actor, COUNT(*) as incidents_per_threat_actor FROM security_incidents WHERE region = 'JP' GROUP BY threat_actor; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (item_code varchar(5), warehouse_id varchar(5), quantity int); INSERT INTO inventory (item_code, warehouse_id, quantity) VALUES ('D01', 'LHR', 800), ('D01', 'MAD', 900); | What is the quantity of item 'D01' in all warehouses? | SELECT SUM(quantity) FROM inventory WHERE item_code = 'D01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name TEXT, vegan BOOLEAN, calories INT); INSERT INTO dishes (id, name, vegan, calories) VALUES (1, 'Quinoa Salad', TRUE, 350), (2, 'Pizza Margherita', FALSE, 500); | Retrieve all records from 'dishes' table with a calorie count less than 400 | SELECT * FROM dishes WHERE calories < 400; | 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.