context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE astrophysics_research (research_id INT, location VARCHAR(50), distance FLOAT); INSERT INTO astrophysics_research (research_id, location, distance) VALUES (1, 'Mars', 50.3), (2, 'Venus', 10.2), (3, 'Mars', 40.1), (4, 'Jupiter', 70.5), (5, 'Mars', 60.0); | What is the average distance traveled by astrophysics research on Mars? | SELECT AVG(distance) FROM astrophysics_research WHERE location = 'Mars'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, Name TEXT, Budget FLOAT); INSERT INTO Programs (ProgramID, Name, Budget) VALUES (1, 'Education', 15000.00), (2, 'Health', 20000.00); | List the programs and their respective budgets for 2022. | SELECT Name, Budget FROM Programs WHERE YEAR(StartDate) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Makeup_Sustainability(Product VARCHAR(30), Rating DECIMAL(3,2), Package_Recyclable BOOLEAN); INSERT INTO Makeup_Sustainability(Product, Rating, Package_Recyclable) VALUES('Lipstick A', 3.2, true), ('Mascara B', 4.1, true), ('Eyeshadow C', 2.9, true), ('Blush D', 3.8, false), ('Eyeliner E', 4.5, false), ('F... | Identify the lowest-rated sustainable makeup products with a recyclable package? | SELECT Product, Rating FROM Makeup_Sustainability WHERE Package_Recyclable = true ORDER BY Rating ASC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (ProjectID INT, Type VARCHAR(50), Country VARCHAR(50), Year INT, CompletionStatus VARCHAR(50)); | What is the number of public transportation projects, categorized by type, that were completed in Latin American countries since 2000? | SELECT Projects.Type, COUNT(*) AS ProjectCount FROM Projects WHERE Projects.Country IN ('Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'CostaRica', 'Cuba', 'DominicanRepublic', 'Ecuador', 'ElSalvador', 'Guatemala', 'Guyana', 'Haiti', 'Honduras', 'Mexico', 'Nicaragua', 'Panama', 'Paraguay', 'Peru', 'Suriname', '... | gretelai_synthetic_text_to_sql |
CREATE TABLE city_budget (city VARCHAR(20), department VARCHAR(20), budget INT); INSERT INTO city_budget (city, department, budget) VALUES ('Houston', 'Police', 7000000); | What is the total budget allocated for public safety in the city of Houston, including all departments, for the fiscal year 2024? | SELECT SUM(budget) FROM city_budget WHERE city = 'Houston' AND department LIKE '%Safety%' AND fiscal_year = 2024; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA forestry; CREATE TABLE trees (id INT, species VARCHAR(50), carbon FLOAT); INSERT INTO trees (id, species, carbon) VALUES (1, 'oak', 4.2), (2, 'pine', 3.8), (3, 'eucalyptus', 5.0), (4, 'oak', 4.5), (5, 'maple', 3.5); | find total carbon sequestration by tree species | SELECT species, SUM(carbon) FROM forestry.trees GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_tours_nz_sa (id INT, country VARCHAR(20), tours INT); INSERT INTO eco_tours_nz_sa (id, country, tours) VALUES (1, 'New Zealand', 120), (2, 'New Zealand', 130), (3, 'South Africa', 140); | What is the total number of eco-friendly tours in New Zealand and South Africa? | SELECT SUM(tours) FROM eco_tours_nz_sa WHERE country IN ('New Zealand', 'South Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales (id INT, region VARCHAR(255), year INT, total_sales DECIMAL(10,2)); INSERT INTO military_sales (id, region, year, total_sales) VALUES (1, 'Asia-Pacific', 2020, 500000.00), (2, 'Europe', 2020, 600000.00); | What is the total number of military equipment sales in the Asia-Pacific region for the year 2020? | SELECT SUM(total_sales) FROM military_sales WHERE region = 'Asia-Pacific' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE projects (id INT, country VARCHAR(50), sector VARCHAR(50), investment FLOAT); INSERT INTO projects (id, country, sector, investment) VALUES (1, 'US', 'Renewable Energy', 5000000); | What is the total investment in renewable energy projects in the US? | SELECT SUM(investment) FROM projects WHERE country = 'US' AND sector = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryAircraft (MilitaryAircraftID INT, AircraftName VARCHAR(50), ManufacturerID INT, Type VARCHAR(50)); | What are the names of the military aircraft manufactured by companies located in France? | SELECT AircraftName FROM MilitaryAircraft JOIN AircraftManufacturers ON MilitaryAircraft.ManufacturerID = AircraftManufacturers.ID WHERE Type = 'Military' AND Country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE edibles_sales (product VARCHAR(20), city VARCHAR(20), state VARCHAR(20), total_sales INT); INSERT INTO edibles_sales (product, city, state, total_sales) VALUES ('Gummies', 'Seattle', 'Washington', 600); INSERT INTO edibles_sales (product, city, state, total_sales) VALUES ('Chocolates', 'Seattle', 'Washingt... | List the top 3 cities with the highest total sales of edibles in Washington state. | SELECT city, SUM(total_sales) AS total_sales FROM edibles_sales WHERE state = 'Washington' AND product IN ('Gummies', 'Chocolates', 'Brownies', 'Cookies', 'Capsules') GROUP BY city ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, gender VARCHAR(50)); INSERT INTO artists (id, gender) VALUES (1, 'Female'), (2, 'Male'), (3, 'Non-binary'), (4, 'Female'); | What is the percentage of female-identifying artists in our organization? | SELECT (COUNT(*) FILTER (WHERE gender = 'Female')) * 100.0 / COUNT(*) FROM artists; | gretelai_synthetic_text_to_sql |
CREATE TABLE room_revenue (hotel_id INT, revenue_per_night INT, night DATE); INSERT INTO room_revenue (hotel_id, revenue_per_night, night) VALUES (4, 250, '2022-02-01'), (4, 300, '2022-02-02'), (4, 200, '2022-02-03'); CREATE TABLE hotels (hotel_id INT, name VARCHAR(50)); INSERT INTO hotels (hotel_id, name) VALUES (4, '... | What is the average room revenue per night for 'Hotel Carlton'? | SELECT AVG(revenue_per_night) FROM room_revenue JOIN hotels ON room_revenue.hotel_id = hotels.hotel_id WHERE hotels.name = 'Hotel Carlton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftManufacturing (id INT, year INT, cost FLOAT); | What is the distribution of spacecraft manufacturing costs by year? | SELECT year, AVG(cost) as avg_cost, STDDEV(cost) as stddev_cost FROM SpacecraftManufacturing GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE member_age_data(id INT, age INT, last_workout_date DATE); INSERT INTO member_age_data(id, age, last_workout_date) VALUES (1,30,'2022-01-14'),(2,40,'2022-02-15'),(3,25,'2022-02-16'),(4,50,'2022-02-17'),(5,35,'2022-02-18'),(6,45,'2022-02-19'),(7,28,'2022-02-20'),(8,55,'2022-02-21'),(9,32,'2022-02-22'),(10,22... | What is the maximum distance covered by each member in the past week, grouped by age? | SELECT age, MAX(distance) FROM (SELECT member_id, age, distance FROM member_age_data JOIN workout_distance ON member_age_data.id = workout_distance.member_id WHERE workout_distance.workout_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) GROUP BY member_id, age) subquery GROUP BY age; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset (country TEXT, program TEXT); INSERT INTO carbon_offset (country, program) VALUES ('United States', 'Program A'), ('United States', 'Program B'), ('Canada', 'Program C'), ('Canada', 'Program D'); | List all carbon offset programs in the United States and Canada | SELECT program FROM carbon_offset WHERE country IN ('United States', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE CornYield (country TEXT, year INTEGER, corn_yield INTEGER); INSERT INTO CornYield (country, year, corn_yield) VALUES ('Mexico', 2019, 80), ('Mexico', 2021, 95), ('Brazil', 2019, 120), ('Brazil', 2021, 145), ('India', 2019, 100), ('India', 2021, 130); | List the top 3 countries with the highest increase in corn yield between 2019 and 2021? | SELECT country, (LAG(corn_yield, 1, 0) OVER (PARTITION BY country ORDER BY year) - corn_yield) AS yield_difference FROM CornYield WHERE year = 2021 ORDER BY yield_difference DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, name TEXT, country TEXT, review_count INT); INSERT INTO virtual_tours VALUES (1, 'Virtual Tokyo Tour', 'Japan', 1200), (2, 'Japanese Garden Tour', 'Japan', 800); | List the virtual tours in Japan with more than 1000 reviews. | SELECT name, review_count FROM virtual_tours WHERE country = 'Japan' AND review_count > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers(id INT, name TEXT, location TEXT);CREATE TABLE products(id INT, supplier_id INT, product_name TEXT, delivery_date DATE);INSERT INTO suppliers(id, name, location) VALUES (1, 'Supplier C', 'City C'), (2, 'Supplier D', 'City D'), (3, 'Supplier E', 'City E'); INSERT INTO products(id, supplier_id, pro... | Find suppliers who have not delivered products in the last 6 months. | SELECT s.* FROM suppliers s LEFT JOIN products p ON s.id = p.supplier_id WHERE p.delivery_date < DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR p.delivery_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (id INT PRIMARY KEY, name VARCHAR(20), year INT, funding_source VARCHAR(30)); INSERT INTO Events (id, name, year, funding_source) VALUES (1, 'Music in the Park', 2020, 'Government Grant'); INSERT INTO Events (id, name, year, funding_source) VALUES (2, 'Art Exhibition', 2019, 'Private Donation'); | Which funding sources supported the Music in the Park events in 2020? | SELECT funding_source FROM Events WHERE name = 'Music in the Park' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiabetesScreening (ID INT, Test INT, Location VARCHAR(50), Year INT); INSERT INTO DiabetesScreening (ID, Test, Location, Year) VALUES (1, 500, 'Mumbai', 2019); INSERT INTO DiabetesScreening (ID, Test, Location, Year) VALUES (2, 300, 'Mumbai', 2019); | How many diabetes screening tests were conducted in Mumbai, India in 2019? | SELECT SUM(Test) FROM DiabetesScreening WHERE Location = 'Mumbai' AND Year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_stats (country VARCHAR(50), visitors INT, year INT, quarter INT); INSERT INTO tourism_stats (country, visitors, year, quarter) VALUES ('Spain', 15, 2020, 1), ('Germany', 18, 2020, 1), ('Spain', 16, 2021, 1), ('Germany', 19, 2021, 1); | What is the average number of international tourists in the first quarter of each year? | SELECT AVG(visitors) as avg_visitors FROM tourism_stats WHERE quarter = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameLibrary (GameID INT, PlayerID INT); INSERT INTO GameLibrary (GameID, PlayerID) VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 1), (2, 2), (2, 6), (2, 7), (2, 8), (3, 2), (3, 3), (3, 4), (3, 8), (3, 9), (4, 1), (4, 5), (4, 6), (4, 9), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (5, 7), (5, 8), (... | List the names of games that are played by more than 5000 players and their respective number of players. | SELECT GameDesign.GameTitle, COUNT(GameLibrary.PlayerID) AS Players FROM GameLibrary INNER JOIN GameDesign ON GameLibrary.GameID = GameDesign.GameID GROUP BY GameLibrary.GameID HAVING Players > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (investment_id INT, investment_amount FLOAT, region VARCHAR(20), investment_date DATE); | What is the year-over-year growth in network infrastructure investment for the region of Quebec, Canada? | SELECT (SUM(CASE WHEN YEAR(investment_date) = YEAR(CURRENT_DATE) - 1 THEN investment_amount ELSE 0 END) - SUM(CASE WHEN YEAR(investment_date) = YEAR(CURRENT_DATE) - 2 THEN investment_amount ELSE 0 END)) * 100.0 / SUM(CASE WHEN YEAR(investment_date) = YEAR(CURRENT_DATE) - 2 THEN investment_amount ELSE 0 END) as yoy_grow... | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers_market (id INT, type VARCHAR(10), name VARCHAR(20), price DECIMAL(5,2), is_in_season BOOLEAN); | What is the average price of vegetables in the 'farmers_market' table that are in season? | SELECT AVG(price) FROM farmers_market WHERE type = 'vegetable' AND is_in_season = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (article_id INT, author_id INT, title VARCHAR(100), pub_date DATE, article_type VARCHAR(50)); CREATE TABLE regions (region_id INT, region_name VARCHAR(50)); | Find the total number of investigative articles published in 'articles' table, grouped by the region in 'regions' table. | SELECT regions.region_name, COUNT(articles.article_id) FROM articles INNER JOIN regions ON articles.region_id = regions.region_id WHERE articles.article_type = 'Investigative' GROUP BY regions.region_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE ota_bookings_3 (booking_id INT, ota_name TEXT, region TEXT, booking_amount DECIMAL(10,2)); INSERT INTO ota_bookings_3 (booking_id, ota_name, region, booking_amount) VALUES (1, 'Booking.com', 'APAC', 200.50), (2, 'Expedia', 'APAC', 150.25), (3, 'Agoda', 'APAC', 300.00), (4, 'Expedia', 'APAC', 50.00); | What is the minimum revenue per OTA booking in the APAC region in 2021? | SELECT MIN(booking_amount) FROM ota_bookings_3 WHERE region = 'APAC' AND YEAR(booking_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50), city VARCHAR(50));CREATE TABLE games (game_id INT, team_id INT, city VARCHAR(50), attendees INT); INSERT INTO teams (team_id, team_name, city) VALUES (1, 'Atlanta Hawks', 'Atlanta'), (2, 'Boston Celtics', 'Boston'); INSERT INTO games (game_id, team_id, city, atten... | How many fans attended the games in each city? | SELECT city, SUM(attendees) FROM games GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE DispensarySales (dispensary_id INT, strain_type TEXT, quantity_sold INT, sale_date DATE); | What is the total quantity of sativa strains sold in the month of June 2021 across all dispensaries? | SELECT SUM(quantity_sold) FROM DispensarySales WHERE strain_type = 'sativa' AND sale_date >= '2021-06-01' AND sale_date <= '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors(DonorID INT, DonorName VARCHAR(100), DonationType VARCHAR(50), DonationValue DECIMAL(10,2), Region VARCHAR(50)); CREATE TABLE ArtPieces(ArtPieceID INT, ArtPieceName VARCHAR(100), DonorID INT); | List all traditional art pieces in the Middle East that have been donated by individuals, along with their donation value and donor information. | SELECT Donors.DonorName, ArtPieces.ArtPieceName, Donors.DonationValue FROM Donors INNER JOIN ArtPieces ON Donors.DonorID = ArtPieces.DonorID WHERE Donors.DonationType = 'Individual' AND Donors.Region = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_applications (id INT, name VARCHAR(255), country VARCHAR(255), regulatory_status VARCHAR(255)); INSERT INTO decentralized_applications (id, name, country, regulatory_status) VALUES (1, 'App 1', 'USA', 'Approved'), (2, 'App 2', 'USA', 'Under Review'), (3, 'App 3', 'Canada', 'Approved'); | What's the regulatory status of decentralized applications in the USA? | SELECT regulatory_status FROM decentralized_applications WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investment_id INT, investor_name VARCHAR(255), investment_amount INT, investment_year INT, sector VARCHAR(255), country VARCHAR(255)); INSERT INTO investments (investment_id, investor_name, investment_amount, investment_year, sector, country) VALUES (1, 'Green Impact Fund', 100000, 2022, 'Rene... | What is the total investment in renewable energy by country in 2022? | SELECT country, SUM(investment_amount) as total_investment FROM investments WHERE investment_year = 2022 AND sector = 'Renewable Energy' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, VRUser CHAR(1)); INSERT INTO Players (PlayerID, Age, VRUser) VALUES (1, 25, 'Y'), (2, 30, 'N'), (3, 22, 'Y'), (4, 35, 'N'); CREATE TABLE GameLibrary (GameID INT, PlayerID INT); INSERT INTO GameLibrary (GameID, PlayerID) VALUES (1, 1), (2, 1), (3, 2), (4, 3), (5, 3), (1, 4); ... | What is the average age of players who use VR technology, and how many distinct game titles do they play? | SELECT AVG(Players.Age), COUNT(DISTINCT GameDesign.Title) FROM Players INNER JOIN GameLibrary ON Players.PlayerID = GameLibrary.PlayerID INNER JOIN GameDesign ON GameLibrary.GameID = GameDesign.GameID INNER JOIN VRGame ON GameDesign.GameID = VRGame.GameID WHERE Players.VRUser = 'Y'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation_projects ( id INT, name VARCHAR(255), location VARCHAR(255), funding FLOAT ); INSERT INTO climate_mitigation_projects (id, name, location, funding) VALUES (1, 'Project F', 'South America', 8000000); INSERT INTO climate_mitigation_projects (id, name, location, funding) VALUES (2, 'Project... | Which climate mitigation projects have the same funding amount as the project with the highest funding in South America? | SELECT * FROM climate_mitigation_projects WHERE funding = (SELECT MAX(funding) FROM climate_mitigation_projects WHERE location = 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (id INT, name VARCHAR(255), factories INT); INSERT INTO Country (id, name, factories) VALUES (1, 'USA', 50), (2, 'China', 80), (3, 'India', 30); | Identify the top 3 countries with the highest number of factories adhering to fair labor practices. | SELECT name, factories FROM Country ORDER BY factories DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_rooms (room_id INT, room_type VARCHAR(20), price DECIMAL(5,2), is_heritage BOOLEAN); INSERT INTO hotel_rooms (room_id, room_type, price, is_heritage) VALUES (1, 'Standard', 100, FALSE), (2, 'Deluxe', 150, FALSE), (3, 'Heritage Standard', 120, TRUE), (4, 'Heritage Deluxe', 180, TRUE); | What is the total revenue for heritage hotel rooms? | SELECT SUM(price) FROM hotel_rooms WHERE is_heritage = TRUE; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech;CREATE TABLE if not exists biotech.startups (id INT PRIMARY KEY, name VARCHAR(100), country VARCHAR(50), funding FLOAT);INSERT INTO biotech.startups (id, name, country, funding) VALUES (1, 'StartupA', 'Australia', 3000000.0), (2, 'StartupB', 'Australia', 1500000.0), (3, 'StartupC', '... | What is the average funding received by biotech startups in Australia? | SELECT AVG(funding) FROM biotech.startups WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (station_id INT, station_name VARCHAR(20)); CREATE TABLE entries (entry_id INT, station_id INT, entry_date DATE); CREATE TABLE exits (exit_id INT, station_id INT, exit_date DATE); | Which stations had more than 200 entries and exits in the last week, and the difference between entries and exits? | SELECT s.station_name, e.entry_date, e.entry_count, x.exit_count, e.entry_count - x.exit_count as difference FROM (SELECT station_id, COUNT(*) as entry_count FROM entries WHERE entry_date BETWEEN CURRENT_DATE - INTERVAL '7 days' AND CURRENT_DATE GROUP BY station_id HAVING COUNT(*) > 200) e JOIN (SELECT station_id, COUN... | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name varchar(255), acidification_station boolean); INSERT INTO marine_protected_areas (name, acidification_station) VALUES ('Galapagos Marine Reserve', true), ('Great Barrier Reef', false), ('Palau National Marine Sanctuary', true); | Which marine protected areas have ocean acidification monitoring stations? | SELECT name FROM marine_protected_areas WHERE acidification_station = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE aid_deliveries (delivery_id INT, organization VARCHAR(50), delivery_status VARCHAR(10)); INSERT INTO aid_deliveries (delivery_id, organization, delivery_status) VALUES (1, 'Org A', 'successful'), (2, 'Org B', 'failed'), (3, 'Org A', 'successful'), (4, 'Org C', 'successful'), (5, 'Org B', 'failed'), (6, 'Or... | What is the total number of successful and failed aid deliveries for each organization? | SELECT o.name, SUM(CASE WHEN ad.delivery_status = 'successful' THEN 1 ELSE 0 END) AS num_successful, SUM(CASE WHEN ad.delivery_status = 'failed' THEN 1 ELSE 0 END) AS num_failed FROM aid_deliveries ad JOIN organizations o ON ad.organization = o.name GROUP BY o.name | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (program_id INT, program_name VARCHAR(50), program_type VARCHAR(20)); CREATE TABLE attendee_demographics (attendee_id INT, age INT, program_id INT); CREATE TABLE funding (funding_id INT, program_id INT, funding_amount DECIMAL(10,2)); INSERT INTO programs (program_id, program_name, program_type) VA... | What is the average age of attendees for each program type, and what is the total funding received by each program type, grouped by program type? | SELECT program_type, AVG(ad.age) AS avg_age, SUM(f.funding_amount) AS total_funding FROM programs p INNER JOIN attendee_demographics ad ON p.program_id = ad.program_id INNER JOIN funding f ON p.program_id = f.program_id GROUP BY program_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (Id INT PRIMARY KEY, Name VARCHAR(100), Type VARCHAR(50), Year INT); INSERT INTO Vessels (Id, Name, Type, Year) VALUES (1, 'Manta Ray', 'Research Vessel', 2015), (2, 'Ocean Explorer', 'Exploration Vessel', 2018), (3, 'Marine Life', 'Conservation Vessel', 2012); | Find the number of vessels in the "Vessels" table | SELECT COUNT(*) FROM Vessels; | gretelai_synthetic_text_to_sql |
CREATE TABLE sector_incidents (id INT, incident_type VARCHAR(255), sector VARCHAR(255), incident_date DATE, affected_assets INT); INSERT INTO sector_incidents (id, incident_type, sector, incident_date, affected_assets) VALUES (1, 'Phishing', 'Technology', '2022-03-15', 25); | What are the most common types of cybersecurity incidents in the technology sector in the past month and their total number of occurrences? | SELECT incident_type, SUM(affected_assets) as total_occurrences FROM sector_incidents WHERE sector = 'Technology' AND incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY incident_type ORDER BY total_occurrences DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Archaeologists (ArchaeologistID INT, Name TEXT, Age INT, Country TEXT); INSERT INTO Archaeologists (ArchaeologistID, Name, Age, Country) VALUES (1, 'Ali', 35, 'Egypt'); INSERT INTO Archaeologists (ArchaeologistID, Name, Age, Country) VALUES (2, 'Jiang', 42, 'China'); INSERT INTO Archaeologists (Archaeologi... | What is the average age of archaeologists from Asian countries? | SELECT AVG(Age) AS AvgAge FROM Archaeologists WHERE Country IN ('China', 'India', 'Japan', 'Indonesia', 'Malaysia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (id INT, name VARCHAR(255), gender VARCHAR(10), agency VARCHAR(255), spacewalks INT); INSERT INTO Astronauts (id, name, gender, agency, spacewalks) VALUES (1, 'Anousheh Ansari', 'Female', 'Private', 0), (2, 'Peggy Whitson', 'Female', 'NASA', 10), (3, 'Robert Curbeam', 'Male', 'NASA', 7); | Who are the astronauts with the most spacewalks for each space agency? | SELECT agency, name, spacewalks, RANK() OVER (PARTITION BY agency ORDER BY spacewalks DESC) as spacewalk_rank FROM Astronauts WHERE spacewalks > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinic_vaccines (clinic_id INT, vaccine_name VARCHAR(255), state VARCHAR(255)); CREATE TABLE clinics (clinic_id INT, clinic_name VARCHAR(255)); INSERT INTO clinic_vaccines (clinic_id, vaccine_name, state) VALUES (1, 'Moderna', 'California'); INSERT INTO clinics (clinic_id, clinic_name) VALUES (1, 'Clinic A... | How many clinics in California offer the Moderna vaccine? | SELECT COUNT(*) FROM clinic_vaccines v INNER JOIN clinics c ON v.clinic_id = c.clinic_id WHERE v.vaccine_name = 'Moderna' AND v.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE launches (id INT, launch_status VARCHAR(50), launch_date DATE); | Count the number of unsuccessful spacecraft launches | SELECT COUNT(*) FROM launches WHERE launch_status = 'Unsuccessful'; | gretelai_synthetic_text_to_sql |
CREATE TABLE stores (store_id INT, store_name VARCHAR(255)); CREATE TABLE employees (employee_id INT, name VARCHAR(255), store_id INT, salary DECIMAL(5,2)); INSERT INTO stores (store_id, store_name) VALUES (1, 'Store A'), (2, 'Store B'), (3, 'Store C'); INSERT INTO employees (employee_id, name, store_id, salary) VALUES... | How many employees work in each store? | SELECT s.store_name, COUNT(e.employee_id) as employee_count FROM stores s JOIN employees e ON s.store_id = e.store_id GROUP BY s.store_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE grant (id INT, department VARCHAR(50), amount INT, grant_date DATE); INSERT INTO grant (id, department, amount, grant_date) VALUES (1, 'Physics', 50000, '2019-12-31'), (2, 'Physics', 75000, '2020-04-15'), (3, 'Mechanical Engineering', 60000, '2019-12-31'); | What is the total amount of research grants awarded to the Physics department in the years 2019 and 2020? | SELECT SUM(amount) FROM grant WHERE department = 'Physics' AND (YEAR(grant_date) = 2019 OR YEAR(grant_date) = 2020); | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (region VARCHAR(50), trial_status VARCHAR(50), year INT); INSERT INTO clinical_trials (region, trial_status, year) VALUES ('North America', 'Success', 2020), ('Europe', 'Success', 2020), ('Asia', 'Failed', 2020), ('South America', 'Success', 2020), ('Africa', 'Failed', 2020), ('Australia', ... | Find the number of clinical trials conducted in each region and the percentage of successful trials in 2020. | SELECT region, COUNT(*) as total_trials, (COUNT(*) FILTER (WHERE trial_status = 'Success')) * 100.0 / COUNT(*) as success_percentage FROM clinical_trials WHERE year = 2020 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE tanker_ships (id INT, name TEXT, fuel_capacity INT); CREATE TABLE fuel_consumption (id INT, ship_id INT, date DATE, consumption INT); INSERT INTO tanker_ships (id, name, fuel_capacity) VALUES (1, 'MV Titan', 500000), (2, 'MV Olympic', 600000); INSERT INTO fuel_consumption (id, ship_id, date, consumption) V... | What is the average fuel consumption per day for all tanker ships? | SELECT AVG(fc.consumption / DATEDIFF(fc.date, fc.date - INTERVAL 1 DAY)) AS avg_fuel_consumption FROM fuel_consumption fc JOIN tanker_ships ts ON fc.ship_id = ts.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, location VARCHAR(20), quantity INT, price DECIMAL(5,2)); INSERT INTO sales (id, location, quantity, price) VALUES (1, 'Northeast', 50, 12.99), (2, 'Midwest', 75, 19.99), (3, 'West', 35, 14.49); | Calculate the total revenue for the Midwest region. | SELECT SUM(quantity * price) FROM sales WHERE location = 'Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE nba_points (player_name VARCHAR(50), team VARCHAR(50), season YEAR, points INT); INSERT INTO nba_points (player_name, team, season, points) VALUES ('Stephen Curry', 'Golden State Warriors', 2022, 31); | What is the average number of points scored by Stephen Curry in the NBA regular season? | SELECT AVG(points) FROM nba_points WHERE player_name = 'Stephen Curry'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, mental_health_score INT); INSERT INTO students (student_id, mental_health_score) VALUES (1, 80), (2, 60), (3, 90), (4, 70), (5, 50); | What is the mental health score of the student with the highest ID? | SELECT mental_health_score FROM students WHERE student_id = (SELECT MAX(student_id) FROM students); | gretelai_synthetic_text_to_sql |
CREATE TABLE maritime_law_violations (id INT, violation VARCHAR(50), location VARCHAR(50), date DATE); | Delete all maritime law violations that occurred in the Southern Hemisphere more than 3 years ago. | DELETE FROM maritime_law_violations WHERE location LIKE 'Southern Hemisphere%' AND date < NOW() - INTERVAL 3 YEAR; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tanks (tank_id INT, tank_depth FLOAT, fish_species VARCHAR(20), biomass FLOAT); INSERT INTO Tanks (tank_id, tank_depth, fish_species, biomass) VALUES (1, 2.5, 'Salmon', 12.5), (2, 4.2, 'Trout', 10.8), (3, 3.1, 'Tilapia', 8.7); | What is the total biomass of fish in Tanks with a depth greater than 3 meters? | SELECT SUM(biomass) as total_biomass FROM Tanks WHERE tank_depth > 3.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (id INT, country VARCHAR(20), year INT, capacity INT); | Update records in landfill_capacity where country is 'India' and year is 2024 | WITH data_to_update AS (UPDATE landfill_capacity SET capacity = capacity * 1.03 WHERE country = 'India' AND year = 2024 RETURNING *) UPDATE landfill_capacity SET capacity = (SELECT capacity FROM data_to_update) WHERE id IN (SELECT id FROM data_to_update); | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftAccidentsByModel (id INT, airline VARCHAR(50), airline_type VARCHAR(50), accident_year INT); INSERT INTO AircraftAccidentsByModel (id, airline, airline_type, accident_year) VALUES (1, 'Delta', '737', 2015), (2, 'Delta', '757', 2017), (3, 'United', '747', 2013), (4, 'United', '777', 2018), (5, 'Sout... | What is the distribution of accidents by aircraft model for each airline? | SELECT airline, airline_type, accident_year, COUNT(*) as total_accidents FROM AircraftAccidentsByModel GROUP BY airline, airline_type, accident_year ORDER BY airline, airline_type, accident_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_farms (farm_id INT, farm_name VARCHAR(255), location VARCHAR(255)); INSERT INTO marine_farms (farm_id, farm_name, location) VALUES (1, 'Pacific Aquaculture', 'Pacific Ocean'), (2, 'Atlantic Aquaculture', 'Atlantic Ocean'), (3, 'Mediterranean Aquaculture', 'Mediterranean Sea'); | How many marine farms are located in the Pacific Ocean, using data from the marine_farms table? | SELECT COUNT(*) FROM marine_farms WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, data_usage FLOAT, state VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id, data_usage, state) VALUES (1, 3.5, 'California'), (2, 4.2, 'Texas'), (3, 2.8, 'California'), (4, 5.1, 'Florida'); | What is the total data usage for each state in the mobile_subscribers table? | SELECT state, SUM(data_usage) FROM mobile_subscribers GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, name TEXT, city TEXT, rating FLOAT); INSERT INTO eco_hotels (hotel_id, name, city, rating) VALUES (1, 'EcoHotel Barcelona', 'Barcelona', 4.3), (2, 'GreenSuites BCN', 'Barcelona', 4.6); | What is the average rating of eco-friendly hotels in Barcelona? | SELECT AVG(rating) FROM eco_hotels WHERE city = 'Barcelona'; | gretelai_synthetic_text_to_sql |
CREATE TABLE individuals (id INT, country VARCHAR(255), gender VARCHAR(255), financial_capability_score INT); | What is the maximum financial capability score for individuals in India, grouped by gender? | SELECT gender, MAX(financial_capability_score) FROM individuals WHERE country = 'India' GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShows (id INT, event_name VARCHAR(50), event_date DATE); INSERT INTO AutoShows (id, event_name, event_date) VALUES (1, 'Auto Show A', '2021-01-01'); | How many auto shows have featured electric vehicles in the past 2 years? | SELECT COUNT(*) FROM AutoShows WHERE event_date >= DATEADD(year, -2, GETDATE()) AND event_name LIKE '%Electric%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name VARCHAR(50), age INT, state VARCHAR(20)); CREATE TABLE cultural_competency_training (id INT, community_health_worker_id INT, date_trained DATE, score INT); INSERT INTO community_health_workers (id, name, age, state) VALUES (1, 'John Doe', 35, 'Texas'), (2, 'Jane Smith... | List community health workers who received cultural competency training in 2022 and their scores. | SELECT c.name, cct.score FROM community_health_workers c INNER JOIN cultural_competency_training cct ON c.id = cct.community_health_worker_id WHERE cct.date_trained >= '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DiveSite (Name VARCHAR(50) PRIMARY KEY, Depth INT); INSERT INTO DiveSite (Name, Depth) VALUES ('Blue Hole', 120); | Delete the "DiveSite" record with a name of Blue Hole | DELETE FROM DiveSite WHERE Name = 'Blue Hole'; | gretelai_synthetic_text_to_sql |
CREATE TABLE permit (permit_id INT, region VARCHAR(20), cost FLOAT, issue_date DATE); INSERT INTO permit VALUES (1, 'Midwest', 5000, '2021-01-05'); INSERT INTO permit VALUES (2, 'Midwest', 6000, '2021-03-15'); | What is the average cost of permits issued in the Midwest region in Q1 2021? | SELECT AVG(cost) FROM permit WHERE region = 'Midwest' AND issue_date BETWEEN '2021-01-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (id INT, service VARCHAR(10), region VARCHAR(10)); INSERT INTO subscribers (id, service, region) VALUES (1, 'broadband', 'Latin America'), (2, 'mobile', 'Latin America'); CREATE TABLE speeds (subscriber_id INT, connection_speed INT, year INT); INSERT INTO speeds (subscriber_id, connection_speed... | What is the maximum connection speed in Mbps for broadband customers in the Latin America region in the last 2 years? | SELECT MAX(speeds.connection_speed) FROM speeds JOIN subscribers ON speeds.subscriber_id = subscribers.id WHERE subscribers.service = 'broadband' AND subscribers.region = 'Latin America' AND speeds.year BETWEEN 2021 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE oceanography (ocean TEXT, location TEXT, acidification_level REAL); | What is the maximum ocean acidification level in the Arctic ocean? | SELECT MAX(acidification_level) FROM oceanography WHERE ocean = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BirdObservations (id INT, location VARCHAR(20), year INT, bird_species VARCHAR(30)); INSERT INTO BirdObservations (id, location, year, bird_species) VALUES (1, 'Arctic Tundra', 2020, 'Snow Bunting'); INSERT INTO BirdObservations (id, location, year, bird_species) VALUES (2, 'Arctic Tundra', 2021, 'Lapland ... | How many species of birds were observed in the Arctic tundra during each year? | SELECT year, COUNT(DISTINCT bird_species) FROM BirdObservations WHERE location LIKE 'Arctic%' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE binance_smart_chain (wallet_address TEXT, interaction_date DATE, dapp_category TEXT, network_name TEXT); | Show the number of unique wallet addresses that have interacted with 'DeFi' dapps on the 'Binance Smart Chain' in the last month. | SELECT wallet_address, COUNT(DISTINCT interaction_date) as interactions FROM binance_smart_chain WHERE network_name = 'Binance Smart Chain' AND dapp_category = 'DeFi' GROUP BY wallet_address HAVING COUNT(DISTINCT interaction_date) >= 1 ORDER BY interactions DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_statistics (labor_category VARCHAR(50), average_wage NUMERIC(10,2)); INSERT INTO labor_statistics (labor_category, average_wage) VALUES ('Carpenters', '35.56'), ('Electricians', '38.42'), ('Plumbers', '42.15'); | What are the top 2 labor categories with the highest average wage? | SELECT labor_category, AVG(average_wage) FROM labor_statistics GROUP BY labor_category ORDER BY AVG(average_wage) DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, Age INT, Gender VARCHAR(10), Program VARCHAR(20)); INSERT INTO Volunteers (VolunteerID, Age, Gender, Program) VALUES (1, 25, 'Male', 'Education'); INSERT INTO Volunteers (VolunteerID, Age, Gender, Program) VALUES (2, 30, 'Female', 'Habitat Preservation'); INSERT INTO Volunteers... | What is the minimum age of volunteers in the 'Habitat Preservation' program? | SELECT MIN(Age) FROM Volunteers WHERE Program = 'Habitat Preservation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation_projects (id INT, project VARCHAR(255), location VARCHAR(255), reduction_percentage DECIMAL(5,2), start_year INT, end_year INT); | What is the minimum CO2 emission reduction achieved by climate mitigation projects in South America in 2018? | SELECT MIN(reduction_percentage) FROM climate_mitigation_projects WHERE location LIKE '%South America%' AND start_year <= 2018 AND end_year >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (sector VARCHAR(10), quarter INT, vulnerabilities_count INT); INSERT INTO vulnerabilities (sector, quarter, vulnerabilities_count) VALUES ('Insurance', 1, 30), ('Insurance', 2, 45), ('Insurance', 3, 60), ('Insurance', 4, 75); | What was the total number of smart contract vulnerabilities discovered in the 'Insurance' sector during Q1 2022? | SELECT vulnerabilities_count FROM vulnerabilities WHERE sector = 'Insurance' AND quarter = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Departments (DepartmentID INT, DepartmentName VARCHAR(50), ResearchGrants INT); | List the departments with no research grants. | SELECT DepartmentName FROM Departments WHERE ResearchGrants = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation_projects (project_id INT, location VARCHAR(50), investment_amount FLOAT, investment_year INT); INSERT INTO climate_adaptation_projects (project_id, location, investment_amount, investment_year) VALUES (1, 'Mozambique', 1000000, 2018), (2, 'Bangladesh', 1500000, 2019), (3, 'Ethiopia', 200... | What is the minimum investment in climate adaptation projects in Least Developed Countries (LDCs) in the last 5 years? | SELECT MIN(investment_amount) FROM climate_adaptation_projects WHERE location LIKE 'LDCs' AND investment_year BETWEEN 2017 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE raw_materials (id INT, product_line VARCHAR(50), amount INT, sub_components VARCHAR(50)); INSERT INTO raw_materials (id, product_line, amount, sub_components) VALUES (1, 'product1', 10000, 'component1,component2'); INSERT INTO raw_materials (id, product_line, amount, sub_components) VALUES (2, 'product2', ... | What is the total amount spent on raw materials for each product line, including the cost of sub-components? | SELECT product_line, SUM(amount + (SELECT SUM(amount) FROM raw_materials WHERE sub_components LIKE CONCAT('%', product_line, '%'))) FROM raw_materials GROUP BY product_line; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_investments (investment_id INT, sector VARCHAR(255), investment_value DECIMAL); INSERT INTO shariah_compliant_investments (investment_id, sector, investment_value) VALUES (1, 'Technology', 5000), (2, 'Healthcare', 7000), (3, 'Finance', 3000); | What is the total value of Shariah-compliant investments in a specific sector? | SELECT SUM(investment_value) FROM shariah_compliant_investments WHERE sector = 'Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition (id INT, name TEXT, rating INT); INSERT INTO Exhibition (id, name, rating) VALUES (1, 'Exhibition1', 4), (2, 'Exhibition2', 5); | List all exhibitions and their average visitor rating | SELECT name, AVG(rating) FROM Exhibition GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage_utilization (province VARCHAR(20), utilization DECIMAL(4,2), year INT); INSERT INTO energy_storage_utilization (province, utilization, year) VALUES ('Ontario', 80.5, 2021), ('Ontario', 82.3, 2021), ('Ontario', 79.2, 2021); | What is the minimum energy storage utilization rate for the province of Ontario in 2021? | SELECT MIN(utilization) FROM energy_storage_utilization WHERE province = 'Ontario' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transactions (id INT, customer_id INT, region VARCHAR(10)); INSERT INTO Transactions (id, customer_id, region) VALUES (1, 10, 'Europe'), (2, 10, 'Asia'), (3, 11, 'Asia'), (4, 12, 'Europe'); | What is the total amount of transactions and their count for customers who have made a transaction in both Europe and Asia? | SELECT SUM(amount) as total_amount, COUNT(*) as transaction_count FROM Transactions t1 INNER JOIN (SELECT customer_id FROM Transactions WHERE region IN ('Europe', 'Asia') GROUP BY customer_id HAVING COUNT(DISTINCT region) = 2) t2 ON t1.customer_id = t2.customer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_membership (year INT, union_name TEXT, industry TEXT, members INT); INSERT INTO union_membership (year, union_name, industry, members) VALUES (2020, 'United Auto Workers', 'Manufacturing', 350000), (2021, 'United Auto Workers', 'Manufacturing', 400000), (2020, 'UAW Local 600', 'Manufacturing', 20000)... | Which union has the greatest increase in members in the manufacturing sector between 2020 and 2021? | SELECT union_name, MAX(members) - MIN(members) AS member_growth FROM union_membership WHERE industry = 'Manufacturing' AND year IN (2020, 2021) GROUP BY union_name ORDER BY member_growth DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name VARCHAR(255), location VARCHAR(255), annual_coal_production INT); INSERT INTO mines (id, name, location, annual_coal_production) VALUES (1, 'Mine A', 'USA', 1000000), (2, 'Mine B', 'Canada', 800000), (3, 'Mine C', 'USA', 1200000), (4, 'Mine D', 'USA', 1100000); | List the top 3 mines with the highest annual coal production in the USA. | SELECT m.name, m.annual_coal_production FROM mines m ORDER BY m.annual_coal_production DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE infectious_disease (id INT, location VARCHAR(10), disease VARCHAR(50), cases INT); INSERT INTO infectious_disease (id, location, disease, cases) VALUES (1, 'Urban', 'Flu', 3000), (2, 'Rural', 'Flu', 2000), (3, 'Urban', 'Measles', 500), (4, 'Rural', 'Measles', 300), (5, 'Urban', 'COVID-19', 10000), (6, 'Rur... | What is the number of flu cases in urban areas compared to rural areas? | SELECT location, SUM(cases) as total_cases FROM infectious_disease WHERE disease = 'Flu' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (id INT, donor_name TEXT, city TEXT, state TEXT); | What is the number of unique donors by city and state? | SELECT city, state, COUNT(DISTINCT donor_name) as unique_donors FROM Donors GROUP BY city, state; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_date DATE, salesperson VARCHAR(255), product VARCHAR(255), quantity INT); | How many units of each product were sold in the last month, by salesperson? | SELECT salesperson, product, SUM(quantity) AS qty_sold, DATE_TRUNC('month', sale_date) AS sale_month FROM sales WHERE sale_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') GROUP BY salesperson, product, sale_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (id INT, contractor VARCHAR(255), government VARCHAR(255), contract_value INT, negotiation_date DATE); INSERT INTO ContractNegotiations (id, contractor, government, contract_value, negotiation_date) VALUES (1, 'Contractor A', 'US Government', 20000000, '2020-01-01'), (2, 'Contractor B'... | How many defense projects were negotiated with the Australian government in the last 3 years? | SELECT COUNT(*) FROM ContractNegotiations WHERE government = 'Australian Government' AND negotiation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_facilities (facility_id INT, name VARCHAR(50), state VARCHAR(25), mental_health_parity_score INT); INSERT INTO mental_health_facilities (facility_id, name, state, mental_health_parity_score) VALUES (1, 'Sunshine Mental Health', 'New York', 85); INSERT INTO mental_health_facilities (facility_i... | What is the average mental health parity score for mental health facilities in New York? | SELECT AVG(mental_health_parity_score) FROM mental_health_facilities WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE consumer_awareness (id INT, country VARCHAR(20), continent VARCHAR(20), score FLOAT); INSERT INTO consumer_awareness (id, country, continent, score) VALUES (1, 'Bangladesh', 'Asia', 3.2), (2, 'India', 'Asia', 3.5), (3, 'Cambodia', 'Asia', 3.0), (4, 'Vietnam', 'Asia', 3.7), (5, 'Indonesia', 'Asia', 3.3), (6... | What is the average consumer awareness score for each continent in the 'consumer_awareness' table? | SELECT continent, AVG(score) FROM consumer_awareness GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (claim_id INT, policy_number INT, claim_amount DECIMAL(10,2), claim_date DATE); | Retrieve the policy numbers, claim amounts, and claim dates for claims that were processed in 'January' of any year | SELECT policy_number, claim_amount, claim_date FROM claims WHERE MONTH(claim_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, city TEXT, ai_adoption INT); INSERT INTO hotels (hotel_id, hotel_name, city, ai_adoption) VALUES (1, 'The Beverly Hills Hotel', 'Los Angeles', 1), (2, 'The Four Seasons Hotel', 'Los Angeles', 1), (3, 'The W Hotel', 'Los Angeles', 0), (4, 'The InterContinental Hotel', ... | What is the percentage of hotels in Los Angeles that have adopted AI technology? | SELECT city, 100.0 * SUM(ai_adoption) / COUNT(*) as adoption_percentage FROM hotels WHERE city = 'Los Angeles' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sustainable_Materials (id INT, material_name TEXT, cost FLOAT, sustainability_rating INT, country TEXT); | What is the maximum cost of a sustainable building material used in green construction projects in Japan? | SELECT MAX(cost) FROM Sustainable_Materials WHERE country = 'Japan' AND sustainability_rating >= 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, name VARCHAR(255), collection_date DATE, collecting_agency VARCHAR(255), mass FLOAT); INSERT INTO space_debris (id, name, collection_date, collecting_agency, mass) VALUES (1, 'RemoveDEBRIS', '2018-04-16', 'NASA', 220.0); INSERT INTO space_debris (id, name, collection_date, collecting_... | Identify the total mass of space debris collected by NASA and JAXA. | SELECT SUM(s.mass) as total_mass FROM space_debris s INNER JOIN space_debris_nasa n ON s.id = n.id INNER JOIN space_debris_jaxa j ON s.id = j.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_trenches (id INT, name VARCHAR(255), depth FLOAT, location VARCHAR(255)); | What is the average depth of marine trenches in the Pacific Ocean? | SELECT AVG(depth) FROM marine_trenches WHERE location LIKE '%Pacific%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (id INT PRIMARY KEY, name VARCHAR(255), category VARCHAR(255), supplier_id INT, FOREIGN KEY (supplier_id) REFERENCES Suppliers(id)); CREATE TABLE Trends (id INT PRIMARY KEY, product_id INT, trend VARCHAR(255), popularity INT); INSERT INTO Products (id, name, category, supplier_id) VALUES (1, 'Prod... | What are the products that are not in any trend? | SELECT Products.name FROM Products LEFT JOIN Trends ON Products.id = Trends.product_id WHERE Trends.product_id IS NULL | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (id INT, country VARCHAR(50)); INSERT INTO Countries (id, country) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); CREATE TABLE Brands (id INT, brand VARCHAR(50)); INSERT INTO Brands (id, brand) VALUES (1, 'Gucci'), (2, 'Chanel'), (3, 'Louis Vuitton'); CREATE TABLE Inventory (id INT, country_id ... | What is the total quantity of unsold garments for each brand, grouped by country, which have a quantity greater than 500? | SELECT c.country, b.brand, SUM(i.quantity) as total_unsold_quantity FROM Inventory i JOIN Countries c ON i.country_id = c.id JOIN Brands b ON i.brand_id = b.id GROUP BY c.country, b.brand HAVING total_unsold_quantity > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE outcomes (id INT, patient_id INT, improvement VARCHAR(10)); INSERT INTO outcomes (id, patient_id, improvement) VALUES (1, 1, 'improved'), (2, 2, 'did not improve'), (3, 3, 'improved'), (4, 4, 'did not improve'), (5, 5, 'improved'), (6, 6, 'did not improve'), (7, 7, 'improved'), (8, 8, 'did not improve'); | What is the percentage of patients who improved after therapy? | SELECT (COUNT(*) FILTER (WHERE improvement = 'improved')) * 100.0 / COUNT(*) AS percentage FROM outcomes; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), industry VARCHAR(255)); INSERT INTO company (id, name, location, industry) VALUES (1, 'BioCatalyst', 'San Francisco, CA', 'Biotech Startup'); CREATE TABLE funding (id INT PRIMARY KEY, company_id INT, fund_type VARCHAR(255), amount INT, ... | What biotech startups in San Francisco received Series A funding over 3 million since 2020? | SELECT c.name, f.fund_type, f.amount FROM company c JOIN funding f ON c.id = f.company_id WHERE c.location = 'San Francisco, CA' AND f.fund_type = 'Series A' AND f.amount > 3000000 AND f.funding_date >= '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_businesses (id INT, name TEXT, partnered_with_tourism BOOLEAN); INSERT INTO local_businesses (id, name, partnered_with_tourism) VALUES (1, 'Vancouver Bike Tours', true), (2, 'Toronto Artisan Market', false), (3, 'Montreal Food Tours', true); | What is the total number of local businesses partnered with tourism initiatives in Canada? | SELECT COUNT(*) FROM local_businesses WHERE partnered_with_tourism = true AND country = 'Canada'; | 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, '2022-01-01', 'LGBTQ+', 'HR'), (2, '2022-02-15', 'Allied', 'Marketing'), (3, '2022-02-15', 'LGBTQ+', 'IT'), (4, '2021-12-01', 'LGBTQ+', 'H... | What is the percentage of new hires who identify as LGBTQ+ in the HR 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 = 'LGBTQ+' AND Department = 'HR' GROUP BY Department; | 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.