context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Medical (Country TEXT, PhysicianDensity FLOAT); INSERT INTO Medical VALUES ('Australia', 3.3); | What is the physician density in Australia? | SELECT PhysicianDensity FROM Medical WHERE Country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory(item_id INT, item_name VARCHAR(50), is_fair_trade_certified BOOLEAN, quantity INT); INSERT INTO Inventory VALUES(1,'Apples',TRUE,100),(2,'Bananas',FALSE,200),(3,'Chocolate',TRUE,150); | Count the number of items in the inventory that are fair trade certified. | SELECT COUNT(*) FROM Inventory WHERE is_fair_trade_certified = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE products_organic_country (id INT, product_name TEXT, consumer_preference FLOAT, sourcing_country TEXT, organic BOOLEAN); INSERT INTO products_organic_country (id, product_name, consumer_preference, sourcing_country, organic) VALUES (1, 'Lotion', 4.3, 'USA', true), (2, 'Shampoo', 4.1, 'Canada', true), (3, '... | What are the top 3 countries with the highest average consumer preference score for organic products? | SELECT sourcing_country, AVG(consumer_preference) AS avg_preference FROM products_organic_country WHERE organic = true GROUP BY sourcing_country ORDER BY avg_preference DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_data (hotel_id INT, hotel_name TEXT, country TEXT, stars INT); INSERT INTO hotel_data (hotel_id, hotel_name, country, stars) VALUES (1, 'Park Hotel', 'Switzerland', 5), (2, 'Four Seasons', 'Canada', 5), (3, 'The Plaza', 'USA', 4); CREATE TABLE virtual_tour_stats (hotel_id INT, country TEXT, total_vie... | List the virtual tour engagement stats for the top_5_countries with the highest number of hotels in the hotel_data table. | (SELECT country, total_views FROM (SELECT country, total_views, ROW_NUMBER() OVER (ORDER BY total_views DESC) as rank FROM virtual_tour_stats JOIN hotel_data ON virtual_tour_stats.hotel_id = hotel_data.hotel_id GROUP BY country) as top_5_countries WHERE rank <= 5); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessel (vessel_id INT, name VARCHAR(255), type VARCHAR(255), max_speed DECIMAL(5,2)); CREATE TABLE Inspection (inspection_id INT, vessel_id INT, inspection_time TIMESTAMP); INSERT INTO Vessel (vessel_id, name, type, max_speed) VALUES (1, 'Test Vessel 1', 'Cargo', 20.5), (2, 'Test Vessel 2', 'Tanker', 15.2)... | What is the maximum speed of vessels that have been inspected? | SELECT MAX(v.max_speed) FROM Vessel v INNER JOIN Inspection i ON v.vessel_id = i.vessel_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Country VARCHAR(50)); INSERT INTO Artists (ArtistID, ArtistName, Country) VALUES (1, 'Taylor Swift', 'USA'), (2, 'BTS', 'South Korea'); CREATE TABLE Concerts (ConcertID INT, ArtistID INT, Venue VARCHAR(100), TicketRevenue DECIMAL(10,2)); INSERT INTO Concerts ... | What is the total revenue generated from concert ticket sales for artists from the United States? | SELECT SUM(Concerts.TicketRevenue) FROM Concerts INNER JOIN Artists ON Concerts.ArtistID = Artists.ArtistID WHERE Artists.Country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE legal_tech (id INT, name VARCHAR(50), type VARCHAR(30), description TEXT); INSERT INTO legal_tech (id, name, type, description) VALUES (1, 'Case Management System', 'Software', 'A system for managing cases and documents within a legal organization.'); INSERT INTO legal_tech (id, name, type, description) VA... | Which legal technology tools are available in the 'legal_tech' table? | SELECT name FROM legal_tech; | gretelai_synthetic_text_to_sql |
CREATE TABLE Defense_Projects(id INT, project_name VARCHAR(255), start_year INT, end_year INT); INSERT INTO Defense_Projects(id, project_name, start_year, end_year) VALUES (1, 'Project A', 2015, 2018), (2, 'Project B', 2016, 2019), (3, 'Project C', 2017, 2020), (4, 'Project D', 2018, 2021), (5, 'Project E', 2015, 2020)... | What was the average duration of defense projects initiated between 2015 and 2018, excluding projects that lasted more than 5 years? | SELECT AVG(end_year - start_year) as Average_Duration FROM Defense_Projects WHERE start_year BETWEEN 2015 AND 2018 AND end_year - start_year <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (PolicyID int, PolicyType varchar(50), EffectiveDate date, RiskScore int); CREATE TABLE Claim (ClaimID int, PolicyID int, ClaimDate date, ClaimAmount int, State varchar(50)); INSERT INTO Policy (PolicyID, PolicyType, EffectiveDate, RiskScore) VALUES (1, 'Auto', '2020-01-01', 700), (2, 'Home', '2019-... | What is the total claim amount for policies in California? | SELECT SUM(Claim.ClaimAmount) FROM Policy INNER JOIN Claim ON Policy.PolicyID = Claim.PolicyID WHERE Claim.State = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorID int, Amount decimal, DonationDate date, ProgramID int); CREATE TABLE Donors (DonorID int, DonorName varchar(50)); CREATE TABLE Programs (ProgramID int, ProgramName varchar(50)); INSERT INTO Donors (DonorID, DonorName) VALUES (1, 'John Smith'); INSERT INTO Programs (Progra... | Which donors contributed the most to environmental programs in 2022? | SELECT DonorName, SUM(Amount) as TotalDonationToEnvironment FROM Donations JOIN Donors ON Donations.DonorID = Donors.DonorID WHERE ProgramID = 1 AND YEAR(DonationDate) = 2022 GROUP BY DonorName ORDER BY TotalDonationToEnvironment DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (name VARCHAR(255), region VARCHAR(255), threatened_by_pollution BOOLEAN); INSERT INTO marine_species (name, region, threatened_by_pollution) VALUES ('Species 1', 'Pacific', TRUE); INSERT INTO marine_species (name, region, threatened_by_pollution) VALUES ('Species 2', 'Atlantic', FALSE); | How many marine species in the Pacific Ocean are threatened by pollution? | SELECT COUNT(*) FROM marine_species WHERE region = 'Pacific' AND threatened_by_pollution = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE certifications_sa (certification_id INT, certification_date DATE, region VARCHAR(50)); INSERT INTO certifications_sa (certification_id, certification_date, region) VALUES (1, '2021-04-15', 'South America'), (2, '2021-06-28', 'South America'), (3, '2020-12-10', 'South America'); | How many fair labor practice certifications were issued in South America in the last 6 months? | SELECT COUNT(*) FROM certifications_sa WHERE region = 'South America' AND certification_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND CURDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, initiative VARCHAR(50), description TEXT); CREATE TABLE funding_sources (id INT, source VARCHAR(50), community_id INT); INSERT INTO community_development (id, initiative, description) VALUES (1, 'Youth Center', 'A place for local youth to gather and learn'); INSERT INTO commu... | List all community development initiatives and their corresponding funding sources from the 'rural_development' database | SELECT community_development.initiative, funding_sources.source FROM community_development INNER JOIN funding_sources ON community_development.id = funding_sources.community_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (hotel_id INT, hotel_name TEXT, region TEXT, views INT, clicks INT); INSERT INTO virtual_tours (hotel_id, hotel_name, region, views, clicks) VALUES (1, 'Hotel Royal', 'Asia', 200, 50), (2, 'Palace Hotel', 'Europe', 300, 80), (3, 'Beach Resort', 'Americas', 150, 30), (4, 'Luxury Villa', 'Europ... | Virtual tour engagement statistics for hotels in 'Europe'? | SELECT region, AVG(views), AVG(clicks) FROM virtual_tours WHERE region = 'Europe' GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_figures_3 (drug_name TEXT, region TEXT, sales_value NUMERIC); INSERT INTO sales_figures_3 (drug_name, region, sales_value) VALUES ('Nexo', 'Australia', 1200000), ('RemedX', 'New Zealand', 1000000); | Calculate the average sales figure for all drugs in Oceania. | SELECT AVG(sales_value) FROM sales_figures_3 WHERE region = 'Oceania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Publication (PublicationID INT PRIMARY KEY, Title VARCHAR(50), AuthorID INT, Year INT, Type VARCHAR(50), Country VARCHAR(50)); INSERT INTO Publication (PublicationID, Title, AuthorID, Year, Type, Country) VALUES (2, 'The Incas: New Perspectives', 4, 2000, 'Book', 'Peru'); | Which publications about the Inca Empire were written by authors from Peru? | SELECT Title FROM Publication WHERE Country = 'Peru' AND Type = 'Book' AND (SELECT Specialty FROM Archaeologist WHERE Archaeologist.ArchaeologistID = Publication.AuthorID) = 'Inca Empire'; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_advocacy (id INT, union_name TEXT, state TEXT, involved_in_advocacy BOOLEAN); INSERT INTO union_advocacy (id, union_name, state, involved_in_advocacy) VALUES (1, 'Union J', 'Illinois', true), (2, 'Union K', 'Illinois', true), (3, 'Union L', 'Illinois', false); | What is the percentage of members that are involved in labor rights advocacy in Illinois? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM union_advocacy WHERE state = 'Illinois')) AS percentage FROM union_advocacy WHERE involved_in_advocacy = true AND state = 'Illinois'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name TEXT, budget INT); INSERT INTO hospitals VALUES (1, 'Rural Hospital A', 1000000); INSERT INTO hospitals VALUES (2, 'Rural Hospital B', 1500000); CREATE TABLE clinics (id INT, name TEXT, budget INT); INSERT INTO clinics VALUES (1, 'Rural Clinic A', 300000); INSERT INTO clinics VALUES... | Which rural hospitals offer more resources (budget) than the total resources allocated to clinics? | SELECT name FROM hospitals WHERE budget > (SELECT SUM(budget) FROM clinics); | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGenre (PlayerID INT, Age INT, Genre VARCHAR(20)); INSERT INTO PlayerGenre (PlayerID, Age, Genre) VALUES (1, 25, 'Racing'); INSERT INTO PlayerGenre (PlayerID, Age, Genre) VALUES (2, 32, 'Shooter'); INSERT INTO PlayerGenre (PlayerID, Age, Genre) VALUES (3, 19, 'Open World'); | What is the average age of players who play games with the 'open world' genre? | SELECT AVG(Age) FROM PlayerGenre WHERE Genre = 'Open World'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name VARCHAR(255), category VARCHAR(255)); CREATE TABLE ingredients (ingredient_id INT, product_id INT, name VARCHAR(255), sourcing_rating INT); INSERT INTO products (product_id, name, category) VALUES (1, 'Lipstick', 'Lip'), (2, 'Eye Shadow', 'Eye'), (3, 'Mascara', 'Eye'), (4, 'F... | What is the average sourcing rating of ingredients for each product category? | SELECT p.category, AVG(i.sourcing_rating) FROM products p JOIN ingredients i ON p.product_id = i.product_id GROUP BY p.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensors (id INT, name VARCHAR(50), type VARCHAR(50), accuracy DECIMAL(3,2)); INSERT INTO biosensors (id, name, type, accuracy) VALUES (1, 'Biosensor1', 'Glucose', 0.95); INSERT INTO biosensors (id, name, type, accuracy) VALUES (2, 'Biosensor2', 'Pressure', 0.98); | What is the name and type of the most accurate biosensor, and the name and type of the least accurate biosensor? | SELECT name, type FROM biosensors WHERE accuracy = (SELECT MAX(accuracy) FROM biosensors) OR accuracy = (SELECT MIN(accuracy) FROM biosensors); | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name TEXT); INSERT INTO artists (id, name) VALUES (1, 'Artist 1'); CREATE TABLE artworks (id INT, title TEXT, artist_id INT); INSERT INTO artworks (id, title, artist_id) VALUES (1, 'Artwork 1', 1), (2, 'Artwork 2', 1); | Delete the artwork 'Artwork 2' and its corresponding artist. | DELETE a, ar FROM artworks a INNER JOIN artists ar ON a.artist_id = ar.id WHERE a.title = 'Artwork 2'; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (id INT PRIMARY KEY, name TEXT); INSERT INTO states (id, name) VALUES (1, 'New York'); CREATE TABLE libraries (id INT PRIMARY KEY, state_id INT, name TEXT); INSERT INTO libraries (id, state_id, name) VALUES (1, 1, 'New York Public Library'); INSERT INTO libraries (id, state_id, name) VALUES (2, 1, '... | What is the total number of libraries in the state of New York? | SELECT COUNT(*) FROM libraries WHERE state_id = (SELECT id FROM states WHERE name = 'New York'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, attorney_id INT, outcome VARCHAR(10)); INSERT INTO cases (id, attorney_id, outcome) VALUES (1, 1001, 'Positive'), (2, 1001, 'Positive'), (3, 1002, 'Negative'); CREATE TABLE attorneys (id INT, name VARCHAR(50)); INSERT INTO attorneys (id, name) VALUES (1001, 'John Doe'), (1002, 'Jane Smith'); | Who are the attorneys with a win rate greater than 75%? | SELECT a.name FROM attorneys a INNER JOIN cases c ON a.id = c.attorney_id WHERE c.outcome = 'Positive' GROUP BY a.name HAVING COUNT(c.id) / (SELECT COUNT(*) FROM cases WHERE attorney_id = a.id) > 0.75; | gretelai_synthetic_text_to_sql |
CREATE TABLE africa_facilities (facility_id INT, facility_name TEXT, safety_officer_name TEXT, safety_officer_phone TEXT); INSERT INTO africa_facilities (facility_id, facility_name, safety_officer_name, safety_officer_phone) VALUES (1, 'Facility K', 'Sara Njeri', '+254 712 345678'), (2, 'Facility L', 'Musa Seko', '+27 ... | List all chemical manufacturing facilities in the African region, with their respective safety officer names and contact phone numbers. | SELECT facility_name, safety_officer_name, safety_officer_phone FROM africa_facilities; | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT PRIMARY KEY, name VARCHAR(50), species VARCHAR(50), population INT); INSERT INTO animals (id, name, species, population) VALUES (1, 'Giraffe', 'Mammal', 500); | Count the number of animals | SELECT COUNT(*) FROM animals; | gretelai_synthetic_text_to_sql |
CREATE TABLE oil_rigs (country text, status text, drilling_depth real); INSERT INTO oil_rigs (country, status, drilling_depth) VALUES ('USA', 'active', 12000), ('USA', 'inactive', 15000), ('Canada', 'active', 9000), ('Mexico', 'inactive', 8000), ('Brazil', 'active', 14000); | How many active oil rigs are there in the USA? | SELECT COUNT(*) FROM oil_rigs WHERE country = 'USA' AND status = 'active'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donor_id INT, donation_date DATE); | Delete all records with a donation date before January 1, 2010 in the 'donations' table. | DELETE FROM donations WHERE donation_date < '2010-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE solana_transactions (transaction_date DATE, volume DECIMAL(30, 0)); INSERT INTO solana_transactions (transaction_date, volume) VALUES ('2022-01-01', 5000000), ('2022-01-02', 6000000), ('2022-01-03', 7000000), ('2022-01-04', 8000000), ('2022-01-05', 9000000); | What is the maximum daily transaction volume on the Solana blockchain, and what was the date with the highest volume? | SELECT MAX(volume), transaction_date FROM solana_transactions GROUP BY transaction_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, runtime INT, director VARCHAR(50)); INSERT INTO movies (id, title, release_year, runtime, director) VALUES (1, 'Movie1', 2016, 105, 'Director1'), (2, 'Movie2', 2018, 120, 'Director2'), (3, 'Movie3', 2019, 95, 'Director3'), (4, 'Movie4', 2020, 110, 'Dire... | What is the minimum runtime of films directed by Indigenous filmmakers and released in the last decade? | SELECT MIN(runtime) FROM movies WHERE release_year BETWEEN 2011 AND 2021 AND director LIKE '%Indigenous%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, city_name VARCHAR(50), state VARCHAR(50)); INSERT INTO cities VALUES (1, 'Los Angeles', 'California'), (2, 'San Diego', 'California'), (3, 'San Francisco', 'California'); CREATE TABLE targets (city_id INT, target_month INT, target_amount FLOAT); INSERT INTO targets VALUES (1, 1, 1200000), ... | What is the monthly water conservation target for each city in California? | SELECT c.city_name, t.target_month, t.target_amount FROM cities c JOIN targets t ON c.id = t.city_id WHERE c.state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, name VARCHAR(50), un_locode VARCHAR(10)); INSERT INTO ports (port_id, name, un_locode) VALUES (1, 'Port of Los Angeles', 'USLAX'), (2, 'Port of Long Beach', 'USLGB'), (3, 'Port of New York', 'USNYC'); | What is the name of the port with UN/LOCODE 'USNYC' in the 'ports' table? | SELECT name FROM ports WHERE un_locode = 'USNYC'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, year INT, region TEXT, revenue INT); INSERT INTO sales (id, year, region, revenue) VALUES (1, 2020, 'EU', 100000); | What is the total revenue of organic food sales in the EU? | SELECT SUM(revenue) FROM sales WHERE region = 'EU' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE OceanFloorMapping (id INT PRIMARY KEY, MapName VARCHAR(100), MapDetails TEXT, MapDate DATE); INSERT INTO OceanFloorMapping (id, MapName, MapDetails, MapDate) VALUES (1, 'Atlantic Ocean Floor Map', 'Detailed map of the Atlantic Ocean floor', '2020-01-01'), (2, 'Pacific Ocean Floor Map', 'Detailed map of the... | Which ocean floor maps have been created more than once on the same day? | SELECT MapName, COUNT(*) as NumberOfMaps FROM OceanFloorMapping GROUP BY MapName HAVING SUM(CASE WHEN COUNT(*) > 1 THEN 1 ELSE 0 END) > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (CHWId INT, Name VARCHAR(50), State VARCHAR(50)); CREATE TABLE HealthEquityMetricTrainings (HEMTrainingId INT, CHWId INT, TrainingDate DATE, State VARCHAR(50)); INSERT INTO CommunityHealthWorkers (CHWId, Name, State) VALUES (1, 'Jasmine', 'California'), (2, 'Kareem', 'Texas'), (3, 'L... | Count of community health workers who have completed health equity metric trainings in California. | SELECT COUNT(DISTINCT CHWId) FROM HealthEquityMetricTrainings WHERE State = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TourismDestinations (DestinationID INT, DestinationType VARCHAR(20), Continent VARCHAR(20)); INSERT INTO TourismDestinations (DestinationID, DestinationType, Continent) VALUES (1, 'SustainableTourism', 'Asia'), (2, 'EcoTourism', 'Oceania'); CREATE TABLE Visitors (VisitorID INT, Nationality VARCHAR(20), Des... | What is the total number of tourists who visited sustainable tourism destinations in Asia and Oceania in 2022? | SELECT COUNT(*) as Total FROM Visitors JOIN TourismDestinations ON Visitors.DestinationID = TourismDestinations.DestinationID WHERE VisitYear = 2022 AND (Continent = 'Asia' OR Continent = 'Oceania') AND DestinationType IN ('SustainableTourism', 'EcoTourism'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA publications;CREATE TABLE student_publications(student_name TEXT,department TEXT,num_publications INTEGER);INSERT INTO student_publications(student_name,department,num_publications)VALUES('Gabby','Physics',0),('Hank','Computer Science',3); | What are the names of graduate students who have not published any papers? | SELECT student_name FROM publications.student_publications WHERE num_publications=0; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID int, VolunteerName varchar(50), State varchar(50), LastEngagementDate date); | What is the total number of volunteers who engaged in our programs in the last 12 months, broken down by state? | SELECT State, COUNT(*) FROM Volunteers WHERE LastEngagementDate >= DATEADD(month, -12, GETDATE()) GROUP BY State; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_bikes (city VARCHAR(20), trips INT); INSERT INTO shared_bikes (city, trips) VALUES ('New York', 2000000), ('Los Angeles', 1500000), ('London', 3000000), ('Berlin', 2500000), ('Paris', 1000000); CREATE TABLE public_transit (city VARCHAR(20), trips INT); INSERT INTO public_transit (city, trips) VALUES... | Find the cities with the most shared bike trips and the most public transit trips. | SELECT city, 'shared_bikes' AS trip_type FROM shared_bikes WHERE trips = (SELECT MAX(trips) FROM shared_bikes) UNION SELECT city, 'public_transit' FROM public_transit WHERE trips = (SELECT MAX(trips) FROM public_transit); | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (program_id INT, program_name VARCHAR(255), year INT, allocated_budget DECIMAL(10, 2)); INSERT INTO Budget (program_id, program_name, year, allocated_budget) VALUES (1, 'Arts', 2021, 2500.00), (2, 'Education', 2021, 6000.00), (3, 'Environment', 2021, 5000.00), (1, 'Arts', 2020, 2000.00), (2, 'Educat... | What is the total budget allocated for program 'Education' in 2021? | SELECT SUM(allocated_budget) FROM Budget WHERE program_name = 'Education' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE housing_affordability (property_id INT, size FLOAT, owner_id INT); INSERT INTO housing_affordability (property_id, size, owner_id) VALUES (1, 800, 1), (2, 900, 1), (3, 1000, 2); | What is the total property size in the housing_affordability table for each owner? | SELECT owner_id, SUM(size) FROM housing_affordability GROUP BY owner_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_surveys (student_id INT, course_type VARCHAR(50), survey_date DATE); INSERT INTO mental_health_surveys VALUES (1, 'open_pedagogy', '2021-06-01'), (2, 'open_pedagogy', '2021-07-01'), (3, 'open_pedagogy', '2021-08-01'); CREATE TABLE professional_development (student_id INT, course_completed VAR... | What is the list of unique students who have taken mental health surveys in open pedagogy courses but have not completed any professional development courses? | SELECT DISTINCT student_id FROM mental_health_surveys WHERE student_id NOT IN (SELECT student_id FROM professional_development); | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Country VARCHAR(20), HeartRate FLOAT); INSERT INTO Members (MemberID, Country, HeartRate) VALUES (1, 'Canada', 185.2), (2, 'USA', 200.1), (3, 'Canada', 190.0); | What is the maximum heart rate recorded for members from Canada? | SELECT MAX(HeartRate) FROM Members WHERE Country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), age INT, game_preference VARCHAR(20)); INSERT INTO players (id, name, age, game_preference) VALUES (1, 'John Doe', 25, 'VR'); INSERT INTO players (id, name, age, game_preference) VALUES (2, 'Jane Smith', 30, 'Non-VR'); | What's the average age of players who prefer VR games, and how many of them are there? | SELECT AVG(age), COUNT(*) FROM players WHERE game_preference = 'VR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT); INSERT INTO Donors (DonorID, DonorName) VALUES (1, 'John Doe'), (2, 'Jane Smith'); | What is the total amount donated by each donor? | SELECT Donors.DonorID, Donors.DonorName, SUM(Donations.DonationAmount) AS TotalDonated FROM Donors JOIN Donations ON Donors.DonorID = Donations.DonorID GROUP BY Donors.DonorID, Donors.DonorName; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_avg_depths_mediterranean (name VARCHAR(255), basin VARCHAR(255), depth FLOAT); INSERT INTO marine_species_avg_depths_mediterranean (name, basin, depth) VALUES ('Species9', 'Mediterranean', 234.56), ('Species10', 'Pacific', 567.89); | What is the average depth of all marine species in the Mediterranean Sea, grouped by species name? | SELECT name, AVG(depth) as avg_depth FROM marine_species_avg_depths_mediterranean WHERE basin = 'Mediterranean' GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_court (id INT, case_id INT, court_hearings INT, case_status TEXT); | What is the average number of court_hearings for cases in the 'criminal_court' table? | SELECT AVG(court_hearings) FROM criminal_court WHERE case_status = 'closed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety_incidents (incident_date DATE, ai_algorithm VARCHAR(255), incidents INT); INSERT INTO ai_safety_incidents (incident_date, ai_algorithm, incidents) VALUES ('2022-01-01', 'Algorithm E', 30), ('2022-02-15', 'Algorithm F', 45), ('2022-03-03', 'Algorithm E', 50); | Find AI safety incidents by algorithm in the past 6 months. | SELECT ai_algorithm, SUM(incidents) AS total_incidents FROM ai_safety_incidents WHERE incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) GROUP BY ai_algorithm; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, Name TEXT, Attendance INT);CREATE TABLE Attendees (AttendeeID INT, EventID INT, Country TEXT); | How many cultural events were attended by people from Latin America? | SELECT SUM(Events.Attendance) FROM Events INNER JOIN Attendees ON Events.EventID = Attendees.EventID WHERE Attendees.Country = 'Latin America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE justice_programs (id INT, country VARCHAR(255), program VARCHAR(255), start_date DATE); INSERT INTO justice_programs (id, country, program, start_date) VALUES (1, 'US', 'Victim Offender Mediation', '1995-01-01'), (2, 'Canada', 'Restorative Circles', '2000-01-01'), (3, 'US', 'Peacebuilding Circles', NULL); | List all restorative justice programs in the US and Canada, along with their start dates, if available. | SELECT country, program, start_date FROM justice_programs WHERE country IN ('US', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(50), author_location VARCHAR(20)); INSERT INTO articles (id, title, author_location) VALUES (1, 'Article1', 'local'), (2, 'Article2', 'international'); | How many articles were written by local authors? | SELECT COUNT(*) FROM articles WHERE author_location = 'local'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, num_posts INT); INSERT INTO users (user_id, num_posts) VALUES (1, 15), (2, 8), (3, 22), (4, 3), (5, 25), (6, 23), (7, 2), (8, 30), (9, 4), (10, 28); | Find the maximum number of posts by a user in the 'social_media' database. | SELECT MAX(num_posts) FROM users; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (id INT, factory VARCHAR(255), country VARCHAR(255), cost DECIMAL(10,2), quantity INT); INSERT INTO production (id, factory, country, cost, quantity) VALUES (1, 'Fabric Inc', 'Spain', 150.00, 100), (2, 'Stitch Time', 'USA', 120.00, 200), (3, 'Sew Good', 'India', 130.00, 150); | What is the production cost per garment for the top 3 producing factories in the world? | SELECT factory, cost/quantity as cost_per_garment FROM (SELECT factory, cost, quantity, ROW_NUMBER() OVER (ORDER BY quantity DESC) as rn FROM production) t WHERE rn <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_posts (title VARCHAR(255), likes INT, publication_year INT, author_continent VARCHAR(50)); INSERT INTO global_posts (title, likes, publication_year, author_continent) VALUES ('Post1', 250, 2021, 'Africa'), ('Post2', 300, 2020, 'Africa'), ('Post3', 150, 2022, 'Africa'), ('Post4', 400, 2021, 'Europe')... | Determine the maximum number of likes received by posts published in the 'global_posts' table, authored by users from Africa, in the year 2021. | SELECT MAX(likes) FROM global_posts WHERE publication_year = 2021 AND author_continent = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (Country VARCHAR(50), VendorCount INT); INSERT INTO Countries (Country, VendorCount) VALUES ('France', 300), ('Italy', 250), ('Spain', 200), ('Germany', 400), ('Sweden', 280), ('Norway', 150), ('Denmark', 180); | Which countries have the highest number of ethical fashion vendors? | SELECT Country, VendorCount FROM Countries ORDER BY VendorCount DESC FETCH FIRST 3 ROWS ONLY; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, campaign_name TEXT, region TEXT); CREATE TABLE conditions (condition_id INT, condition_name TEXT, campaign_id INT); INSERT INTO campaigns (campaign_id, campaign_name, region) VALUES (1, 'Mental Health Matters', 'Asia-Pacific'); INSERT INTO conditions (condition_id, condition_nam... | List all mental health conditions treated in public awareness campaigns in the Asia-Pacific region. | SELECT conditions.condition_name FROM conditions JOIN campaigns ON conditions.campaign_id = campaigns.campaign_id WHERE campaigns.region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Material_Sources (source_id INT, country VARCHAR(50), material VARCHAR(50), carbon_footprint FLOAT); | What is the average carbon footprint of cotton products sourced from India and Pakistan? | SELECT AVG(Material_Sources.carbon_footprint) as avg_carbon_footprint FROM Material_Sources WHERE Material_Sources.country IN ('India', 'Pakistan') AND Material_Sources.material = 'cotton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (1, 25, 'Male', 'Japan'); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (2, 30, 'Female', 'China'); CREATE TABLE VRAdoption (PlayerID INT, VRPurchaseDate DATE)... | How many players from Asia are using VR technology? | SELECT COUNT(Players.PlayerID) FROM Players INNER JOIN VRAdoption ON Players.PlayerID = VRAdoption.PlayerID WHERE Players.Country LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_id INT, drug_name TEXT, approval_year INT, R_D_expenses FLOAT); INSERT INTO drugs (drug_id, drug_name, approval_year, R_D_expenses) VALUES (1001, 'DrugA', 2017, 1200000), (1002, 'DrugB', 2018, 1500000), (1003, 'DrugC', 2017, 1300000), (1004, 'DrugD', 2018, 1100000); | What is the average R&D expenditure for drugs approved in 2017 and 2018? | SELECT approval_year, AVG(R_D_expenses) as avg_R_D_expenses FROM drugs WHERE approval_year IN (2017, 2018) GROUP BY approval_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE courses (id INT PRIMARY KEY, name VARCHAR(50), instructor VARCHAR(50), department VARCHAR(50)); | Delete the record for the course "AI Ethics" from the "courses" table | DELETE FROM courses WHERE name = 'AI Ethics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (product_id INT, product_name VARCHAR(30), weight FLOAT); INSERT INTO inventory (product_id, product_name, weight) VALUES (1, 'Apples', 15.3), (2, 'Oranges', 12.9); | What is the total weight of apples in the inventory? | SELECT SUM(weight) FROM inventory WHERE product_name = 'Apples'; | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_cases (case_id INT, case_number VARCHAR(20), case_type VARCHAR(30), court_location VARCHAR(30), processing_date DATE); | What is the average time to process cases by case type in the 'criminal_cases' table? | SELECT case_type, AVG(DATEDIFF(processing_date, court_date)) AS avg_processing_time FROM criminal_cases GROUP BY case_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher (teacher_id INT, district_id INT, FOREIGN KEY (district_id) REFERENCES school_district(district_id)); CREATE TABLE course (course_id INT, course_name VARCHAR(50), course_year INT, PRIMARY KEY(course_id)); CREATE TABLE teacher_course (teacher_id INT, course_id INT, completed_date DATE, PRIMARY KEY(t... | Which professional development courses did teachers in the 'Uptown' school district complete in the last year? | SELECT c.course_name, c.course_year FROM teacher t INNER JOIN teacher_course tc ON t.teacher_id = tc.teacher_id INNER JOIN course c ON tc.course_id = c.course_id WHERE t.district_id = 2 AND tc.completed_date >= '2021-01-01' AND tc.completed_date < '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE program (id INT, name VARCHAR(50), type VARCHAR(50)); CREATE TABLE grant (id INT, title VARCHAR(100), program_id INT, impact_factor DECIMAL(3,1)); | Identify the graduate programs with the highest average impact factor of their published research grants. | SELECT p.name, AVG(g.impact_factor) as avg_impact_factor FROM program p JOIN grant g ON p.id = g.program_id GROUP BY p.name ORDER BY avg_impact_factor DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutonomousDrivingResearch (id INT, project_name VARCHAR(50), funding_source VARCHAR(50)); INSERT INTO AutonomousDrivingResearch (id, project_name, funding_source) VALUES (1, 'Project A', 'Company X'); INSERT INTO AutonomousDrivingResearch (id, project_name, funding_source) VALUES (2, 'Project B', 'Governme... | List all autonomous driving research projects and their respective funding sources. | SELECT project_name, funding_source FROM AutonomousDrivingResearch; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback (Location VARCHAR(255), ResponseTime INT); INSERT INTO Feedback (Location, ResponseTime) VALUES ('Rural', 120), ('Rural', 150), ('Urban', 90), ('Urban', 100); | What is the average response time for citizen feedback in the rural areas? | SELECT AVG(ResponseTime) FROM Feedback WHERE Location = 'Rural'; | gretelai_synthetic_text_to_sql |
CREATE TABLE TheatrePerformances (id INT, borough VARCHAR(10), performance_type VARCHAR(20), performance_date DATE); INSERT INTO TheatrePerformances (id, borough, performance_type, performance_date) VALUES (1, 'Manhattan', 'Play', '2020-02-01'), (2, 'Brooklyn', 'Musical', '2020-10-15'), (3, 'Queens', 'Opera', '2020-07-... | What was the total number of theatre performances in each borough in 2020? | SELECT borough, performance_type, COUNT(*) as performance_count FROM TheatrePerformances WHERE YEAR(performance_date) = 2020 AND performance_type = 'Play' GROUP BY borough, performance_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_good (region VARCHAR(255), ai_impact FLOAT, updated_on DATE); | Add a new column gender_equality to the social_good table | ALTER TABLE social_good ADD gender_equality VARCHAR(255); | gretelai_synthetic_text_to_sql |
CREATE TABLE preparedness_drills (id INT, state VARCHAR(20), drill_type VARCHAR(20), date DATE); INSERT INTO preparedness_drills (id, state, drill_type, date) VALUES (1, 'Texas', 'evacuation', '2021-01-01'); INSERT INTO preparedness_drills (id, state, drill_type, date) VALUES (2, 'California', 'shelter', '2021-01-02'); | What is the total number of disaster preparedness drills and exercises in the state of Texas, compared to the number of drills and exercises in the state of California? | SELECT state, SUM(drill_count) FROM (SELECT state, COUNT(*) AS drill_count FROM preparedness_drills WHERE state = 'Texas' GROUP BY state UNION ALL SELECT 'California' AS state, COUNT(*) AS drill_count FROM preparedness_drills WHERE state = 'California' GROUP BY state) AS drills GROUP BY state | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, state TEXT, size INT); INSERT INTO mines (id, name, state, size) VALUES (1, 'Golden Mine', 'Texas', 500), (2, 'Silver Mine', 'Texas', 300), (3, 'Bronze Mine', 'California', 200), (4, 'Platinum Mine', 'California', 400); | What is the average size of mines by state in the USA? | SELECT state, AVG(size) as avg_size FROM mines GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (id INT, item_name VARCHAR(255), warehouse_location VARCHAR(255)); INSERT INTO inventory (id, item_name, warehouse_location) VALUES (42, 'Widget', 'Aisle 3'), (43, 'Gizmo', 'Aisle 5'); | Update the warehouse location for item with ID 42 | UPDATE inventory SET warehouse_location = 'Aisle 7' WHERE id = 42; | gretelai_synthetic_text_to_sql |
CREATE TABLE global_news_articles (id INT, title VARCHAR(100), publication_date DATE, author VARCHAR(50), word_count INT, language VARCHAR(20)); INSERT INTO global_news_articles (id, title, publication_date, author, word_count, language) VALUES (1, 'Article 1', '2022-01-01', 'John Doe', 500, 'English'), (2, 'Article 2'... | What is the total word count of articles by language in 'global_news_articles' table? | SELECT language, SUM(word_count) as total_word_count FROM global_news_articles GROUP BY language; | gretelai_synthetic_text_to_sql |
CREATE TABLE StreamsPerUser(id INT, genre VARCHAR(10), region VARCHAR(10), user_id INT, date DATE, streams INT); | What is the number of streams per user per day for the "r&b" genre in the African region for the year 2018? | SELECT date, user_id, AVG(CAST(streams AS FLOAT)/COUNT(date)) AS streams_per_day FROM StreamsPerUser WHERE genre = 'r&b' AND region = 'African' AND year = 2018 GROUP BY date, user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE artist_origin (id INT, artist_name VARCHAR(50), origin VARCHAR(50)); CREATE TABLE artwork_value (id INT, artwork_name VARCHAR(50), artist_id INT, value DECIMAL(10, 2)); | What is the average value of artworks by Indigenous Australian artists? | SELECT AVG(value) as avg_value FROM artwork_value a JOIN artist_origin o ON a.artist_id = o.id WHERE o.origin = 'Indigenous Australian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE baltic_sea (id INT, well_name VARCHAR(255), drill_date DATE, daily_production_gas FLOAT); | What is the minimum daily production rate of gas wells in the Baltic Sea that were drilled after 2015? | SELECT MIN(daily_production_gas) as min_daily_production_gas FROM baltic_sea WHERE drill_date > '2015-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Applications (ApplicationID INT, CandidateName VARCHAR(50), JobTitle VARCHAR(50), ApplicationDate DATE); INSERT INTO Applications (ApplicationID, CandidateName, JobTitle, ApplicationDate) VALUES (1, 'John Doe', 'Manager', '2022-01-01'), (2, 'Jane Smith', 'Manager', '2022-01-02'), (3, 'Bob Johnson', 'Develo... | Identify the top 3 candidates who applied for a position, ordered by application date in descending order, for each job title. | SELECT JobTitle, CandidateName, ApplicationDate, ROW_NUMBER() OVER (PARTITION BY JobTitle ORDER BY ApplicationDate DESC) AS Rank FROM Applications WHERE Rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_mental_health (student_id INT, score INT, year INT); INSERT INTO student_mental_health (student_id, score, year) VALUES (1, 80, 2021), (1, 85, 2022), (2, 70, 2021), (2, 75, 2022), (3, 90, 2021), (3, 95, 2022); | What is the trend of mental health scores over the years? | SELECT year, AVG(score) as avg_score FROM student_mental_health GROUP BY year ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapists (id INT, name TEXT); CREATE TABLE therapy_sessions (id INT, therapist_id INT, session_date DATE); INSERT INTO therapists (id, name) VALUES (1, 'Dewi Suryani'); INSERT INTO therapists (id, name) VALUES (2, 'Temitope Johnson'); INSERT INTO therapy_sessions (id, therapist_id, session_date) VALUES (... | Who are the therapists with the least number of sessions in Indonesia and Nigeria? | SELECT therapists.name, COUNT(therapy_sessions.id) AS session_count FROM therapists INNER JOIN therapy_sessions ON therapists.id = therapy_sessions.therapist_id WHERE therapists.name IN ('Dewi Suryani', 'Temitope Johnson') GROUP BY therapists.name ORDER BY session_count ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_tours (tour_id INT, city VARCHAR(50), sustainability_rating DECIMAL(3,1)); INSERT INTO cultural_tours (tour_id, city, sustainability_rating) VALUES (1, 'New Delhi', 3.2), (2, 'New Delhi', 3.8), (3, 'Mumbai', 4.2), (4, 'Bangalore', 3.9); | Update the sustainability ratings for cultural tours in New Delhi with a rating below 3.5. | UPDATE cultural_tours SET sustainability_rating = sustainability_rating + 0.5 WHERE city = 'New Delhi' AND sustainability_rating < 3.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE world_temperature (country VARCHAR(255), temperature DECIMAL(5,2), measurement_date DATE, continent VARCHAR(255)); INSERT INTO world_temperature (country, temperature, measurement_date, continent) VALUES ('South Africa', 25.3, '2019-01-01', 'Africa'), ('Nigeria', 28.1, '2019-01-01', 'Africa'), ('Canada', 1... | Find the percentage change in temperature for each continent between 2019 and 2020 in the 'world_temperature' table. | SELECT a.continent, (a.temperature - b.temperature) * 100.0 / b.temperature as temperature_change_percentage FROM world_temperature a INNER JOIN world_temperature b ON a.continent = b.continent WHERE YEAR(a.measurement_date) = 2020 AND YEAR(b.measurement_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE vr_headsets (id INT PRIMARY KEY, name VARCHAR(50), manufacturer VARCHAR(50), release_date DATE); | Add new virtual reality headset records | INSERT INTO vr_headsets (id, name, manufacturer, release_date) VALUES (1, 'Headset A', 'Company X', '2022-10-01'), (2, 'Headset B', 'Company Y', '2023-02-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_resolution (id INT, category VARCHAR(255), resolution_time INT, resolution_date DATE); | What is the average time to resolve security incidents in the 'Malware' category in the last quarter? | SELECT AVG(resolution_time) FROM incident_resolution WHERE category = 'Malware' AND resolution_date >= DATEADD(quarter, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthcareProviders (ProviderID INT, CulturalCompetencyScore INT); INSERT INTO HealthcareProviders (ProviderID, CulturalCompetencyScore) VALUES (1, 85); INSERT INTO HealthcareProviders (ProviderID, CulturalCompetencyScore) VALUES (2, 90); INSERT INTO HealthcareProviders (ProviderID, CulturalCompetencyScore... | What is the cultural competency score distribution among healthcare providers? | SELECT CulturalCompetencyScore, COUNT(*) FROM HealthcareProviders GROUP BY CulturalCompetencyScore; | gretelai_synthetic_text_to_sql |
CREATE TABLE TraditionalArts (id INT, name VARCHAR(255), region VARCHAR(255), start_year INT); INSERT INTO TraditionalArts (id, name, region, start_year) VALUES (1, 'Powwow Dancing', 'North America', 1970); | List the traditional arts practiced in 'North America' since 1990. | SELECT name FROM TraditionalArts WHERE region = 'North America' AND start_year >= 1990; | gretelai_synthetic_text_to_sql |
CREATE TABLE Indian_Ocean (id INT, dissolved_oxygen DECIMAL(5,2)); INSERT INTO Indian_Ocean (id, dissolved_oxygen) VALUES (1, 6.5), (2, 7.2), (3, 5.9); CREATE TABLE Tilapia_Farms (id INT, ocean VARCHAR(20)); INSERT INTO Tilapia_Farms (id, ocean) VALUES (1, 'Indian'), (2, 'Pacific'), (3, 'Indian'); | What is the lowest dissolved oxygen level in the Indian Ocean for tilapia farms? | SELECT MIN(Indian_Ocean.dissolved_oxygen) FROM Indian_Ocean INNER JOIN Tilapia_Farms ON Indian_Ocean.id = Tilapia_Farms.id WHERE Tilapia_Farms.ocean = 'Indian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (event_id INT, genre VARCHAR(20), revenue FLOAT, event_date DATE); INSERT INTO events (event_id, genre, revenue, event_date) VALUES (1, 'Dance', 2000, '2021-04-10'); INSERT INTO events (event_id, genre, revenue, event_date) VALUES (2, 'Dance', 3000, '2021-06-15'); | What was the total revenue for 'Dance' concerts in Q2 2021? | SELECT SUM(revenue) FROM events WHERE genre = 'Dance' AND event_date BETWEEN '2021-04-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR, email VARCHAR); CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL, payment_method VARCHAR, program_id INT); CREATE TABLE programs (id INT, name VARCHAR, budget DECIMAL); | List the top 5 donors by total donation amount and the corresponding programs | SELECT donors.name as top_donors, SUM(donations.amount) as total_donation_amount, programs.name as program_name FROM donors JOIN donations ON donors.id = donations.donor_id JOIN programs ON donations.program_id = programs.id GROUP BY donors.id, programs.id ORDER BY total_donation_amount DESC, top_donors LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_wellbeing_programs (program_id INT, country VARCHAR(20)); INSERT INTO financial_wellbeing_programs (program_id, country) VALUES (101, 'USA'), (102, 'Canada'), (103, 'Mexico'), (104, 'USA'), (105, 'Canada'); | Find the total number of financial wellbeing programs offered in each country? | SELECT country, COUNT(*) FROM financial_wellbeing_programs GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, category VARCHAR(20), is_organic BOOLEAN); INSERT INTO products (product_id, category, is_organic) VALUES (1, 'Natural', false), (2, 'Organic', true), (3, 'Natural', true), (4, 'Conventional', false); | What is the percentage of organic products in each category, ranked in descending order of the percentage? | SELECT category, 100.0 * COUNT(*) FILTER (WHERE is_organic) / COUNT(*) as percentage FROM products GROUP BY category ORDER BY percentage DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customers (CustomerId INT, FirstName VARCHAR(20), LastName VARCHAR(20), AccountId INT); INSERT INTO Customers (CustomerId, FirstName, LastName, AccountId) VALUES (1, 'John', 'Doe', 1), (2, 'Jane', 'Doe', 2); CREATE TABLE Accounts (AccountId INT, AccountType VARCHAR(20)); INSERT INTO Accounts (AccountId, Ac... | Who are the customers with Investment accounts and their Investment types? | SELECT C.FirstName, C.LastName, I.InvestmentType FROM Customers C JOIN Accounts A ON C.AccountId = A.AccountId JOIN Investments I ON A.AccountId = I.AccountId WHERE A.AccountType = 'Investment'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence (id INT, event_date DATE); INSERT INTO threat_intelligence (id, event_date) VALUES (1, '2022-02-01'), (2, '2022-02-02'), (3, '2022-02-03'), (4, '2022-02-04'), (5, '2022-02-05'), (6, '2022-02-06'), (7, '2022-02-07'); | How many threat intelligence events were recorded per day in the past week? | SELECT event_date, COUNT(*) as event_count FROM threat_intelligence WHERE event_date >= DATEADD(day, -7, GETDATE()) GROUP BY event_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (product VARCHAR(255), is_vegan BOOLEAN); INSERT INTO inventory (product, is_vegan) VALUES ('Vegan Mascara', TRUE), ('Non-Vegan Lipstick', FALSE); | Show the number of vegan and non-vegan beauty products in the inventory | SELECT COUNT(*) FROM inventory WHERE is_vegan = TRUE; SELECT COUNT(*) FROM inventory WHERE is_vegan = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, brand VARCHAR(100), category VARCHAR(100), revenue FLOAT); | List the top 3 brands by sales in descending order for the "makeup" category. | SELECT brand, SUM(revenue) as total_sales FROM sales WHERE category = 'makeup' GROUP BY brand ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE game (game_id INT, game_title VARCHAR(50), game_genre VARCHAR(20), revenue INT); INSERT INTO game (game_id, game_title, game_genre, revenue) VALUES (1, 'League of Legends', 'MOBA', 1000000); INSERT INTO game (game_id, game_title, game_genre, revenue) VALUES (2, 'Mario Kart', 'Racing', 500000); | What is the total revenue generated from each game genre? | SELECT game_genre, SUM(revenue) FROM game GROUP BY game_genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouses (id INT, name TEXT, location TEXT); INSERT INTO warehouses (id, name, location) VALUES (1, 'WH1', 'New York'), (2, 'WH2', 'Chicago'), (3, 'WH3', 'Los Angeles'); CREATE TABLE chemicals (id INT, name TEXT, type TEXT); INSERT INTO chemicals (id, name, type) VALUES (1, 'ChemA', 'Pharma'), (2, 'ChemB... | What are the names and locations of warehouses that store chemicals used in the production of pharmaceuticals? | SELECT w.name, w.location FROM warehouses w INNER JOIN inventory i ON w.id = i.warehouse_id INNER JOIN chemicals c ON i.chemical_id = c.id WHERE c.type = 'Pharma'; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft_manufacturing (model VARCHAR(50), units_produced INT); | Which aircraft models in the 'aircraft_manufacturing' table have more than 500 units produced? | SELECT model FROM aircraft_manufacturing WHERE units_produced > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sustainable_Projects (Project_ID INT, Project_Name TEXT, Location TEXT, Cost FLOAT, Sustainable BOOLEAN, Type TEXT); INSERT INTO Sustainable_Projects (Project_ID, Project_Name, Location, Cost, Sustainable, Type) VALUES (1, 'Green House', 'California', 500000.00, true, 'Residential'), (2, 'Eco Office', 'New... | What is the total cost of commercial projects in New York? | SELECT SUM(Cost) FROM Sustainable_Projects WHERE Location = 'New York' AND Type = 'Commercial'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Makeup_Sales (SaleID int, ProductName varchar(100), SaleDate date, QuantitySold int, IsVegan bit); INSERT INTO Makeup_Sales (SaleID, ProductName, SaleDate, QuantitySold, IsVegan) VALUES (1, 'Vegan Lipstick', '2021-01-01', 500, 1); INSERT INTO Makeup_Sales (SaleID, ProductName, SaleDate, QuantitySold, IsVeg... | How many vegan makeup products were sold in Canada in 2021? | SELECT SUM(QuantitySold) FROM Makeup_Sales WHERE IsVegan = 1 AND SaleDate >= '2021-01-01' AND SaleDate <= '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bookings (booking_id INT, booking_date DATE, region VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO bookings (booking_id, booking_date, region, revenue) VALUES (1, '2022-01-01', 'APAC', 100), (2, '2022-02-01', 'APAC', 200), (3, '2022-03-01', 'APAC', 300); | What is the total revenue generated by hotel bookings in the APAC region in Q1 2022? | SELECT SUM(revenue) FROM bookings WHERE region = 'APAC' AND booking_date >= '2022-01-01' AND booking_date < '2022-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (id INT PRIMARY KEY, chemical_name VARCHAR(255), co2_emissions INT, date DATE); INSERT INTO co2_emissions (id, chemical_name, co2_emissions, date) VALUES (7, 'Acetic Acid', 120, '2022-05-01'); INSERT INTO co2_emissions (id, chemical_name, co2_emissions, date) VALUES (8, 'Oxalic Acid', 180, '2... | What is the CO2 emissions rank for each chemical in the past year? | SELECT chemical_name, co2_emissions, RANK() OVER(ORDER BY co2_emissions DESC) as co2_rank FROM co2_emissions WHERE date >= DATEADD(year, -1, GETDATE()); | 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.