context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE products (product_id INT, category VARCHAR(20), safety_rating VARCHAR(10)); INSERT INTO products (product_id, category, safety_rating) VALUES (1, 'Skincare', 'High'), (1, 'Cleanser', 'High'), (2, 'Skincare', 'Low'), (2, 'Toner', 'High'), (3, 'Haircare', 'High'), (3, 'Shampoo', 'High'), (4, 'Haircare', 'Low... | Show the number of products in each category that have 'Low' safety ratings. | SELECT category, COUNT(*) as count FROM products WHERE safety_rating = 'Low' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE dispensaries (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); CREATE TABLE social_equity_programs (id INT PRIMARY KEY, dispensary_id INT, program_name VARCHAR(255), start_date DATE); CREATE TABLE social_equity_participation (id INT PRIMARY KEY, dispensary_id INT, year INT, percentage FLOAT); | What is the percentage of social equity participation for each program in the last year, and the corresponding average participation percentage? | SELECT program_name, AVG(percentage) as avg_percentage FROM social_equity_programs INNER JOIN social_equity_participation ON social_equity_programs.id = social_equity_participation.dispensary_id WHERE YEAR(social_equity_participation.year) = YEAR(CURRENT_DATE) - 1 GROUP BY program_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, clean_beauty BOOLEAN); CREATE TABLE reviews (review_id INT, product_id INT, review_rating INT); INSERT INTO products (product_id, product_name, clean_beauty) VALUES (1, 'Product 1', true), (2, 'Product 2', false), (3, 'Product 3', true), (4, 'Product 4', true), ... | Find the top 3 cosmetic products with the highest customer reviews, considering only those that are labeled as 'Clean Beauty'. | SELECT products.product_name, AVG(reviews.review_rating) AS avg_rating FROM products JOIN reviews ON products.product_id = reviews.product_id WHERE products.clean_beauty = true GROUP BY products.product_id ORDER BY avg_rating DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE design_standards (id INT, region VARCHAR(255), structure_type VARCHAR(255), load_capacity_tonnes FLOAT); INSERT INTO design_standards (id, region, structure_type, load_capacity_tonnes) VALUES (1, 'Midwest', 'Bridge', 700.0), (2, 'Northeast', 'Bridge', 800.0), (3, 'Midwest', 'Building', 500.0); | What is the maximum design standard for bridge load capacity in tonnes for projects in the Midwest region? | SELECT MAX(load_capacity_tonnes) FROM design_standards WHERE region = 'Midwest' AND structure_type = 'Bridge'; | gretelai_synthetic_text_to_sql |
CREATE TABLE geopolitical_risk (id INT, region VARCHAR(50), year INT, score INT); INSERT INTO geopolitical_risk (id, region, year, score) VALUES (1, 'Region Y', 2020, 6); | What is the geopolitical risk assessment score for region Y in 2020? | SELECT score FROM geopolitical_risk WHERE region = 'Region Y' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorState TEXT, DonationAmount DECIMAL); | Which states have the highest and lowest donation amounts? | SELECT DonorState, AVG(DonationAmount) as AvgDonation FROM Donors GROUP BY DonorState ORDER BY AvgDonation DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO marine_protected_areas (id, name, region) VALUES (1, 'Galapagos Marine Reserve', 'Pacific'), (2, 'Great Barrier Reef', 'Pacific'); | Insert a new marine protected area 'Gulf of California Marine Reserve' in the Pacific region into the marine_protected_areas table. | INSERT INTO marine_protected_areas (name, region) VALUES ('Gulf of California Marine Reserve', 'Pacific'); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (company_id INT, sector VARCHAR(50), esg_score FLOAT); INSERT INTO companies (company_id, sector, esg_score) VALUES (1, 'Technology', 72.5), (2, 'Finance', 80.1), (3, 'Technology', 69.8); | What is the average ESG score for companies in the technology sector? | SELECT AVG(esg_score) FROM companies WHERE sector = 'Technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SkincareProducts (product_id INT, product_name VARCHAR(255), price DECIMAL(5,2), is_organic BOOLEAN, rating INT, country VARCHAR(50), sales_date DATE); | Insert new records for all organic skincare products sold in the United States in the last month with a rating of 5. | INSERT INTO SkincareProducts (product_id, product_name, price, is_organic, rating, country, sales_date) SELECT product_id, product_name, price, TRUE, 5, 'United States', sales_date FROM SkincareProducts WHERE is_organic = FALSE AND rating = 5 AND country = 'United States' AND sales_date >= DATE_SUB(CURRENT_DATE, INTERV... | gretelai_synthetic_text_to_sql |
CREATE TABLE Counties (CountyName TEXT, CountyID INTEGER); CREATE TABLE Schools (SchoolName TEXT, SchoolID INTEGER, CountyID INTEGER); CREATE TABLE Teachers (TeacherID INTEGER, TeacherSalary INTEGER, SchoolID INTEGER); | What is the average salary of teachers in New York state, grouped by county? | SELECT C.CountyName, AVG(T.TeacherSalary) FROM Teachers T INNER JOIN Schools S ON T.SchoolID = S.SchoolID INNER JOIN Counties C ON S.CountyID = C.CountyID WHERE C.CountyName = 'New York' GROUP BY C.CountyName; | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (id INT, garment VARCHAR(255), color VARCHAR(255), size VARCHAR(255), quantity INT); | Add new garment 'Eco Dress' with colors 'Green' and 'Blue' and sizes 'S' and 'M' to the inventory table. | INSERT INTO inventory (garment, color, size, quantity) VALUES ('Eco Dress', 'Green', 'S', 100), ('Eco Dress', 'Green', 'M', 100), ('Eco Dress', 'Blue', 'S', 100), ('Eco Dress', 'Blue', 'M', 100); | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_id INT, drug_name TEXT); INSERT INTO drugs (drug_id, drug_name) VALUES (1001, 'DrugA'), (1002, 'DrugB'); CREATE TABLE trials (trial_id INT, drug_id INT, trial_year INT); INSERT INTO trials (trial_id, drug_id, trial_year) VALUES (1, 1001, 2018), (2, 1001, 2019), (3, 1002, 2018), (4, 1002, 2019),... | How many clinical trials were conducted per drug in 2018 and 2019? | SELECT drug_name, trial_year, COUNT(*) as trials_per_year FROM trials JOIN drugs ON trials.drug_id = drugs.drug_id GROUP BY drug_name, trial_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE riders (rider_id INT, rider_name TEXT); CREATE TABLE trips (trip_id INT, rider_id INT, trip_date DATE, trip_time TIME); | What is the maximum number of trips taken by a single rider in a day? | SELECT r.rider_name, MAX(COUNT(*)) as max_daily_trips FROM riders r INNER JOIN trips t ON r.rider_id = t.rider_id GROUP BY r.rider_name, t.trip_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, supplier_name VARCHAR(255), total_labor_complaints INT); | Which suppliers have the highest number of labor complaints? | SELECT supplier_name, total_labor_complaints FROM suppliers ORDER BY total_labor_complaints DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredient_sourcing(ingredient_id INT, product_id INT, country VARCHAR(50), organic BOOLEAN); | Which countries source the most organic ingredients for cosmetics products? | SELECT country, COUNT(ingredient_id) as organic_ingredient_count FROM ingredient_sourcing WHERE organic = TRUE GROUP BY country ORDER BY organic_ingredient_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemicals (id INT, name VARCHAR(255), category VARCHAR(255), production_yield FLOAT, region VARCHAR(255)); | What is the average production yield for each chemical category, for chemical manufacturing in the Europe region? | SELECT category, AVG(production_yield) as avg_yield FROM chemicals WHERE region = 'Europe' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_ticket_sales (ticket_sale_id INT, game_id INT, team_id INT, sale_date DATE, revenue INT); INSERT INTO game_ticket_sales (ticket_sale_id, game_id, team_id, sale_date, revenue) VALUES (1, 1, 1, '2021-01-01', 5000), (2, 1, 1, '2021-01-01', 6000), (3, 2, 1, '2021-01-03', 7000), (4, 2, 2, '2021-01-02', 800... | What is the total revenue generated from ticket sales for each game? | SELECT g.game_date, t.team_name, SUM(gts.revenue) as total_revenue FROM game_ticket_sales gts JOIN games g ON gts.game_id = g.game_id JOIN teams t ON g.team_id = t.team_id GROUP BY g.game_date, t.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE player_details (player_id INT, name VARCHAR(50), email VARCHAR(50)); | Update the email of users in 'player_details' table whose names start with 'A' | UPDATE player_details SET email = 'new_email@example.com' WHERE name LIKE 'A%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments(id INT, startup_id INT, investment_type TEXT, investment_amount INT, investment_date DATE); INSERT INTO investments VALUES (1, 1, 'Seed', 2000000, '2020-01-01'); INSERT INTO investments VALUES (2, 1, 'SeriesA', 5000000, '2021-01-01'); INSERT INTO investments VALUES (3, 2, 'Seed', 3000000, '2020... | What is the number of seed funding rounds for startups in the fintech sector, ordered by date? | SELECT COUNT(*) FROM investments WHERE investment_type = 'Seed' AND industry = 'Fintech' ORDER BY investment_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, State VARCHAR(255)); INSERT INTO Attorneys (AttorneyID, State) VALUES (1, 'Texas'); INSERT INTO Attorneys (AttorneyID, State) VALUES (2, 'California'); INSERT INTO Attorneys (AttorneyID, State) VALUES (3, 'Texas'); CREATE TABLE Cases (CaseID INT, AttorneyID INT, BillingAmount INT... | Find the maximum billing amount for cases handled by attorneys from Texas. | SELECT MAX(BillingAmount) FROM Cases JOIN Attorneys ON Cases.AttorneyID = Attorneys.AttorneyID WHERE Attorneys.State = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RecyclingRates (country VARCHAR(255), recycling_rate FLOAT); INSERT INTO RecyclingRates (country, recycling_rate) VALUES ('Japan', 0.61), ('China', 0.34), ('India', 0.28), ('Indonesia', 0.19), ('Philippines', 0.25); | What is the minimum recycling rate in Asia? | SELECT MIN(recycling_rate) FROM RecyclingRates WHERE country IN ('Japan', 'China', 'India', 'Indonesia', 'Philippines') | gretelai_synthetic_text_to_sql |
CREATE TABLE EnvironmentalImpact (ID INT, ProcessID INT, MeasurementDate DATE, Score INT); INSERT INTO EnvironmentalImpact (ID, ProcessID, MeasurementDate, Score) VALUES (1, 200, '2019-11-01', 85), (2, 201, '2019-11-10', 78), (3, 200, '2019-11-20', 88); | What is the average environmental impact score for each process in November 2019? | SELECT ProcessID, AVG(Score) as AverageScore FROM EnvironmentalImpact WHERE MeasurementDate >= '2019-11-01' AND MeasurementDate < '2019-12-01' GROUP BY ProcessID; | gretelai_synthetic_text_to_sql |
CREATE TABLE crop (id INT, type VARCHAR(20)); CREATE TABLE rainfall (id INT, crop_id INT, value INT, timestamp TIMESTAMP); | What is the total rainfall for each crop type in the past month? | SELECT c.type, SUM(r.value) as total_rainfall FROM crop c INNER JOIN rainfall r ON c.id = r.crop_id WHERE r.timestamp >= NOW() - INTERVAL '1 month' GROUP BY c.type; | gretelai_synthetic_text_to_sql |
CREATE TABLE schema1.vulnerabilities (id INT, name VARCHAR(255), severity VARCHAR(50), description TEXT, date_discovered DATE, last_observed DATE); INSERT INTO schema1.vulnerabilities (id, name, severity, description, date_discovered, last_observed) VALUES (1, 'SQL Injection', 'Critical', 'Allows unauthorized access', ... | What is the earliest date a vulnerability was discovered? | SELECT MIN(date_discovered) FROM schema1.vulnerabilities; | gretelai_synthetic_text_to_sql |
CREATE TABLE soil_nutrients (id INT, farm_name VARCHAR(50), location VARCHAR(50), nitrogen FLOAT, phosphorus FLOAT, potassium FLOAT); | What is the 'nitrogen' content in the soil for the farm 'Acme Organics' in the 'soil_nutrients' table? | SELECT nitrogen FROM soil_nutrients WHERE farm_name = 'Acme Organics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity_metrics(id INT, company_id INT, founder_gender TEXT, founder_race TEXT); INSERT INTO diversity_metrics (id, company_id, founder_gender, founder_race) VALUES (1, 3, 'Female', 'African American'); INSERT INTO diversity_metrics (id, company_id, founder_gender, founder_race) VALUES (2, 4, 'Male', 'La... | Which diverse founders have not received any funding yet? | SELECT companies.name FROM companies LEFT JOIN diversity_metrics ON companies.id = diversity_metrics.company_id LEFT JOIN funding_records ON companies.id = funding_records.company_id WHERE diversity_metrics.founder_gender IS NOT NULL AND diversity_metrics.founder_race IS NOT NULL AND funding_records.funding IS NULL | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID int, Genre varchar(50), SalesDate date, Revenue decimal(10,2), ArtistName varchar(100)); INSERT INTO Sales VALUES (1, 'Jazz', '2021-01-01', 2000, 'Artist Q'); INSERT INTO Sales VALUES (2, 'Jazz', '2021-02-01', 2500, 'Artist R'); INSERT INTO Sales VALUES (3, 'Jazz', '2021-03-01', 3000, 'Artist... | Who are the Jazz artists with the highest revenue in the USA in 2021? | SELECT ArtistName, SUM(Revenue) as TotalRevenue FROM Sales WHERE Genre = 'Jazz' AND Country = 'USA' AND YEAR(SalesDate) = 2021 GROUP BY ArtistName ORDER BY TotalRevenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, tour_name TEXT, location TEXT); INSERT INTO virtual_tours (tour_id, tour_name, location) VALUES (1, 'Eiffel Tower', 'Paris'), (2, 'Colosseum', 'Rome'), (3, 'Brandenburg Gate', 'Berlin'), (4, 'Buckingham Palace', 'London'), (5, 'Sagrada Familia', 'Barcelona'); CREATE TABLE tour_v... | What are the most popular virtual tour attractions in Europe? | SELECT tour_name, SUM(viewer) as total_viewers FROM virtual_tours INNER JOIN tour_views ON virtual_tours.tour_id = tour_views.tour_id GROUP BY tour_name ORDER BY total_viewers DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, language VARCHAR(50), therapy_dropped BOOLEAN, medication_dropped BOOLEAN); | What is the number of patients who dropped out of therapy and medication, separated by language? | SELECT language, SUM(CASE WHEN therapy_dropped = TRUE THEN 1 ELSE 0 END) AS dropped_therapy, SUM(CASE WHEN medication_dropped = TRUE THEN 1 ELSE 0 END) AS dropped_medication FROM patients GROUP BY language; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (id INT, date DATE, capacity INT); INSERT INTO landfill_capacity (id, date, capacity) VALUES (1, '2021-01-01', 10000), (2, '2021-02-01', 9500), (3, '2021-03-01', 9200), (4, '2021-04-01', 8900); | What is the monthly change in landfill capacity in 2021? | SELECT date, capacity - LAG(capacity) OVER (ORDER BY date) AS change_in_capacity FROM landfill_capacity WHERE date BETWEEN '2021-01-01' AND '2021-12-31' ORDER BY date; | gretelai_synthetic_text_to_sql |
CREATE TABLE Countries (Country VARCHAR(50)); CREATE TABLE RugbyFans (Country VARCHAR(50), Gender VARCHAR(50), Age INT); INSERT INTO Countries (Country) VALUES ('England'), ('Ireland'), ('Scotland'), ('Wales'), ('France'), ('Italy'); INSERT INTO RugbyFans (Country, Gender, Age) VALUES ('England', 'Female', 25), ('Engla... | Calculate the percentage of rugby fans who are female and under 30 years old in each country. | SELECT Country, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM RugbyFans WHERE Country = f.Country) AS Percentage FROM RugbyFans f WHERE Gender = 'Female' AND Age < 30 GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (asset_id VARCHAR(42), asset_type VARCHAR(20), country VARCHAR(2)); INSERT INTO digital_assets (asset_id, asset_type, country) VALUES ('0x4434567890123456789012345678901234567890', 'Utility Token', 'NG'); | Delete records from the "digital_assets" table where "asset_type" is "Utility Token" and "country" is "NG" | DELETE FROM digital_assets WHERE asset_type = 'Utility Token' AND country = 'NG'; | gretelai_synthetic_text_to_sql |
CREATE TABLE covid_cases (id INT, country TEXT, cases INT); INSERT INTO covid_cases (id, country, cases) VALUES (1, 'USA', 1000); INSERT INTO covid_cases (id, country, cases) VALUES (2, 'Canada', 2000); INSERT INTO covid_cases (id, country, cases) VALUES (3, 'Mexico', 1500); | List the number of COVID-19 cases in each country. | SELECT country, cases FROM covid_cases GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_manufacturers (manufacturer VARCHAR(50), ev_sold INT); INSERT INTO ev_manufacturers (manufacturer, ev_sold) VALUES ('Tesla', 27000), ('Nissan', 16000), ('Chevrolet', 22000), ('BMW', 26000), ('Mercedes', 14000), ('Volvo', 19000); CREATE TABLE vehicle_sales (manufacturer VARCHAR(50), autonomous BOOLEAN, s... | Show the total number of electric vehicles and autonomous vehicles sold by each manufacturer | SELECT manufacturer, SUM(CASE WHEN ev_manufacturers.manufacturer = vehicle_sales.manufacturer THEN ev_sold ELSE 0 END) as total_ev_sold, SUM(CASE WHEN vehicle_sales.autonomous THEN sales ELSE 0 END) as autonomous_sales FROM ev_manufacturers FULL OUTER JOIN vehicle_sales ON ev_manufacturers.manufacturer = vehicle_sales.... | gretelai_synthetic_text_to_sql |
CREATE TABLE deodorant_sales(brand VARCHAR(255), region VARCHAR(255), sales FLOAT); INSERT INTO deodorant_sales(brand, region, sales) VALUES('Brand E', 'Southern', 6000), ('Brand F', 'Southern', 4000), ('Brand G', 'Southern', 8000), ('Brand H', 'Southern', 11000); CREATE TABLE deodorant_type(brand VARCHAR(255), type VA... | Which natural deodorant brands have the lowest sales in the Southern region? | SELECT deodorant_sales.brand, deodorant_sales.sales FROM deodorant_sales INNER JOIN deodorant_type ON deodorant_sales.brand = deodorant_type.brand WHERE deodorant_sales.region = 'Southern' AND deodorant_type.type IN ('natural', 'aluminum-free') ORDER BY deodorant_sales.sales ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE irrigation_system (field_id INT, system_type VARCHAR(20), activated BOOLEAN, timestamp TIMESTAMP); INSERT INTO irrigation_system (field_id, system_type, activated, timestamp) VALUES (2, 'irrigation', true, '2021-04-05 08:00:00'), (2, 'irrigation', false, '2021-04-05 12:00:00'); | Find the number of times the irrigation system was activated in field 2 on weekdays in April 2021. | SELECT COUNT(*) FROM irrigation_system WHERE field_id = 2 AND system_type = 'irrigation' AND activated = true AND DAYOFWEEK(timestamp) BETWEEN 2 AND 6 AND MONTH(timestamp) = 4 AND YEAR(timestamp) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, category VARCHAR(255), amount DECIMAL(10, 2)); INSERT INTO donations (id, category, amount) VALUES (1, 'climate change', 5000), (2, 'poverty reduction', 8000), (3, 'healthcare', 3000), (4, 'climate change', 7000); | What's the total donation amount per category, sorted by the highest amount first? | SELECT category, SUM(amount) AS total_donation FROM donations GROUP BY category ORDER BY total_donation DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE OrganizationESG (OrgID INT, Country VARCHAR(50), ESG FLOAT); INSERT INTO OrganizationESG (OrgID, Country, ESG) VALUES (1, 'US', 75), (2, 'Canada', 80), (3, 'Mexico', 70), (4, 'US', 85), (5, 'Canada', 78), (6, 'Mexico', 72); | Find the top 3 countries with the highest average ESG scores? | SELECT Country, AVG(ESG) as AvgESG FROM OrganizationESG GROUP BY Country ORDER BY AvgESG DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE forests_timber_type (id INT, type VARCHAR(20), timber_type VARCHAR(10), volume FLOAT); INSERT INTO forests_timber_type (id, type, timber_type, volume) VALUES (1, 'Temperate Rainforest', 'Hardwood', 1500000), (2, 'Temperate Rainforest', 'Softwood', 2000000); | Calculate the ratio of hardwood to softwood timber volume in temperate rainforests | SELECT type, SUM(CASE WHEN timber_type = 'Hardwood' THEN volume ELSE 0 END) / SUM(CASE WHEN timber_type = 'Softwood' THEN volume ELSE 0 END) AS hardwood_softwood_ratio FROM forests_timber_type WHERE type = 'Temperate Rainforest' GROUP BY type; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityNews (id INT, reader_gender VARCHAR(10), reader_age INT); CREATE TABLE DailyDigest (id INT, reader_gender VARCHAR(10), reader_age INT); | What is the percentage of female and male readers in 'CityNews' and 'DailyDigest'? | SELECT 'CityNews' as newspaper, SUM(CASE WHEN reader_gender = 'female' THEN 1 ELSE 0 END) as female_readers, SUM(CASE WHEN reader_gender = 'male' THEN 1 ELSE 0 END) as male_readers FROM CityNews UNION ALL SELECT 'DailyDigest' as newspaper, SUM(CASE WHEN reader_gender = 'female' THEN 1 ELSE 0 END) as female_readers, SUM... | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyIncidents (IncidentID INT, IncidentDate DATE, ManufacturerID INT); INSERT INTO SafetyIncidents (IncidentID, IncidentDate, ManufacturerID) VALUES (1, '2020-01-01', 1), (2, '2020-04-15', 2), (3, '2021-07-01', 1); | How many safety incidents were recorded per quarter for the past two years? | SELECT QUARTER(SI.IncidentDate) AS IncidentQuarter, YEAR(SI.IncidentDate) AS IncidentYear, COUNT(SI.IncidentID) AS IncidentCount FROM SafetyIncidents SI WHERE SI.IncidentDate >= DATE_SUB(CURDATE(), INTERVAL 2 YEAR) GROUP BY IncidentQuarter, IncidentYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE domain_vulnerabilities (id INT, domain TEXT, vulnerability_id INT, date_discovered DATE); INSERT INTO domain_vulnerabilities (id, domain, vulnerability_id, date_discovered) VALUES (1, 'Network Security', 1, '2022-01-05'); INSERT INTO domain_vulnerabilities (id, domain, vulnerability_id, date_discovered) VA... | How many vulnerabilities were found in each cybersecurity domain in the last month? | SELECT domain, COUNT(*) as count FROM domain_vulnerabilities WHERE date_discovered >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY domain; | gretelai_synthetic_text_to_sql |
CREATE TABLE WildlifeSightings (id INT, species TEXT, year INT, location TEXT); INSERT INTO WildlifeSightings (id, species, year, location) VALUES (1, 'Polar Bear', 2020, 'Barrow'), (2, 'Polar Bear', 2015, 'Barrow'), (3, 'Walrus', 2019, 'Tromso'), (4, 'Walrus', 2014, 'Tromso'), (5, 'Narwhal', 2018, 'Pond Inlet'); | Delete records of Arctic wildlife sightings older than 2015 | DELETE FROM WildlifeSightings WHERE year < 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE electric_ferries (ferry_id INT, trip_distance INT, trip_date DATE); INSERT INTO electric_ferries (ferry_id, trip_distance, trip_date) VALUES (1, 30, '2022-01-01'), (2, 35, '2022-01-02'); CREATE TABLE city_coordinates (city VARCHAR(50), latitude DECIMAL(9,6), longitude DECIMAL(9,6)); INSERT INTO city_coordi... | What is the total distance traveled by electric ferries in Oslo? | SELECT SUM(trip_distance) FROM electric_ferries, city_coordinates WHERE city_coordinates.city = 'Oslo'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dams (id INT PRIMARY KEY, name VARCHAR(255), height INT, reservoir VARCHAR(255), built_year INT); INSERT INTO dams (id, name, height, reservoir, built_year) VALUES (1, 'DamP', 50, 'LakeA', 1940), (2, 'DamQ', 75, 'LakeB', 1975), (3, 'DamR', 60, 'LakeA', 2000); | What is the maximum height of dams in 'LakeB'? | SELECT MAX(height) as max_height FROM dams WHERE reservoir = 'LakeB'; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_hours (labor_id INT, state VARCHAR(20), year INT, hours_worked INT); INSERT INTO labor_hours (labor_id, state, year, hours_worked) VALUES (1, 'California', 2019, 1500000), (2, 'California', 2018, 1400000), (3, 'New York', 2019, 1200000), (4, 'Texas', 2019, 1300000), (5, 'Texas', 2018, 1100000); | What is the maximum number of construction labor hours worked in a year in the state of Texas? | SELECT state, MAX(hours_worked) FROM labor_hours GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT, city VARCHAR(50), type VARCHAR(50), passengers INT); | Update records in the 'public_transportation' table where the 'city' is 'Sydney' | UPDATE public_transportation SET passengers = 6000 WHERE city = 'Sydney'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cultivators (CultivatorID int, CultivatorName varchar(255), LicenseNumber varchar(255), State varchar(255)); INSERT INTO Cultivators (CultivatorID, CultivatorName, LicenseNumber, State) VALUES (1, 'Oregon Green', 'OR001', 'Oregon'); INSERT INTO Cultivators (CultivatorID, CultivatorName, LicenseNumber, Stat... | Find the daily average quantity of cannabis produced by each cultivator in the state of Oregon, for cultivators with a production quantity of at least 500 units per day. | SELECT Cultivators.CultivatorName, AVG(Production.Quantity/COUNT(DISTINCT ProductionDate)) AS AvgDailyQuantity FROM Cultivators INNER JOIN Production ON Cultivators.CultivatorID = Production.CultivatorID WHERE Cultivators.State = 'Oregon' GROUP BY Cultivators.CultivatorName HAVING AvgDailyQuantity >= 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE Language (name VARCHAR(255), native_speakers INT); INSERT INTO Language (name, native_speakers) VALUES ('Quechua', 5200), ('Yoruba', 5500), ('Guarani', 5800); | What languages have more than 5000 native speakers? | SELECT name FROM Language WHERE native_speakers > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE astronauts(id INT, name VARCHAR(255), birth_date DATE, gender VARCHAR(10)); INSERT INTO astronauts(id, name, birth_date, gender) VALUES (1, 'Jane Doe', '1990-05-18', 'Female'); | What is the age (in years) of the youngest astronaut to go to space? | SELECT FLOOR(DATEDIFF('2022-01-01', astronauts.birth_date) / 365.25) AS age FROM astronauts ORDER BY age LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE imports (id INT, product VARCHAR(50), weight FLOAT, supplier_country VARCHAR(50), store_location VARCHAR(50)); INSERT INTO imports (id, product, weight, supplier_country, store_location) VALUES (1, 'Salmon', 150.5, 'Japan', 'New York'), (2, 'Tuna', 200.3, 'USA', 'California'); | Show the total weight of fish imported from Japan and sold in New York. | SELECT SUM(imports.weight) FROM imports WHERE imports.supplier_country = 'Japan' AND imports.store_location = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Grants (GrantID INT, Professor VARCHAR(50), Department VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO Grants (GrantID, Professor, Department, Amount) VALUES (1, 'Alice', 'Physics', 50000.00); INSERT INTO Grants (GrantID, Professor, Department, Amount) VALUES (2, 'Bob', 'Chemistry', 75000.00); INSERT INTO ... | What are the names of professors who received grants in either the Mathematics or Physics departments? | SELECT Professor FROM Grants WHERE Department = 'Mathematics' UNION SELECT Professor FROM Grants WHERE Department = 'Physics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_communication (campaign_name TEXT, target_population INTEGER); INSERT INTO climate_communication (campaign_name, target_population) VALUES ('Voice for Change', 800000), ('Green Horizons', 1200000), ('Eco Warriors', 550000); CREATE TABLE climate_finance (funding_year INTEGER, campaign_name TEXT); IN... | List the names of all climate communication campaigns targeted at populations over 500000 that have no records in the 'climate_finance' table. | SELECT campaign_name FROM climate_communication WHERE target_population > 500000 AND campaign_name NOT IN (SELECT campaign_name FROM climate_finance); | gretelai_synthetic_text_to_sql |
CREATE TABLE Region ( id INT PRIMARY KEY, name VARCHAR(50) ); CREATE TABLE Farm ( id INT PRIMARY KEY, region_id INT, temperature INT, FOREIGN KEY (region_id) REFERENCES Region(id) ); | What is the average water temperature by region and season? | SELECT Region.name, DATE_FORMAT(Farm.date, '%Y-%m') AS month, AVG(Farm.temperature) FROM Region INNER JOIN Farm ON Region.id = Farm.region_id GROUP BY Region.name, MONTH(Farm.date), YEAR(Farm.date); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_pollution_incidents_2 (id INT, country TEXT, location TEXT, incident_date DATE); INSERT INTO marine_pollution_incidents_2 (id, country, location, incident_date) VALUES (1, 'United States', 'Gulf of Mexico', '2021-01-01'), (2, 'Mexico', 'Gulf of Mexico', '2021-02-01'), (3, 'Cuba', 'Gulf of Mexico', '... | What is the maximum number of marine pollution incidents in the Gulf of Mexico? | SELECT COUNT(*) as incident_count FROM marine_pollution_incidents_2 WHERE location = 'Gulf of Mexico'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, factory_name TEXT, location TEXT); INSERT INTO factories VALUES (1, 'Green Textiles', 'Asia'); INSERT INTO factories VALUES (2, 'Eco-Friendly Solutions', 'North America'); CREATE TABLE workers (worker_id INT, factory_id INT); INSERT INTO workers VALUES (1, 1); INSERT INTO workers... | How many workers are there in factories located in Asia in the factories and workers tables? | SELECT COUNT(workers.worker_id) FROM factories INNER JOIN workers ON factories.factory_id = workers.factory_id WHERE factories.location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellite (ID INT, Name TEXT, Country TEXT, LaunchDate DATE); INSERT INTO Satellite (ID, Name, Country, LaunchDate) VALUES (1, 'GSAT-1', 'India', '2004-06-18'), (2, 'INSAT-3A', 'India', '2003-04-10'), (3, 'RS-1', 'Russia', '2012-06-17'), (4, 'Sentinel-1A', 'Europe', '2014-04-03'); | What is the earliest launch date for a satellite from Russia? | SELECT MIN(LaunchDate) AS EarliestLaunchDate FROM Satellite WHERE Country = 'Russia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (id INT, loan_type VARCHAR(255), balance DECIMAL(10,2)); INSERT INTO loans (id, loan_type, balance) VALUES (1, 'Conventional', 800.00), (2, 'Socially Responsible', 1000.00); | Update the balance for a conventional loan to $1200. | UPDATE loans SET balance = 1200 WHERE loan_type = 'Conventional'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ImpactInvestments (InvestmentID INT, ROI DECIMAL(5,2), Region VARCHAR(50)); | List the impact investments with a return on investment greater than 10% in Southeast Asia. | SELECT InvestmentID, ROI FROM ImpactInvestments WHERE ROI > 10 AND Region = 'Southeast Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_name VARCHAR(255), affected_by VARCHAR(255), location VARCHAR(255), impact_level INT); INSERT INTO marine_species (species_name, affected_by, location, impact_level) VALUES ('Sea Otters', 'Oil Spills', 'Pacific Ocean', 8), ('Blue Whales', 'Plastic Waste', 'Pacific Ocean', 7), ('Sea ... | Find the top 5 species most affected by pollution in the Pacific Ocean. | SELECT species_name, affected_by, impact_level FROM marine_species WHERE location = 'Pacific Ocean' ORDER BY impact_level DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Space_Missions(mission_name VARCHAR(30), leader_id INT, duration INT); CREATE TABLE Astronauts(astronaut_id INT, astronaut_name VARCHAR(30), gender VARCHAR(6)); INSERT INTO Space_Missions(mission_name, leader_id, duration) VALUES ('Apollo 11', 1, 240), ('Apollo 11', 2, 240), ('Ares 1', 4, 315), ('Ares 1', ... | Show all space missions led by a female astronaut | SELECT Space_Missions.mission_name FROM Space_Missions INNER JOIN Astronauts ON Space_Missions.leader_id = Astronauts.astronaut_id WHERE Astronauts.gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(100), age INT, country VARCHAR(50)); INSERT INTO clients (client_id, name, age, country) VALUES (1, 'John Doe', 35, 'USA'); | What is the average income for clients living in the United States? | SELECT AVG(income) FROM clients WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_buses (bus_id INT, trip_date DATE, daily_revenue FLOAT, city VARCHAR(50)); INSERT INTO autonomous_buses (bus_id, trip_date, daily_revenue, city) VALUES (1, '2022-01-01', 850.25, 'Beijing'), (2, '2022-01-01', 920.00, 'Beijing'); | What is the daily revenue for autonomous buses in Beijing? | SELECT trip_date, SUM(daily_revenue) FROM autonomous_buses WHERE city = 'Beijing' GROUP BY trip_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, industry TEXT, patents INT); CREATE TABLE funding (company_id INT, amount INT); INSERT INTO companies (id, name, industry, patents) VALUES (1, 'LearnBright', 'Education', 5); INSERT INTO funding (company_id, amount) VALUES (1, 300000); | List companies in the education sector that have received funding, along with their funding amounts, and the number of patents they hold. | SELECT companies.name, funding.amount, companies.patents FROM companies INNER JOIN funding ON companies.id = funding.company_id WHERE companies.industry = 'Education'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schema2.data_inventory (id INT, name VARCHAR(255), type VARCHAR(50), region VARCHAR(100), last_update DATE); INSERT INTO schema2.data_inventory (id, name, type, region, last_update) VALUES (1, 'Firewall logs', 'Logs', 'North America', '2022-03-01'); | How many data sources are there in the 'data_inventory' table? | SELECT COUNT(*) FROM schema2.data_inventory; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities (city VARCHAR(50), technology VARCHAR(50), energy_consumption FLOAT, num_stations INT); INSERT INTO smart_cities (city, technology, energy_consumption, num_stations) VALUES ('CityA', 'SmartLighting', 1000, 50), ('CityB', 'SmartLighting', 1200, 30), ('CityC', 'SmartTransport', 2000, 80); | What is the total number of electric vehicle charging stations and their combined capacity (in kWh) in the smart_cities table, grouped by city? | SELECT city, SUM(num_stations) as total_stations, SUM(energy_consumption) as total_capacity FROM smart_cities GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE shared_scooters (scooter_id INT, station_id INT, availability_status TEXT, availability_time TIMESTAMP); | What is the total number of shared scooters available in Mexico City? | SELECT COUNT(*) FROM shared_scooters WHERE availability_status = 'available' AND station_id IN (SELECT station_id FROM station_information WHERE city = 'Mexico City'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (id INT, artist VARCHAR(100), location VARCHAR(100), price DECIMAL(5,2), tickets INT); INSERT INTO Concerts (id, artist, location, price, tickets) VALUES (1, 'Justin Bieber', 'United States', 100.00, 10000), (2, 'Lady Gaga', 'United States', 200.00, 20000); | What is the total revenue generated from concerts in the United States? | SELECT SUM(price*tickets) FROM Concerts WHERE location = 'United States' | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO warehouse (id, name, location) VALUES (1, 'Warehouse A', 'City A'), (2, 'Warehouse B', 'City B'); CREATE TABLE inventory (id INT, warehouse_id INT, product VARCHAR(50), quantity INT); INSERT INTO inventory (id, warehouse_id, product, q... | What is the total quantity of items stored in each warehouse? | SELECT w.name, SUM(i.quantity) as total_quantity FROM inventory i JOIN warehouse w ON i.warehouse_id = w.id GROUP BY w.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, client_name TEXT, country TEXT, financial_capability_score FLOAT); INSERT INTO clients (client_id, client_name, country, financial_capability_score) VALUES (1, 'John Doe', 'China', 7), (2, 'Jane Smith', 'Japan', 8), (3, 'Alice Johnson', 'India', 6), (4, 'Bob Brown', 'United States',... | Find the average financial capability score for clients in each country. | SELECT country, AVG(financial_capability_score) FROM clients GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_cultural_competency (state VARCHAR(2), score INT); INSERT INTO state_cultural_competency (state, score) VALUES ('CA', 95), ('NY', 85), ('TX', 90); | Which states have the highest and lowest cultural competency scores? | SELECT state, MAX(score) AS highest_score, MIN(score) AS lowest_score FROM state_cultural_competency GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT PRIMARY KEY, name VARCHAR(255), amount INT, organization VARCHAR(255), region VARCHAR(255), year INT); INSERT INTO funding (id, name, amount, organization, region, year) VALUES (1, 'Funding A', 100000, 'National Science Foundation', 'Arctic', 2023), (2, 'Funding B', 200000, 'University of t... | What is the total funding received by organizations in the Arctic region in the year 2022? | SELECT SUM(f.amount) AS total_funding FROM funding f WHERE f.region = 'Arctic' AND f.year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE ota_revenue (ota_id INT, ota_name TEXT, region TEXT, revenue FLOAT); INSERT INTO ota_revenue (ota_id, ota_name, region, revenue) VALUES (1, 'OTA A', 'Americas', 25000000), (2, 'OTA B', 'Americas', 30000000), (3, 'OTA C', 'APAC', 20000000), (4, 'OTA D', 'EMEA', 35000000); | What is the total revenue of Online Travel Agencies (OTAs) in 'Americas'? | SELECT SUM(revenue) FROM ota_revenue WHERE region = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE packages (id INT, country TEXT, weight FLOAT); INSERT INTO packages (id, country, weight) VALUES (1, 'USA', 2.5), (2, 'China', 4.7), (3, 'Mexico', 3.2), (4, 'USA', 1.9), (5, 'Canada', 5.1); | Count the number of packages shipped to each country | SELECT country, COUNT(*) FROM packages GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(255), sector VARCHAR(255), ESG_score FLOAT); INSERT INTO companies (id, name, sector, ESG_score) VALUES (1, 'SolarCity', 'Renewable Energy', 75.0), (2, 'WindPower Inc', 'Renewable Energy', 80.0), (3, 'GreenTech', 'Renewable Energy', 85.0); | What is the minimum ESG score for companies in the renewable energy sector? | SELECT MIN(ESG_score) FROM companies WHERE sector = 'Renewable Energy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(50), menu_type VARCHAR(20), price DECIMAL(5,2), local_ingredients DECIMAL(5,2), is_vegan BOOLEAN); INSERT INTO menus (menu_id, menu_name, menu_type, price, local_ingredients, is_vegan) VALUES (1, 'Quinoa Salad', 'Vegetarian', 9.99, 0.3, true), (2, 'Margherita Pizza', '... | What is the total weight of locally sourced ingredients in vegan dishes? | SELECT SUM(local_ingredients) FROM menus WHERE is_vegan = true; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA Embraer; CREATE TABLE Embraer.FlightSafetyRecords (safety_record DECIMAL(5,4), year INT); INSERT INTO Embraer.FlightSafetyRecords (safety_record, year) VALUES (0.97, 2019), (0.98, 2018), (0.99, 2017); | What was the minimum flight safety record for aircrafts manufactured by 'Embraer' in the year 2019? | SELECT MIN(safety_record) FROM Embraer.FlightSafetyRecords WHERE year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE covid_cases (zip_code INT, state VARCHAR(20), cases INT); INSERT INTO covid_cases (zip_code, state, cases) VALUES (12345, 'California', 6000); INSERT INTO covid_cases (zip_code, state, cases) VALUES (67890, 'California', 3000); | How many ZIP codes in California have more than 5000 COVID-19 cases? | SELECT COUNT(DISTINCT zip_code) FROM covid_cases WHERE state = 'California' GROUP BY zip_code HAVING SUM(cases) > 5000; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(255), area_size FLOAT, avg_depth FLOAT, region VARCHAR(255)); INSERT INTO marine_protected_areas (id, name, area_size, avg_depth, region) VALUES (1, 'Great Barrier Reef', 344400, -1574, 'Indian'), (2, 'Andaman Islands', 8044, 1234, 'Indian'); | What is the total area of all marine protected areas (MPAs) in the Indian Ocean with an average depth greater than 1000 meters? | SELECT SUM(area_size) FROM marine_protected_areas WHERE region = 'Indian' AND avg_depth > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT PRIMARY KEY, Age INT, Gender VARCHAR(10), Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Gender, Country) VALUES (11, 20, 'Male', 'Brazil'), (12, 22, 'Female', 'India'), (13, 25, 'Non-binary', 'Japan'), (14, 30, 'Male', 'Canada'); CREATE TABLE PlayerVR (PlayerID INT, TechID... | What is the minimum age of players who have adopted VR technology? | SELECT MIN(Age) FROM Players JOIN PlayerVR ON Players.PlayerID = PlayerVR.PlayerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmSpecies (FarmID int, SpeciesID int, SpeciesName varchar(50), Quantity int); INSERT INTO FarmSpecies (FarmID, SpeciesID, SpeciesName, Quantity) VALUES (1, 1, 'Salmon', 2000), (1, 2, 'Tuna', 3000), (2, 1, 'Salmon', 4000), (2, 3, 'Cod', 1000); | How many fish are there in each farm by species? | SELECT FarmID, SpeciesName, SUM(Quantity) as TotalQuantity FROM FarmSpecies GROUP BY FarmID, SpeciesName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50)); CREATE TABLE MonthlyDonations (DonationID int, DonorID int, Amount decimal(10,2), DonationMonth date); INSERT INTO Donors (DonorID, DonorName) VALUES (1, 'John Doe'), (2, 'Jane Smith'), (3, 'Mary Johnson'), (4, 'Ali Hassan'); INSERT INTO MonthlyDonations (Donati... | What is the average donation per month in the 'MonthlyDonations' table? | SELECT EXTRACT(MONTH FROM DonationMonth) as Month, AVG(Amount) as AverageDonationPerMonth FROM MonthlyDonations GROUP BY Month; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA Pollution;CREATE TABLE PollutionData (id INT, country TEXT, pollution_level REAL); INSERT INTO PollutionData (id, country, pollution_level) VALUES (1, 'USA', 8.5), (2, 'China', 9.2), (3, 'India', 8.8), (4, 'Japan', 4.2), (5, 'Germany', 5.1), (6, 'Brazil', 6.3), (7, 'Canada', 4.8), (8, 'Australia', 5.6); | Find the top 3 countries with highest pollution levels in the 'Pollution' schema. | SELECT country, pollution_level FROM (SELECT country, pollution_level, RANK() OVER (ORDER BY pollution_level DESC) AS pollution_rank FROM Pollution.PollutionData) AS pollution_ranks WHERE pollution_rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE threats (id INT, threat_type VARCHAR(50), severity_score INT, threat_date DATE); | What is the average severity score of threats related to 'phishing' in the last year? | SELECT AVG(severity_score) as avg_severity FROM threats WHERE threat_type = 'phishing' AND threat_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE company_profiles (company_name VARCHAR(255), founding_year INT, founder_gender VARCHAR(50), founder_ethnicity VARCHAR(50)); | Insert new records for a startup founded in 2022 by a Latinx female entrepreneur into the "company_profiles" table | INSERT INTO company_profiles (company_name, founding_year, founder_gender, founder_ethnicity) VALUES ('Alpha Startup', 2022, 'Female', 'Latinx'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_conditions (id INT, condition VARCHAR(255), region VARCHAR(255)); INSERT INTO mental_health_conditions (id, condition, region) VALUES (1, 'Anxiety', 'South America'), (2, 'Depression', 'North America'), (3, 'Anxiety', 'Europe'), (4, 'Depression', 'Asia'), (5, 'Bipolar', 'Africa'); | How many mental health conditions are present in each region? | SELECT region, COUNT(DISTINCT condition) FROM mental_health_conditions GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE accommodations (accommodation_id INT, service_id INT, total_students INT); INSERT INTO accommodations (accommodation_id, service_id, total_students) VALUES (1, 1, 100), (2, 2, 200), (3, 3, 300), (4, 4, 400), (5, 5, 500); | What is the total number of students accommodated in disability support programs in the disability services database? | SELECT SUM(total_students) FROM accommodations; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT PRIMARY KEY, habitat_type VARCHAR(50)); INSERT INTO habitats (id, habitat_type) VALUES (1, 'Forest'); INSERT INTO habitats (id, habitat_type) VALUES (2, 'Grassland'); INSERT INTO habitats (id, habitat_type) VALUES (3, 'Wetland'); CREATE TABLE animals (id INT PRIMARY KEY, animal_name VARCHA... | Delete the animal 'Elephant' from the database | DELETE FROM animals WHERE animal_name = 'Elephant'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT); INSERT INTO Players (PlayerID, Age) VALUES (1, 50); INSERT INTO Players (PlayerID, Age) VALUES (2, 60); | Show the top 5 oldest players | SELECT * FROM Players ORDER BY Age DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_taxis (taxi_id INT, registration_date DATE, city TEXT, in_operation BOOLEAN, passenger_count INT, pickup_time TIMESTAMP); | What is the maximum number of passengers in a single autonomous taxi in Sydney during peak hours? | SELECT MAX(passenger_count) FROM autonomous_taxis WHERE city = 'Sydney' AND in_operation = TRUE AND pickup_time BETWEEN '06:00:00' AND '10:00:00' OR pickup_time BETWEEN '15:00:00' AND '19:00:00'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bike_sharing (id INT, city VARCHAR(50), trip_count INT, timestamp TIMESTAMP); | What is the number of bike-sharing trips in Beijing, Paris, and New York? | SELECT city, SUM(trip_count) FROM bike_sharing WHERE city IN ('Beijing', 'Paris', 'New York') GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(100), language VARCHAR(20), word_count INT); | What is the total number of words in all news articles published in English? | SELECT SUM(word_count) FROM articles WHERE language = 'English'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_footprint (brand_id INT, brand_name VARCHAR(255), carbon_footprint DECIMAL(10,2)); INSERT INTO carbon_footprint (brand_id, brand_name, carbon_footprint) VALUES (1, 'Eileen Fisher', 5.50), (2, 'Patagonia', 4.25), (3, 'Allbirds', 6.00); | What is the average carbon footprint of each ethical fashion brand? | SELECT brand_name, AVG(carbon_footprint) as avg_carbon_footprint FROM carbon_footprint GROUP BY brand_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE tokyo_public_transport (user_id INT, mode VARCHAR(20)); CREATE TABLE sydney_public_transport (user_id INT, mode VARCHAR(20)); INSERT INTO tokyo_public_transport (user_id, mode) VALUES (1, 'Train'), (2, 'Bus'), (3, 'Subway'); INSERT INTO sydney_public_transport (user_id, mode) VALUES (4, 'Train'), (5, 'Ferr... | Find the difference in the number of public transportation users in Tokyo and Sydney. | SELECT COUNT(*) FROM tokyo_public_transport EXCEPT SELECT COUNT(*) FROM sydney_public_transport; | gretelai_synthetic_text_to_sql |
CREATE TABLE exoplanets (id INT, name VARCHAR(50), distance_from_earth FLOAT, mission VARCHAR(50)); | What is the average distance from Earth for all exoplanets discovered by the Kepler mission? | SELECT AVG(distance_from_earth) FROM exoplanets WHERE mission = 'Kepler'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceTelescopes (id INT, country VARCHAR(50), year INT, telescope VARCHAR(50)); INSERT INTO SpaceTelescopes (id, country, year, telescope) VALUES (1, 'USA', 1990, 'Hubble'), (2, 'China', 2016, 'Heavenly Palace'), (3, 'Europe', 2013, 'Gaia'); | What is the earliest year in which a country launched a space telescope in the SpaceTelescopes table? | SELECT country, MIN(year) AS earliest_year FROM SpaceTelescopes GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtWorkSales (artworkID INT, saleDate DATE, artworkMedium VARCHAR(50), revenue DECIMAL(10,2)); | What was the average price of artworks sold by medium in 2019? | SELECT artworkMedium, AVG(revenue) as avg_price FROM ArtWorkSales WHERE YEAR(saleDate) = 2019 GROUP BY artworkMedium; | gretelai_synthetic_text_to_sql |
CREATE TABLE disease_data (id INT, patient_id INT, state VARCHAR(20), disease VARCHAR(50)); INSERT INTO disease_data (id, patient_id, state, disease) VALUES (1, 1, 'Queensland', 'Heart Disease'), (2, 1, 'Queensland', 'Diabetes'), (3, 2, 'New South Wales', 'Cancer'), (4, 2, 'New South Wales', 'Asthma'), (5, 3, 'New Sout... | Show the top 2 most common diseases in each state | SELECT state, disease, COUNT(*) as num_diseases FROM disease_data GROUP BY state, disease HAVING COUNT(*) > 1 ORDER BY state, num_diseases DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE mangrove_forests (id INT, region VARCHAR(50), name VARCHAR(50), area_sqkm FLOAT); INSERT INTO mangrove_forests (id, region, name, area_sqkm) VALUES (1, 'Asia', 'Sundarbans', 10000); INSERT INTO mangrove_forests (id, region, name, area_sqkm) VALUES (2, 'Central America', 'Mangrove forests of Belize', 325); | What is the total area covered by mangrove forests in each region? | SELECT region, SUM(area_sqkm) FROM mangrove_forests GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_stats (union_id INT, union_name TEXT, total_members INT, safety_focus BOOLEAN); INSERT INTO union_stats (union_id, union_name, total_members, safety_focus) VALUES (1, 'Union A', 100, true), (2, 'Union B', 200, false), (3, 'Union C', 300, true); | Show all union membership statistics for unions that have a focus on worker safety. | SELECT * FROM union_stats WHERE safety_focus = true; | 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.