context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Roads (Name VARCHAR(255), Speed_limit_mph INT, State VARCHAR(255)); INSERT INTO Roads (Name, Speed_limit_mph, State) VALUES ('New York Thruway', 65, 'New York'); | Find the roads in New York with a speed limit over 60 mph. | SELECT Name FROM Roads WHERE Speed_limit_mph > 60 AND State = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales_11 (id INT, region VARCHAR, year INT, value FLOAT); | Increase the value of military equipment sales by 15% for 'South Asia' in 2023 | UPDATE military_sales_11 SET value = value * 1.15 WHERE region = 'South Asia' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dates (id INT, date DATE); INSERT INTO Dates (id, date) VALUES (1, '2023-01-01'), (2, '2023-01-02'), (3, '2023-01-03'), (4, '2023-01-04'), (5, '2023-01-05'), (6, '2023-01-06'); CREATE TABLE Sales (id INT, date_id INT, product VARCHAR(255), quantity INT, transparent_supply_chain BOOLEAN); INSERT INTO Sales ... | What is the sum of quantities of products sold through transparent supply chains, by day? | SELECT d.date, SUM(s.quantity) AS total_quantity FROM Sales s JOIN Dates d ON s.date_id = d.id WHERE s.transparent_supply_chain = true GROUP BY d.date; | gretelai_synthetic_text_to_sql |
CREATE TABLE audience (id INT, gender VARCHAR(10), age INT, location VARCHAR(50), interests VARCHAR(100)); INSERT INTO audience (id, gender, age, location, interests) VALUES (1, 'Male', 45, 'New York', 'Sports'); INSERT INTO audience (id, gender, age, location, interests) VALUES (2, 'Female', 55, 'California', 'Enterta... | What is the name and interests of all audience members aged 40 or older in the 'audience' table? | SELECT name, interests FROM audience WHERE age >= 40; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (order_id INT, product_id INT, order_date DATE, revenue FLOAT); INSERT INTO Orders (order_id, product_id, order_date, revenue) VALUES (1, 101, '2022-07-01', 200), (2, 102, '2022-07-02', 300); | Which product category had the highest revenue in Q3 2022? | SELECT Products.category, SUM(Orders.revenue) as total_revenue FROM Products JOIN Orders ON Products.product_id = Orders.product_id WHERE Orders.order_date BETWEEN '2022-07-01' AND '2022-09-30' GROUP BY Products.category ORDER BY total_revenue DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlantSafety (id INT, plant_location VARCHAR(50), incident_date DATE); INSERT INTO PlantSafety (id, plant_location, incident_date) VALUES (1, 'France', '2021-01-15'), (2, 'Germany', '2021-12-21'), (3, 'France', '2021-06-05'); | How many safety incidents were reported in the chemical manufacturing plant located in France in 2021? | SELECT COUNT(*) FROM PlantSafety WHERE plant_location = 'France' AND EXTRACT(YEAR FROM incident_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE port_details (id INT, name TEXT, location TEXT, num_of_berries INT); INSERT INTO port_details (id, name, location, num_of_berries) VALUES (1, 'Port A', 'Location A', 10), (2, 'Port B', 'Location B', 15), (3, 'Port C', 'Location C', 20); | What are the names of the ports in 'Location C'? | SELECT name FROM port_details WHERE location = 'Location C'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founding_year INT, founder_race TEXT); INSERT INTO company (id, name, founding_year, founder_race) VALUES (1, 'Delta Inc', 2018, 'African American'); INSERT INTO company (id, name, founding_year, founder_race) VALUES (2, 'Epsilon Corp', 2021, 'Latinx'); INSERT INTO company (id, ... | What is the total number of funding rounds for companies founded by underrepresented minority groups in the last 3 years? | SELECT COUNT(*) FROM investment_rounds ir INNER JOIN company c ON ir.company_id = c.id WHERE c.founder_race IN ('African American', 'Latinx', 'Asian', 'Indigenous') AND c.founding_year >= YEAR(CURRENT_DATE) - 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_platform (id INT, genre VARCHAR(50), streams INT); | What is the total number of streams for all songs in the pop genre on the music streaming platform? | SELECT SUM(streams) as total_streams FROM music_platform WHERE genre = 'pop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE consultation (id INT, name VARCHAR(255), domain VARCHAR(255), start_date DATE); INSERT INTO consultation (id, name, domain, start_date) VALUES (1, 'Teacher Training', 'Education', '2022-01-01'); INSERT INTO consultation (id, name, domain, start_date) VALUES (2, 'School Lunch Program', 'Education', '2022-05... | Which public consultations in the education domain have received the most feedback in the last 6 months? | SELECT c.name FROM consultation c WHERE c.domain = 'Education' AND c.start_date >= DATEADD(month, -6, GETDATE()) GROUP BY c.name ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, exhibition_name VARCHAR(50), location VARCHAR(30), visitors INT, art_period VARCHAR(20), start_date DATE); INSERT INTO Exhibitions (id, exhibition_name, location, visitors, art_period, start_date) VALUES (1, 'Exhibition1', 'Berlin', 300, 'Baroque', '2019-01-01'); | Minimum number of visitors for Baroque exhibitions held in Berlin? | SELECT MIN(visitors) FROM Exhibitions WHERE art_period = 'Baroque' AND location = 'Berlin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai (application_id INT, name TEXT, region TEXT); INSERT INTO creative_ai (application_id, name, region) VALUES (1, 'ApplicationL', 'Asia'), (2, 'ApplicationM', 'Europe'), (3, 'ApplicationN', 'North America'), (4, 'ApplicationO', 'Asia'), (5, 'ApplicationP', 'Europe'); | List all creative AI applications in the 'creative_ai' table that were developed in 'Asia'. | SELECT name FROM creative_ai WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (incident_id INT, incident_date DATE, incident_description TEXT); INSERT INTO incidents (incident_id, incident_date, incident_description) VALUES (1, '2022-01-01', 'Unauthorized access to web server'); INSERT INTO incidents (incident_id, incident_date, incident_description) VALUES (2, '2022-01-15... | What are the details of the most recent security incident? | SELECT * FROM incidents ORDER BY incident_date DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, agency VARCHAR(255), vendor VARCHAR(255), amount DECIMAL(10, 2), year INT); | Insert a record for a new defense contract into the defense_contracts table | INSERT INTO defense_contracts (contract_id, agency, vendor, amount, year) VALUES (1, 'DoD', 'Lockheed Martin', 1000000, 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_profiles (id INT, animal_name VARCHAR(50), age INT, species_id INT); INSERT INTO animal_profiles (id, animal_name, age, species_id) VALUES (1, 'Tiger', 5, 1001), (2, 'Polar Bear', 12, 1002), (3, 'Giant Panda', 8, 1003); | What is the average age of all animals in the 'animal_profiles' table? | SELECT AVG(age) FROM animal_profiles; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact_categories (category_id INT, category_name TEXT); CREATE TABLE investments (investment_id INT, category_id INT, invested_amount INT, invested_date DATE); | Which impact categories received the most investments in Q4 2021? | SELECT category_name, SUM(invested_amount) AS total_investment FROM impact_categories i JOIN investments j ON i.category_id = j.category_id WHERE invested_date BETWEEN '2021-10-01' AND '2021-12-31' GROUP BY category_name ORDER BY total_investment DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL(10, 2), donation_date DATE); INSERT INTO donations (id, donor_id, amount, donation_date) VALUES (1, 1001, '500.00', '2021-10-05'), (2, 1002, '300.00', '2021-11-15'), (3, 1003, '400.00', '2021-12-20'), (4, 1001, '600.00', '2021-12-31'); | What's the total donation amount from first-time donors in the last quarter? | SELECT SUM(amount) FROM donations WHERE donor_id NOT IN (SELECT donor_id FROM donations WHERE donation_date < DATE_SUB(LAST_DAY(CURDATE()), INTERVAL 3 MONTH)) AND donation_date >= DATE_SUB(LAST_DAY(CURDATE()), INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_programs (id INT, name VARCHAR(100), country VARCHAR(50), capacity_mw FLOAT); INSERT INTO carbon_offset_programs (id, name, country, capacity_mw) VALUES (1, 'Program 1', 'Spain', 30.5), (2, 'Program 2', 'Spain', 45.7), (3, 'Program 3', 'France', 60.8); | Find the average capacity (in MW) of Carbon Offset Programs in Spain | SELECT AVG(capacity_mw) FROM carbon_offset_programs WHERE country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (id INT, name VARCHAR(50), membership_start_date DATE); | Insert a new record for a member with ID 101, name 'John Doe', and membership start date '2022-01-01' | INSERT INTO members (id, name, membership_start_date) VALUES (101, 'John Doe', '2022-01-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Audience (AudienceID INT, Age INT, Event TEXT); INSERT INTO Audience (AudienceID, Age, Event) VALUES (1, 30, 'Art'), (2, 25, 'Art'), (3, 40, 'Art'); | What is the minimum age of the audience members who attended the "Art" event? | SELECT MIN(Age) FROM Audience WHERE Event = 'Art'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolarBears (Country VARCHAR(50), Number INT); INSERT INTO PolarBears (Country, Number) VALUES ('Canada', 15000), ('United States', 2500), ('Greenland', 3000), ('Russia', 5000); | What is the total number of polar bears in each country in the Arctic region? | SELECT Country, SUM(Number) FROM PolarBears GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, CuisineType varchar(255), Revenue int); INSERT INTO Restaurants (RestaurantID, CuisineType, Revenue) VALUES (1, 'Italian', 5000), (2, 'Mexican', 6000), (3, 'Indian', 7000), (4, 'Chinese', 8000), (5, 'French', 9000), (6, 'Thai', 10000), (7, 'Chinese', 11000), (8, 'Indian', 120... | What is the total revenue for restaurants serving Indian cuisine? | SELECT CuisineType, SUM(Revenue) FROM Restaurants WHERE CuisineType = 'Indian' GROUP BY CuisineType; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, EmployeeName VARCHAR(50), Department VARCHAR(50), Salary FLOAT); INSERT INTO Employees (EmployeeID, EmployeeName, Department, Salary) VALUES (1, 'John Doe', 'IT', 70000), (2, 'Jane Smith', 'HR', 60000), (3, 'Alice Johnson', 'IT', 75000), (4, 'Bob Brown', 'Finance', 80000), (5, 'C... | List the top 3 highest paid employees by department? | SELECT EmployeeName, Department, Salary, ROW_NUMBER() OVER (PARTITION BY Department ORDER BY Salary DESC) AS Rank FROM Employees WHERE Rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE workers (worker_id INT, sector VARCHAR(255), salary DECIMAL(10,2)); INSERT INTO workers (worker_id, sector, salary) VALUES (1, 'Ethical Manufacturing', 75000.00), (2, 'Ethical Manufacturing', 70000.00), (3, 'Ethical Manufacturing', 78000.00); | What is the minimum salary paid to a worker in the ethical manufacturing sector? | SELECT MIN(salary) FROM workers WHERE sector = 'Ethical Manufacturing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (project_name VARCHAR(255), country VARCHAR(255)); | What are the names of the top 2 countries with the highest number of renewable energy projects in the 'renewable_projects' table? | SELECT country FROM renewable_projects GROUP BY country ORDER BY COUNT(*) DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Types (Id INT, Aircraft_Type VARCHAR(50), Flight_Hours INT); INSERT INTO Aircraft_Types (Id, Aircraft_Type, Flight_Hours) VALUES (1, 'B737', 1000), (2, 'A320', 2000), (3, 'B747', 3000); | What are the total flight hours for each aircraft type? | SELECT Aircraft_Type, SUM(Flight_Hours) FROM Aircraft_Types GROUP BY Aircraft_Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_categories (program_category VARCHAR(20));INSERT INTO program_categories VALUES ('Arts'), ('Education'), ('Health'), ('Science');CREATE TABLE program_donations_time (program_category VARCHAR(20), donation_date DATE);INSERT INTO program_donations_time VALUES ('Arts', '2022-01-01'), ('Education', '20... | List the program categories with no donations in the last 6 months, including those that have never received donations. | SELECT program_category FROM program_categories WHERE program_category NOT IN (SELECT program_category FROM program_donations_time WHERE donation_date IS NOT NULL AND donation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)); | gretelai_synthetic_text_to_sql |
CREATE TABLE Site_A (Artifact_ID INT, Age INT);INSERT INTO Site_A (Artifact_ID, Age) VALUES (1, 2000), (2, 1800), (3, 2500); | What is the average age of artifacts excavated from 'Site A'? | SELECT AVG(Age) FROM Site_A; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpeciesCount2 (ID INT, Species VARCHAR(50), Count INT, TimeStamp DATETIME); INSERT INTO SpeciesCount2 (ID, Species, Count, TimeStamp) VALUES (1, 'Starfish', 300, '2020-01-01 10:00:00'), (2, 'Dolphin', 250, '2020-01-02 10:00:00'), (3, 'Shark', 400, '2020-01-03 10:00:00'), (4, 'Starfish', 380, '2020-01-04 10... | Identify marine species with a rapid increase in count. | SELECT Species, Count, TimeStamp, LAG(Count) OVER (PARTITION BY Species ORDER BY TimeStamp) as PreviousCount FROM SpeciesCount2; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT PRIMARY KEY, year INT, location VARCHAR(50), usage FLOAT); INSERT INTO water_usage (id, year, location, usage) VALUES (1, 2018, 'Detroit', 1234.56), (2, 2019, 'Detroit', 1345.67), (3, 2018, 'Nashville', 897.45), (4, 2019, 'Nashville', 912.34), (5, 2018, 'Tampa', 567.89), (6, 2019, 'Tamp... | Show the change in water usage from 2018 to 2019 for each location | SELECT a.location, a.year, (b.usage - a.usage) AS change FROM water_usage a INNER JOIN water_usage b ON a.location = b.location WHERE a.year = 2018 AND b.year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE ClothingItems (ItemID INT, ItemName VARCHAR(255), AvailableSizes VARCHAR(255)); INSERT INTO ClothingItems (ItemID, ItemName, AvailableSizes) VALUES (101, 'Maxi Dress', 'XS,S,M,L,XL'), (102, 'Blazer', 'S,M,L'), (103, 'Jeans', '28,30,32,34,36'), (104, 'T-Shirt', 'XS,S,M,L,XL,XXL'), (105, 'Jumpsuit', 'M,L,XL'... | List the names and sizes of all size-inclusive clothing items. | SELECT ItemName, AvailableSizes FROM ClothingItems WHERE SIZE(AvailableSizes) >= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (hospital_id INT PRIMARY KEY, hospital_name VARCHAR(50), state_id INT, satisfaction_score INT); CREATE TABLE states (state_id INT PRIMARY KEY, state_name VARCHAR(50)); INSERT INTO hospitals VALUES (1, 'Hospital A', 1, 90), (2, 'Hospital B', 1, 85), (3, 'Hospital C', 2, 70), (4, 'Hospital D', 2, 7... | List all hospitals with their patient satisfaction scores and the average score for each state. | SELECT s.state_name, h.hospital_name, h.satisfaction_score, AVG(h.satisfaction_score) OVER (PARTITION BY h.state_id) AS avg_score FROM hospitals h JOIN states s ON h.state_id = s.state_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (song_id INT, genre VARCHAR(20), release_year INT, streams INT); INSERT INTO songs (song_id, genre, release_year, streams) VALUES (1, 'hip-hop', 2022, 10000); INSERT INTO songs (song_id, genre, release_year, streams) VALUES (2, 'hip-hop', 2022, 12000); | What is the average number of streams for hip-hop songs released in 2022? | SELECT AVG(streams) FROM songs WHERE genre = 'hip-hop' AND release_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (product_id INT, ingredient VARCHAR(255)); | What is the average rating of products that contain Coconut Oil | SELECT AVG(rating) FROM products JOIN ingredients ON products.product_id = ingredients.product_id WHERE ingredients.ingredient = 'Coconut Oil'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Equipment (EquipmentID INT, EquipmentName VARCHAR(20), MaintenanceCost DECIMAL(10,2));CREATE VIEW EquipmentCost AS SELECT EquipmentID, EquipmentName, AVG(MaintenanceCost) as AverageMaintenanceCost FROM Equipment GROUP BY EquipmentID; | What is the equipment with the lowest average maintenance cost? | SELECT EquipmentName FROM EquipmentCost WHERE ROW_NUMBER() OVER(ORDER BY AverageMaintenanceCost ASC) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT PRIMARY KEY, country_name VARCHAR(255)); INSERT INTO countries (country_id, country_name) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); CREATE TABLE regions (region_id INT PRIMARY KEY, region_name VARCHAR(255), country_id INT); INSERT INTO regions (region_id, region_name, count... | List the countries, regions, and mobile towers for regions with an average data usage over 75 among broadband subscribers. | SELECT c.country_name, r.region_name, m.tower_id FROM countries c JOIN regions r ON c.country_id = r.country_id JOIN mobile_towers m ON r.region_id = m.region_id JOIN broadband_subscribers b ON r.region_id = b.region_id GROUP BY r.region_id HAVING AVG(b.data_usage) > 75; | gretelai_synthetic_text_to_sql |
CREATE TABLE division (division_id INT, division_name VARCHAR(255)); INSERT INTO division (division_id, division_name) VALUES (1, 'Patrol'), (2, 'Investigations'), (3, 'Special Operations'), (4, 'Downtown'); CREATE TABLE emergencies (emergency_id INT, division_id INT, response_time INT); | What is the average response time for fire emergencies in the 'Downtown' division? | SELECT AVG(response_time) FROM emergencies WHERE division_id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE InclusiveHousingUnits (Id INT, City VARCHAR(50), Units INT); INSERT INTO InclusiveHousingUnits (Id, City, Units) VALUES (1, 'Oakland', 300), (2, 'Seattle', 400), (3, 'Oakland', 500), (4, 'SanFrancisco', 600), (5, 'Portland', 700); | What is the total number of inclusive housing units in Oakland, CA and San Francisco, CA? | SELECT SUM(Units) FROM InclusiveHousingUnits WHERE City IN ('Oakland', 'SanFrancisco'); | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings (id INT, name VARCHAR(50), state VARCHAR(50), cost FLOAT); INSERT INTO buildings (id, name, state, cost) VALUES (1, 'Building A', 'California', 1000000.00), (2, 'Building B', 'California', 1500000.00), (3, 'Building C', 'Texas', 800000.00); | What is the minimum cost of a building in California? | SELECT MIN(cost) FROM buildings WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name VARCHAR(255)); INSERT INTO programs (id, name) VALUES (1, 'Education'), (2, 'Health'), (3, 'Environment'); CREATE TABLE donations (id INT, program_id INT, amount DECIMAL(10, 2)); INSERT INTO donations (id, program_id, amount) VALUES (1, 1, 500.00), (2, 1, 250.00), (3, 2, 750.00), (4,... | What are the unique programs and their respective total donation amounts? | SELECT programs.name, SUM(donations.amount) FROM donations JOIN programs ON donations.program_id = programs.id GROUP BY programs.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, donor_name VARCHAR(255), donation_amount DECIMAL(10,2), donation_date DATE, country VARCHAR(255)); INSERT INTO Donations (id, donor_name, donation_amount, donation_date, country) VALUES (1, 'John Doe', 500.00, '2021-01-01', 'USA'), (2, 'Jane Smith', 300.00, '2021-02-01', 'Canada'); | Which countries have the highest total donation amounts for the year 2021, excluding the United States? | SELECT country, SUM(donation_amount) as total_donations FROM Donations WHERE country != 'USA' AND donation_date >= '2021-01-01' AND donation_date < '2022-01-01' GROUP BY country ORDER BY total_donations DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE BudgetAllocations (allocation_id INT, allocation_purpose VARCHAR(50), allocation_amount DECIMAL(10, 2)); | Find the total budget for community education programs in 'BudgetAllocations' table | SELECT SUM(allocation_amount) as total_budget FROM BudgetAllocations WHERE allocation_purpose IN ('Community Education', 'Education Programs'); | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, name TEXT, area FLOAT, region TEXT, carbon_sequestration FLOAT); INSERT INTO forests (id, name, area, region, carbon_sequestration) VALUES (1, 'Amazon Rainforest', 6785845.2, 'Amazon', 123456.7), (2, 'Atlantic Forest', 123456.7, 'Amazon', 23456.7); | What is the total carbon sequestration of all forests in the 'Amazon' region? | SELECT SUM(carbon_sequestration) FROM forests WHERE region = 'Amazon'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs_Revenue (program_name VARCHAR(255), location VARCHAR(255), revenue INT); INSERT INTO Programs_Revenue (program_name, location, revenue) VALUES ('Art Education', 'New York', 50000), ('Music Education', 'California', 40000), ('Theater Education', 'New York', 60000); | What was the total revenue generated from programs in 'California'? | SELECT revenue FROM Programs_Revenue WHERE location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Doctors (DoctorID INT, Name VARCHAR(50), Specialty VARCHAR(30), Area VARCHAR(20)); INSERT INTO Doctors (DoctorID, Name, Specialty, Area) VALUES (1, 'Dr. Smith', 'Cardiology', 'Rural Texas'); INSERT INTO Doctors (DoctorID, Name, Specialty, Area) VALUES (2, 'Dr. Johnson', 'Pediatrics', 'Rural Oklahoma'); | What is the total number of doctors working in the rural areas of "Texas" and "Oklahoma"? | SELECT COUNT(*) FROM Doctors WHERE Area IN ('Rural Texas', 'Rural Oklahoma'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteID INT, SiteName TEXT, Country TEXT); INSERT INTO ExcavationSites (SiteID, SiteName, Country) VALUES (1, 'MayanRuins', 'Guatemala'), (2, 'AztecCity', 'Mexico'); | Update the name of the 'AztecCity' site to 'Tenochtitlan'. | UPDATE ExcavationSites SET SiteName = 'Tenochtitlan' WHERE SiteName = 'AztecCity'; | gretelai_synthetic_text_to_sql |
CREATE TABLE south_america_tourism (country VARCHAR(255), year INT, visitors INT); INSERT INTO south_america_tourism (country, year, visitors) VALUES ('Brazil', 2018, 15000), ('Argentina', 2018, 10000), ('Colombia', 2018, 12000), ('Brazil', 2019, 16000), ('Argentina', 2019, 11000), ('Colombia', 2019, 14000); | What is the average number of tourists visiting destinations in South America, grouped by country? | SELECT country, AVG(visitors) as avg_visitors FROM south_america_tourism GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, author VARCHAR(255), title VARCHAR(255), date DATE); | What is the total number of articles published by female authors in the 'publishing' schema? | SELECT COUNT(*) FROM articles WHERE schema='publishing' AND author IN (SELECT name FROM authors WHERE gender='female'); | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (contract_id INT, contract_name VARCHAR(50), region VARCHAR(50)); CREATE TABLE regulatory_actions (action_id INT, contract_id INT, action_date DATE); INSERT INTO smart_contracts (contract_id, contract_name, region) VALUES (1, 'Contract A', 'Antarctic'), (2, 'Contract B', 'Antarctic'); INSER... | Identify the total number of regulatory actions taken against smart contracts in the Antarctic region. | SELECT COUNT(*) FROM regulatory_actions r JOIN smart_contracts s ON r.contract_id = s.contract_id WHERE s.region = 'Antarctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE concerts (id INT, city VARCHAR(20), revenue DECIMAL(10, 2)); INSERT INTO concerts (id, city, revenue) VALUES (1, 'Los Angeles', 50000.00), (2, 'New York', 75000.00); | What is the total revenue generated from concert ticket sales in the city of Los Angeles? | SELECT SUM(revenue) FROM concerts WHERE city = 'Los Angeles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE disinformation_detections (id INT, date DATE, source VARCHAR(255), location VARCHAR(255)); INSERT INTO disinformation_detections (id, date, source, location) VALUES (1, '2023-02-01', 'Facebook', 'India'), (2, '2023-02-02', 'Twitter', 'India'), (3, '2023-02-03', 'Instagram', 'India'); | How many instances of disinformation were detected in social media in India in the last month? | SELECT COUNT(*) FROM disinformation_detections WHERE location = 'India' AND date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorker (ID INT, Name TEXT, ServiceArea TEXT); INSERT INTO CommunityHealthWorker (ID, Name, ServiceArea) VALUES (1, 'Mabel Lee', 'Chinatown'); INSERT INTO CommunityHealthWorker (ID, Name, ServiceArea) VALUES (2, 'Ali Hassan', 'Little Kabul'); CREATE TABLE PatientMentalHealth (PatientID INT, C... | What is the average mental health score for patients from each community health worker's service area, ordered by the community health worker's ID? | SELECT CommunityHealthWorkerID, AVG(Score) as AvgScore FROM (SELECT PatientID, CommunityHealthWorkerID, Score, ROW_NUMBER() OVER (PARTITION BY CommunityHealthWorkerID ORDER BY PatientID) as rn FROM PatientMentalHealth) tmp WHERE rn = 1 GROUP BY CommunityHealthWorkerID ORDER BY CommunityHealthWorkerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE developers (id INT, name VARCHAR(50), salary FLOAT, project VARCHAR(50)); INSERT INTO developers (id, name, salary, project) VALUES (1, 'Alice', 80000.0, 'Social Good'); INSERT INTO developers (id, name, salary, project) VALUES (2, 'Bob', 85000.0, 'Machine Learning'); | Delete all records of developers who work on social good projects | DELETE FROM developers WHERE project = 'Social Good'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, product_id INT, supplier_id INT, sale_amount DECIMAL(5,2)); CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(50), country VARCHAR(20)); INSERT INTO sales (sale_id, product_id, supplier_id, sale_amount) VALUES (1, 1, 1, 25.00), (2, 2, 2, 50.00), (3, 3, 3, 75.00); INSERT INT... | What is the total revenue of suppliers from a specific country? | SELECT SUM(sale_amount) FROM sales INNER JOIN suppliers ON sales.supplier_id = suppliers.supplier_id WHERE suppliers.country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_divide (region VARCHAR(255), internet_speed FLOAT, updated_on DATE); | Delete records in digital_divide table where internet_speed is slower than 10 Mbps | DELETE FROM digital_divide WHERE internet_speed < 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists(id INT PRIMARY KEY, name VARCHAR(255), genre VARCHAR(255)); | get artists and their genres from the artists table | SELECT name, genre FROM artists; | gretelai_synthetic_text_to_sql |
CREATE TABLE coaches (id INT, name TEXT, sport TEXT, team_id INT, salary INT); CREATE TABLE teams (id INT, name TEXT, sport TEXT, league TEXT, conference TEXT); | What are the names and salaries of all coaches who have ever coached a team in the given league? | SELECT c.name, c.salary FROM coaches c INNER JOIN teams t ON c.team_id = t.id WHERE t.league = 'NFL'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (id INT, name VARCHAR(50), HQ VARCHAR(50), founding_date DATE); INSERT INTO Company (id, name, HQ, founding_date) VALUES (9, 'TechPioneer Pte Ltd', 'Singapore', '2018-11-15'); | How many companies have been founded in Singapore since 2018? | SELECT COUNT(*) as company_count FROM Company WHERE YEAR(founding_date) >= 2018 AND HQ = 'Singapore'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, student_name VARCHAR(255), mental_health_score INT, mental_health_year INT); INSERT INTO students VALUES (1, 'Alex Lee', 85, 2021), (2, 'Yasmine Khalil', 90, 2021), (3, 'James Chen', 75, 2021), (4, 'Sophia Kim', 80, 2020); | What is the average mental health score for students in 2021? | SELECT AVG(s.mental_health_score) as average_mental_health_score FROM students s WHERE s.mental_health_year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, state TEXT);CREATE TABLE treatments (id INT, patient_id INT, therapy TEXT); | Insert a new record for a patient from Florida who received medication management treatment. | INSERT INTO patients (id, name, state) VALUES (1, 'James Johnson', 'Florida');INSERT INTO treatments (id, patient_id, therapy) VALUES (1, 1, 'Medication Management'); | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation (id INT, project_name VARCHAR(50), project_type VARCHAR(50), country VARCHAR(50), cost DECIMAL(10,2)); INSERT INTO agricultural_innovation VALUES (1, 'Solar Irrigation System', 'Agricultural Innovation', 'Kenya', 25000.00), (2, 'Modern Greenhouse', 'Agricultural Innovation', 'Tanzan... | Find the number of unique agricultural innovation projects implemented in each country, sorted by the number of projects in descending order. | SELECT country, COUNT(DISTINCT project_name) AS projects_count FROM agricultural_innovation GROUP BY country ORDER BY projects_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_projects (id INT, project_name VARCHAR(100), state VARCHAR(50), project_type VARCHAR(50), installed_capacity INT); INSERT INTO wind_projects (id, project_name, state, project_type, installed_capacity) VALUES (1, 'Wind Project A', 'California', 'Onshore', 50000), (2, 'Wind Project B', 'California', 'Of... | What is the total installed capacity of wind energy projects in the state of California, grouped by project type? | SELECT project_type, SUM(installed_capacity) FROM wind_projects WHERE state = 'California' GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(10), Department VARCHAR(20)); INSERT INTO Employees (EmployeeID, Gender, Department) VALUES (1, 'Female', 'IT'), (2, 'Male', 'IT'), (3, 'Non-binary', 'HR'), (4, 'Male', 'Finance'), (5, 'Non-binary', 'IT'), (6, 'Genderqueer', 'IT'), (7, 'Female', 'Engineering'), (8,... | List all departments and the number of employees in each department, sorted by the number of employees in descending order. | SELECT Department, COUNT(*) AS EmployeeCount FROM Employees GROUP BY Department ORDER BY EmployeeCount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, industry VARCHAR(20), incident_date DATE); INSERT INTO incidents (id, industry, incident_date) VALUES (1, 'construction', '2022-01-01'), (2, 'construction', '2022-02-15'), (3, 'retail', '2022-03-01'); | Determine the number of workplace safety incidents in the 'construction' industry for the last 3 months | SELECT COUNT(*) FROM incidents WHERE industry = 'construction' AND incident_date >= (CURRENT_DATE - INTERVAL '3 months'); | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_stations (station_id INT, name VARCHAR(50), location VARCHAR(50)); | Remove the weather station record with ID WS009 | DELETE FROM weather_stations WHERE station_id = 9; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (id INT, title VARCHAR(255), artist_name VARCHAR(255), genre VARCHAR(255), streams INT); INSERT INTO songs (id, title, artist_name, genre, streams) VALUES (1, 'Shake it Off', 'Taylor Swift', 'Pop', 10000000), (2, 'Dynamite', 'BTS', 'Pop', 15000000), (3, 'Rolling in the Deep', 'Adele', 'Soul', 1200000... | Calculate the total number of streams for each artist in the songs table. | SELECT artist_name, SUM(streams) as total_streams FROM songs GROUP BY artist_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), Country varchar(50), FirstDonationDate date); INSERT INTO Donors VALUES (1, 'John Smith', 'Canada', '2021-11-01'); CREATE TABLE Donations (DonationID int, DonorID int, ProgramID int, DonationAmount decimal(10,2), DonationDate date); INSERT INTO Donations VALUES (... | What was the average donation amount for first-time donors in Q4 2021? | SELECT AVG(DonationAmount) FROM Donations D JOIN Donors DON ON D.DonorID = DON.DonorID WHERE D.DonationDate BETWEEN '2021-10-01' AND '2021-12-31' AND NOT EXISTS (SELECT 1 FROM Donations D2 WHERE D2.DonorID = D.DonorID AND D2.DonationDate < D.DonationDate) | gretelai_synthetic_text_to_sql |
CREATE TABLE Building_Permits (id INT, region VARCHAR(20), permit_number VARCHAR(20), project VARCHAR(30), is_sustainable BOOLEAN); INSERT INTO Building_Permits (id, region, permit_number, project, is_sustainable) VALUES (1, 'North', 'GP001', 'Green Tower', true), (2, 'West', 'GP002', 'Solar Park', false), (3, 'East', ... | What is the total number of permits issued for sustainable projects? | SELECT COUNT(*) FROM Building_Permits WHERE is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerDonors (VolunteerDonorID int, DonorID int, VolunteerID int, OrganizationID int); INSERT INTO VolunteerDonors (VolunteerDonorID, DonorID, VolunteerID, OrganizationID) VALUES (1, 1, 1, 1), (2, 2, 2, 1), (3, 3, 3, 2); | What is the percentage of donors who also volunteered for the same organization? | SELECT OrganizationID, COUNT(DISTINCT DonorID) * 100.0 / COUNT(DISTINCT VolunteerID) FROM VolunteerDonors GROUP BY OrganizationID; | gretelai_synthetic_text_to_sql |
CREATE TABLE dysprosium_production (country VARCHAR(255), production_volume FLOAT); | Provide the average Dysprosium production volume for Australia and China. | SELECT AVG(production_volume) FROM dysprosium_production WHERE country IN ('Australia', 'China'); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment_sales (country TEXT, sale_date DATE); INSERT INTO military_equipment_sales (country, sale_date) VALUES ('Canada', '2021-01-15'), ('Australia', '2022-01-03'), ('Germany', '2021-12-21'), ('France', '2022-02-09'), ('Mexico', '2022-03-17'), ('Brazil', '2022-01-28'), ('South Korea', '2022-02-... | Identify the total number of countries with military equipment purchases from France in the last 21 months | SELECT COUNT(DISTINCT country) as unique_countries FROM military_equipment_sales WHERE country = 'France' AND sale_date >= (SELECT CURRENT_DATE - INTERVAL '21 months'); | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (name VARCHAR(255), city VARCHAR(255), type VARCHAR(255), num_students INT); INSERT INTO schools (name, city, type, num_students) VALUES ('PS 1', 'New York City', 'Public', 500), ('PS 2', 'New York City', 'Public', 600); | What is the total number of public schools in New York City, and what are their names? | SELECT SUM(num_students) FROM schools WHERE city = 'New York City' AND type = 'Public'; SELECT name FROM schools WHERE city = 'New York City' AND type = 'Public'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Streaming (song VARCHAR(50), genre VARCHAR(20), streams INT); INSERT INTO Streaming (song, genre, streams) VALUES ('Heat Waves', 'Indie Rock', 500), ('Drivers License', 'Pop', 700), ('Good 4 U', 'Pop', 600); | What was the total number of streams for a specific genre in the music streaming data? | SELECT SUM(streams) FROM Streaming WHERE genre = 'Pop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_change_communication (country VARCHAR(50), year INT, campaigns INT); INSERT INTO climate_change_communication (country, year, campaigns) VALUES ('Brazil', 2016, 50), ('Brazil', 2017, 60), ('Brazil', 2018, 70), ('Brazil', 2019, 80), ('Brazil', 2020, 90), ('Argentina', 2016, 40), ('Argentina', 2017, ... | List the number of climate change communication campaigns in South America by year. | SELECT year, SUM(campaigns) FROM climate_change_communication WHERE country IN ('Brazil', 'Argentina') GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE south_asia_projects (project_id INT, project_name TEXT, location TEXT, project_type TEXT, start_date DATE, end_date DATE); | What is the average number of climate mitigation projects per year in South Asia from 2010 to 2020? | SELECT AVG(projects_per_year) FROM (SELECT YEAR(start_date) AS project_year, COUNT(project_id) AS projects_per_year FROM south_asia_projects WHERE location LIKE '%South Asia%' AND project_type = 'climate_mitigation' AND start_date BETWEEN '2010-01-01' AND '2020-12-31' GROUP BY YEAR(start_date)) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE art_exhibit_funding (id INT, funding_amount INT, event_date DATE); INSERT INTO art_exhibit_funding (id, funding_amount, event_date) VALUES (1, 10000, '2020-01-01'), (2, 15000, '2021-01-01'), (3, 12000, '2020-01-02'), (4, 13000, '2021-01-02'); | What is the total funding_amount for art_exhibit events in 2020 and 2021? | SELECT SUM(funding_amount) FROM art_exhibit_funding WHERE YEAR(event_date) IN (2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE states (id INT, name VARCHAR(255)); INSERT INTO states (id, name) VALUES (1, 'Illinois'); CREATE TABLE schools (id INT, state_id INT, name VARCHAR(255), after_school_program BOOLEAN); INSERT INTO schools (id, state_id, name, after_school_program) VALUES (1, 1, 'Chicago Public School', true), (2, 1, 'Spring... | What is the number of schools in Illinois, and how many of them offer after-school programs? | SELECT COUNT(schools.id) AS total_schools, SUM(schools.after_school_program) AS schools_with_after_school_programs FROM schools WHERE state_id = (SELECT id FROM states WHERE name = 'Illinois'); | gretelai_synthetic_text_to_sql |
CREATE TABLE urban_agriculture_projects (id INT, name VARCHAR(255), water_efficiency_rating INT); | Which urban agriculture projects have the highest water efficiency ratings? | SELECT name, water_efficiency_rating FROM urban_agriculture_projects ORDER BY water_efficiency_rating DESC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE oil_production (id INT, field VARCHAR(50), country VARCHAR(50), production_year INT, production_number FLOAT); INSERT INTO oil_production (id, field, country, production_year, production_number) VALUES (1, 'Orinoco', 'Venezuela', 2016, 9000000); INSERT INTO oil_production (id, field, country, production_ye... | Update the record in the 'oil_production' table where the country is 'Venezuela' and the production_year is 2016, setting the 'production_number' to 8000000 | UPDATE oil_production SET production_number = 8000000 WHERE country = 'Venezuela' AND production_year = 2016; | gretelai_synthetic_text_to_sql |
CREATE TABLE audience_demographics (article_id INT, category VARCHAR(30), word_count INT, age INT, gender VARCHAR(10)); INSERT INTO audience_demographics (article_id, category, word_count, age, gender) VALUES (1, 'Politics', 500, 30, 'Male'), (2, 'Sports', 700, 25, 'Female'); | What is the average word count for articles in specific categories in the 'audience_demographics' table? | SELECT category, AVG(word_count) AS avg_word_count FROM audience_demographics GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccine_records (patient_id INT, vaccine_name VARCHAR(20), age INT, state VARCHAR(20)); INSERT INTO vaccine_records VALUES (1, 'Johnson', 35, 'Illinois'), (2, 'Johnson', 42, 'Illinois'), (3, 'Johnson', 50, 'Illinois'); INSERT INTO vaccine_records VALUES (4, 'Johnson', 25, 'Illinois'), (5, 'Johnson', 30, 'I... | What is the average age of patients who received the Johnson vaccine in Illinois? | SELECT AVG(age) FROM vaccine_records WHERE vaccine_name = 'Johnson' AND state = 'Illinois'; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage_capacity (technology VARCHAR(50), year INT, energy_storage_capacity FLOAT); INSERT INTO energy_storage_capacity (technology, year, energy_storage_capacity) VALUES ('Lithium-ion Batteries', 2025, 3000.2), ('Flow Batteries', 2025, 4000.1), ('Flywheels', 2025, 2000.3), ('Pumped Hydro Storage', ... | Find the top 2 energy storage technologies with the highest energy storage capacity (in MWh) in 2025. | SELECT e.technology, e.energy_storage_capacity FROM energy_storage_capacity e WHERE e.year = 2025 ORDER BY e.energy_storage_capacity DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (id INT PRIMARY KEY, tech_name VARCHAR(100), category VARCHAR(50), department VARCHAR(50), acquisition_date DATE); INSERT INTO military_tech (id, tech_name, category, department, acquisition_date) VALUES (1, 'F-35', 'Fighter Jet', 'Air Force', '2015-12-31'), (2, 'MQ-9 Reaper', 'Drone', 'Air F... | What is the latest military technology acquisition date for 'Air Force' in the 'military_tech' table? | SELECT MAX(acquisition_date) FROM military_tech WHERE department = 'Air Force'; | gretelai_synthetic_text_to_sql |
CREATE TABLE violations (id INT, union_id INT, region TEXT, date DATE, violation_count INT); INSERT INTO violations (id, union_id, region, date, violation_count) VALUES (1, 1, 'Asia-Pacific', '2021-01-01', 5), (2, 2, 'Asia-Pacific', '2021-02-15', 3); | How many labor rights violations were reported in the Asia-Pacific region in the last 12 months? | SELECT SUM(violation_count) FROM violations WHERE region = 'Asia-Pacific' AND date >= DATEADD(year, -1, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE reo_production (id INT PRIMARY KEY, reo_type VARCHAR(50), production_quantity INT, production_year INT); | Insert new record with ID 25, REO type Europium Oxide, production quantity 150, and production year 2022 into the reo_production table | INSERT INTO reo_production (id, reo_type, production_quantity, production_year) VALUES (25, 'Europium Oxide', 150, 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_applications (app_id INT, name VARCHAR(255), tx_count INT); | Find the total number of transactions for a specific decentralized application? | SELECT SUM(tx_count) FROM decentralized_applications WHERE name = 'Uniswap'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WAPO_Investigative(id INT, name VARCHAR(20), age INT, awards VARCHAR(50));CREATE TABLE MH_Investigative(id INT, name VARCHAR(20), age INT, awards VARCHAR(50)); | Which investigative journalists in 'Washington Post' and 'Miami Herald' have won a Pulitzer Prize and what are their ages? | SELECT wapo.age FROM WAPO_Investigative wapo JOIN MH_Investigative mh ON wapo.name = mh.name WHERE wapo.awards LIKE '%Pulitzer%' AND mh.awards LIKE '%Pulitzer%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchExpedition ( id INT PRIMARY KEY, expedition_name VARCHAR(100), location VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO ResearchExpedition (id, expedition_name, location, start_date, end_date) VALUES (11, 'DeepSea Explorer', 'Pacific Ocean', '2020-12-01', '2020-12-15'); INSERT INTO Resea... | What is the total number of expeditions that have taken place in the Pacific Ocean? | SELECT COUNT(*) FROM ResearchExpedition WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists oil_production (id INT PRIMARY KEY, well_id INT, year INT, production REAL); INSERT INTO oil_production (id, well_id, year, production) VALUES (1, 1, 2019, 1000), (2, 2, 2019, 2000), (3, 3, 2018, 1500), (4, 1, 2020, 1200); CREATE TABLE if not exists oil_wells (id INT PRIMARY KEY, well_name TE... | What are the production figures for oil wells in the 'South Atlantic' and 'Barents Sea'? | SELECT oil_wells.region, oil_production.year, oil_production.production FROM oil_production JOIN oil_wells ON oil_production.well_id = oil_wells.id WHERE oil_wells.region IN ('South Atlantic', 'Barents Sea'); | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_papers (author_id INT, author_name VARCHAR(255), paper_title VARCHAR(255)); INSERT INTO creative_ai_papers (author_id, author_name, paper_title) VALUES ('1', 'Bob Brown', 'Creative AI: A Survey'); | Who are the authors who have published more than 10 papers in creative AI applications? | SELECT author_name, COUNT(*) as num_papers FROM creative_ai_papers GROUP BY author_name HAVING num_papers > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE volleyball_teams (team_id INT, team_name VARCHAR(50));CREATE TABLE volleyball_matches (match_id INT, home_team_id INT, away_team_id INT, tournament_type VARCHAR(50), time_in_minutes INT); | Find the average time_in_minutes for matches with a tournament_type of 'indoor' in volleyball_games. | SELECT AVG(time_in_minutes) AS avg_time_in_minutes FROM volleyball_matches WHERE tournament_type = 'indoor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, name VARCHAR, site_id INT); INSERT INTO events (id, name, site_id) VALUES (1, 'Event A', 1), (2, 'Event B', 2); CREATE TABLE heritage_sites (id INT, name VARCHAR, location VARCHAR); INSERT INTO heritage_sites (id, name, location) VALUES (1, 'Heritage Site A', 'City A'), (2, 'Heritage Site B... | What is the name and location of all heritage sites with no community engagement events? | SELECT heritage_sites.name, heritage_sites.location FROM heritage_sites LEFT JOIN events ON heritage_sites.id = events.site_id WHERE events.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE brands (brand_id INT, brand_name TEXT, country TEXT); INSERT INTO brands (brand_id, brand_name, country) VALUES (1, 'EcoBrand', 'USA'), (2, 'GreenFashion', 'France'), (5, 'USAEthicalFashion', 'USA'); CREATE TABLE material_usage (brand_id INT, material_type TEXT, quantity INT, co2_emissions INT); INSERT INT... | What is the maximum CO2 emissions per unit of sustainable material for brands operating in the United States? | SELECT MAX(mu.co2_emissions / mu.quantity) AS max_co2_emissions FROM brands b JOIN material_usage mu ON b.brand_id = mu.brand_id WHERE b.country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(50), production_volume FLOAT, location VARCHAR(50)); INSERT INTO wells VALUES (1, 'Well A', 1000, 'North Sea'); INSERT INTO wells VALUES (2, 'Well B', 1500, 'Alaska North Slope'); INSERT INTO wells VALUES (3, 'Well C', 1200, 'North Sea'); | List the production figures for all wells in the North Sea | SELECT well_name, production_volume FROM wells WHERE location = 'North Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (project_id INT, project_name VARCHAR(255), location VARCHAR(255), start_date DATE, end_date DATE); | List all climate communication projects in 'Africa' from the year 2000. | SELECT * FROM climate_communication WHERE location = 'Africa' AND start_date >= '2000-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), products VARCHAR(255)); CREATE TABLE chemical_inventory (id INT PRIMARY KEY, chemical_name VARCHAR(255), quantity INT, supplier_id INT, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); CREATE TABLE safety_protocols (id INT PRIMARY... | Display suppliers, their products, and the environmental impact of those products, sorted by the impact score. | SELECT suppliers.name, suppliers.products, environmental_impact.impact FROM suppliers INNER JOIN chemical_inventory ON suppliers.id = chemical_inventory.supplier_id INNER JOIN environmental_impact ON chemical_inventory.chemical_name = environmental_impact.chemical_name ORDER BY environmental_impact.impact DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (dish_name TEXT, cost FLOAT, category TEXT); INSERT INTO inventory (dish_name, cost, category) VALUES ('Spicy Quinoa', 7.50, 'Vegan'), ('Tofu Stir Fry', 8.99, 'Vegan'), ('Chickpea Curry', 9.49, 'Vegan'), ('Spicy Beef Burrito', 9.99, 'Non-Veg'), ('Chicken Alfredo', 8.50, 'Non-Veg'), ('Spicy Fish a... | What is the average inventory cost for dishes in the 'Vegan' category? | SELECT category, AVG(cost) FROM inventory WHERE category = 'Vegan' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_access_2(strategy_name TEXT, quarter INT, year INT); INSERT INTO market_access_2(strategy_name, quarter, year) VALUES('Strategy1', 1, 2018), ('Strategy2', 2, 2018), ('Strategy3', 3, 2018), ('Strategy4', 4, 2018), ('Strategy5', 1, 2019), ('Strategy6', 2, 2019), ('Strategy7', 3, 2019), ('Strategy8', 4... | How many market access strategies were implemented in each quarter of 2018? | SELECT quarter, COUNT(*) FROM market_access_2 WHERE year = 2018 GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT PRIMARY KEY, title VARCHAR(255), artist VARCHAR(255), year INT); CREATE VIEW gogh_artworks AS SELECT * FROM artworks WHERE artist = 'Vincent van Gogh'; | List all artworks by 'Vincent van Gogh' | SELECT * FROM gogh_artworks; | gretelai_synthetic_text_to_sql |
CREATE TABLE representatives (id INT PRIMARY KEY, name VARCHAR(255), district INT, title VARCHAR(255)); | Insert a new representative into the 'representatives' table | INSERT INTO representatives (id, name, district, title) VALUES (1, 'John Doe', 1, 'Councilor'), (2, 'Jane Doe', 2, 'Councilor'); | 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.