context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE research_vessels (id INT, name VARCHAR(50), type VARCHAR(20), year INT); | Insert a new record for a research vessel 'RV Sea Surveyor' in the research_vessels table. | INSERT INTO research_vessels (id, name, type, year) VALUES (4, 'RV Sea Surveyor', 'Hydrographic', 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, disaster_id INT, amount FLOAT); CREATE TABLE disasters (id INT, name VARCHAR(255)); | Determine the average amount donated per donor for each disaster response. | SELECT d.name, AVG(donors.amount) as avg_donation_per_donor FROM disasters d LEFT JOIN donors ON d.id = donors.disaster_id GROUP BY d.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE MiningOperations (MineID INT, Material VARCHAR(20), Quantity INT, Date DATE); INSERT INTO MiningOperations (MineID, Material, Quantity, Date) VALUES (1, 'Gold', 500, '2021-01-01'); INSERT INTO MiningOperations (MineID, Material, Quantity, Date) VALUES (2, 'Silver', 300, '2021-01-02'); | What is the total quantity of gold and silver mined at each mine between 2021-01-01 and 2021-01-07? | SELECT MineID, SUM(Quantity) as TotalQuantity FROM MiningOperations WHERE Date >= '2021-01-01' AND Date <= '2021-01-07' AND Material IN ('Gold', 'Silver') GROUP BY MineID; | gretelai_synthetic_text_to_sql |
CREATE TABLE temp_data (farm_id INT, location VARCHAR(20), temp FLOAT); INSERT INTO temp_data (farm_id, location, temp) VALUES (1, 'Caribbean region', 25.5), (2, 'Caribbean region', 24.8), (3, 'Caribbean region', 26.1); | What is the maximum and minimum water temperature in the farms located in the Caribbean region? | SELECT MAX(temp), MIN(temp) FROM temp_data WHERE location = 'Caribbean region'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_data (element VARCHAR(10), year INT, quantity INT); INSERT INTO production_data VALUES ('Erbium', 2015, 1200), ('Erbium', 2016, 1500), ('Erbium', 2017, 1800), ('Ytterbium', 2015, 500), ('Ytterbium', 2016, 600), ('Ytterbium', 2017, 700); | Identify the years with the highest production of Erbium and Ytterbium | SELECT element, MAX(year) AS max_year FROM production_data WHERE element IN ('Erbium', 'Ytterbium') GROUP BY element; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_temperatures (year INTEGER, ocean VARCHAR(255), temperature FLOAT); | What is the minimum temperature recorded in the Atlantic Ocean? | SELECT MIN(temperature) FROM ocean_temperatures WHERE ocean = 'Atlantic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VRSales (HeadsetID INT, Name VARCHAR(20), ReleaseDate DATE, Sales INT); INSERT INTO VRSales (HeadsetID, Name, ReleaseDate, Sales) VALUES (1, 'Oculus Rift', '2016-03-28', 500000), (2, 'HTC Vive', '2016-04-05', 700000), (3, 'PlayStation VR', '2016-10-13', 1000000), (4, 'Samsung Gear VR', '2015-11-20', 200000... | What are the total sales (in USD) of VR headsets released before 2015? | SELECT SUM(Sales) FROM VRSales WHERE ReleaseDate < '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, HireDate DATE); CREATE TABLE UnderrepresentedCommunities (CommunityID INT, CommunityName VARCHAR(50)); CREATE TABLE EmployeeCommunities (EmployeeID INT, CommunityID INT); | What is the total number of employees hired from Latinx and Indigenous communities, by year? | SELECT YEAR(e.HireDate) AS Year, COUNT(DISTINCT e.EmployeeID) FROM Employees e INNER JOIN EmployeeCommunities ec ON e.EmployeeID = ec.EmployeeID INNER JOIN UnderrepresentedCommunities uc ON ec.CommunityID = uc.CommunityID WHERE uc.CommunityName IN ('Latinx', 'Indigenous') GROUP BY YEAR(e.HireDate); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerCountry VARCHAR(20), Game VARCHAR(20), Wins INT); INSERT INTO Players (PlayerID, PlayerCountry, Game, Wins) VALUES (1, 'Germany', 'Rocket League', 50), (2, 'Germany', 'Fortnite', 60); | What is the total number of wins of players who played Rocket League in Germany? | SELECT SUM(Wins) FROM Players WHERE Game = 'Rocket League' AND PlayerCountry = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup_funding (company_name VARCHAR(100), company_location VARCHAR(100), funding_source VARCHAR(50), funding_amount DECIMAL(10,2), funding_date DATE); INSERT INTO startup_funding VALUES ('GreenGeniusBio', 'Brazil', 'VC Funding', 2000000.00, '2021-02-14'); INSERT INTO startup_funding VALUES ('BioTechMexic... | Which biotech startups have received funding from at least 2 different sources and are based in Latin America or the Caribbean? | SELECT company_name FROM startup_funding WHERE company_location IN ('Latin America', 'Caribbean') AND funding_source IN (SELECT funding_source FROM startup_funding GROUP BY funding_source HAVING COUNT(DISTINCT funding_source) > 1) GROUP BY company_name HAVING COUNT(DISTINCT funding_source) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT PRIMARY KEY, species VARCHAR(255), population INT); | Create a view to display animal species with their population counts | CREATE VIEW animal_population_view AS SELECT species, population FROM animal_population; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), location VARCHAR(255), product VARCHAR(255), price DECIMAL(5,2), delivery_date TIMESTAMP); INSERT INTO suppliers (id, name, location, product, price, delivery_date) VALUES (1, 'Acme Farms', 'California', 'Tomatoes', 2.50, '2022-01-05 09:00:00'), (2, 'Green Earth', 'Mex... | What is the price difference between the most expensive and least expensive product from each supplier? | SELECT name, product, MAX(price) - MIN(price) as price_difference FROM suppliers GROUP BY name; | gretelai_synthetic_text_to_sql |
CREATE TABLE operators (operator_id INT, operator_name TEXT, country TEXT); INSERT INTO operators (operator_id, operator_name, country) VALUES (1, 'Operator A', 'USA'), (2, 'Operator B', 'Canada'), (3, 'Operator C', 'Nigeria'); | Delete all records from the 'operators' table where the operator is based in Nigeria. | DELETE FROM operators WHERE country = 'Nigeria'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workplaces (id INT, name TEXT, state TEXT); INSERT INTO workplaces (id, name, state) VALUES (1, 'DEF Company', 'Pennsylvania'); | What is the number of workplaces in total in the state of Pennsylvania? | SELECT COUNT(*) FROM workplaces WHERE state = 'Pennsylvania'; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (route_id INT, route_name TEXT); INSERT INTO routes (route_id, route_name) VALUES (101, 'Bus Route 101'), (102, 'Bus Route 102'), (105, 'Bus Route 105'), (501, 'Bus Route 501'), (502, 'Bus Route 502'); CREATE TABLE bus_routes (route_id INT, start_station TEXT, end_station TEXT, distance INT, fare DE... | Insert a new bus route from 'Tokyo' to 'Osaka' with a distance of 500 km and a fare of ¥5000. | INSERT INTO bus_routes (route_id, start_station, end_station, distance, fare) VALUES (501, 'Tokyo', 'Osaka', 500, 5000); | gretelai_synthetic_text_to_sql |
CREATE TABLE Climate_Data (region VARCHAR(20), month INT, year INT, temperature FLOAT); INSERT INTO Climate_Data (region, month, year, temperature) VALUES ('Amazon Rainforest', 1, 2017, 25.5), ('Amazon Rainforest', 2, 2017, 26.3); | What is the average temperature in the 'Amazon Rainforest' for the months of January, February, and March in the years 2017 and 2018? | SELECT AVG(cd.temperature) as avg_temperature FROM Climate_Data cd WHERE cd.region = 'Amazon Rainforest' AND cd.month IN (1, 2, 3) AND cd.year IN (2017, 2018) GROUP BY cd.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(255)); CREATE TABLE Sales (id INT, artist_id INT, sale_date DATE); CREATE TABLE Works (id INT, artist_id INT, sale_date DATE); | What is the maximum number of works sold by an artist in a single year? | SELECT artist_id, MAX(sales_per_year) FROM (SELECT artist_id, YEAR(sale_date) AS sale_year, COUNT(*) AS sales_per_year FROM Sales JOIN Works ON Sales.id = Works.id GROUP BY artist_id, sale_year) subquery GROUP BY artist_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites_by_country (id INT, country VARCHAR(255), name VARCHAR(255)); INSERT INTO satellites_by_country (id, country, name) VALUES (1, 'USA', 'Starlink 1'), (2, 'New Zealand', 'Photon 1'), (3, 'USA', 'GPS 3-01'), (4, 'Russia', 'Glonass-M 58'), (5, 'China', 'Beidou-3 M23'); | Which countries have launched the most satellites, and how many have they launched? | SELECT country, COUNT(*) as num_satellites FROM satellites_by_country GROUP BY country ORDER BY num_satellites DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE hydroelectric_power_plants (id INT, plant_name VARCHAR(50), province VARCHAR(50), installed_capacity FLOAT); INSERT INTO hydroelectric_power_plants (id, plant_name, province, installed_capacity) VALUES (1, 'Quebec Hydroelectric Power Plant', 'Quebec', 5000); | What is the total installed capacity of hydroelectric power plants in the province of Quebec? | SELECT SUM(installed_capacity) FROM hydroelectric_power_plants WHERE province = 'Quebec'; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(100), topic VARCHAR(50), date DATE); INSERT INTO articles (id, title, topic, date) VALUES (1, 'Article 1', 'Politics', '2021-01-01'); INSERT INTO articles (id, name, topic, date) VALUES (2, 'Article 2', 'Sports', '2021-01-02'); INSERT INTO articles (id, title, topic, date) V... | Find the earliest date of articles in 'Technology' | SELECT MIN(date) as earliest_date FROM articles WHERE topic = 'Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE uk_cosmetics_preferences (id INT, consumer_id INT, product_id INT, preference_score INT, is_cruelty_free BOOLEAN); INSERT INTO uk_cosmetics_preferences (id, consumer_id, product_id, preference_score, is_cruelty_free) VALUES (1, 1, 1, 5, true); | Which cruelty-free certified cosmetic products have the lowest consumer preference scores in the United Kingdom? | SELECT p.name, cp.preference_score FROM uk_cosmetics_preferences cp INNER JOIN products p ON cp.product_id = p.id WHERE cp.is_cruelty_free = true ORDER BY cp.preference_score ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (campaign_id INT, start_date DATE, end_date DATE, focus VARCHAR(20)); INSERT INTO campaigns (campaign_id, start_date, end_date, focus) VALUES (1, '2022-04-01', '2022-06-30', 'mindfulness-based interventions'), (2, '2022-07-01', '2022-08-31', 'stress management'), (3, '2022-09-01', '2022-10-31', '... | List all campaigns that targeted mindfulness-based interventions in the last 3 months. | SELECT * FROM campaigns WHERE focus = 'mindfulness-based interventions' AND start_date <= '2022-04-01' AND end_date >= '2022-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtExhibitAttendees (attendeeID INT, visitDate DATE, age INT); INSERT INTO ArtExhibitAttendees (attendeeID, visitDate, age) VALUES (1, '2022-01-03', 35), (2, '2022-01-17', 42), (3, '2022-01-25', 28); | What is the average age of attendees who visited the art exhibit last month? | SELECT AVG(age) FROM ArtExhibitAttendees WHERE visitDate >= '2022-01-01' AND visitDate <= '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_yearly_consumption (id INT, city VARCHAR(50), year INT, yearly_consumption FLOAT); INSERT INTO city_yearly_consumption (id, city, year, yearly_consumption) VALUES (1, 'New York', 2018, 1200000000), (2, 'New York', 2019, 1260000000), (3, 'Los Angeles', 2018, 600000000), (4, 'Los Angeles', 2019, 6300000... | Determine the year-over-year change in water consumption for each city from 2018 to 2019. | SELECT city, (t2.yearly_consumption - t1.yearly_consumption) * 100.0 / t1.yearly_consumption AS yoy_change FROM city_yearly_consumption t1, city_yearly_consumption t2 WHERE t1.city = t2.city AND t1.year = 2018 AND t2.year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableCotton (country VARCHAR(50), price DECIMAL(10,2)); | What is the average price of sustainably sourced cotton by country? | SELECT country, AVG(price) FROM SustainableCotton GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_aid (id INT PRIMARY KEY, aid_name VARCHAR(50), recipient_country VARCHAR(50), amount_donated DECIMAL(10,2)); | Insert a new record into the humanitarian_aid table. | INSERT INTO humanitarian_aid (id, aid_name, recipient_country, amount_donated) VALUES (1, 'Food Aid', 'Yemen', 500000.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE environment (id INT, date DATE, score INT); INSERT INTO environment (id, date, score) VALUES (1, '2017-01-01', 70), (2, '2017-02-01', 75), (3, '2019-01-01', 80), (4, '2019-02-01', 85), (5, '2021-01-01', 90); | What is the minimum environmental impact score in the last 5 years? | SELECT MIN(e.score) AS min_impact_score FROM environment e WHERE e.date >= DATE_SUB(CURDATE(), INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE animals (id INT, species TEXT, population INT, habitat_type TEXT); INSERT INTO animals (id, species, population, habitat_type) VALUES (1, 'Tiger', 1200, 'Forest'), (2, 'Elephant', 1500, 'Savannah'), (3, 'Rhinoceros', 800, 'Wetlands'); | What is the total population of animals in each habitat type? | SELECT habitat_type, SUM(population) as total_population FROM animals GROUP BY habitat_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_plants (country VARCHAR(20), capacity INT); INSERT INTO wind_plants (country, capacity) VALUES ('Germany', 50000), ('France', 30000); CREATE TABLE solar_plants (country VARCHAR(20), capacity INT); INSERT INTO solar_plants (country, capacity) VALUES ('Germany', 70000), ('France', 60000); | Find the total installed capacity of wind and solar power plants in Germany and France. | SELECT SUM(capacity) FROM wind_plants WHERE country IN ('Germany', 'France') UNION ALL SELECT SUM(capacity) FROM solar_plants WHERE country IN ('Germany', 'France'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ManufacturingSite(Id INT, Name VARCHAR(50), Location VARCHAR(50)); CREATE TABLE SafetyInspectionScore(Id INT, Score INT, ManufacturingSiteId INT, InspectionDate DATE); | What are the average safety inspection scores for each manufacturing site, grouped by month? | SELECT m.Name, DATE_FORMAT(s.InspectionDate, '%Y-%m') AS Month, AVG(s.Score) AS AverageScore FROM SafetyInspectionScore s JOIN ManufacturingSite m ON s.ManufacturingSiteId = m.Id GROUP BY m.Name, Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cities (CityName TEXT, CityID INTEGER); CREATE TABLE PoliceStations (StationID INTEGER, StationCityID INTEGER); CREATE TABLE PoliceOfficers (OfficerID INTEGER, OfficerStationID INTEGER, OfficerSalary INTEGER); | Who are the top 5 cities with the most police officers in Texas, and what is the number of officers in each city? | SELECT C.CityName, COUNT(PO.OfficerID) FROM Cities C INNER JOIN PoliceStations PS ON C.CityID = PS.StationCityID INNER JOIN PoliceOfficers PO ON PS.StationID = PO.OfficerStationID WHERE C.State = 'Texas' GROUP BY C.CityName ORDER BY COUNT(PO.OfficerID) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists renewables; Use renewables; CREATE TABLE if not exists wind_projects (project_id INT, country VARCHAR(50), installed_capacity INT); INSERT INTO wind_projects (project_id, country, installed_capacity) VALUES (1, 'Germany', 20000), (2, 'Spain', 15000), (3, 'France', 25000); | What is the total installed capacity of wind power projects in the 'renewables' schema, grouped by country? | SELECT country, SUM(installed_capacity) FROM wind_projects GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, museum_id INT, category VARCHAR(255), acquisition_cost INT); CREATE TABLE museums (id INT, name VARCHAR(255), city VARCHAR(255), state VARCHAR(255)); | What is the average acquisition cost of artworks in the modern art category, grouped by museum? | SELECT m.name, AVG(acquisition_cost) FROM artworks a JOIN museums m ON a.museum_id = m.id WHERE category = 'Modern Art' GROUP BY m.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE YttriumExport(year INT, country VARCHAR(50), percentage DECIMAL(5,2)); INSERT INTO YttriumExport(year, country, percentage) VALUES (2018, 'India', 22.5), (2018, 'USA', 15.0), (2018, 'China', 40.0), (2019, 'India', 25.0), (2019, 'USA', 16.0), (2019, 'China', 39.0); | What is the percentage of Yttrium exported from India to other countries annually? | SELECT (SUM(percentage) FILTER (WHERE country = 'India'))/SUM(percentage) FROM YttriumExport; | gretelai_synthetic_text_to_sql |
CREATE TABLE content_creators (creator_id INT, creator_name VARCHAR(50), genre VARCHAR(50), post_count INT, engagement DECIMAL(10, 2)); INSERT INTO content_creators VALUES (109, 'Creator 1', 'Sports', 55, 2500), (110, 'Creator 2', 'Sports', 40, 2000), (111, 'Creator 3', 'Music', 60, 800), (112, 'Creator 4', 'Sports', 5... | Who are the top 5 content creators in terms of post engagement in the sports genre? | SELECT creator_name, SUM(engagement) as total_engagement FROM content_creators WHERE genre = 'Sports' GROUP BY creator_name ORDER BY total_engagement DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE tickets (ticket_id INT, game_id INT, region VARCHAR(50), quantity INT); INSERT INTO tickets (ticket_id, game_id, region, quantity) VALUES (1, 1, 'Midwest', 500); INSERT INTO tickets (ticket_id, game_id, region, quantity) VALUES (2, 2, 'Northeast', 700); CREATE TABLE games (game_id INT, sport VARCHAR(50)); ... | What is the total number of tickets sold for football games in the Midwest region? | SELECT SUM(quantity) FROM tickets INNER JOIN games ON tickets.game_id = games.game_id WHERE region = 'Midwest' AND sport = 'Football'; | gretelai_synthetic_text_to_sql |
CREATE TABLE volunteers (id INT, volunteer_name TEXT, organization TEXT, signup_date DATE); INSERT INTO volunteers (id, volunteer_name, organization, signup_date) VALUES (1, 'Alice', 'Doctors Without Borders', '2022-07-05'); INSERT INTO volunteers (id, volunteer_name, organization, signup_date) VALUES (2, 'Bob', 'Green... | How many volunteers signed up for each organization in Q3 of 2022? | SELECT organization, COUNT(volunteer_name) as num_volunteers FROM volunteers WHERE signup_date >= '2022-07-01' AND signup_date < '2022-10-01' GROUP BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (building_id INT, city VARCHAR(50), size INT); | Insert a new green building with ID 8 in Portland, OR with a size of 15000 | INSERT INTO green_buildings (building_id, city, size) VALUES (8, 'Portland', 15000); | gretelai_synthetic_text_to_sql |
CREATE TABLE strategies (id INT, sector VARCHAR(20), investment FLOAT); INSERT INTO strategies (id, sector, investment) VALUES (1, 'Education', 50000.0), (2, 'Healthcare', 75000.0), (3, 'Education', 100000.0); | What is the maximum investment in each sector? | SELECT sector, MAX(investment) FROM strategies GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE Chemicals (Id INT, Name VARCHAR(255), Manufacturing_Country VARCHAR(255)); CREATE TABLE Safety_Protocols (Id INT, Chemical_Id INT, Safety_Measure VARCHAR(255)); INSERT INTO Chemicals (Id, Name, Manufacturing_Country) VALUES (1, 'Nitric Acid', 'China'); INSERT INTO Safety_Protocols (Id, Chemical_Id, Safety_... | What safety measures are required for 'Nitric Acid' in China? | SELECT Chemicals.Name, Safety_Protocols.Safety_Measure FROM Chemicals INNER JOIN Safety_Protocols ON Chemicals.Id = Safety_Protocols.Chemical_Id WHERE Chemicals.Name = 'Nitric Acid' AND Chemicals.Manufacturing_Country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_intelligence_reports (report_id INT, report_date DATE, contractor TEXT, region TEXT, report_description TEXT, completion_date DATE); INSERT INTO threat_intelligence_reports (report_id, report_date, contractor, region, report_description, completion_date) VALUES (1, '2022-02-01', 'ACME Inc', 'Northea... | What is the average time to complete threat intelligence reports, by region, for the top three contractors in the defense industry in the past year? | SELECT region, AVG(DATEDIFF(completion_date, report_date)) as avg_time_to_complete FROM threat_intelligence_reports WHERE contractor IN (SELECT contractor FROM (SELECT contractor, COUNT(*) as num_reports FROM threat_intelligence_reports GROUP BY contractor ORDER BY num_reports DESC LIMIT 3) as top_three_contractors) GR... | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, years_of_experience INT); INSERT INTO attorneys (attorney_id, years_of_experience) VALUES (1, 6), (2, 3), (3, 7); | How many cases were handled by attorneys with more than 5 years of experience? | SELECT COUNT(*) FROM attorneys WHERE years_of_experience > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales_Data (Sale_Date DATE, Vehicle_Type VARCHAR(20), Quantity_Sold INT); | What is the total number of hybrid and electric vehicles sold in the Sales_Data table in the fourth quarter of 2022? | SELECT SUM(Quantity_Sold) FROM Sales_Data WHERE Vehicle_Type IN ('Hybrid', 'Electric') AND Sale_Date BETWEEN '2022-10-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (faculty_id INT, name TEXT, gender TEXT, department TEXT); CREATE TABLE research_grants (grant_id INT, faculty_id INT, amount DECIMAL(10,2), date DATE); | What is the total amount of research grants awarded to female faculty members in the past 5 years? | SELECT SUM(rg.amount) FROM research_grants rg INNER JOIN faculty f ON rg.faculty_id = f.faculty_id WHERE f.gender = 'female' AND rg.date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (researcher_id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), experience INT); | Show the "name" and "region" of all researchers in the "researchers" table who have more than 5 years of experience in "Asia". | SELECT name, region FROM researchers WHERE region = 'Asia' AND experience > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE threat_actors (actor_id INT, actor_name VARCHAR(255), attack_count INT); INSERT INTO threat_actors (actor_id, actor_name, attack_count) VALUES (1, 'APT28', 20), (2, 'APT33', 30), (3, 'Lazarus Group', 40); | What are the top 3 threat actors with the highest number of attacks in the last 6 months? | SELECT actor_name, attack_count as total_attacks FROM (SELECT actor_name, attack_count, ROW_NUMBER() OVER (ORDER BY attack_count DESC) as rank FROM threat_actors WHERE attack_date >= DATEADD(month, -6, CURRENT_TIMESTAMP)) subquery WHERE rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition_Visitors (visitor_id INT, exhibition_id INT, visit_date DATE, visitor_count INT); INSERT INTO Exhibition_Visitors (visitor_id, exhibition_id, visit_date, visitor_count) VALUES (1, 2, '2023-01-01', 2000), (2, 3, '2023-02-01', 1500); CREATE TABLE Exhibitions (exhibition_id INT, exhibition_name VAR... | Update the visitor count for exhibition 'Asian Art' to 3500 for the date 2023-04-15. | UPDATE Exhibition_Visitors SET visitor_count = 3500 WHERE exhibition_id = (SELECT exhibition_id FROM Exhibitions WHERE exhibition_name = 'Asian Art') AND visit_date = '2023-04-15'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Research_Studies (id INT, title VARCHAR(100), description TEXT, date_conducted DATE, location VARCHAR(50)); INSERT INTO Research_Studies (id, title, description, date_conducted, location) VALUES (1, 'Autonomous Driving and Pedestrian Safety', 'Research on pedestrian safety in autonomous driving vehicles...... | What is the most recent autonomous driving research study conducted in Japan? | SELECT title FROM Research_Studies WHERE date_conducted = (SELECT MAX(date_conducted) FROM Research_Studies WHERE location = 'Japan'); | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(50), country VARCHAR(50)); INSERT INTO company (id, name, country) VALUES (1, 'Maple Leaf Technologies', 'Canada'); INSERT INTO company (id, name, country) VALUES (2, 'Acme Corp', 'USA'); INSERT INTO company (id, name, country) VALUES (3, 'TechNord', 'Sweden'); | How many companies were founded in Canada? | SELECT COUNT(*) AS num_companies FROM company WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Emissions (EmissionID INT, MineID INT, EmissionType VARCHAR(20), EmissionValue INT, Year INT); INSERT INTO Emissions (EmissionID, MineID, EmissionType, EmissionValue, Year) VALUES (1, 1, 'CO2', 1000, 2020); INSERT INTO Emissions (EmissionID, MineID, EmissionType, EmissionValue, Year) VALUES (2, 2, 'CO2', 1... | What is the average CO2 emission from the Canadian oil sands in the last 5 years? | SELECT AVG(EmissionValue) FROM Emissions WHERE EmissionType = 'CO2' AND MineID IN (SELECT MineID FROM Mines WHERE Country = 'Canada') AND Year >= (SELECT YEAR(CURDATE()) - 5); | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_users (user_id INT, username VARCHAR(50), os VARCHAR(20)); INSERT INTO mobile_users VALUES (1, 'User 1', 'Android'); INSERT INTO mobile_users VALUES (2, 'User 2', 'iOS'); INSERT INTO mobile_users VALUES (3, 'User 3', 'Android'); INSERT INTO mobile_users VALUES (4, 'User 4', 'Windows Phone'); | How many users have each mobile operating system? | SELECT os, COUNT(*) as user_count FROM mobile_users GROUP BY os; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory(item VARCHAR(255), warehouse VARCHAR(255)); INSERT INTO inventory VALUES('XYZ', 'A01'), ('DEF', 'A02'); | Insert new item ABC into inventory | INSERT INTO inventory(item) VALUES('ABC'); | gretelai_synthetic_text_to_sql |
CREATE TABLE DroughtImpactAssessments (AssessmentID INT, Location VARCHAR(50), Date DATE, AgriculturalImpact INT, EnvironmentalImpact INT); INSERT INTO DroughtImpactAssessments (AssessmentID, Location, Date, AgriculturalImpact, EnvironmentalImpact) VALUES (4, 'Los Angeles, CA', '2022-04-01', 250, 125), (5, 'Los Angeles... | What is the agricultural and environmental impact of drought in a specific location over time? | SELECT Location, Date, SUM(AgriculturalImpact + EnvironmentalImpact) as TotalImpact FROM DroughtImpactAssessments GROUP BY Location, Date; | gretelai_synthetic_text_to_sql |
CREATE TABLE works (id INT, artist_id INT, medium TEXT, quantity INT); INSERT INTO works (id, artist_id, medium, quantity) VALUES (1, 1, 'sculpture', 12), (2, 2, 'painting', 25), (3, 3, 'sculpture', 8); | What is the maximum number of works created by an artist in the 'sculpture' medium? | SELECT MAX(quantity) FROM works WHERE medium = 'sculpture'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Race VARCHAR(20), Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, Race, Salary) VALUES (1, 'Asian', 80000.00), (2, 'Black', 85000.00), (3, 'Hispanic', 90000.00), (4, 'White', 95000.00); | What is the average salary for employees who identify as BIPOC? | SELECT AVG(Salary) FROM Employees WHERE Race IN ('Asian', 'Black', 'Hispanic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE travel_advisories (id INT, country VARCHAR(255), advisory_date DATE, advisory_update TEXT); INSERT INTO travel_advisories (id, country, advisory_date, advisory_update) VALUES (1, 'Bahamas', '2023-01-10', 'Protests in Nassau...'), (2, 'Jamaica', '2023-02-15', 'New entry requirements...'), (3, 'Cuba', '2022-... | Show travel advisory updates for Caribbean countries in the last 6 months | SELECT country, advisory_update FROM travel_advisories WHERE country IN ('Bahamas', 'Jamaica', 'Cuba', 'Haiti', 'Puerto Rico', 'Barbados', 'Dominican Republic', 'Trinidad and Tobago', 'Haiti', 'Grenada') AND advisory_date >= DATEADD(month, -6, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE Universities (UniversityID int, UniversityName varchar(255)); CREATE TABLE ResearchGrants (GrantID int, UniversityID int, Amount int, GrantDate date); | What is the average amount of research grants awarded to each university in the last three years, rounded to the nearest dollar, with a rank based on the total amount of grants awarded? | SELECT UniversityName, ROUND(AVG(Amount)) as AvgGrantAmount, RANK() OVER (PARTITION BY UniversityName ORDER BY AVG(Amount) DESC) as GrantRank FROM ResearchGrants WHERE GrantDate >= DATEADD(year, -3, GETDATE()) GROUP BY UniversityName; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, state VARCHAR(2), billing_amount DECIMAL(10,2)); INSERT INTO cases (id, state, billing_amount) VALUES (1, 'FL', 2000.00), (2, 'NY', 3000.00), (3, 'FL', 1000.00); | What is the minimum billing amount for cases in Florida? | SELECT MIN(billing_amount) FROM cases WHERE state = 'FL'; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleSafetyRatings (id INT, make VARCHAR(50), model VARCHAR(50), safety_rating INT); INSERT INTO VehicleSafetyRatings (id, make, model, safety_rating) VALUES (1, 'Volvo', 'XC90', 5), (2, 'Volvo', 'XC60', 4), (3, 'Tesla', 'Model S', 5), (4, 'Tesla', 'Model 3', 4), (5, 'BMW', 'X5', 4), (6, 'BMW', 'X3', 3),... | What is the average safety rating of vehicles, partitioned by manufacturer, for vehicles with a safety rating of 4 or higher? | SELECT make, AVG(safety_rating) AS avg_safety_rating FROM VehicleSafetyRatings WHERE safety_rating >= 4 GROUP BY make; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(50), founder_identity VARCHAR(50)); INSERT INTO company (id, name, founder_identity) VALUES (1, 'GreenTech', 'LGBTQ+'); INSERT INTO company (id, name, founder_identity) VALUES (2, 'CodeSolutions', 'Non-LGBTQ+'); INSERT INTO company (id, name, founder_identity) VALUES (3, 'Inno... | How many companies have been founded by individuals identifying as LGBTQ+? | SELECT COUNT(*) AS num_companies FROM company WHERE founder_identity = 'LGBTQ+'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists caribbean; USE caribbean; CREATE TABLE if not exists military_bases (id INT, name VARCHAR(255), type VARCHAR(255), location VARCHAR(255)); INSERT INTO military_bases (id, name, type, location) VALUES (1, 'Guantanamo Bay Naval Base', 'Navy Base', 'Cuba'), (2, 'Camp Santiago', 'Army Base', 'Pu... | What is the total number of military bases located in 'caribbean' schema | SELECT COUNT(*) FROM caribbean.military_bases; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name TEXT, volunteers_count INT, total_donation FLOAT); | What is the total number of volunteers and the total amount donated for each program? | SELECT p.name, SUM(d.total_donation) as total_donation, COUNT(v.id) as volunteers_count FROM programs p LEFT JOIN volunteers v ON p.id = v.program_id LEFT JOIN donors d ON v.id = d.volunteer_id GROUP BY p.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_name VARCHAR(255), season_start_year INT, season_end_year INT); INSERT INTO teams (team_name, season_start_year, season_end_year) VALUES ('Raptors', 2019, 2020); CREATE TABLE games (team_name VARCHAR(255), location VARCHAR(255), won BOOLEAN); | How many games were won by the Raptors at home in the 2019-2020 season? | SELECT COUNT(*) FROM games WHERE team_name = 'Raptors' AND location = 'home' AND won = TRUE AND season_start_year = 2019 AND season_end_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammals (mammal TEXT, ocean TEXT); INSERT INTO marine_mammals (mammal, ocean) VALUES ('Dolphin', 'Atlantic Ocean'), ('Whale', 'Pacific Ocean'), ('Seal', 'Arctic Ocean'); | What is the total number of marine mammals in the Pacific Ocean? | SELECT COUNT(*) FROM marine_mammals WHERE ocean = 'Pacific Ocean' AND mammal LIKE 'Whale%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Life_Expectancy (ID INT, Country VARCHAR(50), Life_Expectancy FLOAT); INSERT INTO Life_Expectancy (ID, Country, Life_Expectancy) VALUES (1, 'Australia', 82.8); | What is the life expectancy in Australia? | SELECT Life_Expectancy FROM Life_Expectancy WHERE Country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, ProgramID INT, Amount DECIMAL(10,2), DonationDate DATE); | Which programs had the highest total donations in the first half of this year? | SELECT p.ProgramName, SUM(d.Amount) FROM Donations d INNER JOIN Programs p ON d.ProgramID = p.ProgramID WHERE d.DonationDate >= DATEADD(year, DATEDIFF(year, 0, GETDATE()) - 1, 0) AND d.DonationDate < DATEADD(year, DATEDIFF(year, 0, GETDATE()), 6) GROUP BY p.ProgramName ORDER BY SUM(d.Amount) DESC; | gretelai_synthetic_text_to_sql |
mines(mine_id, mine_name, location, extraction_type) | Update the location of mine with ID 4 | UPDATE mines SET location = 'New Location' WHERE mine_id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_algorithms (algorithm_id INT, algorithm_name VARCHAR(50), safety_score DECIMAL(5,2)); INSERT INTO ai_algorithms (algorithm_id, algorithm_name, safety_score) VALUES (1, 'DeepQA', 85.34), (2, 'Random Forest', 91.23), (3, 'Support Vector Machine', 89.11), (4, 'Neural Network', 87.54); | What is the average safety score for each AI algorithm, partitioned by algorithm type, ordered by score in descending order? | SELECT algorithm_name, AVG(safety_score) as avg_safety_score FROM ai_algorithms GROUP BY algorithm_name ORDER BY avg_safety_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, daily_oil_production FLOAT); INSERT INTO wells (well_id, daily_oil_production) VALUES (1, 1000), (2, 2000), (3, 1500), (4, 2500), (5, 3000), (6, 4000), (7, 5000), (8, 6000), (9, 7000), (10, 8000); | Identify the top 5 wells with the highest daily oil production | SELECT well_id, daily_oil_production FROM wells ORDER BY daily_oil_production DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_precipitation_data (id INT, country VARCHAR(255), precipitation INT, timestamp TIMESTAMP); INSERT INTO country_precipitation_data (id, country, precipitation, timestamp) VALUES (1, 'India', 10, '2022-01-01 10:00:00'), (2, 'Brazil', 20, '2022-01-01 10:00:00'); | What is the total precipitation for each country in the past month? | SELECT country, SUM(precipitation) FROM country_precipitation_data WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 MONTH) GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity(landfill VARCHAR(50), location VARCHAR(50), capacity FLOAT); INSERT INTO landfill_capacity(landfill, location, capacity) VALUES('Landfill7', 'SuburbanArea', 60000), ('Landfill7', 'SuburbanArea', 60000), ('Landfill8', 'SuburbanArea', 65000), ('Landfill8', 'SuburbanArea', 65000), ('Landfill... | What is the total capacity of each landfill in GB serving 'SuburbanArea' as of 2022? | SELECT landfill, SUM(capacity) FROM landfill_capacity WHERE location = 'SuburbanArea' GROUP BY landfill; | gretelai_synthetic_text_to_sql |
CREATE TABLE MicroTransactions (TransactionID INT, PlayerID INT, Amount FLOAT, Game VARCHAR(50)); INSERT INTO MicroTransactions (TransactionID, PlayerID, Amount, Game) VALUES (1, 1, 20, 'CS:GO'); INSERT INTO MicroTransactions (TransactionID, PlayerID, Amount, Game) VALUES (2, 2, 30, 'CS:GO'); INSERT INTO MicroTransacti... | What is the maximum number of microtransactions made by players from South America in CS:GO? | SELECT Continent, MAX(Amount) as MaxMicroTransactions FROM MicroTransactions JOIN Players ON MicroTransactions.PlayerID = Players.PlayerID WHERE Game = 'CS:GO' AND Continent = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_plants (id INT PRIMARY KEY, country VARCHAR(50), name VARCHAR(50), capacity FLOAT); INSERT INTO renewable_plants (id, country, name, capacity) VALUES (1, 'Japan', 'Renewable Plant A', 65.5), (2, 'Japan', 'Renewable Plant B', 75.6); | What is the total capacity of renewable energy plants in Japan? | SELECT SUM(capacity) FROM renewable_plants WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsEvents (EventID INT, Country VARCHAR(20), VRAdoption INT); INSERT INTO EsportsEvents (EventID, Country, VRAdoption) VALUES (1, 'USA', 50), (2, 'Canada', 30), (3, 'Mexico', 40), (4, 'USA', 60), (5, 'Canada', 70); | What is the number of esports events in each country and the total number of VR headset adoptions in those events? | SELECT Country, COUNT(*) as NumEvents, SUM(VRAdoption) as TotalVRAdoption FROM EsportsEvents GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE LanguagePreservation (Country VARCHAR(255), Programs INT); INSERT INTO LanguagePreservation (Country, Programs) VALUES ('Nigeria', 15), ('South Africa', 12), ('Ethiopia', 18), ('Kenya', 10), ('Tanzania', 14); | What is the total number of language preservation programs in Africa, grouped by country? | SELECT Country, SUM(Programs) FROM LanguagePreservation WHERE Country = 'Africa' GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE navy_recruits (recruit_id INT, name VARCHAR(50), rank VARCHAR(50), join_date DATE); | Insert records of new recruits who joined the navy in 2022 into the navy_recruits table | INSERT INTO navy_recruits (recruit_id, name, rank, join_date) VALUES (1, 'Nguyen Thi Ha', 'Seaman Recruit', '2022-03-04'), (2, 'Ibrahim Ahmed', 'Seaman Recruit', '2022-07-20'), (3, 'Maria Rodriguez', 'Seaman Recruit', '2022-11-12'); | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryFishSpecies (Country varchar(50), SpeciesID int, SpeciesName varchar(50), Quantity int); INSERT INTO CountryFishSpecies (Country, SpeciesID, SpeciesName, Quantity) VALUES ('Canada', 1, 'Salmon', 5000), ('Canada', 2, 'Tuna', 6000), ('USA', 1, 'Salmon', 7000); | What is the total quantity of fish farmed in each country by species? | SELECT Country, SpeciesName, SUM(Quantity) as TotalQuantity FROM CountryFishSpecies GROUP BY Country, SpeciesName; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_profiles (union_name VARCHAR(30), safety_rating INT); INSERT INTO union_profiles (union_name, safety_rating) VALUES ('UnionA', 85), ('UnionB', 70), ('UnionC', 90); | What is the average duration of membership for unions that have a workplace safety rating above 80? * Assume a column named 'safety_rating' exists in the 'union_profiles' table with numeric values between 0 and 100. | SELECT AVG(membership_duration) FROM union_profiles WHERE safety_rating > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE VehicleSafetyTests (Manufacturer VARCHAR(50), Model VARCHAR(50), Year INT, SafetyRating DECIMAL(3,2)); INSERT INTO VehicleSafetyTests (Manufacturer, Model, Year, SafetyRating) VALUES ('Toyota', 'Corolla', 2020, 4.2), ('Toyota', 'Camry', 2020, 4.8), ('Honda', 'Civic', 2020, 4.6), ('Honda', 'Accord', 2020, 4... | What is the safety rating of vehicles by manufacturer and model? | SELECT Manufacturer, Model, SafetyRating FROM VehicleSafetyTests; | gretelai_synthetic_text_to_sql |
CREATE TABLE drilling_data (well_id INT, drilling_date DATE, well_depth INT, state TEXT); INSERT INTO drilling_data (well_id, drilling_date, well_depth, state) VALUES (1, '2015-01-01', 12000, 'Brazil'); INSERT INTO drilling_data (well_id, drilling_date, well_depth, state) VALUES (2, '2016-05-15', 15000, 'Brazil'); INSE... | How many wells were drilled in Brazil between 2015 and 2017? | SELECT COUNT(*) FROM drilling_data WHERE state = 'Brazil' AND drilling_date BETWEEN '2015-01-01' AND '2017-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE threats (ip_address VARCHAR(255), timestamp TIMESTAMP); CREATE TABLE security_incidents (id INT, ip_address VARCHAR(255), timestamp TIMESTAMP); | Which IP addresses have been detected as threats in the last week and have also had security incidents in the last month? | SELECT t.ip_address FROM threats t JOIN security_incidents i ON t.ip_address = i.ip_address WHERE t.timestamp >= NOW() - INTERVAL 1 WEEK AND i.timestamp >= NOW() - INTERVAL 1 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorRegion VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO Donors (DonorID, DonorRegion, Amount) VALUES (1, 'North America', 1200), (2, 'Europe', 1100), (3, 'Asia', 900), (4, 'North America', 1500), (5, 'Africa', 800); | Which regions had the highest and lowest donation amounts in 2022? | SELECT DonorRegion, MAX(Amount) as HighestDonation, MIN(Amount) as LowestDonation FROM Donors WHERE YEAR(DonationDate) = 2022 GROUP BY DonorRegion HAVING COUNT(DonorID) > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredient_sourcing (ingredient_name VARCHAR(100), source_country VARCHAR(100), is_natural BOOLEAN); INSERT INTO ingredient_sourcing (ingredient_name, source_country, is_natural) VALUES ('Coconut Oil', 'Sri Lanka', true), ('Rosehip Oil', 'Chile', true), ('Lavender Oil', 'France', true); | Which country sources the most natural ingredients for cosmetic products? | SELECT source_country, SUM(CASE WHEN is_natural THEN 1 ELSE 0 END) AS total_natural_ingredients FROM ingredient_sourcing GROUP BY source_country ORDER BY total_natural_ingredients DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (teacher_id INT, age INT, num_courses_completed INT); INSERT INTO teachers (teacher_id, age, num_courses_completed) VALUES (1, 35, 2), (2, 45, 0), (3, 30, 1), (4, 50, 3); | What is the average age of teachers who have completed at least one professional development course in the past year? | SELECT AVG(age) FROM teachers WHERE num_courses_completed >= (SELECT COUNT(course_id) FROM courses WHERE completion_date > DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)); | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtMovements (MovementID int, Name varchar(50)); CREATE TABLE ArtPieces (ArtPieceID int, Title varchar(50), YearCreated int, MovementID int, Medium varchar(50)); | What is the most common medium used in sculptures from the Baroque period? | SELECT ArtMovements.Name, ArtPieces.Medium, COUNT(ArtPieces.ArtPieceID) AS ArtPiecesCount FROM ArtMovements INNER JOIN ArtPieces ON ArtMovements.MovementID = ArtPieces.MovementID WHERE ArtMovements.Name = 'Baroque' AND ArtPieces.Medium IS NOT NULL GROUP BY ArtMovements.Name, ArtPieces.Medium ORDER BY ArtPiecesCount DES... | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (Country VARCHAR(255), Region VARCHAR(255), EventType VARCHAR(255), InvolvesCybersecurity BOOLEAN); INSERT INTO DefenseDiplomacy (Country, Region, EventType, InvolvesCybersecurity) VALUES ('France', 'Europe', 'MilitaryExercise', TRUE), ('Germany', 'Europe', 'MilitaryExercise', FALSE); | How many defense diplomacy events involved cybersecurity cooperation in the European region? | SELECT COUNT(*) FROM DefenseDiplomacy WHERE Region = 'Europe' AND InvolvesCybersecurity = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups (id INT, name VARCHAR(255), location VARCHAR(255), budget FLOAT); INSERT INTO startups (id, name, location, budget) VALUES (1, 'StartupA', 'UK', 6000000); INSERT INTO startups (id, name, location, budget) VALUES (2, 'StartupB', 'UK', 3000000); INSERT INTO startups (id, name, location, budget) VALU... | What is the maximum budget allocated for biosensor technology development in startups located in the United Kingdom? | SELECT MAX(budget) FROM startups WHERE location = 'UK' AND category = 'biosensor technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, name VARCHAR(255), charity_donation BOOLEAN); INSERT INTO suppliers (supplier_id, name, charity_donation) VALUES (1, 'Kind Supplies', TRUE), (2, 'Eco Goods', FALSE); | List all suppliers that donate a portion of their profits to charity. | SELECT * FROM suppliers WHERE charity_donation = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonationDate DATE, DonationAmount DECIMAL(10,2)); INSERT INTO Donors (DonorID, DonationDate, DonationAmount) VALUES (1, '2022-02-15', 50.00), (2, '2022-03-20', 100.00), (3, '2021-12-31', 75.00); | What is the average donation amount per donor in the last year? | SELECT DonorID, AVG(DonationAmount) as AvgDonationPerDonor FROM Donors WHERE DonationDate >= DATE_TRUNC('year', CURRENT_DATE - INTERVAL '1 year') AND DonationDate < DATE_TRUNC('year', CURRENT_DATE) GROUP BY DonorID; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_species (id INT PRIMARY KEY, species VARCHAR(255), scientific_name VARCHAR(255)); | Delete records of Carp species from the fish_species table | DELETE FROM fish_species WHERE species = 'Carp'; | gretelai_synthetic_text_to_sql |
CREATE TABLE commercial_buildings (id INT, state VARCHAR(2), energy_consumption FLOAT); INSERT INTO commercial_buildings (id, state, energy_consumption) VALUES (1, 'TX', 1200000), (2, 'TX', 1500000), (3, 'TX', 900000), (4, 'TX', 1700000); CREATE TABLE energy_source (id INT, source VARCHAR(20), commercial_buildings_id I... | What is the total energy consumption for commercial buildings in Texas, categorized by energy source, for the year 2020?' | SELECT e.source, SUM(cb.energy_consumption) as total_energy_consumption FROM commercial_buildings cb JOIN energy_source e ON cb.id = e.commercial_buildings_id WHERE cb.state = 'TX' AND YEAR(cb.timestamp) = 2020 GROUP BY e.source; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), manufacturer VARCHAR(255), launch_date DATE); INSERT INTO satellites (id, name, manufacturer, launch_date) VALUES (1, 'FalconSat', 'SpaceX', '2020-01-01'), (2, 'Cubesat', 'Blue Origin', '2019-01-01'), (3, 'Electron', 'Rocket Lab', '2021-01-01'), (4, 'Telstar 18V', 'Te... | What is the name and manufacturer of the earliest deployed satellite, considering 'Telstar 18V' by Telesat? | SELECT name, manufacturer FROM satellites ORDER BY launch_date ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feed (FeedID INT, StockID INT, FeedType VARCHAR(50), Quantity INT, FeedDate DATE, Location VARCHAR(50), DissolvedOxygen FLOAT); INSERT INTO Feed (FeedID, StockID, FeedType, Quantity, FeedDate, Location, DissolvedOxygen) VALUES (1, 1, 'Organic', 120, '2021-01-01', 'Arctic', 8.2); INSERT INTO Feed (FeedID, S... | For how many fish species has feed been provided in the Arctic region with a dissolved oxygen level greater than 8? | SELECT COUNT(DISTINCT Species) FROM FishStock fs JOIN Feed f ON fs.StockID = f.StockID WHERE f.Location = 'Arctic' AND f.DissolvedOxygen > 8; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_species (species_id INT, species_name VARCHAR(255)); INSERT INTO animal_species (species_id, species_name) VALUES (1, 'Tiger'), (2, 'Lion'), (3, 'Elephant'); CREATE TABLE rehabilitation_center (animal_id INT, species_id INT, admission_date DATE); INSERT INTO rehabilitation_center (animal_id, species... | What is the total number of animals in the rehabilitation center and their respective species? | SELECT r.animal_id, s.species_name FROM rehabilitation_center r JOIN animal_species s ON r.species_id = s.species_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (policy_id INT, risk_assessment_model_id INT); CREATE TABLE claims (claim_id INT, policy_id INT); CREATE TABLE risk_assessment_models (risk_assessment_model_id INT, model_name VARCHAR(50)); | Retrieve the total number of policies and claims for each risk assessment model. | SELECT risk_assessment_models.model_name, COUNT(policies.policy_id) AS total_policies, COUNT(claims.claim_id) AS total_claims FROM risk_assessment_models LEFT JOIN policies ON risk_assessment_models.risk_assessment_model_id = policies.risk_assessment_model_id LEFT JOIN claims ON policies.policy_id = claims.policy_id GR... | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, weight FLOAT, origin VARCHAR(20), shipped_date DATE); INSERT INTO Shipments (id, weight, origin, shipped_date) VALUES (1, 50, 'Spain', '2021-01-05'), (2, 70, 'USA', '2021-02-10'), (3, 30, 'Spain', '2021-03-20'); | What is the total weight of shipments from Spain since 2021-01-01? | SELECT SUM(weight) FROM Shipments WHERE origin = 'Spain' AND shipped_date >= '2021-01-01' | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_fuel_consumption ( vessel_name VARCHAR(255), voyage_date DATE, fuel_consumption_liters INT); | Delete records in the vessel_fuel_consumption table where the fuel_consumption_liters is greater than 1000 and the voyage_date is within the last month for vessel "Green Wave" | DELETE FROM vessel_fuel_consumption WHERE vessel_name = 'Green Wave' AND fuel_consumption_liters > 1000 AND voyage_date > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Agricultural_Projects (Project_ID INT, Project_Name TEXT, Location TEXT, Funding_Received DECIMAL, Led_By TEXT, Year INT); INSERT INTO Agricultural_Projects (Project_ID, Project_Name, Location, Funding_Received, Led_By, Year) VALUES (1, 'Agroforestry Project', 'Bolivia', 35000, 'Indigenous', 2018); | What was the average amount of funding received by Indigenous-led agricultural projects in Bolivia in 2018? | SELECT AVG(Funding_Received) FROM Agricultural_Projects WHERE Led_By = 'Indigenous' AND Year = 2018 AND Location = 'Bolivia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (id INT, name VARCHAR(100), code VARCHAR(1000), creation_date DATE); INSERT INTO smart_contracts (id, name, code, creation_date) VALUES (1, 'testSC123', '0x123...', '2017-01-01'); INSERT INTO smart_contracts (id, name, code, creation_date) VALUES (2, 'otherSC', '0x456...', '2018-05-05'); | Update the name of all smart contracts with the word 'test' in it to 'TestSC' in the smart_contracts table. | UPDATE smart_contracts SET name = 'TestSC' WHERE name LIKE '%test%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Flight_Safety_Table (id INT, year INT, num_accidents INT); | How many flight accidents were recorded in the year 2000? | SELECT SUM(NUM_ACCIDENTS) FROM Flight_Safety_Table WHERE YEAR = 2000; | 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.