context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE legal_aid (provider_id INT, provider VARCHAR(255), location VARCHAR(255)); CREATE TABLE providers_history (provider_id INT, provider VARCHAR(255), location VARCHAR(255)); | Insert new legal aid providers into the 'legal_aid' table that do not already exist in the 'providers_history' table? | INSERT INTO legal_aid (provider_id, provider, location) SELECT provider_id, provider, location FROM (SELECT ROW_NUMBER() OVER (ORDER BY provider) AS provider_id, provider, location FROM (VALUES ('1001', 'Advocacy Inc.', 'NY'), ('1002', 'Justice League', 'CA')) AS t(provider_id, provider, location) EXCEPT SELECT provide... | gretelai_synthetic_text_to_sql |
CREATE TABLE Bookings (booking_id INT, hotel_id INT, booking_date DATE, revenue FLOAT, channel VARCHAR(50)); INSERT INTO Bookings (booking_id, hotel_id, booking_date, revenue, channel) VALUES (1, 1, '2022-01-01', 200.0, 'Direct'), (2, 1, '2022-01-03', 150.0, 'OTA'), (3, 2, '2022-01-05', 300.0, 'Direct'), (8, 8, '2022-0... | What is the total revenue generated by bookings for hotels in the 'Boutique' category? | SELECT SUM(revenue) FROM Bookings INNER JOIN Hotels ON Bookings.hotel_id = Hotels.hotel_id WHERE category = 'Boutique'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Flight_Data (aircraft_model VARCHAR(255), region VARCHAR(255), flight_time INT); INSERT INTO Flight_Data (aircraft_model, region, flight_time) VALUES ('B737', 'North', 200), ('A320', 'South', 220), ('B737', 'North', 210); | What is the average flight time for each aircraft model in the North region? | SELECT aircraft_model, AVG(flight_time) FROM Flight_Data WHERE region = 'North' GROUP BY aircraft_model; | gretelai_synthetic_text_to_sql |
CREATE TABLE Auto (policyholder_id INT, car_make VARCHAR(20)); | What is the average age of policyholders who have a car make of 'Tesla' in the 'Auto' table? | SELECT AVG(age) FROM Policyholders INNER JOIN Auto ON Policyholders.id = Auto.policyholder_id WHERE car_make = 'Tesla'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists music_schema;CREATE TABLE if not exists artists (id INT, name VARCHAR);CREATE TABLE if not exists concert_attendance (artist_id INT, concert_id INT, tickets_sold INT);INSERT INTO artists (id, name) VALUES (1, 'Artist A'), (2, 'Artist B'), (3, 'Artist C');INSERT INTO concert_attendance (artis... | Delete all artists who have not sold more than 1000 tickets for any concert. | DELETE FROM music_schema.artists a USING music_schema.concert_attendance ca WHERE a.id = ca.artist_id AND ca.tickets_sold <= 1000; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA manufacturing;CREATE TABLE ethical_manufacturers (id INT PRIMARY KEY, name TEXT, region TEXT);INSERT INTO ethical_manufacturers (id, name, region) VALUES (1, 'Ethical Manufacturer A', 'North'); INSERT INTO ethical_manufacturers (id, name, region) VALUES (2, 'Ethical Manufacturer B', 'South'); | Add new ethical manufacturing record with ID 3, name 'Ethical Manufacturer C', region 'Central' | INSERT INTO ethical_manufacturers (id, name, region) VALUES (3, 'Ethical Manufacturer C', 'Central'); | gretelai_synthetic_text_to_sql |
CREATE TABLE high_scores (id INT, username VARCHAR(255), game VARCHAR(255), score INT); | Insert new high scores | WITH cte AS (VALUES (1, 'player1', 'Game1', 1000), (2, 'player2', 'Game2', 1500), (3, 'player3', 'Game3', 2000)) INSERT INTO high_scores (id, username, game, score) SELECT * FROM cte; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (id INT, site VARCHAR(20), location VARCHAR(30), start_date DATE, end_date DATE); INSERT INTO ExcavationSites (id, site, location, start_date, end_date) VALUES (1, 'BronzeAge', 'UK', '2000-01-01', '2005-12-31'), (2, 'IronAge', 'Germany', '1994-01-01', '1997-12-31'); | What is the earliest excavation start date for the 'Iron Age' culture? | SELECT MIN(start_date) FROM ExcavationSites WHERE site = 'IronAge'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (trial_id INT, trial_name VARCHAR(255), location VARCHAR(255)); INSERT INTO clinical_trials (trial_id, trial_name, location) VALUES (1, 'TrialA', 'America'), (2, 'TrialB', 'Africa'), (3, 'TrialC', 'Europe'); | List the clinical trials conducted in Africa. | SELECT trial_name FROM clinical_trials WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE model_safety (model_id INT, safety_score FLOAT, region_id INT); CREATE TABLE regions (region_id INT, region_name VARCHAR(50)); INSERT INTO regions (region_id, region_name) VALUES (1, 'North America'), (2, 'Europe'), (3, 'Asia'), (4, 'South America'), (5, 'Africa'); | What is the average safety score for models trained on the 'South America' or 'Africa' regions? | SELECT AVG(ms.safety_score) FROM model_safety ms JOIN regions r ON ms.region_id = r.region_id WHERE r.region_name IN ('South America', 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_projects (name VARCHAR(255), location VARCHAR(255), budget FLOAT); INSERT INTO conservation_projects (name, location, budget) VALUES ('Coral Reef Restoration', 'Kenya', 500000), ('Mangrove Forest Protection', 'Tanzania', 750000); | List all marine conservation projects and their budgets in Africa. | SELECT name, budget FROM conservation_projects WHERE location LIKE 'Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, production_volume INT); INSERT INTO mines (id, name, location, production_volume) VALUES (1, 'Mexican Silver Mine', 'Mexico', 10000); INSERT INTO mines (id, name, location, production_volume) VALUES (2, 'Silver Ridge', 'USA', 12000); | What is the maximum production volume for silver mines in Mexico? | SELECT MAX(production_volume) FROM mines WHERE location = 'Mexico' AND mineral = 'silver'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists defense_projects;CREATE TABLE if not exists defense_project_delays(project_name text, delay_year integer, delay_duration integer);INSERT INTO defense_project_delays(project_name, delay_year, delay_duration) VALUES('F-35', 2020, 2), ('Joint Light Tactical Vehicle', 2020, 3), ('Global Hawk', 2... | What was the average delay for defense projects in 2020? | SELECT AVG(delay_duration) FROM defense_project_delays WHERE delay_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_production (id INT PRIMARY KEY, chemical_id VARCHAR(10), quantity INT, country VARCHAR(50)); INSERT INTO chemical_production (id, chemical_id, quantity, country) VALUES (1, 'XY987', 700, 'Brazil'), (2, 'GH247', 600, 'India'), (3, 'XY987', 300, 'Australia'), (4, 'GH247', 500, 'India'), (5, 'GH247',... | List the chemical_ids and total production quantities for chemicals produced in Argentina | SELECT chemical_id, SUM(quantity) FROM chemical_production WHERE country = 'Argentina' GROUP BY chemical_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, name VARCHAR(50), department VARCHAR(50), age INT); | What is the number of employees in the "mining_operations" table, who are working in the "safety" department and have an age greater than 30? | SELECT COUNT(*) FROM mining_operations WHERE department = 'safety' AND age > 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), email VARCHAR(50), loyalty_points INT); | Delete all customers with loyalty points less than 100 | DELETE FROM customers WHERE loyalty_points < 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE timber_production (id INT, country VARCHAR(255), site_name VARCHAR(255), area FLOAT); INSERT INTO timber_production (id, country, site_name, area) VALUES (1, 'Canada', 'Site A', 50000.0), (2, 'Canada', 'Site B', 60000.0), (3, 'Brazil', 'Site C', 70000.0), (4, 'Brazil', 'Site D', 80000.0); | How many timber production sites are there in each country, and what is their total area in hectares? | SELECT country, COUNT(*), SUM(area) FROM timber_production GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (teacher_id INT, teacher_name VARCHAR(50), last_pd_course_date DATE); CREATE TABLE professional_development_courses (course_id INT, course_name VARCHAR(50), course_date DATE); | Identify teachers who have not completed any professional development courses in the past year. | SELECT teacher_id, teacher_name FROM teachers LEFT JOIN professional_development_courses ON teachers.teacher_id = professional_development_courses.teacher_id WHERE professional_development_courses.course_date IS NULL OR professional_development_courses.course_date < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), year INT, element VARCHAR(10), quantity INT); INSERT INTO production (country, year, element, quantity) VALUES ('China', 2019, 'Nd', 120000), ('China', 2019, 'Pr', 130000), ('China', 2019, 'Dy', 140000), ('Australia', 2019, 'Nd', 50000); | Which countries produced more than 100,000 units of any REE in 2019? | SELECT country, element, quantity FROM production WHERE year = 2019 AND quantity > 100000; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, donation_date DATE, amount DECIMAL(10,2)); INSERT INTO donations (id, donor_id, donation_date, amount) VALUES (1, 1001, '2021-01-15', 50.00), (2, 1002, '2021-03-30', 100.00), (3, 1001, '2021-04-10', 75.00); | What's the total amount donated by first-time donors in Q1 2021? | SELECT SUM(amount) FROM donations WHERE donor_id NOT IN (SELECT donor_id FROM donations WHERE donation_date < '2021-01-01') AND donation_date < '2021-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, country TEXT); INSERT INTO company (id, name, country) VALUES (1, 'Acme Inc', 'USA'), (2, 'Beta Corp', 'UK'), (3, 'Gamma PLC', 'Australia'); CREATE TABLE investment (investor_id INT, company_id INT); INSERT INTO investment (investor_id, company_id) VALUES (1, 1), (2, 2), (3, 3),... | List unique investors who have invested in companies based in the United Kingdom and Australia. | SELECT DISTINCT investor_id FROM investment WHERE company_id IN (SELECT id FROM company WHERE country IN ('UK', 'Australia')) | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items(item_id INT, name TEXT, type TEXT, price DECIMAL, cost_price DECIMAL); | List all desserts with a profit margin over 50% | SELECT name FROM menu_items WHERE (price - cost_price) / price > 0.5 AND type = 'Dessert'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (id INT, size INT, quantity INT); INSERT INTO inventory (id, size, quantity) VALUES (1, 10, 25), (2, 12, 30), (3, 14, 40); | How many size 14 garments are in the 'inventory' table? | SELECT SUM(quantity) FROM inventory WHERE size = 14; | gretelai_synthetic_text_to_sql |
CREATE TABLE artifact_catalog (artifact_id INT, site_id INT, artifact_type TEXT, artifact_description TEXT, quantity INT); INSERT INTO artifact_catalog (artifact_id, site_id, artifact_type, artifact_description, quantity) VALUES (1, 1, 'ceramic', 'small bowl', 25), (2, 1, 'metal', 'copper pin', 10), (3, 1, 'bone', 'ani... | What is the total quantity of stone artifacts at Site D? | SELECT SUM(quantity) FROM artifact_catalog WHERE site_id = 4 AND artifact_type = 'stone'; | gretelai_synthetic_text_to_sql |
CREATE TABLE seafood_imports (import_id INT, import_date DATE, product VARCHAR(255), quantity INT, country VARCHAR(255)); | What is the total amount of seafood imported from Canada in the seafood_imports table? | SELECT SUM(quantity) FROM seafood_imports WHERE product LIKE '%seafood%' AND country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mars_rovers (id INT, rover VARCHAR(50), landed_on_mars BOOLEAN);INSERT INTO mars_rovers (id, rover, landed_on_mars) VALUES (1, 'Spirit', true); | List all rovers that landed on Mars. | SELECT rover FROM mars_rovers WHERE landed_on_mars = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceMissions (ID INT, Name VARCHAR(50), LaunchDate DATE, Status VARCHAR(20)); INSERT INTO SpaceMissions VALUES (1, 'Mission A', '2008-03-12', NULL), (2, 'Mission B', '2012-06-18', 'active'), (3, 'Mission C', '2005-02-03', NULL), (4, 'Mission D', '2017-11-14', NULL); | Update the statuses of all space missions launched before 2010 to 'inactive'. | UPDATE SpaceMissions SET Status = 'inactive' WHERE LaunchDate < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, registration_date DATE, ad_revenue DECIMAL(10,2)); INSERT INTO users (id, registration_date, ad_revenue) VALUES (1, '2022-01-01', 500.00), (2, '2022-02-01', 450.00), (3, '2022-01-15', 600.00), (4, '2022-03-01', 300.00); | What was the sum of ad revenue for users who joined in Q1? | SELECT SUM(ad_revenue) FROM users WHERE QUARTER(registration_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_relief_funding (organization TEXT, funding_amount INTEGER, funding_date DATE); INSERT INTO disaster_relief_funding (organization, funding_amount, funding_date) VALUES ('Red Cross', 500000, '2015-04-25'), ('World Vision', 300000, '2015-04-25'), ('CARE', 400000, '2017-08-24'); | What is the total amount of funding received by the Red Cross for disaster relief in Nepal since 2015? | SELECT SUM(funding_amount) FROM disaster_relief_funding WHERE organization = 'Red Cross' AND funding_date >= '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE NY_Roads (id INT, length FLOAT); INSERT INTO NY_Roads (id, length) VALUES (1, 100.0), (2, 200.0); | What is the average length of all roads in New York? | SELECT AVG(length) FROM NY_Roads; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmployeeTraining (EmployeeID INT, Manager VARCHAR(50), Training VARCHAR(50), CompletionDate DATE); | How many employees have completed training on diversity and inclusion, by manager? | SELECT Manager, COUNT(*) as Num_Employees FROM EmployeeTraining WHERE Training = 'Diversity and Inclusion' GROUP BY Manager; | gretelai_synthetic_text_to_sql |
CREATE TABLE travel_advisory (id INT PRIMARY KEY, country TEXT, advisory TEXT, updated_date DATE); | Delete all records from the "travel_advisory" table where the "advisory" is older than 3 months | DELETE FROM travel_advisory WHERE updated_date < DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (id INT, artist_id INT, city VARCHAR(50), country VARCHAR(50), revenue FLOAT); INSERT INTO concerts (id, artist_id, city, country, revenue) VALUES (1, 1, 'Los Angeles', 'USA', 500000), (2, 1, 'New York', 'USA', 700000), (3, 2, 'Seoul', 'South Korea', 800000), (4, 2, 'Tokyo', 'Japan', 900000), (5, ... | What is the average revenue per concert by country? | SELECT country, AVG(revenue) as avg_revenue FROM concerts GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, name TEXT, member_count INT); CREATE TABLE members (id INT, union_id INT); | Delete the union with the least number of members. | DELETE FROM unions WHERE id IN (SELECT id FROM (SELECT id, ROW_NUMBER() OVER (ORDER BY member_count ASC) AS rn FROM unions) AS seq_table WHERE rn = 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel (id INT, type VARCHAR(50), name VARCHAR(50));CREATE TABLE cargo (id INT, vessel_id INT, weight INT, cargo_date DATE); | What is the average cargo weight transported by oil tankers in the last month? | SELECT AVG(c.weight) as avg_weight FROM vessel v INNER JOIN cargo c ON v.id = c.vessel_id WHERE v.type = 'oil tanker' AND c.cargo_date >= DATE(NOW(), INTERVAL -1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE ProjectTimelines (project_id INT, project_name VARCHAR(50), start_date DATE, end_date DATE, negotiation_status VARCHAR(50), geopolitical_risk_score INT, project_region VARCHAR(50)); INSERT INTO ProjectTimelines (project_id, project_name, start_date, end_date, negotiation_status, geopolitical_risk_score, pr... | List defense projects and their respective start and end dates, along with the contract negotiation status, that are in the Middle East region and have a geopolitical risk score above 5, ordered by the geopolitical risk score in descending order. | SELECT project_name, start_date, end_date, negotiation_status, geopolitical_risk_score FROM ProjectTimelines WHERE project_region = 'Middle East' AND geopolitical_risk_score > 5 ORDER BY geopolitical_risk_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainability_metrics (product_id INT PRIMARY KEY, carbon_footprint DECIMAL(10,2), water_usage DECIMAL(10,2), waste_generation DECIMAL(10,2)); | Update carbon footprint to 1 for product_id 3 in 'sustainability_metrics' table | UPDATE sustainability_metrics SET carbon_footprint = 1 WHERE product_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, event_date DATE); INSERT INTO events (id, event_date) VALUES (1, '2022-01-01'), (2, '2022-02-01'), (3, '2022-03-01'); | How many events were organized in the last month? | SELECT COUNT(*) FROM events WHERE event_date >= '2022-02-01' AND event_date < '2022-03-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_unions (id INT, union_name VARCHAR(50), members INT); CREATE TABLE safety_records (id INT, union_id INT, safety_score INT); | Show the union_name and safety record for unions with names starting with 'D' from the 'labor_unions' and 'safety_records' tables | SELECT l.union_name, s.safety_score FROM labor_unions l JOIN safety_records s ON l.id = s.union_id WHERE l.union_name LIKE 'D%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dresses (id INT PRIMARY KEY, size INT, price DECIMAL(5,2), sale_date DATE); INSERT INTO dresses (id, size, price, sale_date) VALUES (1, 8, 69.99, '2021-12-01'), (2, 10, 79.99, '2021-12-05'), (3, 12, 89.99, '2021-12-10'); | Update the price of all size 8 dresses to 79.99. | UPDATE dresses SET price = 79.99 WHERE size = 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name TEXT); CREATE TABLE incidents(id INT, vessel_id INT, incident_date DATE); INSERT INTO vessels VALUES (1, 'VesselA'), (2, 'VesselB'), (3, 'VesselC'), (4, 'VesselD'), (5, 'VesselE'); INSERT INTO incidents VALUES (1, 2, '2022-02-15'), (2, 3, '2022-04-01'), (3, 5, '2022-01-20'); | Which vessels had an incident in Q1 2022? | SELECT DISTINCT v.name FROM vessels v JOIN incidents i ON v.id = i.vessel_id WHERE incident_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, country VARCHAR(255)); CREATE TABLE posts (id INT, user_id INT, likes INT, hashtags TEXT, post_date DATE); CREATE TABLE likes (id INT, user_id INT, post_id INT, like_date DATE); | What is the total number of unique users who liked posts containing the hashtag #movies, by users from Russia, in the last week? | SELECT COUNT(DISTINCT user_id) FROM likes INNER JOIN posts ON likes.post_id = posts.id INNER JOIN users ON posts.user_id = users.id WHERE users.country = 'Russia' AND hashtags LIKE '%#movies%' AND post_date >= DATE(NOW()) - INTERVAL 1 WEEK; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, ExperienceYears INT, BillingAmount DECIMAL); INSERT INTO Attorneys (AttorneyID, ExperienceYears, BillingAmount) VALUES (1, 6, 2500.00), (2, 3, 1800.00), (3, 8, 3200.00); | What is the average billing amount for cases handled by attorneys with more than 5 years of experience? | SELECT AVG(BillingAmount) FROM Attorneys WHERE ExperienceYears > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE pallets (pallet_id INT, warehouse_id INT, received_date DATE, shipped_date DATE, num_pallets INT); INSERT INTO pallets (pallet_id, warehouse_id, received_date, shipped_date, num_pallets) VALUES (1, 1, '2021-04-25', '2021-04-28', 10), (2, 1, '2021-05-03', NULL, 15), (3, 2, '2021-05-05', '2021-05-07', 20); | Get the number of pallets stored in 'Warehouse A' that were received between '2021-05-01' and '2021-05-15' and have not been shipped yet. | SELECT COUNT(*) FROM pallets WHERE warehouse_id = 1 AND received_date BETWEEN '2021-05-01' AND '2021-05-15' AND shipped_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_financing (financing_id INT, financing_date DATE, financing_amount INT, business_size TEXT); CREATE TABLE shariah_small_businesses (business_id INT, financing_id INT); | What is the total amount of Shariah-compliant financing provided to small businesses in the last quarter? | SELECT SUM(sf.financing_amount) FROM shariah_financing sf JOIN shariah_small_businesses ssb ON sf.financing_id = ssb.financing_id WHERE sf.financing_date >= DATEADD(quarter, -1, CURRENT_DATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, country TEXT, founding_year INT, total_funding FLOAT, women_founded INT); INSERT INTO companies (id, name, country, founding_year, total_funding, women_founded) VALUES (1, 'Acme Corp', 'USA', 2010, 20000000.0, 1); | What is the average funding amount per company, per country, for companies founded by women? | SELECT country, AVG(total_funding) FROM companies WHERE women_founded = 1 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_forests.carbon_sequestration (species VARCHAR(255), sequestration_rate DECIMAL(5,2)); | What are the top 5 tree species with the lowest carbon sequestration rate in the state_forests schema? | SELECT species FROM state_forests.carbon_sequestration ORDER BY sequestration_rate ASC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (Year INT, Region VARCHAR(50), Category VARCHAR(50), Amount INT); INSERT INTO Budget (Year, Region, Category, Amount) VALUES (2020, 'North', 'Education', 5000000), (2020, 'South', 'Education', 6000000), (2020, 'East', 'Education', 7000000), (2020, 'West', 'Education', 8000000); | What is the total budget allocated for education in the year 2020 across all regions? | SELECT SUM(Amount) FROM Budget WHERE Year = 2020 AND Category = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species VARCHAR(255), conservation_status VARCHAR(255)); INSERT INTO marine_species (id, species, conservation_status) VALUES (1, 'Blue Whale', 'Endangered'); INSERT INTO marine_species (id, species, conservation_status) VALUES (2, 'Green Sea Turtle', 'Vulnerable'); INSERT INTO mari... | What is the number of marine species, grouped by conservation status? | SELECT conservation_status, COUNT(*) FROM marine_species GROUP BY conservation_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, HireDate DATE, Community VARCHAR(25), Department VARCHAR(25)); INSERT INTO Employees (EmployeeID, HireDate, Community, Department) VALUES (1, '2021-12-01', 'Underrepresented', 'Marketing'), (2, '2022-02-15', 'Represented', 'Marketing'), (3, '2022-02-15', 'Underrepresented', 'IT')... | What is the percentage of new hires who are from underrepresented communities in each department in the past year? | SELECT Department, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Employees WHERE HireDate >= DATEADD(year, -1, GETDATE())) AS Percentage FROM Employees WHERE Community = 'Underrepresented' AND HireDate >= DATEADD(year, -1, GETDATE()) GROUP BY Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, age INT, treatment TEXT); INSERT INTO patients (id, name, age, treatment) VALUES (1, 'Alice', 30, 'CBT'), (2, 'Bob', 45, 'DBT'), (3, 'Charlie', 60, 'CBT'); | What's the average age of patients who received CBT? | SELECT AVG(age) FROM patients WHERE treatment = 'CBT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO employees (id, name, country) VALUES (1, 'John Doe', 'USA'); INSERT INTO employees (id, name, country) VALUES (2, 'Jane Smith', 'Canada'); | Update the country of the employee with id 2 from 'Canada' to 'Mexico'. | UPDATE employees SET country = 'Mexico' WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE economic_diversification (id INT, year INT, effort VARCHAR(50), budget FLOAT); INSERT INTO economic_diversification (id, year, effort, budget) VALUES (1, 2018, 'Tourism', 200000.00), (2, 2019, 'Renewable Energy', 800000.00), (3, 2020, 'Handicrafts', 500000.00); | What is the total budget for economic diversification efforts in 2019 and 2020? | SELECT SUM(budget) FROM economic_diversification WHERE year IN (2019, 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE workforce_development (id INT PRIMARY KEY, name VARCHAR(50), position VARCHAR(50), training_hours INT); | Create a table named 'workforce_development' | CREATE TABLE workforce_development (id INT PRIMARY KEY, name VARCHAR(50), position VARCHAR(50), training_hours INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE cv_models (id INT, model VARCHAR(255), algorithm VARCHAR(255), technique VARCHAR(255), accuracy FLOAT, time FLOAT); INSERT INTO cv_models (id, model, algorithm, technique, accuracy, time) VALUES (1, 'LeNet', 'convnet', 'transfer_learning', 0.98, 2.1), (2, 'ResNet', 'convnet', 'transfer_learning', 0.96, 3.5... | What is the average accuracy and training time for models in the 'Computer Vision' domain using the 'transfer_learning' technique? | SELECT technique, AVG(accuracy) as avg_accuracy, AVG(time) as avg_time FROM cv_models WHERE domain = 'Computer Vision' AND technique = 'transfer_learning' GROUP BY technique; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends ( id INT PRIMARY KEY, year INT, price_per_kg DECIMAL(10,2), total_kg INT ); | Insert a new record into the market_trends table for 2022: price_per_kg = 70.00, total_kg = 22000 | INSERT INTO market_trends (id, year, price_per_kg, total_kg) VALUES (5, 2022, 70.00, 22000); | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (student_id INT, name VARCHAR(50)); CREATE TABLE publications (publication_id INT, title VARCHAR(50), student_id INT); INSERT INTO graduate_students VALUES (1, 'Alice Johnson'); INSERT INTO graduate_students VALUES (2, 'Bob Smith'); INSERT INTO publications VALUES (1, 'Paper 1', 1); INSER... | Delete all graduate students who have not published any papers. | DELETE FROM graduate_students WHERE student_id NOT IN (SELECT student_id FROM publications); | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_exchanges (exchange_id INT PRIMARY KEY, exchange_name VARCHAR(100), exchange_address VARCHAR(100), swap_volume DECIMAL(20,2), swap_time TIMESTAMP); CREATE VIEW exchange_launch_dates AS SELECT exchange_address, MIN(swap_time) AS first_swap_time FROM decentralized_exchanges GROUP BY exchange_ad... | Which decentralized exchanges were launched in the last month? | SELECT dex.* FROM decentralized_exchanges dex JOIN exchange_launch_dates eld ON dex.exchange_address = eld.exchange_address WHERE dex.swap_time >= eld.first_swap_time + INTERVAL '1 month'; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations_3 (id INT, name TEXT, region TEXT, cost FLOAT); INSERT INTO accommodations_3 (id, name, region, cost) VALUES (1, 'Wheelchair Ramp', 'South America', 120000.00), (2, 'Sign Language Interpreter', 'South America', 60000.00); | What is the minimum cost for accommodations in the South American region? | SELECT MIN(cost) FROM accommodations_3 WHERE region = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_sales (id INT, country VARCHAR(50), vehicle_type VARCHAR(50), sales INT); | What is the market share of electric vehicles in Germany and France? | SELECT country, 100.0 * SUM(CASE WHEN vehicle_type = 'electric' THEN sales ELSE 0 END) / SUM(sales) AS market_share FROM vehicle_sales WHERE country IN ('Germany', 'France') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_budget (country VARCHAR(50), budget INT); INSERT INTO military_budget (country, budget) VALUES ('United States', 7050000000), ('China', 22800000000), ('Japan', 4936000000), ('India', 5574000000), ('South Korea', 4370000000); | Which countries have the highest military budgets in the Asia-Pacific region, excluding China? | SELECT country, budget FROM military_budget WHERE country != 'China' AND country IN ('United States', 'Japan', 'India', 'South Korea') ORDER BY budget DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Patients (ID INT, Gender VARCHAR(10), Age INT, Disease VARCHAR(20), State VARCHAR(20)); INSERT INTO Patients (ID, Gender, Age, Disease, State) VALUES (1, 'Female', 34, 'Tuberculosis', 'California'); | What is the average age of female patients diagnosed with Tuberculosis in California? | SELECT AVG(Age) FROM Patients WHERE Gender = 'Female' AND Disease = 'Tuberculosis' AND State = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_innovations (id INT, project_name VARCHAR(50), funding_org VARCHAR(50), org_location VARCHAR(50)); INSERT INTO rural_innovations (id, project_name, funding_org, org_location) VALUES (1, 'Precision Agriculture', 'InnovateAfrica', 'Kenya'); | What are the names of all agricultural innovation projects in the 'rural_innovations' table that were funded by organizations located in Africa? | SELECT project_name FROM rural_innovations WHERE org_location LIKE '%Africa%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (volunteer_id INT, volunteer_program TEXT, volunteer_hours INT, volunteer_date DATE); INSERT INTO volunteers (volunteer_id, volunteer_program, volunteer_hours, volunteer_date) VALUES (1, 'Education', 20, '2021-01-01'), (2, 'Food Bank', 30, '2021-02-01'), (3, 'Education', 10, '2021-03-01'), (4, '... | What was the total number of volunteers and total volunteer hours for each program in 2021? | SELECT volunteer_program, COUNT(DISTINCT volunteer_id) AS total_volunteers, SUM(volunteer_hours) AS total_hours FROM volunteers WHERE YEAR(volunteer_date) = 2021 GROUP BY volunteer_program; | gretelai_synthetic_text_to_sql |
CREATE TABLE fda_approval (drug varchar(255), year int); INSERT INTO fda_approval (drug, year) VALUES ('DrugA', 2018), ('DrugB', 2019); | Which drugs were approved by the FDA in 2018? | SELECT drug FROM fda_approval WHERE year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE risk_assessment_table (assessment_id INT, policy_holder TEXT, risk_score INT); INSERT INTO risk_assessment_table (assessment_id, policy_holder, risk_score) VALUES (1, 'John Smith', 650), (2, 'Jane Doe', 500), (3, 'Mike Johnson', 800), (4, 'Sarah Lee', 700); | Delete risk assessments for policyholders with the last name 'Lee' from the risk_assessment_table | DELETE FROM risk_assessment_table WHERE policy_holder LIKE '%Lee%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (article_id INT, title VARCHAR(50), category VARCHAR(20), word_count INT, author_id INT); INSERT INTO articles (article_id, title, category, word_count, author_id) VALUES (1, 'Investigation 1', 'investigation', 500, 1), (2, 'News 2', 'news', 300, 2), (3, 'Investigation 2', 'investigation', 700, 3)... | What is the percentage of articles in the 'investigation' category, and the average word count, for each gender? | SELECT gender, 100.0 * COUNT(CASE WHEN category = 'investigation' THEN 1 END) / COUNT(*) as investigation_percentage, AVG(word_count) as avg_word_count FROM articles JOIN users ON articles.author_id = users.user_id GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls_3 (id INT, borough_id INT, call_time TIMESTAMP); INSERT INTO emergency_calls_3 (id, borough_id, call_time) VALUES (1, 1, '2021-01-01 01:00:00'), (2, 1, '2021-01-02 02:00:00'), (3, 2, '2021-01-03 23:00:00'), (4, 2, '2021-01-04 04:00:00'), (5, 3, '2021-01-05 05:00:00'), (6, 3, '2021-01-06 06:... | How many emergency calls were made in each borough in January 2021? | SELECT b.name, COUNT(ec.id) FROM borough b JOIN emergency_calls_3 ec ON b.id = ec.borough_id WHERE EXTRACT(MONTH FROM ec.call_time) = 1 GROUP BY b.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (employee_id INT, first_name VARCHAR(50), last_name VARCHAR(50), position VARCHAR(50), age INT, country VARCHAR(50)); INSERT INTO mining_operations (employee_id, first_name, last_name, position, age, country) VALUES (1, 'John', 'Doe', 'Engineer', 35, 'USA'); INSERT INTO mining_operations ... | What is the minimum age of employees in each position in the 'mining_operations' table? | SELECT position, MIN(age) FROM mining_operations GROUP BY position; | gretelai_synthetic_text_to_sql |
CREATE TABLE extraction (id INT, year INT, mineral TEXT, quantity INT); INSERT INTO extraction (id, year, mineral, quantity) VALUES (1, 2009, 'Mineral X', 500); INSERT INTO extraction (id, year, mineral, quantity) VALUES (2, 2010, 'Mineral Y', 700); | What is the total quantity of mineral X extracted in Year 2010? | SELECT SUM(quantity) FROM extraction WHERE year = 2010 AND mineral = 'Mineral X'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cyber_incidents_europe (region VARCHAR(255), year INT, success BOOLEAN); INSERT INTO cyber_incidents_europe (region, year, success) VALUES ('Europe', 2021, TRUE), ('Europe', 2021, FALSE), ('Europe', 2020, TRUE); | What is the average number of successful cybersecurity incidents reported in Europe in the last 2 years? | SELECT AVG(COUNT(CASE WHEN success THEN 1 END)) FROM cyber_incidents_europe WHERE region = 'Europe' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_projects (project_id INT, project_name VARCHAR(255), state VARCHAR(255), project_type VARCHAR(255), installed_capacity INT); | What is the total installed capacity (in MW) of wind power projects in the state of Texas, grouped by project type? | SELECT project_type, SUM(installed_capacity) FROM wind_projects WHERE state = 'Texas' GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (customerID INT, customerName VARCHAR(50), loyalty_score INT); INSERT INTO Customers (customerID, customerName, loyalty_score) VALUES (1, 'Alice Johnson', 75), (2, 'Bob Smith', 85), (3, 'Carla Jones', 65), (4, 'Daniel Kim', 90); | Delete all customer records with a loyalty_score below 60 from the Customers table. | DELETE FROM Customers WHERE loyalty_score < 60; | gretelai_synthetic_text_to_sql |
CREATE TABLE CustomerOrders (id INT, customer VARCHAR(20), country VARCHAR(20), total DECIMAL(5,2)); INSERT INTO CustomerOrders (id, customer, country, total) VALUES (1, 'Alice', 'United States', 100.00), (2, 'Bob', 'Canada', 150.00), (3, 'Charlie', 'United States', 75.00); | What is the total revenue generated from sales to customers in the United States? | SELECT SUM(total) FROM CustomerOrders WHERE country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transactions (id INT PRIMARY KEY, user_id INT, amount INT, tx_type VARCHAR(50), smart_contract_id INT, FOREIGN KEY (user_id) REFERENCES Users(id), FOREIGN KEY (smart_contract_id) REFERENCES Smart_Contracts(id)); INSERT INTO Transactions (id, user_id, amount, tx_type, smart_contract_id) VALUES (3, 1, 800, '... | What is the average transaction amount for smart contracts in the Finance category? | SELECT AVG(t.amount) FROM Transactions t INNER JOIN Smart_Contracts sc ON t.smart_contract_id = sc.id WHERE sc.category = 'Finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organization (org_id INT, org_name TEXT); INSERT INTO organization (org_id, org_name) VALUES (1, 'Habitat for Humanity'), (2, 'American Red Cross'), (3, 'Doctors Without Borders'); CREATE TABLE donation (donation_id INT, donor_id INT, org_id INT); INSERT INTO donation (donation_id, donor_id, org_id) VALUES... | Find organizations with no volunteer activities but have received donations. | SELECT org_name FROM organization WHERE org_id NOT IN (SELECT org_id FROM volunteer); | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_subscribers (region VARCHAR(50), subscriber_id INT); INSERT INTO broadband_subscribers VALUES ('Region A', 100); INSERT INTO broadband_subscribers VALUES ('Region A', 200); INSERT INTO broadband_subscribers VALUES ('Region B', 300); INSERT INTO broadband_subscribers VALUES ('Region C', 400); INSE... | Which regions have more than 500 total broadband subscribers? | SELECT region FROM broadband_subscribers GROUP BY region HAVING COUNT(subscriber_id) > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE innovation_projects (id INT, project VARCHAR(50), status VARCHAR(50)); INSERT INTO innovation_projects (id, project, status) VALUES (1, 'Precision Agriculture', 'Completed'); INSERT INTO innovation_projects (id, project, status) VALUES (2, 'Drip Irrigation', 'In Progress'); | How many agricultural innovation projects are in the 'innovation_projects' table? | SELECT COUNT(*) FROM innovation_projects; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.projects (id INT PRIMARY KEY, name VARCHAR(100), focus VARCHAR(100)); | What are the names of genetic research projects focusing on genome editing? | SELECT name FROM genetics.projects WHERE focus = 'genome editing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (mission_id INT, name VARCHAR(100), launch_date DATE, launching_agency VARCHAR(50)); INSERT INTO space_missions (mission_id, name, launch_date, launching_agency) VALUES (1, 'Luna 1', '1959-01-02', 'ISA'); | What are the names and launch dates of all space missions launched by ISA? | SELECT name, launch_date FROM space_missions WHERE launching_agency = 'ISA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (product_type VARCHAR(10), sale_date DATE, revenue DECIMAL(10,2)); INSERT INTO sales (product_type, sale_date, revenue) VALUES ('organic', '2021-01-01', 150.00), ('non_organic', '2021-01-01', 200.00), ('organic', '2021-01-02', 120.00), ('non_organic', '2021-01-02', 250.00), ('organic', '2021-02-01', ... | What is the total sales revenue for organic products in Q1 2021? | SELECT SUM(revenue) FROM sales WHERE product_type = 'organic' AND sale_date BETWEEN '2021-01-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SupplyChain (supplier_id INT, supplier_name TEXT); CREATE TABLE Sustainability (supplier_id INT, certification TEXT); | List all suppliers and their associated sustainable certifications from the 'SupplyChain' and 'Sustainability' tables. | SELECT SupplyChain.supplier_name, Sustainability.certification FROM SupplyChain INNER JOIN Sustainability ON SupplyChain.supplier_id = Sustainability.supplier_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contracts (Contract_Id INT, Contract_Name VARCHAR(50), Contract_Value FLOAT, Start_Year INT, End_Year INT); INSERT INTO Contracts (Contract_Id, Contract_Name, Contract_Value, Start_Year, End_Year) VALUES (1, 'Contract X', 75000000, 2019, 2023); INSERT INTO Contracts (Contract_Id, Contract_Name, Contract_Va... | List Defense contracts that were active in 2020 and have a contract value greater than $60 million. | SELECT * FROM Contracts WHERE Contract_Value > 60000000 AND Start_Year <= 2020 AND End_Year >= 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE africa_sustainable_tourism (id INT, country VARCHAR(20), certifications INT); INSERT INTO africa_sustainable_tourism (id, country, certifications) VALUES (1, 'Egypt', 50), (2, 'South Africa', 100), (3, 'Morocco', 75); | How many sustainable tourism certifications does each country in Africa have? | SELECT country, certifications FROM africa_sustainable_tourism; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities (city_id INT, city_name VARCHAR(255), location VARCHAR(255)); CREATE TABLE carbon_offsets (offset_id INT, city_id INT, offset_value FLOAT); | Show the carbon offset generated by each smart city initiative in the smart_cities and carbon_offsets tables. | SELECT smart_cities.city_name, carbon_offsets.offset_value FROM smart_cities JOIN carbon_offsets ON smart_cities.city_id = carbon_offsets.city_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Parks (Area TEXT, NumParks INTEGER); INSERT INTO Parks (Area, NumParks) VALUES ('Urban', 15), ('Rural', 10); | How many public parks are there in urban areas compared to rural areas? | SELECT Area, NumParks FROM Parks; | gretelai_synthetic_text_to_sql |
CREATE TABLE crime_stats (id INT, city VARCHAR(20), crime_type VARCHAR(20), frequency INT); INSERT INTO crime_stats (id, city, crime_type, frequency) VALUES (1, 'Houston', 'Theft', 1200), (2, 'Houston', 'Assault', 800), (3, 'Houston', 'Vandalism', 500); | What is the most common type of crime committed in the city of Houston? | SELECT crime_type, MAX(frequency) FROM crime_stats WHERE city = 'Houston' GROUP BY crime_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_data (user_id INT, workout_type VARCHAR(20), duration INT); INSERT INTO workout_data (user_id, workout_type, duration) VALUES (1, 'Running', 30), (1, 'Cycling', 60), (2, 'Yoga', 45), (3, 'Pilates', 50); | What is the average duration of 'Running' workouts in the 'workout_data' table? | SELECT AVG(duration) as avg_duration FROM workout_data WHERE workout_type = 'Running'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsPlayers (PlayerID INT, Age INT, EventID INT); INSERT INTO EsportsPlayers (PlayerID, Age, EventID) VALUES (1, 22, 1), (2, 25, 2), (3, 28, 3), (4, 30, 4); | What is the minimum and maximum age of players who have participated in esports events? | SELECT MIN(Age), MAX(Age) FROM EsportsPlayers; | gretelai_synthetic_text_to_sql |
CREATE TABLE Staff (StaffID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Email VARCHAR(50)); INSERT INTO Staff (StaffID, FirstName, LastName, Email) VALUES (1, 'Jane', 'Doe', '[jane.doe@disabilityservices.org](mailto:jane.doe@disabilityservices.org)'); INSERT INTO Staff (StaffID, FirstName, LastName, Email) VALUES... | What is the name and email of all staff members involved in disability services? | SELECT Staff.FirstName, Staff.LastName, Staff.Email FROM Staff; | gretelai_synthetic_text_to_sql |
CREATE TABLE Music_Albums (album_id INT PRIMARY KEY, artist VARCHAR(100), title VARCHAR(100), release_year INT); | Insert a new music album 'Sour' by Olivia Rodrigo with a release year of 2021 into the 'Music_Albums' table. | INSERT INTO Music_Albums (artist, title, release_year) VALUES ('Olivia Rodrigo', 'Sour', 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE Salmon_farms (id INT, name TEXT, country TEXT, water_temp FLOAT); INSERT INTO Salmon_farms (id, name, country, water_temp) VALUES (1, 'Farm A', 'Norway', 8.5), (2, 'Farm B', 'Canada', 2.0); | What is the minimum water temperature in 'Salmon_farms'? | SELECT MIN(water_temp) FROM Salmon_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_economy (id INT, location VARCHAR(50), year INT, local_impact DECIMAL(10, 2)); INSERT INTO local_economy (id, location, year, local_impact) VALUES (1, 'Bangkok', 2018, 15000.00), (2, 'Paris', 2019, 22000.00); | What is the local economic impact in 'Bangkok' for the year 2021? | SELECT year, local_impact FROM local_economy WHERE location = 'Bangkok'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PoliceStations (StationID INT PRIMARY KEY, StationName VARCHAR(50), Region VARCHAR(50)); | Delete all records in the 'PoliceStations' table where the 'StationName' is 'Central Police Station' | DELETE FROM PoliceStations WHERE StationName = 'Central Police Station'; | gretelai_synthetic_text_to_sql |
CREATE TABLE diplomacy (id INT PRIMARY KEY, activity_name VARCHAR(100), description TEXT, country VARCHAR(100), start_date DATE, end_date DATE, status VARCHAR(50)); | Delete defense diplomacy activities that have been canceled | DELETE FROM diplomacy WHERE status = 'Cancelled'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationDates (SiteID INT, Region VARCHAR(50), ExcavationDate DATE); INSERT INTO ExcavationDates (SiteID, Region, ExcavationDate) VALUES (1, 'africa', '2020-01-01'), (2, 'americas', '2019-01-01'), (3, 'africa', '2018-01-01'), (4, 'europe', '2021-01-01'); | What is the earliest excavation date in each region? | SELECT Region, MIN(ExcavationDate) AS EarliestExcavationDate FROM ExcavationDates GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE libraries (id INT, type TEXT, state TEXT); INSERT INTO libraries (id, type, state) VALUES (1, 'public', 'TX'), (2, 'mobile', 'TX'), (3, 'school', 'TX'); | What is the total number of public libraries in Texas, excluding mobile libraries? | SELECT COUNT(*) FROM libraries WHERE type = 'public' AND state = 'TX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT PRIMARY KEY, name VARCHAR(50), population INT); | Delete the species 'Narwhal' from the species table. | DELETE FROM species WHERE name = 'Narwhal'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restorative_justice_programs (id INT, state VARCHAR(50), program_name VARCHAR(50), type VARCHAR(50)); INSERT INTO restorative_justice_programs (id, state, program_name, type) VALUES (1, 'California', 'Restorative Justice Circle', 'Victim-Offender'), (2, 'Texas', 'Community Conferencing', 'Community'), (3, ... | What is the total number of restorative justice programs in California and Texas? | SELECT COUNT(*) FROM restorative_justice_programs WHERE state IN ('California', 'Texas'); | gretelai_synthetic_text_to_sql |
CREATE TABLE avg_energy_storage (country VARCHAR(20), capacity INT); INSERT INTO avg_energy_storage (country, capacity) VALUES ('South Korea', 65), ('South Korea', 70), ('South Korea', 75), ('Chile', 80), ('Chile', 85), ('Chile', 90); | What is the average energy storage capacity in South Korea and Chile? | SELECT AVG(capacity) FROM avg_energy_storage WHERE country IN ('South Korea', 'Chile'); | 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.