context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE DisasterPreparedness (id INT, month INT, year INT, disasterType VARCHAR(30), score INT); | List all disaster types and their respective average preparedness scores, for the last 3 months, from 'DisasterPreparedness' table. | SELECT disasterType, AVG(score) FROM DisasterPreparedness WHERE year = YEAR(CURRENT_DATE) AND month BETWEEN MONTH(CURRENT_DATE) - 2 AND MONTH(CURRENT_DATE) GROUP BY disasterType; | gretelai_synthetic_text_to_sql |
CREATE TABLE student (id INT, program TEXT, gpa REAL); INSERT INTO student (id, program, gpa) VALUES (1, 'math', 3.8), (2, 'math', 3.9), (3, 'math', 4.0); | What is the minimum GPA of graduate students in the 'math' program? | SELECT MIN(gpa) FROM student WHERE program = 'math'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (drug_name TEXT, sale_amount INTEGER, sale_year INTEGER, region TEXT); INSERT INTO sales_data (drug_name, sale_amount, sale_year, region) VALUES ('DrugC', 1200, 2020, 'North'), ('DrugC', 1500, 2020, 'South'), ('DrugD', 2000, 2020, 'East'), ('DrugD', 1800, 2020, 'West'); | What is the total sales amount for a specific drug across different regions in a given year? | SELECT SUM(sale_amount) FROM sales_data WHERE drug_name = 'DrugC' AND sale_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE veteran_employment (employee_id INT, industry VARCHAR(255), date DATE); INSERT INTO veteran_employment (employee_id, industry, date) VALUES (1, 'defense', '2019-09-01'); INSERT INTO veteran_employment (employee_id, industry, date) VALUES (2, 'non-defense', '2019-12-05'); | How many veterans found employment in the defense industry in 2019? | SELECT COUNT(*) FROM veteran_employment WHERE industry = 'defense' AND date BETWEEN '2019-01-01' AND '2019-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceExploration(mission VARCHAR(20), mission_year INT, company VARCHAR(20)); INSERT INTO SpaceExploration VALUES('Mission A', 2019, 'NASA'),('Mission B', 2020, 'SpaceX'); | How many space missions were conducted by 'NASA' in the year 2019? | SELECT COUNT(*) FROM SpaceExploration WHERE mission_year=2019 AND company='NASA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_ethics (ethic_id INT PRIMARY KEY, ethic_name VARCHAR(255), description TEXT, source VARCHAR(255)); | Update the description of the ethic with ethic_id 1 in the 'media_ethics' table | UPDATE media_ethics SET description = 'The right to access and distribute information without interference from government or other powers.' WHERE ethic_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, employee_id INT, transaction_type VARCHAR(20), transaction_value DECIMAL(10,2), is_fraudulent BOOLEAN); | Find the number of fraudulent transactions and their total value, excluding transactions with a value less than 1000, for each employee in the sales department. | SELECT employee_id, COUNT(*) as fraud_count, SUM(transaction_value) as total_fraud_value FROM transactions WHERE transaction_type = 'Sales' AND is_fraudulent = TRUE AND transaction_value >= 1000 GROUP BY employee_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE therapy_sessions (id INT, session_name TEXT, cost INT, country TEXT); | What is the average cost of group therapy sessions in France? | SELECT AVG(cost) FROM therapy_sessions WHERE session_name = 'Group Therapy' AND country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (id INT, mine_id INT, year INT, co2_emissions INT, water_usage INT); INSERT INTO environmental_impact (id, mine_id, year, co2_emissions, water_usage) VALUES (7, 7, 2021, 40000, 900000); INSERT INTO environmental_impact (id, mine_id, year, co2_emissions, water_usage) VALUES (8, 8, 2021,... | What is the total CO2 emissions for each year in the diamond mining industry? | SELECT YEAR(e.year) AS year, SUM(e.co2_emissions) AS total_co2_emissions FROM environmental_impact e JOIN mines m ON e.mine_id = m.id WHERE m.mineral = 'Diamond' GROUP BY YEAR(e.year); | gretelai_synthetic_text_to_sql |
CREATE TABLE MediaContent (ContentID INT PRIMARY KEY, ContentName VARCHAR(50), ContentType VARCHAR(30), DiversityScore DECIMAL(5,2), MediaPlatform VARCHAR(30)); INSERT INTO MediaContent (ContentID, ContentName, ContentType, DiversityScore, MediaPlatform) VALUES (1, 'Content 1', 'Video', 8.5, 'Platform A'), (2, 'Content... | List all the video contents with a diversity score greater than 8.5. | SELECT * FROM MediaContent WHERE ContentType = 'Video' AND DiversityScore > 8.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE whale_sightings (id INTEGER, species TEXT, sighting_date DATE, location TEXT); INSERT INTO whale_sightings (id, species, sighting_date, location) VALUES (1, 'Blue Whale', '2022-01-01', 'Pacific Ocean'); INSERT INTO whale_sightings (id, species, sighting_date, location) VALUES (2, 'Gray Whale', '2022-03-15'... | Count the number of whale sightings in the Pacific Ocean in 2022. | SELECT COUNT(*) FROM whale_sightings WHERE sighting_date >= '2022-01-01' AND sighting_date < '2023-01-01' AND location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE african_census (model_name TEXT, fairness_score FLOAT); INSERT INTO african_census (model_name, fairness_score) VALUES ('model1', 0.95), ('model2', 0.85), ('model3', 0.90); | What is the maximum fairness score for models trained on the 'african_census' dataset? | SELECT MAX(fairness_score) FROM african_census; | gretelai_synthetic_text_to_sql |
CREATE TABLE package_destinations (id INT, package_weight FLOAT, shipped_from VARCHAR(20), shipped_to VARCHAR(20), shipped_date DATE); INSERT INTO package_destinations (id, package_weight, shipped_from, shipped_to, shipped_date) VALUES (1, 2.3, 'New Zealand', 'Australia', '2022-01-15'); | What is the total weight of packages shipped to Australia from any country in Oceania in the last month? | SELECT SUM(package_weight) FROM package_destinations WHERE shipped_to = 'Australia' AND shipped_from LIKE 'Oceania%' AND shipped_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE life_expectancy(id INT, country TEXT, continent TEXT, expectancy FLOAT); | What is the average life expectancy in each continent? | SELECT continent, AVG(expectancy) FROM life_expectancy GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE company_impact (id INT, name VARCHAR(50), sector VARCHAR(20), impact_score FLOAT); INSERT INTO company_impact (id, name, sector, impact_score) VALUES (1, 'Company X', 'Healthcare', 90.0), (2, 'Company Y', 'Finance', 85.0), (3, 'Company Z', 'Healthcare', 92.5); | What is the maximum impact score achieved by a company in the healthcare sector? | SELECT MAX(impact_score) FROM company_impact WHERE sector = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, division VARCHAR(50)); CREATE TABLE ticket_sales (id INT, team_id INT, num_tickets INT); | How many season tickets have been sold in the Pacific Division? | SELECT SUM(ticket_sales.num_tickets) FROM ticket_sales JOIN teams ON ticket_sales.team_id = teams.team_id WHERE teams.division = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE access_to_justice_cases (id INT, resolution_type VARCHAR(20), resolution_date DATE); | What is the percentage of cases in the access to justice database that were resolved through mediation in the last quarter? | SELECT (COUNT(*) FILTER (WHERE resolution_type = 'mediation')) * 100.0 / COUNT(*) FROM access_to_justice_cases WHERE resolution_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTHS); | gretelai_synthetic_text_to_sql |
CREATE TABLE space_objects (id INT, name VARCHAR(255), mass FLOAT, type VARCHAR(255)); INSERT INTO space_objects (id, name, mass, type) VALUES (1, 'Object 1', 1000.0, 'Rocket Stage'), (2, 'Object 2', 20.0, 'Fractured Debris'), (3, 'Object 3', 1500.0, 'Dead Satellite'); | What is the average mass of different types of space debris? | SELECT type, AVG(mass) FROM space_objects GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE MusicArtists (id INT, name VARCHAR(100), country VARCHAR(50), rating FLOAT); | What's the average rating of music artists from Asia? | SELECT AVG(rating) FROM MusicArtists WHERE country = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, name TEXT, certification_level TEXT, city TEXT); | Delete all green buildings in the green_buildings table associated with the 'Boston' city | WITH cte AS (DELETE FROM green_buildings WHERE city = 'Boston') SELECT * FROM cte; | gretelai_synthetic_text_to_sql |
CREATE TABLE species(id INT, name VARCHAR(255), common_name VARCHAR(255), population INT, endangered BOOLEAN); | Add a new column endangered to the species table and update values | ALTER TABLE species ADD COLUMN endangered BOOLEAN; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ethnicities (EthnicityID INT, Ethnicity VARCHAR(50)); CREATE TABLE MentalHealthScores (MH_ID INT, EthnicityID INT, MentalHealthScore INT); INSERT INTO Ethnicities (EthnicityID, Ethnicity) VALUES (1, 'Hispanic'), (2, 'African American'), (3, 'Asian'), (4, 'Caucasian'); INSERT INTO MentalHealthScores (MH_ID,... | What is the minimum mental health score by ethnicity? | SELECT e.Ethnicity, MIN(mhs.MentalHealthScore) as Min_Score FROM MentalHealthScores mhs JOIN Ethnicities e ON mhs.EthnicityID = e.EthnicityID GROUP BY e.Ethnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, ocean TEXT, affected_by_safety_issues BOOLEAN); INSERT INTO marine_species (id, name, ocean, affected_by_safety_issues) VALUES (1, 'Krill', 'Southern', TRUE), (2, 'Blue Whale', 'Atlantic', FALSE), (3, 'Penguin', 'Southern', TRUE); | What is the total number of marine species in the Southern Ocean that are affected by maritime safety issues? | SELECT COUNT(*) FROM marine_species WHERE ocean = 'Southern' AND affected_by_safety_issues = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(255), manufacturer VARCHAR(255), type VARCHAR(255), launch_date DATE); INSERT INTO Spacecraft (id, name, manufacturer, type, launch_date) VALUES (3, 'Galileo Orbiter', 'ESA', 'Robotic', '1989-10-18'); INSERT INTO Spacecraft (id, name, manufacturer, type, launch_date) VALUES... | Which spacecraft have been launched by the European Space Agency? | SELECT name FROM Spacecraft WHERE manufacturer = 'ESA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Labor_OR (labor_id INT, labor_cost FLOAT, labor_state VARCHAR(20), labor_date DATE); INSERT INTO Labor_OR (labor_id, labor_cost, labor_state, labor_date) VALUES (1, 300, 'Oregon', '2022-01-01'), (2, 350, 'Oregon', '2022-01-15'), (3, 400, 'Oregon', '2022-03-01'); | What was the maximum labor cost for each month in Oregon in 2022? | SELECT labor_date, MAX(labor_cost) OVER (PARTITION BY EXTRACT(MONTH FROM labor_date)) AS max_labor_cost FROM Labor_OR WHERE labor_state = 'Oregon' AND labor_date >= '2022-01-01' AND labor_date < '2023-01-01' ORDER BY labor_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE location (location_id INT, location_name TEXT); INSERT INTO location (location_id, location_name) VALUES (1, 'Indian Ocean'); CREATE TABLE measurement (measurement_id INT, location_id INT, dissolved_oxygen FLOAT); INSERT INTO measurement (measurement_id, location_id, dissolved_oxygen) VALUES (1, 1, 6.5), (... | What is the minimum dissolved oxygen level in the Indian Ocean? | SELECT MIN(dissolved_oxygen) FROM measurement WHERE location_id = (SELECT location_id FROM location WHERE location_name = 'Indian Ocean'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Accidents (aircraft_model VARCHAR(255), accident_date DATE, country VARCHAR(255)); INSERT INTO Aircraft_Accidents (aircraft_model, accident_date, country) VALUES ('Boeing 737', '2020-01-01', 'USA'), ('Airbus A320', '2020-02-01', 'France'), ('Boeing 747', '2020-03-01', 'UK'), ('Boeing 737', '2020-0... | List the top 3 countries with the most aircraft accidents in 2020. | SELECT country, COUNT(*) AS num_accidents FROM Aircraft_Accidents WHERE YEAR(accident_date) = 2020 GROUP BY country ORDER BY num_accidents DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, home_location VARCHAR(50)); INSERT INTO mobile_subscribers (subscriber_id, home_location) VALUES (1, 'USA'), (2, 'Mexico'), (3, 'Canada'), (4, 'USA'), (5, 'Canada'); | How many mobile subscribers are there in each country? | SELECT home_location, COUNT(*) FROM mobile_subscribers GROUP BY home_location; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name TEXT, location TEXT, sustainability_rating REAL); | Delete the supplier with id 2 | DELETE FROM suppliers WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (id INT, name VARCHAR(50), location VARCHAR(50));CREATE TABLE coal_mine (mine_id INT, amount INT);CREATE TABLE iron_mine (mine_id INT, amount INT);CREATE TABLE gold_mine (mine_id INT, amount INT);CREATE TABLE silver_mine (mine_id INT, amount INT); | List the names and locations of mines that have mined any type of metal. | SELECT m.name, m.location FROM mine m LEFT JOIN coal_mine c ON m.id = c.mine_id LEFT JOIN iron_mine i ON m.id = i.mine_id LEFT JOIN gold_mine g ON m.id = g.mine_id LEFT JOIN silver_mine s ON m.id = s.mine_id WHERE c.mine_id IS NOT NULL OR i.mine_id IS NOT NULL OR g.mine_id IS NOT NULL OR s.mine_id IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors(vendor_id INT, vendor_name TEXT, country TEXT); INSERT INTO vendors(vendor_id, vendor_name, country) VALUES (1, 'VendorA', 'India'), (2, 'VendorB', 'China'), (3, 'VendorC', 'Japan'); CREATE TABLE products(product_id INT, product_name TEXT, rating INT); INSERT INTO products(product_id, product_name,... | What is the average rating of products sold by vendors from Asia? | SELECT AVG(products.rating) FROM products JOIN vendors ON products.vendor_id = vendors.vendor_id WHERE vendors.country = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExhibitionAnalytics (ExhibitionID INT, ExhibitionName VARCHAR(50), TotalVisitors INT, TotalEngagement INT); | Update the TotalEngagement column in the ExhibitionAnalytics table for the 'Ancient Art' exhibition to 300. | UPDATE ExhibitionAnalytics SET TotalEngagement = 300 WHERE ExhibitionName = 'Ancient Art'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GarmentProduction (garmentID INT, material VARCHAR(20), year INT, quantity INT); INSERT INTO GarmentProduction (garmentID, material, year, quantity) VALUES (1, 'Recycled Polyester', 2020, 12000), (2, 'Organic Cotton', 2020, 15000), (3, 'Recycled Denim', 2019, 8000), (4, 'Recycled Polyester', 2019, 9000), (... | What is the total quantity of recycled materials used in garment production? | SELECT SUM(quantity) FROM GarmentProduction WHERE material LIKE '%Recycled%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Voyage (VoyageID INT, VesselID INT, StartPortID INT, EndPortID INT, StartDate DATETIME, EndDate DATETIME); INSERT INTO Voyage (VoyageID, VesselID, StartPortID, EndPortID, StartDate, EndDate) VALUES (1, 1, 1, 2, '2022-01-01 08:00:00', '2022-01-02 10:00:00'); INSERT INTO Voyage (VoyageID, VesselID, StartPort... | List the voyages with their start and end ports and the time difference between arrivals. | SELECT v1.VesselID, p1.PortName AS StartPort, p2.PortName AS EndPort, DATEDIFF(HOUR, v1.StartDate, v1.EndDate) AS TimeDifference FROM Voyage v1 JOIN Port p1 ON v1.StartPortID = p1.PortID JOIN Port p2 ON v1.EndPortID = p2.PortID; | gretelai_synthetic_text_to_sql |
CREATE TABLE Buses (id INT, model VARCHAR(255), last_inspection DATETIME); | Which buses have not had a safety inspection in the last 6 months? | SELECT B.id, B.model FROM Buses B LEFT JOIN (SELECT bus_id, MAX(last_inspection) as max_inspection FROM Buses GROUP BY bus_id) BI ON B.id = BI.bus_id WHERE B.last_inspection < BI.max_inspection - INTERVAL 6 MONTH; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, post_text VARCHAR(255), likes INT, language VARCHAR(10)); INSERT INTO posts (id, user_id, post_text, likes, language) VALUES (1, 1, 'Hola!', 20, 'es'), (2, 2, 'Hello!', 15, 'en'), (3, 3, 'Bonjour!', 25, 'fr'), (4, 4, 'Olá!', 18, 'pt'); | What was the maximum number of likes received by posts in Spanish? | SELECT MAX(likes) FROM posts WHERE language = 'es'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (id INT, law_name TEXT, state TEXT); INSERT INTO MentalHealthParity (id, law_name, state) VALUES (1, 'Parity Act 2020', 'Massachusetts'); INSERT INTO MentalHealthParity (id, law_name, state) VALUES (2, 'Equity Act 2018', 'Massachusetts'); | List all mental health parity laws in Massachusetts. | SELECT * FROM MentalHealthParity WHERE state = 'Massachusetts'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (production_id INT, location VARCHAR(255), year INT, gas_production FLOAT); INSERT INTO production (production_id, location, year, gas_production) VALUES (1, 'Nigeria', 2020, 5000000), (2, 'Algeria', 2020, 4000000), (3, 'Egypt', 2019, 3000000); | What is the average gas production in the 'Africa' region for the year 2020? (Assuming gas production values are stored in a separate column) | SELECT AVG(gas_production) FROM production WHERE location LIKE '%Africa%' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), hire_date DATE); INSERT INTO employees (id, name, department, hire_date) VALUES (1, 'John Doe', 'IT', '2021-03-01'), (2, 'Jane Smith', 'Marketing', '2021-07-15'), (3, 'Mike Johnson', 'IT', '2021-02-12'), (4, 'Sara Connor', 'Marketing', '2021-10-0... | Show the number of employees hired in each month of the year, broken down by department. | SELECT department, DATE_TRUNC('month', hire_date) AS hire_month, COUNT(*) AS num_hires FROM employees GROUP BY department, hire_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name VARCHAR(255), safety_record JSON); CREATE TABLE inspections (vessel_id INT, inspection_date DATE, score INT); INSERT INTO vessels VALUES (1, 'Vessel A', '{"inspection_date": "2021-01-01", "score": 90}'::JSON), (2, 'Vessel B', '{"inspection_date": "2021-02-01", "score": 85}'::JSON); IN... | Update the vessel's safety record with the latest inspection date and score. | UPDATE vessels v SET safety_record = jsonb_set(v.safety_record, '{inspection_date, score}', jsonb_build_object('inspection_date', (SELECT i.inspection_date FROM inspections i WHERE i.vessel_id = v.id ORDER BY i.inspection_date DESC LIMIT 1), 'score', (SELECT i.score FROM inspections i WHERE i.vessel_id = v.id ORDER BY ... | gretelai_synthetic_text_to_sql |
CREATE TABLE news.articles (article_id INT, title VARCHAR(100), publish_date DATE); INSERT INTO news.articles (article_id, title, publish_date) VALUES (1, 'Article 1', '2021-01-01'), (2, 'Article 2', '2021-02-01'); | How many news articles were published per month in 2021 in the 'news' schema? | SELECT MONTH(publish_date), COUNT(*) FROM news.articles WHERE YEAR(publish_date) = 2021 GROUP BY MONTH(publish_date); | gretelai_synthetic_text_to_sql |
CREATE TABLE Dispensaries (id INT, dispensary_name VARCHAR(255), state VARCHAR(255), income DECIMAL(10, 2)); INSERT INTO Dispensaries (id, dispensary_name, state, income) VALUES (1, 'Green Earth Dispensary', 'Colorado', 125000.00); CREATE TABLE Cannabis_Sales (id INT, dispensary_id INT, sale_year INT, sale_weight DECIM... | What is the total weight of indoor grown cannabis sold by dispensaries in Colorado in 2021? | SELECT SUM(sale_weight) FROM Dispensaries d JOIN Cannabis_Sales s ON d.id = s.dispensary_id WHERE d.state = 'Colorado' AND s.sale_year = 2021 AND s.sale_type = 'Indoor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (region VARCHAR(50), year INT, waste_kg FLOAT); INSERT INTO waste_generation (region, year, waste_kg) VALUES ('Greater Toronto', 2021, 123456.78); | What is the total waste generation in kg for the region 'Greater Toronto' for the year 2021? | SELECT SUM(waste_kg) FROM waste_generation WHERE region = 'Greater Toronto' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE pipelines (id INT, name VARCHAR(50), location VARCHAR(50), construction_cost DECIMAL(10,2)); INSERT INTO pipelines (id, name, location, construction_cost) VALUES (1, 'Alberta Clipper Pipeline', 'Alberta', 1500000000.00); | Find the maximum construction cost for pipelines in 'Alberta' | SELECT MAX(construction_cost) FROM pipelines WHERE location = 'Alberta'; | gretelai_synthetic_text_to_sql |
CREATE TABLE voice_plans (plan_id int, plan_cost float, plan_type varchar(10)); INSERT INTO voice_plans (plan_id, plan_cost, plan_type) VALUES (1, 30, 'basic'), (2, 50, 'premium'); CREATE TABLE voice_subscribers (subscriber_id int, voice_plan varchar(10), state varchar(20)); INSERT INTO voice_subscribers (subscriber_id... | How many subscribers are using premium voice plans in each state? | SELECT state, COUNT(*) as num_premium_subscribers FROM voice_subscribers sub INNER JOIN voice_plans plan ON sub.voice_plan = plan.plan_type WHERE plan_type = 'premium' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricAutonomousVehicles (id INT, make VARCHAR(50), model VARCHAR(50), electric BOOLEAN, autonomous BOOLEAN); | What is the total number of electric and autonomous vehicles in the electricautonomousvehicles schema? | SELECT COUNT(*) FROM electricautonomousvehicles.ElectricAutonomousVehicles WHERE electric = TRUE OR autonomous = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE EpicRacers (PlayerID INT, Name VARCHAR(50), Platform VARCHAR(10)); INSERT INTO EpicRacers (PlayerID, Name, Platform) VALUES (1, 'John', 'PC'), (2, 'Amy', 'Console'), (3, 'Mike', 'Mobile'), (4, 'Linda', 'PC'), (5, 'Sam', 'Console'); | How many players are there in the "EpicRacers" table, grouped by their preferred gaming platform (PC, Console, Mobile)? | SELECT Platform, COUNT(PlayerID) FROM EpicRacers GROUP BY Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE Teams (TeamID INT, TeamName VARCHAR(50)); INSERT INTO Teams (TeamID, TeamName) VALUES (1, 'Red Dragons'), (2, 'Blue Warriors'); CREATE TABLE TicketSales (SaleID INT, TeamID INT, SaleDate DATE); INSERT INTO TicketSales (SaleID, TeamID, SaleDate) VALUES (1, 1, '2022-01-10'), (2, 1, '2022-03-05'), (3, 2, '202... | Which teams have no ticket sales in the last month? | SELECT T.TeamName FROM Teams T LEFT JOIN TicketSales TS ON T.TeamID = TS.TeamID WHERE TS.SaleDate IS NULL OR TS.SaleDate < DATE_SUB(CURDATE(), INTERVAL 1 MONTH) GROUP BY T.TeamName; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselInspections2 (ID INT, Vessel VARCHAR(50), InspectionDate DATE, ViolationCount INT); INSERT INTO VesselInspections2 (ID, Vessel, InspectionDate, ViolationCount) VALUES (1, 'SS Freedom', '2020-01-01', 3), (2, 'SS Liberty', '2020-01-02', 2), (3, 'SS Eagle', '2020-01-03', 4), (4, 'SS Freedom', '2020-01-0... | Reveal vessels with decreasing violations. | SELECT Vessel, ViolationCount, LAG(ViolationCount) OVER (PARTITION BY Vessel ORDER BY InspectionDate) as PreviousViolationCount FROM VesselInspections2; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, affordability VARCHAR(20), sustainability_rating FLOAT); INSERT INTO properties (id, affordability, sustainability_rating) VALUES (1, 'affordable', 80.5), (2, 'unaffordable', 60.0); | What is the total number of properties in areas with affordable housing and sustainability ratings above 70? | SELECT COUNT(*) FROM properties WHERE affordability = 'affordable' AND sustainability_rating > 70; | gretelai_synthetic_text_to_sql |
CREATE TABLE room_prices (hotel_id INT, year INT, price INT); INSERT INTO room_prices (hotel_id, year, price) VALUES (1, 2022, 150); INSERT INTO room_prices (hotel_id, year, price) VALUES (1, 2023, 150); | Update the room prices for the 'Sustainable Hotel' in France by 10% for 2023. | UPDATE room_prices SET price = price * 1.1 WHERE hotel_id = 1 AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, name VARCHAR(255), location VARCHAR(255), biome VARCHAR(255), area FLOAT, elevation_range VARCHAR(255)); INSERT INTO forests (id, name, location, biome, area, elevation_range) VALUES (1, 'Amazon Rainforest', 'South America', 'Tropical Rainforest', 6700000, '0 - 300 m'); CREATE TABLE timber... | What is the total volume of timber harvested in tropical rainforests in 2020? | SELECT SUM(volume) FROM timber_harvest WHERE forest_id IN (SELECT id FROM forests WHERE biome = 'Tropical Rainforest') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), ManagerID INT, ManagerFirstName VARCHAR(50), ManagerLastName VARCHAR(50)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, ManagerID, ManagerFirstName, ManagerLastName) VALUES (1, 'Jose', 'Ga... | Find employees who have the same first name as their department head. | SELECT E1.FirstName FROM Employees E1 INNER JOIN Employees E2 ON E1.ManagerID = E2.EmployeeID WHERE E1.FirstName = E2.FirstName AND E1.Department = E2.Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation_projects (project VARCHAR(50), location VARCHAR(50), year INT); INSERT INTO climate_adaptation_projects (project, location, year) VALUES ('Sea Level Rise Mitigation', 'Maldives', 2019), ('Water Management', 'Barbados', 2020), ('Disaster Risk Reduction', 'Cape Verde', 2021), ('Coastal Pro... | How many climate adaptation projects were implemented in Small Island Developing States (SIDS) in the last 3 years? | SELECT COUNT(*) FROM climate_adaptation_projects cp INNER JOIN sids s ON cp.location = s.location WHERE s.sids_status = 'SIDS' AND cp.year BETWEEN 2019 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media(user_id INT, user_name VARCHAR(50), region VARCHAR(50), post_date DATE, likes INT); | Show the daily number of posts in the 'social_media' table for the top 5 regions with the most posts. | SELECT post_date, region, COUNT(*) as daily_posts FROM (SELECT region, post_date, user_id FROM social_media GROUP BY region, post_date, user_id ORDER BY region, COUNT(*) DESC LIMIT 5) as top_regions GROUP BY post_date, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity (company_name VARCHAR(255), gender_distribution VARCHAR(50), ethnicity_distribution VARCHAR(50)); INSERT INTO diversity (company_name, gender_distribution, ethnicity_distribution) VALUES ('Acme Inc', '50/50', 'Diverse'), ('Beta Corp', '60/40', 'Not Diverse'), ('Charlie LLC', NULL, NULL); | Identify companies with no diversity metrics recorded | SELECT company_name FROM diversity WHERE gender_distribution IS NULL AND ethnicity_distribution IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (teacher_id INT, teacher_name VARCHAR(50)); INSERT INTO teachers (teacher_id, teacher_name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie'); CREATE TABLE professional_development_courses (course_id INT, course_name VARCHAR(50), completion_date DATE); INSERT INTO professional_development_courses (c... | How many teachers have completed professional development courses in the last 6 months? | SELECT COUNT(DISTINCT teachers.teacher_id) as num_teachers FROM teachers JOIN professional_development_courses ON teachers.teacher_id = professional_development_courses.teacher_id WHERE professional_development_courses.completion_date >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, name VARCHAR(50), nationality VARCHAR(50), age INT, medal VARCHAR(10), event VARCHAR(50)); INSERT INTO athletes (athlete_id, name, nationality, age, medal, event) VALUES (1, 'Michael Phelps', 'United States', 35, 'Gold', 'Swimming'); | What is the total number of medals won by athletes in the 'Athletes' table who are from the United States, grouped by the type of medal? | SELECT medal, SUM(1) as total_medals FROM athletes WHERE nationality = 'United States' GROUP BY medal; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_details (user_id INT, num_posts INT); INSERT INTO user_details (user_id, num_posts) VALUES (1, 25), (2, 32), (3, 18), (4, 45); | List all users and their respective number of posts, ordered by the user_id in ascending order. | SELECT user_id, num_posts FROM user_details ORDER BY user_id ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftMaintenance (id INT, region VARCHAR(20), priority VARCHAR(10), request_date DATE); INSERT INTO AircraftMaintenance (id, region, priority, request_date) VALUES (1, 'Middle East', 'Urgent', '2021-09-15'); | How many aircraft maintenance requests were made in the Middle East in Q3 2021, with a priority level of 'Urgent'? | SELECT COUNT(*) as urgent_requests FROM AircraftMaintenance WHERE region = 'Middle East' AND priority = 'Urgent' AND request_date BETWEEN '2021-07-01' AND '2021-09-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE destinations (destination_id INT, name VARCHAR(50), country_id INT); INSERT INTO destinations (destination_id, name, country_id) VALUES (3, 'Milford Sound', 1); INSERT INTO destinations (destination_id, name, country_id) VALUES (4, 'Prambanan Temple', 2); | What is the total number of visitors for each destination in the international_visitors table? | SELECT d.name, SUM(i.num_visitors) as total_visitors FROM destinations d INNER JOIN international_visitors i ON d.destination_id = i.country_id GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE albums (id INT, title TEXT, release_date DATE); INSERT INTO albums (id, title, release_date) VALUES (1, 'Millennium', '1999-12-31'), (2, 'Hybrid Theory', '2000-01-02'); | Delete all albums released before the year 2000. | DELETE FROM albums WHERE release_date < '2000-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm (id INT, farm_name VARCHAR(255), state VARCHAR(255), country VARCHAR(255)); INSERT INTO farm (id, farm_name, state, country) VALUES (1, 'Farm 1', 'California', 'USA'); INSERT INTO farm (id, farm_name, state, country) VALUES (2, 'Farm 2', 'Texas', 'USA'); | How many farms are in each state of the USA? | SELECT state, COUNT(*) AS num_farms FROM farm WHERE country = 'USA' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE tour_bookings(id INT, city TEXT, booking_date DATE, booking_type TEXT); INSERT INTO tour_bookings (id, city, booking_date, booking_type) VALUES (1, 'New York', '2022-04-01', 'virtual'), (2, 'Los Angeles', '2022-04-02', 'virtual'), (3, 'Chicago', '2022-04-03', 'in-person'); | Identify the top 2 cities with the highest number of virtual tours in the US. | SELECT city, COUNT(*) AS num_virtual_tours FROM tour_bookings WHERE booking_type = 'virtual' GROUP BY city ORDER BY num_virtual_tours DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_towers (tower_id INT, location VARCHAR(50), latitude DECIMAL(9,6), longitude DECIMAL(9,6), installed_date DATE); | Add a new network tower to the network_towers table | INSERT INTO network_towers (tower_id, location, latitude, longitude, installed_date) VALUES (54321, 'City Center', 40.7128, -74.0060, '2021-12-15'); | gretelai_synthetic_text_to_sql |
CREATE TABLE members (id INT, age INT, gender VARCHAR(10)); CREATE TABLE wearables (id INT, member_id INT, heart_rate INT); | What is the average heart rate of members aged 25-30 who use our wearable devices, grouped by gender? | SELECT gender, AVG(heart_rate) FROM members INNER JOIN wearables ON members.id = wearables.member_id WHERE members.age BETWEEN 25 AND 30 GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourists (id INT, country VARCHAR(255), destination VARCHAR(255), year INT, expenditure DECIMAL(10,2)); INSERT INTO tourists (id, country, destination, year, expenditure) VALUES (1, 'USA', 'Costa Rica', 2019, 1500), (2, 'USA', 'Costa Rica', 2019, 1800), (3, 'USA', 'Costa Rica', 2019, 1200), (4, 'USA', 'Cos... | What was the average travel expenditure for US tourists visiting Costa Rica in 2019? | SELECT AVG(expenditure) FROM tourists WHERE country = 'USA' AND destination = 'Costa Rica' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(255), location VARCHAR(255), country VARCHAR(255)); INSERT INTO wells (well_id, well_name, location, country) VALUES (1, 'Well A', 'North Sea', 'UK'), (2, 'Well B', 'North Sea', 'Norway'), (3, 'Well C', 'Gulf of Mexico', 'USA'), (4, 'Well D', 'South China Sea', 'Vietna... | List the number of wells in each country, sorted by the number of wells in descending order. | SELECT country, COUNT(*) AS num_wells FROM wells GROUP BY country ORDER BY num_wells DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_wind (project_name TEXT, country TEXT); INSERT INTO project_wind (project_name, country) VALUES ('Project A', 'Country A'), ('Project B', 'Country A'), ('Project C', 'Country B'), ('Project D', 'Country C'), ('Project E', 'Country D'), ('Project F', 'Country D'); | Which countries have the most wind power projects? | SELECT country, COUNT(*) FROM project_wind GROUP BY country ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_equity_metrics (region VARCHAR(10), metric INT); INSERT INTO health_equity_metrics (region, metric) VALUES ('North', 90), ('South', 85), ('East', 95), ('West', 88); | What is the maximum health equity metric by region? | SELECT region, MAX(metric) OVER (PARTITION BY 1) as max_metric FROM health_equity_metrics; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_2 (name TEXT, location TEXT, num_individuals INT); INSERT INTO marine_species_2 (name, location, num_individuals) VALUES ('Clownfish', 'Indian Ocean', '10000'), ('Dolphin', 'Pacific Ocean', '20000'); | Display the total number of marine species in the Pacific Ocean. | SELECT SUM(num_individuals) FROM marine_species_2 WHERE location = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE country_reserves (country VARCHAR(50), reserves INT); INSERT INTO country_reserves (country, reserves) VALUES ('China', 44000), ('USA', 1300), ('Australia', 3800), ('India', 674), ('Brazil', 220); | What are the total rare earth element reserves for each country? | SELECT country, SUM(reserves) FROM country_reserves GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels_2 (vessel_id INT, name VARCHAR(255), operating_region VARCHAR(255)); | What is the total number of vessels operating in the Pacific and Atlantic Oceans? | SELECT COUNT(*) FROM vessels_2 WHERE operating_region IN ('Pacific', 'Atlantic'); | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_incident (id INT, department_id INT, severity INT, incident_date DATE); INSERT INTO cybersecurity_incident (id, department_id, severity, incident_date) VALUES (1, 1, 8, '2021-03-15'); INSERT INTO cybersecurity_incident (id, department_id, severity, incident_date) VALUES (2, 2, 5, '2022-01-10'... | What is the total number of cybersecurity incidents and the average severity for each department, partitioned by month and ordered by total number of cybersecurity incidents in descending order? | SELECT d.name as department, DATEPART(YEAR, incident_date) as year, DATEPART(MONTH, incident_date) as month, COUNT(ci.id) as total_cybersecurity_incidents, AVG(ci.severity) as avg_severity, ROW_NUMBER() OVER (PARTITION BY d.name ORDER BY COUNT(ci.id) DESC) as rank FROM cybersecurity_incident ci JOIN department d ON ci.... | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS public_transport;CREATE TABLE IF NOT EXISTS public_transport.payment (payment_id SERIAL PRIMARY KEY, passenger_id INTEGER, route_id INTEGER, fare DECIMAL, payment_date DATE);CREATE TABLE IF NOT EXISTS public_transport.route (route_id INTEGER PRIMARY KEY, route_name TEXT);INSERT INTO public_t... | Show the total fare collected per route and day of the week in the 'payment' and 'route' tables | SELECT EXTRACT(DOW FROM payment_date) AS day_of_week, route_id, SUM(fare) FROM public_transport.payment JOIN public_transport.route ON payment.route_id = route.route_id GROUP BY EXTRACT(DOW FROM payment_date), route_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_designers (designer_id INT, gender VARCHAR(10), genre VARCHAR(10), players INT); | Which female game designers have created RPG games with more than 10,000 players? | SELECT COUNT(*) FROM game_designers WHERE gender = 'female' AND genre = 'RPG' AND players > 10000; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (year INT, impact_statistic VARCHAR(255)); INSERT INTO environmental_impact (year, impact_statistic) VALUES (2017, 'Carbon emissions: 5000 tons'), (2018, 'Water usage: 20000 cubic meters'), (2019, 'Energy consumption: 15000 MWh'), (2020, 'Waste generation: 8000 tons'), (2021, 'Land deg... | List REE environmental impact statistics for each year since 2017? | SELECT year, impact_statistic FROM environmental_impact; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media (user_id INT, post_id INT, post_date DATE, likes INT); | Count the number of posts that have more than 100 likes in the 'social_media' table. | SELECT COUNT(*) FROM social_media WHERE likes > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT, trip_id INT, mode VARCHAR(255), start_time TIMESTAMP, end_time TIMESTAMP, city VARCHAR(255)); INSERT INTO public_transportation (id, trip_id, mode, start_time, end_time, city) VALUES (1, 123, 'Metro', '2022-01-01 08:00:00', '2022-01-01 08:15:00', 'Paris'); INSERT INTO public_... | What is the total number of trips and average trip duration for public transportation in Paris? | SELECT COUNT(DISTINCT trip_id) as total_trips, AVG(TIMESTAMPDIFF(MINUTE, start_time, end_time)) as avg_duration FROM public_transportation WHERE city = 'Paris'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_initiatives (id INT, country VARCHAR(50), year INT, initiatives INT); INSERT INTO conservation_initiatives (id, country, year, initiatives) VALUES (1, 'Australia', 2017, 10), (2, 'Australia', 2018, 15), (3, 'Australia', 2019, 20), (4, 'Canada', 2017, 12), (5, 'Canada', 2018, 14), (6, 'Canada',... | How many water conservation initiatives were implemented in Australia for the year 2017 and 2018? | SELECT SUM(initiatives) FROM conservation_initiatives WHERE country = 'Australia' AND year IN (2017, 2018); | gretelai_synthetic_text_to_sql |
CREATE TABLE Armaments (name TEXT, type TEXT); CREATE TABLE Countries (country TEXT, peacekeeping_operation TEXT); CREATE TABLE Supplies (armament TEXT, country TEXT); INSERT INTO Armaments (name, type) VALUES ('AK-47', 'Assault Rifle'), ('M16', 'Assault Rifle'), ('Carl Gustaf', 'Recoilless Rifle'); INSERT INTO Countri... | List the name and type of all armaments that have been supplied to peacekeeping operations by each country from the 'Armaments', 'Countries', and 'Supplies' tables | SELECT Armaments.name, Armaments.type, Countries.country FROM Armaments INNER JOIN (Supplies INNER JOIN Countries ON Supplies.country = Countries.country) ON Armaments.name = Supplies.armament; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_trenches (name VARCHAR(255), region VARCHAR(255), depth FLOAT);INSERT INTO deep_sea_trenches (name, region, depth) VALUES ('Trench 1', 'Pacific Ocean', 8000), ('Trench 2', 'Atlantic Ocean', 7000), ('Trench 3', 'Pacific Ocean', 10000); | What is the maximum depth of all deep-sea trenches in the Pacific Ocean? | SELECT MAX(depth) FROM deep_sea_trenches WHERE region = 'Pacific Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, year INT, restorative_justice BOOLEAN); | How many cases were resolved using restorative justice practices in the cases table in each year? | SELECT year, COUNT(*) FROM cases WHERE restorative_justice = TRUE GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE LocalTourOperators (name VARCHAR(50), location VARCHAR(20), year INT, revenue DECIMAL(10,2)); | What is the total revenue generated by local tour operators in Germany for the year 2022? | SELECT SUM(revenue) FROM LocalTourOperators WHERE location = 'Germany' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites_paris (site_id INT, name TEXT, city TEXT, visitors INT); INSERT INTO cultural_sites_paris (site_id, name, city, visitors) VALUES (1, 'Eiffel Tower', 'Paris', 7000000), (2, 'Notre Dame Cathedral', 'Paris', 6000000), (3, 'Louvre Museum', 'Paris', 5000000); | List the top 2 cultural heritage sites in Paris by visitor count. | SELECT name, visitors FROM cultural_sites_paris WHERE city = 'Paris' ORDER BY visitors DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE items_produced (product_id INT, country VARCHAR(255), year INT); INSERT INTO items_produced (product_id, country, year) VALUES (1, 'USA', 2021), (2, 'Canada', 2022), (3, 'Mexico', 2021), (4, 'USA', 2021); | What is the number of items produced in each country in 2021? | SELECT country, COUNT(*) as items_produced FROM items_produced WHERE year = 2021 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, gender VARCHAR(20), successful_cases INT); INSERT INTO attorneys (attorney_id, gender, successful_cases) VALUES (1, 'Female', 12), (2, 'Male', 8), (3, 'Non-binary', 7); | What is the average number of successful cases handled by attorneys who identify as non-binary? | SELECT AVG(successful_cases) FROM attorneys WHERE gender = 'Non-binary'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyRecord (ProductID INT, SafetyTestDate DATE, Result VARCHAR(255)); INSERT INTO SafetyRecord (ProductID, SafetyTestDate, Result) VALUES (8, '2022-06-01', 'Pass'), (8, '2022-07-01', 'Pass'), (9, '2022-06-05', 'Pass'); CREATE TABLE Product (ProductID INT, ProductName VARCHAR(255), Price DECIMAL(5,2)); IN... | Identify the cruelty-free certified products and their safety records. | SELECT P.ProductName, SR.Result FROM CrueltyFree CF INNER JOIN Product P ON CF.ProductID = P.ProductID INNER JOIN SafetyRecord SR ON P.ProductID = SR.ProductID; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_union (member_id INT, union_name VARCHAR(20)); INSERT INTO healthcare_union (member_id, union_name) VALUES (1, 'Healthcare Workers Union'), (2, 'Nurses Union'), (3, 'Doctors Union'); | What is the total number of members in the 'healthcare_union' table? | SELECT COUNT(*) FROM healthcare_union; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_efficiency (id INT, city VARCHAR(50), efficiency FLOAT); INSERT INTO building_efficiency (id, city, efficiency) VALUES (1, 'Tokyo', 120), (2, 'Osaka', 110), (3, 'Sydney', 140); | Show the energy efficiency (kWh/m2) of buildings in Sydney | SELECT efficiency FROM building_efficiency WHERE city = 'Sydney'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (name text, product text, is_organic boolean); INSERT INTO Suppliers (name, product, is_organic) VALUES ('Down to Earth', 'Quinoa', true), ('Down to Earth', 'Rice', false), ('Fresh Harvest', 'Carrots', true); | List all suppliers from 'Down to Earth' that provide organic products. | SELECT DISTINCT name FROM Suppliers WHERE is_organic = true AND name = 'Down to Earth'; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_enrollment (student_id INT, continent VARCHAR(50), program VARCHAR(50)); INSERT INTO student_enrollment (student_id, continent, program) VALUES (1, 'North America', 'Lifelong Learning 101'), (2, 'Europe', 'Lifelong Learning 202'), (3, 'Asia', 'Lifelong Learning 101'); | How many students are enrolled in lifelong learning programs in each continent? | SELECT continent, COUNT(DISTINCT student_id) as num_students FROM student_enrollment GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, gadolinium_production FLOAT, timestamp DATE); INSERT INTO mines (id, name, location, gadolinium_production, timestamp) VALUES (1, 'Mine A', 'Canada', 120.5, '2021-01-01'), (2, 'Mine B', 'Canada', 150.7, '2021-02-01'), (3, 'Mine C', 'USA', 200.3, '2021-03-01'), (4, '... | What is the average Gadolinium production by month for 2021 and 2022? | SELECT MONTH(timestamp), AVG(gadolinium_production) FROM mines WHERE YEAR(timestamp) IN (2021, 2022) GROUP BY MONTH(timestamp); | gretelai_synthetic_text_to_sql |
CREATE TABLE Transactions (transaction_id INT, user_id INT, gender VARCHAR(10), transaction_amount DECIMAL(10,2)); INSERT INTO Transactions (transaction_id, user_id, gender, transaction_amount) VALUES (1, 101, 'Male', 50.00), (2, 102, 'Female', 75.00), (3, 103, 'Non-binary', 35.00), (4, 104, 'Male', 60.00); | What is the total number of transactions for each gender? | SELECT gender, SUM(transaction_amount) as total_amount FROM Transactions GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founder_lgbtq INT, industry TEXT); INSERT INTO company (id, name, founder_lgbtq, industry) VALUES (1, 'EduTech', 1, 'Education Technology'); INSERT INTO company (id, name, founder_lgbtq, industry) VALUES (2, 'LearningPlatforms', 0, 'Education Technology'); | What is the number of startups founded by people who identify as LGBTQ+ in the education technology industry? | SELECT COUNT(*) FROM company WHERE founder_lgbtq = 1 AND industry = 'Education Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat (id INT, size FLOAT); CREATE TABLE animal_population (id INT, habitat_id INT, animal_count INT); | What is the total number of animals in habitats larger than 100 square kilometers? | SELECT SUM(ap.animal_count) FROM animal_population ap INNER JOIN habitat h ON ap.habitat_id = h.id WHERE h.size > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_tech (tech_id INT, tech_name VARCHAR(30), city VARCHAR(20), population INT); INSERT INTO smart_city_tech (tech_id, tech_name, city, population) VALUES (1, 'Smart Grids', 'New York', 8500000), (2, 'Smart Lighting', 'Los Angeles', 4000000), (3, 'Smart Traffic Management', 'Toronto', 3000000); | List all smart city technology adoptions in the North American cities with a population greater than 1 million. | SELECT tech_name, city FROM smart_city_tech WHERE population > 1000000 AND city IN ('New York', 'Los Angeles', 'Toronto'); | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildingMaterials (MaterialID INT, MaterialName VARCHAR(50));CREATE TABLE GreenBuildingMaterialsUsage (UsageID INT, MaterialID INT, CityID INT, ProjectID INT); | List all green building materials and the number of each material used in a specific city, for projects in London. | SELECT GreenBuildingMaterials.MaterialName, COUNT(GreenBuildingMaterialsUsage.UsageID) FROM GreenBuildingMaterials INNER JOIN GreenBuildingMaterialsUsage ON GreenBuildingMaterials.MaterialID = GreenBuildingMaterialsUsage.MaterialID WHERE GreenBuildingMaterialsUsage.CityID = 2 GROUP BY GreenBuildingMaterials.MaterialNam... | gretelai_synthetic_text_to_sql |
CREATE TABLE refugee (id INT, name VARCHAR(255), age INT, location VARCHAR(255), supported_by VARCHAR(255), support_date DATE); INSERT INTO refugee (id, name, age, location, supported_by, support_date) VALUES (1, 'Jane Doe', 35, 'Europe', 'Red Crescent', '2022-01-01'); | What is the average age of refugees supported by 'Red Crescent' in 'Europe'? | SELECT AVG(age) FROM refugee WHERE location = 'Europe' AND supported_by = 'Red Crescent'; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_info (info_id INT, sq_footage INT, city TEXT, sustainable BOOLEAN); INSERT INTO building_info VALUES (1, 50000, 'Seattle', TRUE), (2, 60000, 'Houston', FALSE), (3, 70000, 'Seattle', TRUE), (4, 40000, 'New York', FALSE), (5, 30000, 'Denver', TRUE); | What is the total number of sustainable buildings in each city? | SELECT city, COUNT(*) FILTER (WHERE sustainable = TRUE) FROM building_info GROUP BY city; | 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.