context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Health_Inspections (Restaurant text, Rating int, InspectionDate date); | Insert a new record into the health_inspections table with a rating of 95 for 'RestaurantA' on '2022-05-15'? | INSERT INTO Health_Inspections (Restaurant, Rating, InspectionDate) VALUES ('RestaurantA', 95, '2022-05-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE techniques (id INT, name VARCHAR(255), domain VARCHAR(255), published_date DATE); | What explainable AI techniques were applied in the past year for speech recognition tasks, in the Explainable AI database? | SELECT name FROM techniques WHERE domain = 'Speech Recognition' AND YEAR(published_date) = YEAR(CURRENT_DATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganizationRisks (OrgID INT, Sector VARCHAR(50), RiskRating INT, Year INT); INSERT INTO OrganizationRisks (OrgID, Sector, RiskRating, Year) VALUES (1, 'Technology', 3, 2018), (2, 'Technology', 4, 2018), (3, 'Technology', 2, 2019), (4, 'Technology', 3, 2019), (5, 'Technology', 5, 2020), (6, 'Technology', 4... | Identify the risk rating trends for organizations in the technology sector over time? | SELECT Sector, Year, RiskRating, COUNT(*) OVER (PARTITION BY Sector, RiskRating ORDER BY Year) as CountByRiskRating FROM OrganizationRisks WHERE Sector = 'Technology'; | gretelai_synthetic_text_to_sql |
INSERT INTO claims (id, policyholder_id, claim_amount, claim_date) VALUES (4, 3, 3000, '2021-02-03'); INSERT INTO claims (id, policyholder_id, claim_amount, claim_date) VALUES (5, 3, 1000, '2021-06-18'); | What is the total claim amount for policyholders in New York with 'Home' policy_type? | SELECT SUM(claim_amount) FROM claims JOIN policyholders ON claims.policyholder_id = policyholders.id WHERE policyholders.state = 'New York' AND policyholders.policy_type = 'Home'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildingProjects (id INT, city VARCHAR(50), project_status VARCHAR(50)); INSERT INTO GreenBuildingProjects (id, city, project_status) VALUES (1, 'NYC', 'Completed'), (2, 'LA', 'In Progress'), (3, 'NYC', 'Completed'); | How many green building projects were completed in each city in the 'GreenBuildingProjects' table? | SELECT city, COUNT(*) FROM GreenBuildingProjects WHERE project_status = 'Completed' GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfills (id INT, region_id INT, capacity INT); INSERT INTO landfills (id, region_id, capacity) VALUES (1, 3, 1000), (2, 3, 2000), (3, 1, 500), (4, 1, 700); CREATE TABLE regions (id INT, name VARCHAR(20)); INSERT INTO regions (id, name) VALUES (1, 'North America'), (2, 'South America'), (3, 'Europe'); | What is the capacity of landfills in the North American region? | SELECT SUM(landfills.capacity) FROM landfills INNER JOIN regions ON landfills.region_id = regions.id WHERE regions.name = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotel_reviews (id INT, hotel_id INT, guest_name VARCHAR(50), rating INT, review_date DATE, region VARCHAR(50)); | In hotel_reviews_table, for the Europe region, update the rating to 1 star lower if the original rating is 5 | UPDATE hotel_reviews SET rating = CASE WHEN rating = 5 THEN 4 ELSE rating END WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (project_id INT, project_name VARCHAR(100), country VARCHAR(50), energy_source VARCHAR(50), installed_capacity FLOAT); CREATE TABLE countries (country VARCHAR(50), continent VARCHAR(50)); | Count the number of renewable energy projects in each country by energy source. | SELECT r.energy_source, c.country, COUNT(r.project_id) FROM renewable_projects r INNER JOIN countries c ON r.country = c.country GROUP BY r.energy_source, c.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Customer_Data (Customer_ID INT, Purchase_Date DATE, Item_Size INT); INSERT INTO Customer_Data (Customer_ID, Purchase_Date, Item_Size) VALUES (1, '2022-01-01', 12), (2, '2022-02-01', 14), (3, '2022-03-01', 12), (4, '2022-04-01', 16), (5, '2022-05-01', 12), (6, '2022-06-01', 12); | How many unique customers have purchased size 12 garments in the last 6 months? | SELECT COUNT(DISTINCT Customer_ID) FROM Customer_Data WHERE Item_Size = 12 AND Purchase_Date BETWEEN '2022-01-01' AND '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_stations (id INT, station_id INT, departure_time TIME); INSERT INTO bus_stations (id, station_id, departure_time) VALUES (1, 1, '07:00:00'), (2, 2, '08:00:00'), (3, 1, '18:00:00'); | What is the earliest and latest time a bus has departed from a station, for each station, in the last month? | SELECT MIN(departure_time) as earliest_time, MAX(departure_time) as latest_time, station_id FROM bus_stations WHERE departure_time >= DATEADD(day, -30, GETDATE()) GROUP BY station_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE annual_production (id INT, country VARCHAR(255), mineral VARCHAR(255), year INT, quantity INT); INSERT INTO annual_production (id, country, mineral, year, quantity) VALUES (1, 'China', 'Coal', 2020, 3500), (2, 'USA', 'Coal', 2020, 1200), (3, 'India', 'Coal', 2020, 2000); | What is the percentage of global coal production by China? | SELECT 100.0 * SUM(CASE WHEN country = 'China' THEN quantity ELSE 0 END) / SUM(quantity) as percentage_of_global_coal_production FROM annual_production WHERE mineral = 'Coal' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_participation_events (id INT, sector VARCHAR(20), year INT); INSERT INTO public_participation_events (id, sector, year) VALUES (1, 'justice', 2018), (2, 'justice', 2019), (3, 'justice', 2020), (4, 'healthcare', 2018), (5, 'healthcare', 2019), (6, 'healthcare', 2020), (7, 'healthcare', 2021); | What is the total number of public participation events in the healthcare sector in the last 4 years? | SELECT SUM(1) FROM public_participation_events WHERE sector = 'healthcare' AND year BETWEEN (SELECT MAX(year) - 3 FROM public_participation_events) AND MAX(year); | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, sector VARCHAR(255), vulnerability VARCHAR(255), date DATE); | Which types of vulnerabilities were found in the healthcare sector in the past week? | SELECT DISTINCT vulnerability FROM vulnerabilities WHERE sector = 'healthcare' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech;USE biotech;CREATE TABLE if not exists startups(id INT, name VARCHAR(255), location VARCHAR(255), funding FLOAT);INSERT INTO startups(id, name, location, funding) VALUES (1, 'StartupA', 'California', 15000000.00), (2, 'StartupB', 'New York', 20000000.00), (3, 'StartupC', 'California'... | What is the maximum funding amount for biotech startups located in each state? | SELECT location, MAX(funding) FROM biotech.startups GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, sector TEXT, exit_strategy TEXT); INSERT INTO startups VALUES(1, 'StartupA', 'E-commerce', 'Acquisition'); INSERT INTO startups VALUES(2, 'StartupB', 'Tech', 'IPO'); INSERT INTO startups VALUES(3, 'StartupC', 'E-commerce', 'Bankruptcy'); INSERT INTO startups VALUES(4, 'StartupD'... | How many startups have exited via acquisition or IPO in the E-commerce sector? | SELECT COUNT(*) FROM startups WHERE sector = 'E-commerce' AND exit_strategy IN ('Acquisition', 'IPO'); | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT PRIMARY KEY, name VARCHAR(100), age INT, gender VARCHAR(10), location VARCHAR(50)); INSERT INTO farmers (id, name, age, gender, location) VALUES (1, 'Jane Doe', 35, 'Female', 'Rural Texas'); | Insert data into 'farmers' table | INSERT INTO farmers (id, name, age, gender, location) VALUES (2, 'Pedro Alvarez', 42, 'Male', 'Rural Mexico'); | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_incidents (id INT, incident_type VARCHAR(255), incident_count INT); INSERT INTO emergency_incidents (id, incident_type, incident_count) VALUES (1, 'Medical', 300), (2, 'Fire', 150), (3, 'Rescue', 200); | What is the total number of emergency incidents for each type, ordered by the total? | SELECT incident_type, SUM(incident_count) as total_incidents FROM emergency_incidents GROUP BY incident_type ORDER BY total_incidents DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR(50)); | Identify top 5 donors by total donation amount | SELECT d.name, SUM(donations.amount) as total_donations FROM donors d JOIN donations ON d.id = donations.donor_id GROUP BY d.name ORDER BY total_donations DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Military_Operations (id INT, operation VARCHAR(50)); INSERT INTO Military_Operations (id, operation) VALUES (1, 'Operation Enduring Freedom'); INSERT INTO Military_Operations (id, operation) VALUES (2, 'Operation Iraqi Freedom'); | What are the names of the military operations in the 'Military_Operations' table? | SELECT DISTINCT operation FROM Military_Operations; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, case_type VARCHAR(50)); INSERT INTO cases (case_id, case_type) VALUES (1, 'Divorce'), (2, 'Bankruptcy'), (3, 'Divorce'), (4, 'Custody'); | What is the most common case type in the database? | SELECT case_type, COUNT(*) as count FROM cases GROUP BY case_type ORDER BY count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, name TEXT, region TEXT); CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, stars FLOAT, is_eco_friendly BOOLEAN); | Show the top 3 destinations with the highest percentage of eco-friendly hotels among all hotels in their respective countries. | SELECT c.name, COUNT(h.hotel_id) AS total_hotels, SUM(h.is_eco_friendly) AS eco_friendly_hotels, ROUND(SUM(h.is_eco_friendly) * 100.0 / COUNT(h.hotel_id), 2) AS pct_eco_friendly FROM hotels h INNER JOIN countries c ON h.country = c.name GROUP BY c.name ORDER BY pct_eco_friendly DESC, total_hotels DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(100), content TEXT, publish_date DATE, word_count INT); INSERT INTO articles (id, title, content, publish_date, word_count) VALUES (1, 'Article 1', 'Content 1', '2020-01-01', 500), (2, 'Article 2', 'Content 2', '2020-01-15', 700), (3, 'Article 3', 'Content 3', '2019-12-31', ... | What is the total word count of articles published in 2020? | SELECT SUM(word_count) as total_word_count FROM articles WHERE YEAR(publish_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteID int, SiteName varchar(50), Location varchar(50)); CREATE TABLE PublicOutreach (EventID int, SiteID int, EventType varchar(20)); CREATE TABLE Artifacts (ArtifactID int, SiteID int, Material varchar(20), Description varchar(100)); | What are the site names, locations, and total number of artifacts for excavation sites with public outreach events? | SELECT ExcavationSites.SiteName, ExcavationSites.Location, COUNT(Artifacts.ArtifactID) AS TotalArtifacts FROM ExcavationSites INNER JOIN PublicOutreach ON ExcavationSites.SiteID = PublicOutreach.SiteID INNER JOIN Artifacts ON ExcavationSites.SiteID = Artifacts.SiteID WHERE PublicOutreach.EventType = 'event' GROUP BY Ex... | gretelai_synthetic_text_to_sql |
CREATE TABLE blog_posts (id INT, title VARCHAR(50), word_count INT, author_name VARCHAR(50), author_region VARCHAR(50)); INSERT INTO blog_posts (id, title, word_count, author_name, author_region) VALUES (1, 'Post1', 500, 'John Doe', 'Asia'), (2, 'Post2', 700, 'Jane Smith', 'Africa'), (3, 'Post3', 600, 'Bob Johnson', 'A... | What is the average word count of blog posts written by authors from Asia and Africa, in the last month? | SELECT author_region, AVG(word_count) as avg_word_count FROM blog_posts WHERE author_region IN ('Asia', 'Africa') AND post_date >= NOW() - INTERVAL 30 DAY GROUP BY author_region; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA culture; CREATE TABLE programs (program_id INT, type VARCHAR(255), visitors INT, program_date DATE); INSERT INTO programs (program_id, type, visitors, program_date) VALUES (1, 'Exhibition', 200, '2021-01-10'), (2, 'Workshop', 50, '2021-02-12'), (3, 'Lecture', 100, '2021-03-15'); | How many visitors attended each program type in the first half of 2021? | SELECT type, COUNT(visitors) as total_visitors FROM programs WHERE program_date < DATEADD(year, 1, '2021-01-01') AND program_date >= '2021-01-01' GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation_projects(id INT, organization VARCHAR(255), project VARCHAR(255), start_year INT, technology VARCHAR(255)); INSERT INTO military_innovation_projects(id, organization, project, start_year, technology) VALUES (1, 'ASEAN', 'AI in Border Control', 2017, 'AI'), (2, 'AU', 'Autonomous Underwat... | What is the minimum number of military innovation projects initiated by ASEAN that involve artificial intelligence (AI) between 2017 and 2022, inclusive? | SELECT MIN(id) FROM military_innovation_projects WHERE organization = 'ASEAN' AND technology = 'AI' AND start_year BETWEEN 2017 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Materials (Id INT, MaterialName VARCHAR(50), Quantity INT, UnitPrice DECIMAL(5,2), ProjectId INT); CREATE TABLE Projects (Id INT, Name VARCHAR(50), City VARCHAR(50), StartDate DATE, EndDate DATE, Sustainable BOOLEAN, Country VARCHAR(50)); | What is the total quantity of lumber used in green building projects in Seattle, WA? | SELECT SUM(m.Quantity) FROM Materials m JOIN Projects p ON m.ProjectId = p.Id WHERE p.City = 'Seattle' AND p.Country = 'WA' AND p.Sustainable = TRUE AND m.MaterialName = 'Lumber'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fares (service text, date date, fare decimal); INSERT INTO fares (service, date, fare) VALUES ('subway', '2023-01-01', 2.50), ('bus', '2023-01-02', 1.50); | Update the fare for the 'subway' service to $2.50 on January 1, 2023. | UPDATE fares SET fare = 2.50 WHERE service = 'subway' AND date = '2023-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, player_name VARCHAR(255), team_name VARCHAR(255)); INSERT INTO players VALUES (1, 'Stephen Curry', 'Golden State Warriors'); INSERT INTO players VALUES (2, 'Kevin Durant', 'Golden State Warriors'); CREATE TABLE points (player_id INT, points INT, games_played INT); INSERT INTO points... | List all basketball players who have played for the 'Golden State Warriors' and their total points scored, sorted by the number of games played. | SELECT p.player_name, p.team_name, SUM(pnts.points) as total_points FROM players p INNER JOIN points pnts ON p.player_id = pnts.player_id WHERE p.team_name = 'Golden State Warriors' GROUP BY p.player_id ORDER BY games_played DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (country VARCHAR(50), amount NUMERIC(10,2)); INSERT INTO humanitarian_assistance (country, amount) VALUES ('Japan', 25000000), ('USA', 50000000), ('Germany', 15000000), ('UK', 20000000), ('France', 22000000); | What is the maximum humanitarian assistance provided by Japan? | SELECT MAX(amount) FROM humanitarian_assistance WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rare_earth_production (year INT, element VARCHAR(10), production_quantity FLOAT); INSERT INTO rare_earth_production (year, element, production_quantity) VALUES (2015, 'Neodymium', 12000), (2016, 'Neodymium', 15000), (2017, 'Neodymium', 18000), (2018, 'Neodymium', 20000), (2019, 'Neodymium', 22000), (2020, ... | Update the production quantity of Dysprosium in 2018 to 13500 in the 'rare_earth_production' table. | UPDATE rare_earth_production SET production_quantity = 13500 WHERE element = 'Dysprosium' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_sightings (id INT, marine_life_type VARCHAR(255), sighting_date DATE, ocean_basin VARCHAR(255)); INSERT INTO marine_sightings (id, marine_life_type, sighting_date, ocean_basin) VALUES (1, 'Coral', '2021-01-01', 'Atlantic'), (2, 'Anglerfish', '2021-01-01', 'Pacific'); | Determine the number of marine species sighted in the last year, grouped by ocean basin. | SELECT ocean_basin, COUNT(*) FROM marine_sightings WHERE sighting_date > (CURRENT_DATE - INTERVAL '1 year') GROUP BY ocean_basin; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (GameID INT, GameName VARCHAR(50), Platform VARCHAR(10), GameGenre VARCHAR(20)); | Find the total number of games and unique genres for each platform. | SELECT Platform, COUNT(DISTINCT GameGenre) AS Unique_Genres, COUNT(*) AS Total_Games FROM Games GROUP BY Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE coaches (id INT, name TEXT, type TEXT); CREATE TABLE teams (id INT, name TEXT, type TEXT); | List all the coaches who have managed both national and club teams. | SELECT c.name FROM coaches c INNER JOIN teams t1 ON c.id = t1.coach INNER JOIN teams t2 ON c.id = t2.coach WHERE t1.type = 'national' AND t2.type = 'club'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID INT, Name TEXT, Type TEXT, YearBuilt INT, Registry TEXT); INSERT INTO Vessels VALUES (1, 'Fishing Vessel 1', 'Fishing', 2005, 'Canada'), (2, 'Fishing Vessel 2', 'Fishing', 2012, 'Canada'); | What is the average age of fishing vessels in the Canadian registry? | SELECT AVG(YEAR(CURRENT_DATE) - Vessels.YearBuilt) FROM Vessels WHERE Vessels.Registry = 'Canada' AND Vessels.Type = 'Fishing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, building_name VARCHAR(255), state VARCHAR(255), energy_consumption FLOAT); | What is the total energy consumption (in kWh) of green buildings in each state? | SELECT state, SUM(energy_consumption) FROM green_buildings GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE flights(airline VARCHAR(255), aircraft_type VARCHAR(255), flight_date DATE, passengers INT); | What is the total number of passengers carried by each airline, grouped by the type of aircraft and the airline, for the past year? | SELECT airline, aircraft_type, SUM(passengers) as Total_Passengers FROM flights WHERE flight_date >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY airline, aircraft_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, Name TEXT, Age INT, ProgramID INT, VolunteerDate DATE); INSERT INTO Volunteers VALUES (1, 'Alice', 25, 1, '2020-01-01'), (2, 'Bob', 30, 1, '2020-06-01'), (3, 'Charlie', 35, 2, '2020-06-01'), (4, 'David', 40, 2, '2020-12-31'); | What is the maximum, minimum, and average age of volunteers who engaged in programs in the year 2020, and the total number of volunteers in that time period? | SELECT MIN(Age) as MinAge, MAX(Age) as MaxAge, AVG(Age) as AvgAge, COUNT(*) as NumVolunteers FROM Volunteers WHERE YEAR(VolunteerDate) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE tickets (ticket_id INT, game_id INT, quantity INT, price DECIMAL(5,2), team VARCHAR(20)); INSERT INTO tickets VALUES (1, 1, 50, 35.99, 'Cubs'); INSERT INTO tickets VALUES (2, 2, 30, 29.99, 'Red Sox'); | What is the average ticket price for baseball games in Chicago and Boston? | SELECT AVG(tickets.price) FROM tickets WHERE tickets.team IN ('Cubs', 'Red Sox') GROUP BY tickets.team HAVING tickets.team IN ('Cubs', 'Red Sox'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), DonatedAmount decimal(10,2)); INSERT INTO Donors (DonorID, DonorName, DonatedAmount) VALUES (1, 'John Smith', 500.00), (2, 'Jane Doe', 800.00); CREATE TABLE DisasterRelief (CampaignID int, DonorID int, DisasterType varchar(50), DonatedAmount decimal(10,2)); INSER... | What is the total amount of funds donated by each donor for the Nepal earthquake relief campaign? | SELECT DonorName, SUM(DonatedAmount) as TotalDonated FROM Donors INNER JOIN DisasterRelief ON Donors.DonorID = DisasterRelief.DonorID WHERE DisasterType = 'Nepal Earthquake' GROUP BY DonorName; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (id INT, title VARCHAR(100), genre VARCHAR(50), release_year INT, marketing_budget DECIMAL(10,2)); INSERT INTO songs (id, title, genre, release_year, marketing_budget) VALUES (1, 'Song1', 'Pop', 2009, 250000.00), (2, 'Song2', 'Latin', 2011, 300000.00), (3, 'Song3', 'Jazz', 2015, 150000.00); | Minimum marketing budget for Latin music released since 2010? | SELECT MIN(marketing_budget) FROM songs WHERE genre = 'Latin' AND release_year >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, drug_id INT, quarter INT, year INT, revenue FLOAT); INSERT INTO sales (id, drug_id, quarter, year, revenue) VALUES (1, 1, 1, 2022, 1500000); CREATE TABLE drugs (id INT, name VARCHAR(50), company VARCHAR(50), indication VARCHAR(50)); INSERT INTO drugs (id, name, company, indication) VALUES (1... | What are the drug names and their respective total sales for oncology drugs with sales greater than psychiatric drugs' total sales? | SELECT s.drug_id, d.name, SUM(s.revenue) as total_sales FROM sales s JOIN drugs d ON s.drug_id = d.id WHERE d.indication = 'Oncology' GROUP BY s.drug_id HAVING total_sales > (SELECT SUM(s2.revenue) FROM sales s2 JOIN drugs d2 ON s2.drug_id = d2.id WHERE d2.indication = 'Psychiatric') | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_control_initiatives (initiative_name TEXT, funding_amount FLOAT); INSERT INTO pollution_control_initiatives (initiative_name, funding_amount) VALUES ('Clean Oceans Act', 15000000.0), ('Ocean Restoration Project', 20000000.0), ('Plastic Reduction Program', 10000000.0); | List all pollution control initiatives and their funding amounts. | SELECT * FROM pollution_control_initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID varchar(10), Region varchar(10), FuelConsumption int); INSERT INTO Vessels (VesselID, Region, FuelConsumption) VALUES ('VesselA', 'Asia-Pacific', 1000), ('VesselC', 'Atlantic', 1500); | What is the average fuel consumption for vessels in the Atlantic region? | SELECT AVG(FuelConsumption) FROM Vessels WHERE Region = 'Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_accidents (id INT, trip_id INT, accident_type VARCHAR(50), cargo_weight INT); INSERT INTO cargo_accidents VALUES (1, 1, 'Collision', 500), (2, 1, 'Grounding', 600), (3, 2, 'Collision', 700), (4, 3, 'Fire', 800); | What is the maximum cargo weight for each accident type? | SELECT accident_type, MAX(cargo_weight) FROM cargo_accidents GROUP BY accident_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE savings (customer_id INT, savings DECIMAL(10,2)); CREATE TABLE loans (customer_id INT, is_socially_responsible BOOLEAN); | Calculate the average savings of customers who have a socially responsible loan | SELECT AVG(savings) FROM savings INNER JOIN loans ON savings.customer_id = loans.customer_id WHERE is_socially_responsible = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE courts (court_id INT, name VARCHAR(50)); INSERT INTO courts (court_id, name) VALUES (1001, 'Court A'), (1002, 'Court B'), (1003, 'Court C'); CREATE TABLE cases (case_id INT, court_id INT, case_type VARCHAR(20), duration INT); INSERT INTO cases (case_id, court_id, case_type, duration) VALUES (1, 1001, 'Civi... | What is the average duration of cases for each court, partitioned by case type, in descending order of average duration? | SELECT court_id, case_type, AVG(duration) as avg_duration FROM cases GROUP BY court_id, case_type ORDER BY avg_duration DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_expenditure (country VARCHAR(50), year INT, expenditure FLOAT); INSERT INTO military_expenditure (country, year, expenditure) VALUES ('USA', 2020, 775000000), ('China', 2020, 250000000), ('Russia', 2020, 65000000), ('India', 2020, 60000000), ('Germany', 2020, 48000000); | List all countries and their respective military innovation expenditures for the year 2020 | SELECT country, expenditure FROM military_expenditure WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, campaign_name VARCHAR(50), budget INT); | insert a new campaign into the "campaigns" table | INSERT INTO campaigns (campaign_id, campaign_name, budget) | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (volunteer_id INT, program_id INT, volunteer_date DATE, hours DECIMAL(10, 2)); INSERT INTO Volunteers (volunteer_id, program_id, volunteer_date, hours) VALUES (1, 1001, '2022-04-02', 3.00), (2, 1002, '2022-01-15', 5.00), (3, 1001, '2022-06-01', 4.00); | How many hours did each volunteer contribute in H1 2022? | SELECT volunteer_id, SUM(hours) as total_hours FROM Volunteers WHERE volunteer_date BETWEEN '2022-01-01' AND '2022-06-30' GROUP BY volunteer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE movie (id INT, title VARCHAR(100), release_year INT, country VARCHAR(50), genre VARCHAR(50), global_gross INT); INSERT INTO movie (id, title, release_year, country, genre, global_gross) VALUES (1, 'Movie1', 2015, 'Japan', 'Animation', 500000000); INSERT INTO movie (id, title, release_year, country, genre, ... | Find the top 5 most-watched animated movies released in Japan between 2010 and 2020, ordered by global gross. | SELECT title, global_gross FROM movie WHERE country = 'Japan' AND genre = 'Animation' AND release_year BETWEEN 2010 AND 2020 ORDER BY global_gross DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (song_id INT, title TEXT, length FLOAT, platform TEXT); | What is the total number of songs and their average length for each platform? | SELECT platform, COUNT(*), AVG(length) FROM songs GROUP BY platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT, name VARCHAR(50), region VARCHAR(50)); CREATE TABLE Shipments (id INT, Supplier_id INT, weight INT); INSERT INTO Suppliers (id, name, region) VALUES (1, 'Oceanic Harvest', 'Asia'), (2, 'European Harvest', 'Europe'), (3, 'North American Harvest', 'North America'); INSERT INTO Shipments (i... | What is the total weight of all shipments from suppliers in the 'Europe' region? | SELECT SUM(weight) FROM Shipments JOIN Suppliers ON Shipments.Supplier_id = Suppliers.id WHERE Suppliers.region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_workers (worker_id INT, occupation VARCHAR(50), state VARCHAR(50), salary INT); INSERT INTO construction_workers (worker_id, occupation, state, salary) VALUES (1, 'Carpenter', 'California', 60000); INSERT INTO construction_workers (worker_id, occupation, state, salary) VALUES (2, 'Electrician'... | What is the minimum salary of construction workers in each state? | SELECT state, MIN(salary) FROM construction_workers GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm (id INT PRIMARY KEY, name VARCHAR(50), avg_temp DECIMAL(5,2)); INSERT INTO farm (id, name, avg_temp) VALUES (1, 'Smith Farm', 15.5), (2, 'Jones Farm', 16.3), (3, 'Brown Farm', 20.2); | What is the highest and lowest temperature recorded in farms? | SELECT MIN(f.avg_temp) AS lowest_temp, MAX(f.avg_temp) AS highest_temp FROM farm f; | gretelai_synthetic_text_to_sql |
CREATE TABLE ethical_ai_projects (id INT, location VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO ethical_ai_projects (id, location, budget) VALUES (1, 'Africa', 250000.00); INSERT INTO ethical_ai_projects (id, location, budget) VALUES (2, 'Asia', 300000.00); | What are the names and budgets of all ethical AI projects in Africa? | SELECT name, budget FROM ethical_ai_projects WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget (id INT, program_id INT, amount DECIMAL(10, 2)); | What is the budget for each program? | SELECT Program.name, SUM(Budget.amount) as total_budget FROM Budget JOIN Program ON Budget.program_id = Program.id GROUP BY Program.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmergencyCalls (id INT, city VARCHAR(20), response_time FLOAT); | What is the minimum response time for emergency calls in the city of San Francisco? | SELECT MIN(response_time) FROM EmergencyCalls WHERE city = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels(id INT, name TEXT, country TEXT, ai BOOLEAN); | What is the percentage of hotels that have adopted AI in 'Europe'? | SELECT 100.0 * COUNT(CASE WHEN ai = TRUE THEN 1 END) / COUNT(*) AS percentage FROM hotels WHERE country = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE job_count (id INT, country VARCHAR(50), job VARCHAR(50)); INSERT INTO job_count (id, country, job) VALUES (1, 'USA', 'Engineer'), (2, 'Mexico', 'Assembler'), (3, 'China', 'Quality Control'), (4, 'USA', 'Assembler'), (5, 'Mexico', 'Engineer'); | Display the total number of manufacturing jobs for each country, ordered from the country with the most jobs to the country with the least jobs. | SELECT country, COUNT(*) as total_jobs FROM job_count GROUP BY country ORDER BY total_jobs DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningOperation (OperationID int, OperationName varchar(50), Country varchar(50), PollutionLevel int); INSERT INTO MiningOperation VALUES (1, 'ABC Operation', 'USA', 50), (2, 'DEF Operation', 'Canada', 40), (3, 'GHI Operation', 'Mexico', 60), (4, 'JKL Operation', 'Brazil', 45); | What is the average pollution level per mining operation for each country? | SELECT Country, AVG(PollutionLevel) as AveragePollutionLevel FROM MiningOperation GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50)); INSERT INTO teams (team_id, team_name) VALUES (1, 'NY Knicks'), (2, 'LA Lakers'), (3, 'Chicago Bulls'); CREATE TABLE ticket_sales (id INT, team_id INT, revenue INT); | What is the total revenue generated from ticket sales for the LA Lakers and the Chicago Bulls? | SELECT SUM(ticket_sales.revenue) FROM ticket_sales JOIN teams ON ticket_sales.team_id = teams.team_id WHERE teams.team_name IN ('LA Lakers', 'Chicago Bulls'); | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (id INT, title VARCHAR(100), author_id INT, published_date DATE, country VARCHAR(50)); INSERT INTO news_articles (id, title, author_id, published_date, country) VALUES (1, 'News Article 1', 1, '2022-01-01', 'Canada'), (2, 'News Article 2', 2, '2022-01-02', 'USA'); | How many news articles were published in the "news_articles" table by authors from Canada? | SELECT COUNT(*) FROM news_articles WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, name TEXT, region TEXT, value FLOAT); INSERT INTO investments (id, name, region, value) VALUES (1, 'Investment 1', 'Latin America', 500000), (2, 'Investment 2', 'Latin America', 750000); | What is the total value of economic diversification investments in 'Latin America'? | SELECT SUM(investments.value) FROM investments WHERE investments.region = 'Latin America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_features (city VARCHAR(50), feature VARCHAR(50)); INSERT INTO smart_city_features (city, feature) VALUES ('CityA', 'Smart Lighting'), ('CityB', 'Smart Waste Management'); | Which smart_city_features are present in both 'CityA' and 'CityB'? | SELECT feature FROM smart_city_features WHERE city = 'CityA' INTERSECT SELECT feature FROM smart_city_features WHERE city = 'CityB'; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(50), price DECIMAL(12, 2), coowner_count INT); INSERT INTO properties (id, city, price, coowner_count) VALUES (1, 'Seattle', 1200000.00, 2), (2, 'Seattle', 900000.00, 1), (3, 'Seattle', 1500000.00, 3); | Identify property co-ownerships in the city of Seattle, Washington with a total price above 1 million dollars. | SELECT * FROM properties WHERE city = 'Seattle' AND price > 1000000.00 AND coowner_count > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellites (SatelliteID int, SatelliteName varchar(50), LaunchCountryID int, LaunchDate date); CREATE TABLE Countries (CountryID int, CountryName varchar(50)); INSERT INTO Satellites VALUES (1, 'Sat1', 1, '2020-01-01'), (2, 'Sat2', 1, '2021-05-15'), (3, 'Sat3', 2, '2019-03-12'), (4, 'Sat4', 3, '2022-06-18'... | Which satellites were launched in the last 3 years? | SELECT s.SatelliteName FROM Satellites s INNER JOIN Countries c ON s.LaunchCountryID = c.CountryID WHERE s.LaunchDate >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY s.SatelliteName; | gretelai_synthetic_text_to_sql |
CREATE TABLE indigenous_communities (community_id INT, community_name VARCHAR(255), population INT, region VARCHAR(255)); | How many communities in the 'indigenous_communities' table are located in each region, and what is the total population? | SELECT r.region, COUNT(c.community_name) AS community_count, SUM(c.population) AS total_population FROM indigenous_communities c INNER JOIN (SELECT DISTINCT region FROM indigenous_communities) r ON c.region = r.region GROUP BY r.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fabrics (id INT, fabric_type VARCHAR(255), sustainable BOOLEAN, price DECIMAL(5,2)); INSERT INTO Fabrics (id, fabric_type, sustainable, price) VALUES (1, 'Cotton', true, 5.00), (2, 'Polyester', false, 3.00), (3, 'Hemp', true, 7.00), (4, 'Rayon', false, 4.00); | What is the average price of sustainable fabric types? | SELECT AVG(Fabrics.price) FROM Fabrics WHERE Fabrics.sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE Dysprosium_Production (id INT, year INT, country VARCHAR(255), quantity FLOAT); | How many metric tons of Dysprosium were extracted in Australia between 2015 and 2019? | SELECT SUM(quantity) FROM Dysprosium_Production WHERE year BETWEEN 2015 AND 2019 AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
player (player_id, name, email, age, gender, country, total_games_played, join_date) | Add new player 'Sarah' from 'CA' with email 'sarah@email.com' | INSERT INTO player (name, email, age, gender, country, total_games_played, join_date) VALUES ('Sarah', 'sarah@email.com', 25, 'Female', 'CA', 0, '2023-03-15') | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturers (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), sustainability_score FLOAT); INSERT INTO manufacturers (id, name, location, sustainability_score) VALUES (1, 'XYZ Fashions', 'Paris, France', 8.2); CREATE TABLE sales (id INT PRIMARY KEY, manufacturer_id INT, date DATE, units INT,... | What is the total revenue for each manufacturer in the past month? | SELECT m.name, SUM(s.revenue) AS total_revenue FROM manufacturers m JOIN sales s ON m.id = s.manufacturer_id WHERE s.date BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 MONTH) AND CURDATE() GROUP BY m.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(50), industry VARCHAR(50), diversity_score DECIMAL(3,2)); INSERT INTO companies VALUES (1, 'Acme Corp', 'Technology', 0.85); INSERT INTO companies VALUES (2, 'Beta Inc', 'Retail', 0.70); | Show companies with a diversity score above the industry average | SELECT companies.name, companies.diversity_score FROM companies INNER JOIN (SELECT industry, AVG(diversity_score) AS industry_avg FROM companies GROUP BY industry) AS industry_averages ON companies.industry = industry_averages.industry WHERE companies.diversity_score > industry_averages.industry_avg; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing_employees (id INT, region VARCHAR(255), industry VARCHAR(255), employees INT); | What is the total number of employees in the manufacturing industry across all regions? | SELECT SUM(employees) FROM manufacturing_employees WHERE industry = 'Manufacturing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (id INT, name VARCHAR(50), department VARCHAR(50), salary DECIMAL(10,2)); | What is the average salary of female employees in the Production dept? | SELECT AVG(salary) FROM Employees WHERE gender = 'female' AND department = 'Production'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Initiatives (id INT, name VARCHAR(50), organization VARCHAR(50), region VARCHAR(50), completed BOOLEAN); INSERT INTO Initiatives (id, name, organization, region, completed) VALUES (1, 'Digital Divide Research', 'Global Connect', 'South America', true), (2, 'Access to Technology Education', 'Tech Learning',... | How many digital divide initiatives were completed by organizations in South America? | SELECT COUNT(*) FROM Initiatives WHERE region = 'South America' AND completed = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT PRIMARY KEY, donor_id INT); INSERT INTO donors (id, donor_id) VALUES (1, 1); CREATE TABLE donations (id INT PRIMARY KEY, donor_id INT, donation_amount INT, donation_date DATE); INSERT INTO donations (id, donor_id, donation_amount, donation_date) VALUES (1, 1, 150, '2021-12-01'); | Determine the number of unique donors who gave more than $100 in Q4 2021. | SELECT COUNT(DISTINCT donor_id) FROM donations WHERE donation_amount > 100 AND donation_date BETWEEN '2021-10-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_buildings_2 (building_id INT, building_type TEXT, country TEXT, capacity_kw FLOAT); INSERT INTO solar_buildings_2 (building_id, building_type, country, capacity_kw) VALUES (1, 'Residential', 'India', 5), (2, 'Residential', 'India', 7); | What is the average solar power capacity (in kW) of residential buildings in India? | SELECT country, AVG(capacity_kw) FROM solar_buildings_2 WHERE building_type = 'Residential'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), Country varchar(50), AmountDonated numeric(18,2), DonationDate date); INSERT INTO Donors (DonorID, DonorName, Country, AmountDonated, DonationDate) VALUES (1, 'John Doe', 'Canada', 8000, '2021-01-01'), (2, 'Jane Smith', 'Canada', 9000, '2021-02-01'), (3, 'Mike Jo... | Who are the top 3 donors in Canada by amount donated in 2021? | SELECT DonorName, SUM(AmountDonated) as TotalDonated FROM Donors WHERE Country = 'Canada' AND YEAR(DonationDate) = 2021 GROUP BY DonorName ORDER BY TotalDonated DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE participations (initiative_id INT, launch_date DATE, num_participants INT); INSERT INTO participations (initiative_id, launch_date, num_participants) VALUES (1, '2021-01-01', 500), (2, '2021-11-15', 700), (3, '2021-04-01', 300), (4, '2021-12-20', 800), (5, '2021-07-01', 600); | What is the average number of public participations for initiatives launched in Q1? | SELECT AVG(num_participants) FROM participations WHERE EXTRACT(QUARTER FROM launch_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE systems (system_id INT, system_name VARCHAR(255), cvss_score DECIMAL(3,2)); CREATE TABLE vulnerabilities (vulnerability_id INT, system_id INT, vulnerability_description TEXT); | What are the top 5 most vulnerable systems in the organization based on their Common Vulnerability Scoring System (CVSS) scores? | SELECT s.system_name, s.cvss_score FROM systems s JOIN (SELECT system_id, MAX(cvss_score) AS max_cvss FROM systems GROUP BY system_id) max_scores ON s.system_id = max_scores.system_id ORDER BY s.cvss_score DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft_manufacturing (id INT PRIMARY KEY, model VARCHAR(100), manufacturing_year INT); | Delete all records from the aircraft_manufacturing table where the manufacturing_year is less than 2010 | DELETE FROM aircraft_manufacturing WHERE manufacturing_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_projects (id INT, name VARCHAR(50), start_date DATE, end_date DATE, organization_id INT); INSERT INTO research_projects (id, name, start_date, end_date, organization_id) VALUES (1, 'Ethical AI', '2020-01-01', '2021-12-31', 1), (2, 'Digital Divide', '2019-01-01', '2020-12-31', 2), (3, 'Tech for Soc... | Show all records from the 'research_projects' table where 'start_date' is in the year 2020 | SELECT * FROM research_projects WHERE YEAR(start_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_incidents (region TEXT, date DATE, incident_count INT); INSERT INTO daily_incidents (region, date, incident_count) VALUES ('LATAM', '2022-01-01', 3), ('LATAM', '2022-01-03', 5), ('LATAM', '2022-01-05', 2); | What is the maximum number of security incidents that occurred in a single day in the LATAM region in 2022? | SELECT MAX(incident_count) FROM daily_incidents WHERE region = 'LATAM' AND date >= '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE festivals (festival_id INT, festival_name VARCHAR(100), festival_country VARCHAR(50)); CREATE TABLE festival_artists (festival_id INT, artist_id INT); INSERT INTO festivals (festival_id, festival_name, festival_country) VALUES (1, 'Coachella', 'United States'), (2, 'Glastonbury', 'United Kingdom'); INSERT ... | List all music festivals and the number of artists performing, sorted by the number of artists in descending order. | SELECT f.festival_name, COUNT(fa.artist_id) AS artists_count FROM festivals f LEFT JOIN festival_artists fa ON f.festival_id = fa.festival_id GROUP BY f.festival_id ORDER BY artists_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(50), supply_chain_transparency VARCHAR(50)); | Add a new product with a transparent supply chain | INSERT INTO products (product_id, product_name, supply_chain_transparency) VALUES (5, 'Product F', 'Transparent'); | gretelai_synthetic_text_to_sql |
CREATE TABLE esports_tournaments (id INT PRIMARY KEY, name VARCHAR(50), game_name VARCHAR(50), location VARCHAR(50), start_date DATE, end_date DATE); | Insert new eSports tournament data | INSERT INTO esports_tournaments (id, name, game_name, location, start_date, end_date) VALUES (1, 'Tournament A', 'Game X', 'USA', '2023-01-01', '2023-01-03'); | gretelai_synthetic_text_to_sql |
CREATE TABLE company_profiles (company_id INT, founding_year INT); INSERT INTO company_profiles (company_id, founding_year) VALUES (1, 2010), (2, 2012), (3, 2010), (4, 2011), (5, 2009), (6, 2008), (7, 2008), (8, 2011), (9, 2010), (10, 2012); | How many companies were founded in each year? | SELECT founding_year, COUNT(*) FROM company_profiles GROUP BY founding_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft (ID INT, Name VARCHAR(50), MaxSpeed FLOAT); | What is the name of the aircraft and their maximum speed, ordered by the maximum speed? | SELECT Name, MaxSpeed FROM Aircraft ORDER BY MaxSpeed DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT PRIMARY KEY, name TEXT, state TEXT, total_beds INT); | Add a new record to the "hospitals" table for a hospital located in "AZ" with 1000 total beds | INSERT INTO hospitals (name, state, total_beds) VALUES ('Hospital AZ', 'AZ', 1000); | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations_asia (id INT, mine_name VARCHAR(50), department VARCHAR(50), employee VARCHAR(50), age INT, ethnicity VARCHAR(20)); CREATE VIEW workforce_diversity_asia AS SELECT department, ((MAX(count) - MIN(count)) / MAX(count)) AS diversity_score FROM (SELECT department, ethnicity, COUNT(*) AS count ... | Which mining operations in 'Asia' region have a workforce diversity score above 0.6? | SELECT mine_name FROM mining_operations_asia JOIN workforce_diversity_asia ON TRUE WHERE workforce_diversity_asia.diversity_score > 0.6 AND region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE divisions (divid INT, name TEXT);CREATE TABLE police_officers (pid INT, divid INT, active BOOLEAN); | What is the total number of police officers in each division? | SELECT divisions.name, COUNT(police_officers.pid) FROM divisions INNER JOIN police_officers ON divisions.divid = police_officers.divid WHERE police_officers.active = TRUE GROUP BY divisions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, industry TEXT, founder_gender TEXT, funding FLOAT); INSERT INTO startups (id, name, industry, founder_gender, funding) VALUES (1, 'TechLatino', 'Technology', 'Latinx', 15000000); | What is the maximum funding received by a startup founded by a Latinx individual in the technology sector? | SELECT MAX(funding) FROM startups WHERE industry = 'Technology' AND founder_gender = 'Latinx'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founders TEXT, founding_year INT, industry TEXT); INSERT INTO startups VALUES (1, 'StartupA', 'Aisha, Bob', 2010, 'E-commerce'); INSERT INTO startups VALUES (2, 'StartupB', 'Eve', 2015, 'Healthcare'); INSERT INTO startups VALUES (3, 'StartupC', 'Carlos', 2018, 'Tech'); CREATE TA... | What is the average founding year for startups founded by individuals who identify as Indigenous in the e-commerce industry? | SELECT AVG(founding_year) FROM startups WHERE industry = 'E-commerce' AND founders LIKE '%Aisha%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmTypes (FarmTypeID INT, FarmType TEXT); INSERT INTO FarmTypes (FarmTypeID, FarmType) VALUES (1, 'Organic Farm'); INSERT INTO FarmTypes (FarmTypeID, FarmType) VALUES (2, 'Conventional Farm'); CREATE TABLE Farms (FarmID INT, FarmTypeID INT, Location TEXT); INSERT INTO Farms (FarmID, FarmTypeID, Location) ... | Identify the number of 'Organic Farms' and 'Conventional Farms' in 'Amazon Rainforest'? | SELECT FarmTypes.FarmType, COUNT(*) as Count FROM Farms INNER JOIN FarmTypes ON Farms.FarmTypeID = FarmTypes.FarmTypeID WHERE Farms.Location = 'Amazon Rainforest' GROUP BY FarmTypes.FarmType; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget_allocation (state VARCHAR(20), category VARCHAR(20), budget FLOAT); INSERT INTO budget_allocation (state, category, budget) VALUES ('Florida', 'Transportation', 15000000), ('Florida', 'Infrastructure', 20000000), ('Florida', 'Education', 10000000); CREATE TABLE total_budget (state VARCHAR(20), total... | What is the total budget allocated to transportation and infrastructure in the state of Florida, and what is the percentage of the total budget that this represents? | SELECT (budget / total_budget) * 100 as percentage FROM budget_allocation INNER JOIN total_budget ON budget_allocation.state = total_budget.state WHERE budget_allocation.state = 'Florida' AND budget_allocation.category IN ('Transportation', 'Infrastructure'); | gretelai_synthetic_text_to_sql |
CREATE TABLE VegetarianDishes (menu_item VARCHAR(50), cuisine VARCHAR(20), type VARCHAR(20), price DECIMAL(5,2)); INSERT INTO VegetarianDishes (menu_item, cuisine, type, price) VALUES ('Vegetable Lasagna', 'Italian', 'Vegetarian', 11.99), ('Vegetable Curry', 'Indian', 'Vegetarian', 9.99), ('Vegetable Sushi Rolls', 'Jap... | What is the minimum price of vegetarian dishes across all cuisine types? | SELECT MIN(price) FROM VegetarianDishes WHERE type = 'Vegetarian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sessions (session_id INT, name VARCHAR(255), success BOOLEAN); INSERT INTO sessions (session_id, name, success) VALUES (1, 'Art Therapy', true); INSERT INTO sessions (session_id, name, success) VALUES (2, 'Music Therapy', false); INSERT INTO sessions (session_id, name, success) VALUES (3, 'Art Therapy', tr... | What is the success rate of the 'Art Therapy' group sessions? | SELECT AVG(sessions.success) FROM sessions WHERE sessions.name = 'Art Therapy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employee_data (country VARCHAR(50), industry VARCHAR(50), num_employees INT); INSERT INTO employee_data (country, industry, num_employees) VALUES ('Mexico', 'Manufacturing', 5000000), ('Vietnam', 'Manufacturing', 3000000); | How many employees work in the manufacturing sector in Mexico and Vietnam? | SELECT country, SUM(num_employees) FROM employee_data WHERE country IN ('Mexico', 'Vietnam') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (site_id INT, site_name VARCHAR(255)); CREATE TABLE artifacts (artifact_id INT, site_id INT, artifact_type VARCHAR(255), date_found DATE); INSERT INTO excavation_sites (site_id, site_name) VALUES (1, 'site_a'), (2, 'site_b'), (3, 'site_c'), (4, 'site_d'), (5, 'site_e'), (6, 'site_f'); INSE... | What is the earliest artifact date for 'site_f'? | SELECT MIN(date_found) FROM artifacts WHERE site_id = (SELECT site_id FROM excavation_sites WHERE site_name = 'site_f'); | 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.