context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE fabric (type VARCHAR(20), price DECIMAL(5,2), is_sustainable BOOLEAN); INSERT INTO fabric (type, price, is_sustainable) VALUES ('cotton', 3.50, true), ('polyester', 2.50, false), ('recycled_polyester', 3.00, true); | Find the average price of sustainable fabric types | SELECT AVG(price) FROM fabric WHERE is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (state VARCHAR(50), race_ethnicity VARCHAR(50), workers INT); | Insert a new community health worker in Texas with 2 workers for the Hispanic race/ethnicity? | INSERT INTO community_health_workers (state, race_ethnicity, workers) VALUES ('Texas', 'Hispanic', 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE greenhouse_gas_emissions (id INT PRIMARY KEY, source_type VARCHAR(50), country VARCHAR(50), year INT, amount DECIMAL(10,2));CREATE TABLE climate_adaptation_projects (id INT PRIMARY KEY, project_type VARCHAR(50), country VARCHAR(50), year INT, reduction DECIMAL(10,2));CREATE VIEW v_south_american_adaptation... | List the top 5 countries in South America with the highest greenhouse gas emissions reduction due to climate adaptation projects. | SELECT country, total_reduction FROM v_ghg_reductions WHERE source_type = 'Greenhouse Gas' ORDER BY total_reduction DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Temperature (field VARCHAR(50), date DATE, temperature FLOAT); INSERT INTO Temperature (field, date, temperature) VALUES ('Field J', '2022-06-01', 30.1), ('Field J', '2022-06-02', 32.6), ('Field J', '2022-06-03', 28.3); | What is the maximum temperature in field J in the past week? | SELECT MAX(temperature) FROM Temperature WHERE field = 'Field J' AND date >= DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY); | gretelai_synthetic_text_to_sql |
CREATE TABLE shelters (id INT, project_id INT, location VARCHAR(255), construction_date DATE); INSERT INTO shelters (id, project_id, location, construction_date) VALUES (1, 10001, 'USA', '2019-05-01'); INSERT INTO shelters (id, project_id, location, construction_date) VALUES (2, 10002, 'Canada', '2019-02-01'); | What is the total number of shelters constructed in "North America" in 2019? | SELECT COUNT(*) FROM shelters WHERE location = 'North America' AND YEAR(construction_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics; USE genetics; CREATE TABLE if not exists gene_expression (sample_id INT, gene_name VARCHAR(255), expression DECIMAL(5,2)); INSERT INTO gene_expression (sample_id, gene_name, expression) VALUES (1, 'ABC', 3.45), (2, 'ABC', 3.56), (3, 'MNO', 1.23), (4, 'DEF', 2.98), (5, 'MNO', 0.98),... | What is the minimum expression level for gene 'MNO' across all samples? | SELECT MIN(expression) FROM genetics.gene_expression WHERE gene_name = 'MNO'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (EventID INT, EventName VARCHAR(20), EventCategory VARCHAR(20));CREATE TABLE FundingSources (FundingSourceID INT, FundingSourceName VARCHAR(20));CREATE TABLE EventFunding (EventID INT, FundingSourceID INT, FundingAmount INT); | What is the total amount of funding received by events in the 'Dance' category from 'Private Donations'? | SELECT SUM(EF.FundingAmount) AS Total_Funding_Received FROM Events E INNER JOIN EventFunding EF ON E.EventID = EF.EventID INNER JOIN FundingSources FS ON EF.FundingSourceID = FS.FundingSourceID WHERE E.EventCategory = 'Dance' AND FS.FundingSourceName = 'Private Donations'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (id INT, restaurant_id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2)); INSERT INTO menu_items (id, restaurant_id, name, category, price) VALUES (1, 1, 'Quinoa Salad', 'Salads', 15.99), (2, 1, 'Grilled Chicken Sandwich', 'Sandwiches', 12.49), (3, 2, 'Cheeseburger', 'Burgers', ... | Identify the menu item with the highest price from the "menu_items" table. | SELECT name, MAX(price) FROM menu_items; | gretelai_synthetic_text_to_sql |
CREATE TABLE ota_bookings (booking_id INT, hotel_name TEXT, region TEXT, revenue FLOAT); INSERT INTO ota_bookings (booking_id, hotel_name, region, revenue) VALUES (1, 'Hotel Q', 'Asia', 600), (2, 'Hotel R', 'Asia', 800), (3, 'Hotel S', 'Asia', 500); | What is the average revenue per OTA booking in 'Asia'? | SELECT AVG(revenue) FROM ota_bookings WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, EmployeeName varchar(50), JobCategory varchar(50), Salary decimal(10,2), Gender varchar(10), Country varchar(50)); INSERT INTO Employees (EmployeeID, EmployeeName, JobCategory, Salary, Gender, Country) VALUES (1, 'Jasmine White', 'IT', 85000.00, 'Female', 'USA'), (2, 'Kai Johnson... | List the bottom 2 countries with the lowest average salary in the 'Finance' job category, including the average salary for that job category in each country? | SELECT Country, AVG(Salary) AS avg_salary FROM Employees WHERE JobCategory = 'Finance' GROUP BY Country ORDER BY avg_salary, Country LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Outages (id INT, state VARCHAR(2), year INT, outage_cause VARCHAR(10), power_restoration_time TIME, count INT); INSERT INTO Outages (id, state, year, outage_cause, power_restoration_time, count) VALUES (1, 'FL', 2019, 'Hurricane', '2H', 20), (2, 'FL', 2019, 'Equipment Failure', '30M', 30), (3, 'FL', 2019, ... | What is the total number of power outages in Florida in 2019, categorized by outage cause and power restoration time? | SELECT outage_cause, power_restoration_time, SUM(count) FROM Outages WHERE state = 'FL' AND year = 2019 GROUP BY outage_cause, power_restoration_time; | gretelai_synthetic_text_to_sql |
CREATE TABLE launches (id INT, agency_id INT, launch_date DATE); CREATE TABLE space_agencies (id INT, name VARCHAR(50)); | What is the latest launch date for each space agency? | SELECT a.name, MAX(l.launch_date) FROM launches l JOIN space_agencies a ON l.agency_id = a.id GROUP BY a.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE SupportProgramProviders (ProgramID INT, ProviderName VARCHAR(50), DisabilityType VARCHAR(50)); | Who are the top 5 most frequent providers of support programs for students with physical disabilities? | SELECT ProviderName, COUNT(ProgramID) as ProgramCount FROM SupportProgramProviders WHERE DisabilityType = 'physical disability' GROUP BY ProviderName ORDER BY ProgramCount DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (title VARCHAR(255), release_year INT, rating DECIMAL(3,2), production_country VARCHAR(50)); | What is the average rating of movies produced in the US and released between 2015 and 2020? | SELECT AVG(rating) FROM movies WHERE production_country = 'United States' AND release_year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE eu_countries (country VARCHAR(255), wastewater_treated INT); INSERT INTO eu_countries (country, wastewater_treated) VALUES ('Germany', 2000000), ('France', 3000000), ('Italy', 4000000); | What is the total wastewater treated in European Union countries? | SELECT SUM(wastewater_treated) FROM eu_countries; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining (year INT, element VARCHAR(10), quantity INT); INSERT INTO mining VALUES (2020, 'Neodymium', 1200); CREATE TABLE recycling (year INT, element VARCHAR(10), quantity INT); INSERT INTO recycling VALUES (2020, 'Neodymium', 800); | What is the average production quantity of Neodymium in 2020 from the 'mining' and 'recycling' sources? | SELECT AVG(quantity) FROM (SELECT quantity FROM mining WHERE element = 'Neodymium' AND year = 2020 UNION ALL SELECT quantity FROM recycling WHERE element = 'Neodymium' AND year = 2020) AS total | gretelai_synthetic_text_to_sql |
CREATE TABLE Festivals (id INT, name VARCHAR(50), country VARCHAR(50), year INT, revenue INT); INSERT INTO Festivals (id, name, country, year, revenue) VALUES (1, 'Summer Sonic', 'Japan', 2023, 4000000), (2, 'ZoukOut', 'Singapore', 2023, 3000000), (3, 'Ultra', 'Miami', 2023, 5000000), (4, 'Ultra', 'Seoul', 2023, 600000... | What is the total revenue generated by music festivals in Asia in 2023? | SELECT SUM(revenue) FROM Festivals WHERE country IN ('Japan', 'Singapore', 'Seoul') AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_products (product_id INT, category VARCHAR(255), price DECIMAL(10,2), recycled BOOLEAN, certified_by INT);CREATE TABLE certified_products (certification_id INT, name VARCHAR(255)); | What is the total number of products in the 'sustainable_products' table that are certified by the 'certified_products' table? | SELECT COUNT(*) FROM sustainable_products WHERE certified_by IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities(id INT, timestamp TIMESTAMP, severity FLOAT); | What is the average severity of vulnerabilities found in the last quarter, grouped by month? | SELECT DATE_FORMAT(timestamp, '%Y-%m') as month, AVG(severity) as avg_severity FROM vulnerabilities WHERE timestamp >= NOW() - INTERVAL 3 MONTH GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE TreeSpecies (id INT, name VARCHAR(255)); INSERT INTO TreeSpecies (id, name) VALUES (1, 'Pine'), (2, 'Oak'), (3, 'Maple'), (4, 'Birch'); CREATE TABLE CarbonSeq (id INT, tree_species_id INT, year INT, rate FLOAT); INSERT INTO CarbonSeq (id, tree_species_id, year, rate) VALUES (1, 1, 2000, 2.5), (2, 1, 2001, ... | What is the maximum carbon sequestration rate for each tree species? | SELECT ts.id, ts.name, MAX(cs.rate) AS max_carbon_sequestration_rate FROM TreeSpecies ts JOIN CarbonSeq cs ON ts.id = cs.tree_species_id GROUP BY ts.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE excavation_sites (id INT, site_name VARCHAR(50), location VARCHAR(50), num_artifacts INT); INSERT INTO excavation_sites (id, site_name, location, num_artifacts) VALUES (1, 'Site A', 'USA', 30), (2, 'Site B', 'Mexico', 45), (3, 'Site C', 'Canada', 25); | List all excavation sites and the number of artifacts associated with each site. | SELECT site_name, num_artifacts FROM excavation_sites; | gretelai_synthetic_text_to_sql |
CREATE TABLE regulatory_compliance (id INT PRIMARY KEY, cargo_id INT, regulation_id INT); INSERT INTO regulatory_compliance (id, cargo_id, regulation_id) VALUES (1, 101, 201); | Delete all records from table regulatory_compliance with regulation_id 201 | DELETE FROM regulatory_compliance WHERE regulation_id = 201; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (id INT, project_type VARCHAR(255), initiator VARCHAR(255), initiated_year INT, capacity FLOAT); | Delete all records from the 'renewable_energy_projects' table where the 'initiator' is 'SolarPioneers' | DELETE FROM renewable_energy_projects WHERE initiator = 'SolarPioneers'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Claims (ClaimID INT, PolicyID INT, ClaimAmount DECIMAL(10, 2), ClaimDate DATE, Region VARCHAR(255)); INSERT INTO Claims VALUES (1, 1, 500, '2021-01-05', 'East'), (2, 2, 1000, '2022-02-10', 'West'), (3, 3, 750, '2021-03-15', 'Central'), (4, 4, 1200, '2022-01-25', 'East'), (5, 5, 300, '2021-02-01', 'West'), ... | What is the total claim amount per policy type, quarter, and region? | SELECT PolicyType, Region, EXTRACT(QUARTER FROM ClaimDate) AS Quarter, SUM(ClaimAmount) AS TotalClaimAmount FROM Claims GROUP BY PolicyType, Region, Quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE Boroughs (name VARCHAR(50), green_certified INT); INSERT INTO Boroughs (name, green_certified) VALUES ('Manhattan', 150), ('Brooklyn', 200), ('Queens', 120); | How many green-certified buildings are there in each borough? | SELECT name, green_certified FROM Boroughs; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinics (id INT, patient_volume INT, location VARCHAR(20), year INT); INSERT INTO clinics (id, patient_volume, location, year) VALUES (1, 500, 'rural', 2021), (2, 200, 'urban', 2021), (3, 750, 'rural', 2020), (4, 600, 'rural', 2019); | Determine the number of rural clinics that have seen an increase in patient volume in the past year. | SELECT COUNT(*) FROM clinics WHERE location LIKE '%rural%' AND patient_volume > (SELECT patient_volume FROM clinics WHERE location = 'rural' AND year = YEAR(GETDATE()) - 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (country VARCHAR(50), year INT, amount INT); INSERT INTO humanitarian_assistance (country, year, amount) VALUES ('Syria', 2018, 1000000), ('Yemen', 2019, 1500000), ('Syria', 2020, 2000000), ('Yemen', 2020, 1200000); | What is the maximum amount of humanitarian assistance provided by the United States to any country in 2020? | SELECT MAX(amount) FROM humanitarian_assistance WHERE country = 'Syria' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Streams (id INT, artist VARCHAR(100), country VARCHAR(100), streams INT); INSERT INTO Streams (id, artist, country, streams) VALUES (1, 'Dua Lipa', 'Canada', 700000), (2, 'Dua Lipa', 'Canada', 800000); | What is the average number of streams for artist 'Dua Lipa' in Canada? | SELECT AVG(streams) FROM Streams WHERE artist = 'Dua Lipa' AND country = 'Canada' | gretelai_synthetic_text_to_sql |
CREATE TABLE salesperson (id INT, name VARCHAR(50), revenue DECIMAL(10,2)); INSERT INTO salesperson (id, name, revenue) VALUES (1, 'John Doe', 5000.00), (2, 'Jane Smith', 7000.00); | What is the total revenue for each salesperson, ordered by total revenue? | SELECT name, SUM(revenue) as total_revenue FROM salesperson GROUP BY name ORDER BY total_revenue DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name VARCHAR(255), manufacturer_country VARCHAR(50)); INSERT INTO products (product_id, name, manufacturer_country) VALUES (1, 'T-Shirt', 'USA'), (2, 'Jeans', 'India'); | What is the average rating of products manufactured in the USA? | SELECT AVG(rating) FROM products JOIN product_reviews ON products.product_id = product_reviews.product_id WHERE manufacturer_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE vessel_locations(id INT, vessel_id INT, location VARCHAR(50), timestamp TIMESTAMP); | How many vessels from Nigeria have been to the Mediterranean sea in the past month? | SELECT COUNT(DISTINCT vessels.id) FROM vessels JOIN vessel_locations ON vessels.id = vessel_locations.vessel_id WHERE vessels.country = 'Nigeria' AND location LIKE '%Mediterranean%' AND timestamp > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) | gretelai_synthetic_text_to_sql |
CREATE TABLE ship (id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), length INT, port_id INT, FOREIGN KEY (port_id) REFERENCES port(id)); INSERT INTO ship VALUES (1, 'Sea Giant', 'Container', 300, 1); INSERT INTO ship VALUES (2, 'Ocean Titan', 'Tanker', 400, 2); CREATE TABLE cargo (id INT PRIMARY KEY, ship_id INT... | What is the maximum cargo weight for each ship? | SELECT s.name as ship_name, MAX(c.weight) as max_weight FROM cargo c JOIN ship s ON c.ship_id = s.id GROUP BY s.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, production_company VARCHAR(100)); INSERT INTO movies (id, title, release_year, production_company) VALUES (1, 'Movie1', 2005, 'CompanyA'), (2, 'Movie2', 2002, 'CompanyB'), (3, 'Movie3', 2018, 'CompanyA'); | List the top 3 most active movie production companies in Asia based on the number of movies released since 2000? | SELECT production_company, COUNT(*) as num_movies FROM movies WHERE release_year >= 2000 AND production_company IN (SELECT production_company FROM movies WHERE release_year >= 2000 GROUP BY production_company HAVING COUNT(*) > 2) GROUP BY production_company ORDER BY num_movies DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_approvals (region TEXT, quarter TEXT, year INTEGER, num_approvals INTEGER); INSERT INTO drug_approvals (region, quarter, year, num_approvals) VALUES ('EU', 'Q3', 2018, 50); | How many drug approvals were granted in the EU in Q3 2018? | SELECT SUM(num_approvals) FROM drug_approvals WHERE region = 'EU' AND quarter = 'Q3' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE attractions (id INT, name TEXT, country TEXT); CREATE TABLE visits (id INT, attraction_id INT, visitor_id INT, visit_date DATE); | Find the number of tourists who visited 'New Zealand' attractions more than twice in the last year. | SELECT COUNT(DISTINCT visitor_id) FROM (SELECT visitor_id, attraction_id FROM attractions JOIN visits ON attractions.id = visits.attraction_id WHERE country = 'New Zealand' AND visit_date > (CURRENT_DATE - INTERVAL '1 year') GROUP BY visitor_id, attraction_id HAVING COUNT(*) > 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_efforts (id INT, species_id INT, project_status VARCHAR(20)); | Delete all records from the conservation_efforts table where the project status is 'unsuccessful' | DELETE FROM conservation_efforts WHERE project_status = 'unsuccessful'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_revenue (region VARCHAR(50), revenue FLOAT, quarter INT, year INT); INSERT INTO tourism_revenue (region, revenue, quarter, year) VALUES ('Americas', 4000000, 2, 2022), ('Americas', 4500000, 3, 2022), ('Asia', 3000000, 2, 2022), ('Asia', 3200000, 3, 2022), ('Europe', 5000000, 2, 2022), ('Europe', 53... | What was the change in virtual tourism revenue between Q2 and Q3 2022, for each region in the world? | SELECT region, (q3_revenue - q2_revenue) as revenue_change FROM (SELECT region, SUM(CASE WHEN quarter = 2 THEN revenue ELSE 0 END) as q2_revenue, SUM(CASE WHEN quarter = 3 THEN revenue ELSE 0 END) as q3_revenue FROM tourism_revenue GROUP BY region) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE memberships (id INT, member_type VARCHAR(50), region VARCHAR(50), enrollment_date DATE); | How many members have enrolled in the last 30 days? | SELECT COUNT(*) FROM memberships WHERE enrollment_date >= CURRENT_DATE - INTERVAL '30' DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE SmartCityTechAdoption (id INT, city VARCHAR(50), technology VARCHAR(50), adoption_rate FLOAT); | What is the adoption rate of each smart city technology in the 'SmartCityTechAdoption' table? | SELECT technology, AVG(adoption_rate) as avg_adoption_rate FROM SmartCityTechAdoption GROUP BY technology; | gretelai_synthetic_text_to_sql |
CREATE TABLE region_data (region VARCHAR(255), participations INT); INSERT INTO region_data VALUES ('Northeast', 250), ('Midwest', 300), ('South', 375), ('West', 225); | How many public participations occurred in each region? | SELECT region, SUM(participations) FROM region_data GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE strains (id INT, name TEXT, dispensary_id INT); INSERT INTO strains (id, name, dispensary_id) VALUES (1, 'Strain A', 1), (2, 'Strain B', 1), (3, 'Strain C', 2); CREATE TABLE dispensaries (id INT, name TEXT, state TEXT); INSERT INTO dispensaries (id, name, state) VALUES (1, 'Organic Dispensary', 'Colorado')... | How many unique strains are available in CO dispensaries that have 'organic' in their name? | SELECT COUNT(DISTINCT s.name) FROM strains s JOIN dispensaries d ON s.dispensary_id = d.id WHERE d.state = 'Colorado' AND d.name LIKE '%organic%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GasProduction (ProductionID INT, Location VARCHAR(20), ProductionMonth DATE, GasProduction INT); INSERT INTO GasProduction (ProductionID, Location, ProductionMonth, GasProduction) VALUES (1, 'Marcellus Shale', '2022-06-01', 1200000), (2, 'Marcellus Shale', '2022-05-01', 1100000), (3, 'Barnett Shale', '2022... | What is the average daily gas production, in cubic feet, for all wells in the Marcellus Shale, for the last 6 months? | SELECT AVG(GasProduction) FROM GasProduction WHERE Location = 'Marcellus Shale' AND ProductionMonth >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, HasSmartwatch BOOLEAN); CREATE TABLE Workouts (WorkoutID INT, MemberID INT, WorkoutDate DATE, Duration INT, WorkoutType VARCHAR(10)); | What is the total duration of cardio workouts for members with a smartwatch? | SELECT SUM(Duration) FROM Workouts INNER JOIN Members ON Workouts.MemberID = Members.MemberID WHERE Members.HasSmartwatch = TRUE AND WorkoutType = 'cardio'; | gretelai_synthetic_text_to_sql |
CREATE TABLE production ( id INT PRIMARY KEY, element VARCHAR(10), quantity INT, production_date DATE); | Update the quantity of dysprosium produced on January 1, 2017 in the production table | UPDATE production SET quantity = 250 WHERE element = 'dysprosium' AND production_date = '2017-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, sector VARCHAR(255), risk_assessment_score INT); INSERT INTO investments (id, sector, risk_assessment_score) VALUES (1, 'Renewable Energy', 75), (2, 'Renewable Energy', 80), (3, 'Healthcare', 60); | How many investments have been made in the renewable energy sector with a risk assessment score greater than 70? | SELECT COUNT(*) FROM investments WHERE sector = 'Renewable Energy' AND risk_assessment_score > 70; | gretelai_synthetic_text_to_sql |
CREATE TABLE Product (product_id INT PRIMARY KEY, product_name VARCHAR(50), price DECIMAL(5,2), is_ethically_sourced BOOLEAN); | Find the average price of all products that are ethically sourced from the 'Product' table | SELECT AVG(price) FROM Product WHERE is_ethically_sourced = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicle_Sales (id INT, vehicle_type TEXT, quantity INT, year INT, country TEXT); INSERT INTO Vehicle_Sales (id, vehicle_type, quantity, year, country) VALUES (1, 'Electric', 800, 2019, 'Canada'); INSERT INTO Vehicle_Sales (id, vehicle_type, quantity, year, country) VALUES (2, 'Hybrid', 1200, 2019, 'Canada'... | What is the percentage of hybrid vehicles sold in Canada in 2019? | SELECT (SUM(quantity) FILTER (WHERE vehicle_type = 'Hybrid')::FLOAT / SUM(quantity)) * 100.0 FROM Vehicle_Sales WHERE year = 2019 AND country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE olympic_marathon (athlete VARCHAR(50), distance INT); INSERT INTO olympic_marathon (athlete, distance) VALUES ('Eliud Kipchoge', 42195), ('Feyisa Lilesa', 42320), ('Galen Rupp', 42200); | What is the average distance each marathoner ran in the Olympics? | SELECT AVG(distance) AS avg_distance FROM olympic_marathon; | gretelai_synthetic_text_to_sql |
CREATE TABLE endangered_species (species_name TEXT, conservation_status TEXT, habitat TEXT); INSERT INTO endangered_species (species_name, conservation_status, habitat) VALUES ('Leopard Seal', 'Vulnerable', 'Antarctic Ocean'), ('Crabeater Seal', 'Near Threatened', 'Antarctic Ocean'), ('Hourglass Dolphin', 'Critically E... | Identify the most endangered species in the Antarctic Ocean | SELECT species_name, conservation_status FROM endangered_species WHERE habitat = 'Antarctic Ocean' ORDER BY conservation_status DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE stops (id INT, name VARCHAR(255), lat DECIMAL(9,6), lon DECIMAL(9,6), city VARCHAR(255)); INSERT INTO stops (id, name, lat, lon, city) VALUES (1, 'Central Station', 40.7128, -74.0060, 'NYC'), (2, 'Times Square', 40.7590, -73.9844, 'NYC'), (3, 'Eiffel Tower', 48.8582, 2.2945, 'Paris'), (4, 'Big Ben', 51.500... | What is the distance from a given stop to every other stop in a city? | SELECT s1.name as Start, s2.name as End, ROUND(ST_Distance_Sphere(POINT(s2.lon, s2.lat), POINT(s1.lon, s1.lat)), 2) as Distance FROM stops s1 JOIN stops s2 ON s1.city = s2.city WHERE s1.id <> s2.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE prison (id INT, name TEXT, security_level TEXT, age INT); INSERT INTO prison (id, name, security_level, age) VALUES (1, 'Jane Smith', 'low_security', 45); | Update the name of the inmate with ID 1 to 'John Doe' in the prison table. | UPDATE prison SET name = 'John Doe' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE grad_students (student_id INT, student_name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); INSERT INTO grad_students (student_id, student_name, gender, department) VALUES (1, 'Alice', 'Female', 'Computer Science'), (2, 'Bob', 'Male', 'Physics'); CREATE TABLE research_grants (grant_id INT, studen... | What is the total research grant amount awarded to female graduate students per department? | SELECT department, SUM(grant_amount) as total_grant_amount FROM research_grants rg JOIN grad_students gs ON rg.student_id = gs.student_id WHERE gs.gender = 'Female' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, region TEXT, donation_amount FLOAT); INSERT INTO donors (id, name, region, donation_amount) VALUES (1, 'John Doe', 'Africa', 500.00), (2, 'Jane Smith', 'Africa', 3000.00); | Delete records of donors who have not donated more than $1000 in the 'africa' region. | DELETE FROM donors WHERE region = 'Africa' AND donation_amount < 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical (chemical_id INT, name TEXT); INSERT INTO chemical (chemical_id, name) VALUES (1, 'ChemicalA'), (2, 'ChemicalB'), (3, 'ChemicalC'); CREATE TABLE emission_log (log_id INT, chemical_id INT, emission_amount INT, emission_date DATE); INSERT INTO emission_log (log_id, chemical_id, emission_amount, emis... | What is the maximum emission level of ChemicalB in 2022? | SELECT MAX(emission_log.emission_amount) FROM emission_log JOIN chemical ON emission_log.chemical_id = chemical.chemical_id WHERE chemical.name = 'ChemicalB' AND YEAR(emission_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers( id INT PRIMARY KEY AUTO_INCREMENT, volunteer_name VARCHAR(255), hours_served INT, volunteer_date DATE) INSERT INTO Volunteers (volunteer_name, hours_served, volunteer_date) VALUES ('Juanita Flores', 12, '2022-01-01') INSERT INTO Volunteers (volunteer_name, hours_served, volunteer_date) VALUES (... | Get the total number of volunteer hours served | SELECT SUM(hours_served) FROM Volunteers | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation (project_id INT, project_name TEXT, allocation DECIMAL(10, 2), year INT); INSERT INTO climate_adaptation (project_id, project_name, allocation, year) VALUES (4, 'Flood Resistance D', 8000000, 2019), (5, 'Drought Resilience E', 9000000, 2019), (6, 'Coastal Protection F', 11000000, 2019); | List all climate adaptation projects and their respective funding allocations for the year 2019. | SELECT project_name, allocation FROM climate_adaptation WHERE year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_apps (app_id INT, app_name VARCHAR(50), category VARCHAR(50), platform VARCHAR(50), launch_date DATE); | Insert a new record into the 'decentralized_apps' table with 'app_id' 1001, 'app_name' 'Balancer', 'category' 'DEX', 'platform' 'Ethereum' and 'launch_date' '2020-02-01' | INSERT INTO decentralized_apps (app_id, app_name, category, platform, launch_date) VALUES (1001, 'Balancer', 'DEX', 'Ethereum', '2020-02-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_articles (id INT, article_id INT, tech_topic TEXT, word_count INT); CREATE VIEW tech_summary AS SELECT a.id, a.title, a.section, a.publish_date, AVG(ta.word_count) as avg_word_count FROM website_articles a JOIN tech_articles ta ON a.id = ta.article_id WHERE a.section = 'technology' GROUP BY a.id; | What is the average word count for articles published in the "technology" section in 2017? | SELECT AVG(avg_word_count) FROM tech_summary WHERE publish_date BETWEEN '2017-01-01' AND '2017-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE user_registrations (registration_date DATE); INSERT INTO user_registrations (registration_date) VALUES ('2021-01-01'), ('2021-01-15'), ('2021-02-10'), ('2021-03-01'), ('2021-04-05'), ('2021-05-12'), ('2021-06-08'), ('2021-07-02'), ('2021-08-04'), ('2021-09-07'), ('2021-10-01'), ('2021-11-05'), ('2021-12-10... | What is the number of users registered in each day of the week? | SELECT EXTRACT(DAY FROM registration_date) AS day, COUNT(*) FROM user_registrations GROUP BY day; | gretelai_synthetic_text_to_sql |
CREATE TABLE crimes_4 (id INT, city VARCHAR(50), district VARCHAR(50), year INT, crime_count INT); INSERT INTO crimes_4 (id, city, district, year, crime_count) VALUES (1, 'CityZ', 'District1', 2019, 42), (2, 'CityZ', 'District1', 2018, 36), (3, 'CityAA', 'District2', 2019, 44); | How many crimes were reported in District1 of CityZ in 2019? | SELECT SUM(crime_count) FROM crimes_4 WHERE city = 'CityZ' AND district = 'District1' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE VIEW sustainable_urbanism AS SELECT properties.id, properties.city, SUM(properties.square_footage) as total_square_footage FROM properties JOIN sustainable_developments ON properties.id = sustainable_developments.id GROUP BY properties.id, properties.city; INSERT INTO properties (id, city, square_footage) VALUES... | What is the sum of the total square footage of properties in the 'sustainable_urbanism' view that are located in the city of 'San Francisco'? | SELECT SUM(total_square_footage) FROM sustainable_urbanism WHERE city = 'San Francisco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects ( ProjectID INT, Name VARCHAR(255), StartDate DATE, EndDate DATE, TotalCost DECIMAL(10, 2)); | List the names and total costs of all projects that started before 2017 and were completed after 2016. | SELECT Name, SUM(TotalCost) as TotalCost FROM Projects WHERE StartDate < '2017-01-01' AND EndDate > '2016-12-31' GROUP BY Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE deliveries (id INT, shipment_id INT, delivered_at TIMESTAMP); INSERT INTO deliveries (id, shipment_id, delivered_at) VALUES (1, 1, '2021-02-01 12:30:00'), (2, 2, '2021-02-28 09:15:00'); CREATE TABLE shipments (id INT, origin VARCHAR(255), destination VARCHAR(255), shipped_at TIMESTAMP); INSERT INTO shipmen... | What was the minimum delivery time for shipments from China to the United States in February 2021? | SELECT MIN(TIMESTAMPDIFF(MINUTE, shipped_at, delivered_at)) FROM deliveries D JOIN shipments S ON D.shipment_id = S.id WHERE S.origin = 'China' AND S.destination = 'United States' AND shipped_at >= '2021-02-01' AND shipped_at < '2021-03-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_data (id INT, name VARCHAR(20), state VARCHAR(2), score INT); INSERT INTO customer_data (id, name, state, score) VALUES (1, 'JohnDoe', 'CA', 75), (2, 'JaneDoe', 'NY', 80), (3, 'MikeSmith', 'TX', 85), (4, 'SaraLee', 'TX', 90); | What is the average financial wellbeing score of customers in 'TX'? | SELECT AVG(score) FROM customer_data WHERE state = 'TX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE algorand_transactions (transaction_id INT, timestamp TIMESTAMP); | What is the total number of transactions on the Algorand network in the past week? | SELECT COUNT(transaction_id) FROM algorand_transactions WHERE timestamp >= NOW() - INTERVAL '1 week'; | gretelai_synthetic_text_to_sql |
CREATE TABLE route_optimization (id INT, route_id INT, delivery_time INT, distance FLOAT); INSERT INTO route_optimization (id, route_id, delivery_time, distance) VALUES [(1, 1001, 120, 50.0), (2, 1002, 90, 40.0), (3, 1003, 150, 60.0), (4, 1004, 180, 70.0), (5, 1005, 80, 30.0), (6, 1006, 130, 55.0), (7, 1007, 110, 45.0)... | What is the average delivery time for each route in the route optimization data? | SELECT route_id, AVG(delivery_time) AS avg_delivery_time FROM route_optimization GROUP BY route_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Routes (route_id INT, departure_port VARCHAR(20), arrival_port VARCHAR(20)); CREATE TABLE VesselTravel (vessel_id INT, route INT, departure_date DATE, travel_time INT); INSERT INTO Routes (route_id, departure_port, arrival_port) VALUES (1, 'Los Angeles', 'Tokyo'), (2, 'Rotterdam', 'New York'), (3, 'Santos'... | How many vessels have traveled between the Port of Mumbai and the Port of Shanghai in the last 6 months? | SELECT COUNT(DISTINCT vessel_id) as num_vessels FROM VesselTravel JOIN Routes ON VesselTravel.route = Routes.route_id WHERE Routes.departure_port = 'Mumbai' AND Routes.arrival_port = 'Shanghai' AND VesselTravel.departure_date >= DATEADD(month, -6, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Race VARCHAR(50)); CREATE TABLE TrainingPrograms (ProgramID INT, ProgramName VARCHAR(50), Completed DATE); CREATE TABLE EmployeeTraining (EmployeeID INT, ProgramID INT); | What is the percentage of employees who have completed harassment prevention training, by race? | SELECT e.Race, COUNT(DISTINCT e.EmployeeID) * 100.0 / (SELECT COUNT(DISTINCT EmployeeID) FROM Employees) AS Percentage FROM Employees e INNER JOIN EmployeeTraining et ON e.EmployeeID = et.EmployeeID INNER JOIN TrainingPrograms tp ON et.ProgramID = tp.ProgramID WHERE tp.ProgramName = 'Harassment Prevention Training' GRO... | gretelai_synthetic_text_to_sql |
CREATE TABLE heritage_sites (id INT, site_name TEXT, location TEXT, budget INT); INSERT INTO heritage_sites (id, site_name, location, budget) VALUES (1, 'Pyramids of Giza', 'Egypt', 1000000), (2, 'Tiwi Islands Sacred Sites', 'Australia', 500000); | What is the total budget for all heritage sites in Africa and how much has been spent on each one? | SELECT SUM(budget), site_name FROM heritage_sites WHERE location LIKE '%%Africa%%' GROUP BY site_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_plans (plan_id INT, plan_name VARCHAR(255), company_name VARCHAR(255), data_limit INT, monthly_cost DECIMAL(10, 2)); | Insert a new mobile plan for the 'Telco Inc.' company. | INSERT INTO mobile_plans (plan_id, plan_name, company_name, data_limit, monthly_cost) VALUES (5, 'Unlimited Data', 'Telco Inc.', 10000, 100.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_projects (project_id INT, project_name TEXT, location TEXT, project_type TEXT, start_year INT); INSERT INTO climate_projects (project_id, project_name, location, project_type, start_year) VALUES (1, 'Communication 1', 'France', 'climate communication', 2013), (2, 'Mitigation 1', 'Germany', 'climate... | List all climate communication projects in Europe that started after 2012. | SELECT * FROM climate_projects WHERE project_type = 'climate communication' AND location LIKE 'Europe%' AND start_year > 2012; | gretelai_synthetic_text_to_sql |
CREATE TABLE operations (name TEXT, description TEXT, year INT); INSERT INTO operations (name, description, year) VALUES ('Operation Desert Storm', 'Military intervention in Iraq.', 1991), ('Operation Enduring Freedom', 'Military intervention in Afghanistan.', 2001), ('Operation Just Cause', 'Military intervention in P... | Delete all intelligence operations in the operations table that were conducted before the year 2000. | DELETE FROM operations WHERE year < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (quarter TEXT, material TEXT, rate DECIMAL(3,2)); INSERT INTO recycling_rates (quarter, material, rate) VALUES ('Q1 2021', 'plastic', 0.30), ('Q1 2021', 'paper', 0.45), ('Q2 2022', 'plastic', 0.31), ('Q2 2022', 'paper', 0.46), ('Q3 2022', 'plastic', 0.32), ('Q3 2022', 'paper', 0.47), ('Q4 2... | Insert a new record for 'Metal' with a recycling rate of 60% in 'recycling_rates' table for Q4 2022. | INSERT INTO recycling_rates (quarter, material, rate) VALUES ('Q4 2022', 'Metal', 0.60); | gretelai_synthetic_text_to_sql |
CREATE TABLE RouteFares (RouteID int, FareType varchar(50)); INSERT INTO RouteFares VALUES (1, 'Standard'); INSERT INTO RouteFares VALUES (1, 'Discounted'); INSERT INTO RouteFares VALUES (2, 'Standard'); INSERT INTO RouteFares VALUES (3, 'Standard'); INSERT INTO RouteFares VALUES (3, 'Discounted'); INSERT INTO RouteFar... | Find the number of routes that offer only one fare type. | SELECT RouteID FROM RouteFares GROUP BY RouteID HAVING COUNT(DISTINCT FareType) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (Id INT, Name VARCHAR(50), Compliance INT); INSERT INTO Vessels (Id, Name, Compliance) VALUES (1, 'Vessel1', 1), (2, 'Vessel2', 0), (3, 'Vessel3', 1), (4, 'Vessel4', 0); | Count the number of vessels with safety records violating regulatory compliance | SELECT COUNT(*) FROM Vessels WHERE Compliance = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_stations (id INT, region VARCHAR(255), num_stations INT, avg_temp FLOAT, year INT); INSERT INTO weather_stations (id, region, num_stations, avg_temp, year) VALUES (1, 'Southeast Asia', 55, 26.3, 2000); | What is the average temperature increase in Southeast Asia from 2000 to 2020, rounded to one decimal place, for regions where the number of weather stations is greater than 50? | SELECT ROUND(AVG(avg_temp), 1) FROM weather_stations WHERE region = 'Southeast Asia' AND num_stations > 50 AND year BETWEEN 2000 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityCommittees (CommitteeID INT PRIMARY KEY, CommitteeName VARCHAR(50), CommitteeDescription VARCHAR(255)); CREATE TABLE CommitteeMembers (MemberID INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50), CommitteeID INT, FOREIGN KEY (CommitteeID) REFERENCES CityCommittees(CommitteeID)); INSERT INTO C... | How many members are on each committee? | SELECT CommitteeName, COUNT(*) AS NumberOfMembers FROM CommitteeMembers JOIN CityCommittees ON CommitteeMembers.CommitteeID = CityCommittees.CommitteeID GROUP BY CommitteeName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Country (Country_ID INT PRIMARY KEY, Country_Name VARCHAR(100)); INSERT INTO Country (Country_ID, Country_Name) VALUES (1, 'Canada'); CREATE TABLE Attraction (Attraction_ID INT PRIMARY KEY, Attraction_Name VARCHAR(100), Country_ID INT, Sustainability_Score INT, FOREIGN KEY (Country_ID) REFERENCES Country(C... | What is the average sustainability score of attractions in Canada? | SELECT AVG(Sustainability_Score) FROM Attraction WHERE Country_ID = (SELECT Country_ID FROM Country WHERE Country_Name = 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE workforce_programs (program_id INT, name TEXT, budget FLOAT); INSERT INTO workforce_programs (program_id, name, budget) VALUES (1, 'Apprenticeship Initiative', 50000.00), (2, 'Skills Training Program', 75000.00), (3, 'Youth Employment Scheme', 120000.00); | List all workforce development programs and their respective budgets, sorted by budget in descending order. | SELECT * FROM workforce_programs ORDER BY budget DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_types (type_id INT, event_id INT, description VARCHAR(50), price DECIMAL(5,2)); INSERT INTO ticket_types VALUES (1, 1, 'VIP', 100); | Increase the price of all VIP tickets for a specific event by 10%. | UPDATE ticket_types tt SET tt.price = tt.price * 1.1 WHERE tt.type_id = 1 AND tt.event_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_transportation (union_id INT, union_name TEXT, industry TEXT, members INT); INSERT INTO union_transportation (union_id, union_name, industry, members) VALUES (1, 'Union S', 'Transportation', 8000), (2, 'Union T', 'Transportation', 12000), (3, 'Union U', 'Aerospace', 9000); | What is the minimum and maximum number of members in unions in the transportation industry? | SELECT MIN(members), MAX(members) FROM union_transportation WHERE industry = 'Transportation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE factory (id INT, name VARCHAR(255), location VARCHAR(255), capacity INT, renewable_energy BOOLEAN); INSERT INTO factory (id, name, location, capacity, renewable_energy) VALUES (1, 'Factory A', 'Los Angeles', 1000, TRUE); INSERT INTO factory (id, name, location, capacity, renewable_energy) VALUES (2, 'Facto... | What is the total capacity of factories located in Texas? | SELECT SUM(capacity) FROM factory WHERE location = 'Houston'; | gretelai_synthetic_text_to_sql |
CREATE TABLE oakland_crimes (id INT, crime_date DATE, crime_type VARCHAR(20)); INSERT INTO oakland_crimes (id, crime_date, crime_type) VALUES (1, '2022-02-01', 'Theft'), (2, '2022-02-15', 'Vandalism'); | How many crimes were reported in Oakland in the last month? | SELECT COUNT(*) FROM oakland_crimes WHERE crime_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE flu_cases (id INT, country VARCHAR(255), case_number INT); | Insert a new record into the flu_cases table with a case number of 7007 from the country of Nigeria. | INSERT INTO flu_cases (id, country, case_number) VALUES (7, 'Nigeria', 7007); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics; CREATE TABLE if not exists genetics.projects( project_id INT PRIMARY KEY, name VARCHAR(100), technology VARCHAR(50)); CREATE TABLE if not exists genetics.biosensors( biosensor_id INT PRIMARY KEY, project_id INT, name VARCHAR(100), FOREIGN KEY (project_id) REFERENCES genetics.projec... | Which genetic research projects are using biosensor technology? | SELECT p.name FROM genetics.projects p JOIN genetics.biosensors b ON p.project_id = b.project_id WHERE p.technology = 'biosensor'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_sales (id INT, vehicle_type VARCHAR(20), avg_speed FLOAT, sales INT); INSERT INTO vehicle_sales (id, vehicle_type, avg_speed, sales) VALUES (1, 'Tesla Model 3', 80.0, 50000), (2, 'Nissan Leaf', 70.0, 40000), (3, 'Chevrolet Bolt', 75.0, 30000); | What is the maximum speed of electric vehicles in 'vehicle_sales' table? | SELECT MAX(avg_speed) FROM vehicle_sales WHERE vehicle_type LIKE '%electric%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLOAT); INSERT INTO wind_farms (id, name, region, capacity, efficiency) VALUES (1, 'Windfarm B', 'East', 140.5, 0.32); CREATE TABLE solar_farms (id INT, name VARCHAR(50), region VARCHAR(50), capacity FLOAT, efficiency FLOA... | What is the combined capacity of all renewable energy farms (wind and solar) in the 'East' region as of 2022-02-15? | SELECT SUM(capacity) AS total_capacity FROM wind_farms WHERE region = 'East' UNION SELECT SUM(capacity) AS total_capacity FROM solar_farms WHERE region = 'East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryArtistConcerts (Country VARCHAR(50), Artist VARCHAR(50), ConcertID INT); INSERT INTO CountryArtistConcerts (Country, Artist, ConcertID) VALUES ('USA', 'Taylor Swift', 1); INSERT INTO CountryArtistConcerts (Country, Artist, ConcertID) VALUES ('USA', 'BTS', 2); INSERT INTO CountryArtistConcerts ... | Display the number of concerts by country and artist. | SELECT Country, Artist, COUNT(DISTINCT ConcertID) AS ConcertCount FROM CountryArtistConcerts GROUP BY Country, Artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_share (drug_name VARCHAR(50), year INT, region VARCHAR(50), market_share FLOAT); INSERT INTO market_share (drug_name, year, region, market_share) VALUES ('DrugX', 2020, 'North', 0.3), ('DrugX', 2020, 'South', 0.25), ('DrugX', 2020, 'East', 0.35), ('DrugY', 2020, 'North', 0.4), ('DrugY', 2020, 'South... | What was the market share of a specific drug, 'DrugY', in a specific region, 'North', in the year 2020? | SELECT market_share as drug_market_share FROM market_share WHERE drug_name = 'DrugY' AND region = 'North' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (id INT PRIMARY KEY, project_name VARCHAR(255), project_location VARCHAR(255), project_type VARCHAR(255), capacity_mw FLOAT); CREATE VIEW canada_projects AS SELECT * FROM renewable_projects WHERE project_location = 'Canada'; | Find the average capacity of renewable energy projects in Canada. | SELECT AVG(capacity_mw) FROM canada_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_safety_papers (year INT, paper_title VARCHAR(255), author_name VARCHAR(255)); INSERT INTO ai_safety_papers (year, paper_title, author_name) VALUES ('2018', 'SafeAI: A Framework for Safe Artificial Intelligence', 'John Doe'); | Update the title of all AI safety research papers with 'SafeAI' in the title. | UPDATE ai_safety_papers SET paper_title = REPLACE(paper_title, 'SafeAI', 'Safe and Trustworthy AI') WHERE paper_title LIKE '%SafeAI%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Grants (ID INT, Category VARCHAR(50), Amount FLOAT, Year INT); INSERT INTO Grants (ID, Category, Amount, Year) VALUES (1, 'Machine Learning', 700000, 2021), (2, 'AI', 500000, 2020); | What is the total funding received by research grants in the 'Machine Learning' category in 2021? | SELECT SUM(Amount) FROM Grants WHERE Category = 'Machine Learning' AND Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE ConcertTickets (ticket_id INT, genre VARCHAR(20), price DECIMAL(5,2)); | Find the maximum ticket price for country concerts. | SELECT MAX(price) FROM ConcertTickets WHERE genre = 'country'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DisasterPreparedness (id INT, state VARCHAR(20), year INT, training_count INT); | What is the maximum number of disaster preparedness trainings held in the state of Florida in a single year? | SELECT MAX(training_count) FROM DisasterPreparedness WHERE state = 'Florida' GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (vessel_id INT, vessel_name VARCHAR(50), status VARCHAR(50)); CREATE TABLE vessel_movements (movement_id INT, vessel_id INT, port_id INT, movement_date DATE); CREATE TABLE ports (port_id INT, port_name VARCHAR(50), country VARCHAR(50)); | Which vessels were at the Port of Hamburg in the last week? | SELECT V.vessel_name FROM vessel_movements VM JOIN vessels V ON VM.vessel_id = V.vessel_id JOIN ports P ON VM.port_id = P.port_id WHERE P.port_name = 'Port of Hamburg' AND VM.movement_date >= CURDATE() - INTERVAL 7 DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_rights_advocacy (advocacy_id INT, advocacy_type VARCHAR(10), year INT); INSERT INTO labor_rights_advocacy (advocacy_id, advocacy_type, year) VALUES (1, 'lobbying', 2021); INSERT INTO labor_rights_advocacy (advocacy_id, advocacy_type, year) VALUES (2, 'protest', 2022); INSERT INTO labor_rights_advocac... | Update records in the "labor_rights_advocacy" table by setting the "advocacy_type" column to "strike" for the row where the "advocacy_id" is 3 | UPDATE labor_rights_advocacy SET advocacy_type = 'strike' WHERE advocacy_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature_data (temperature FLOAT, time DATETIME, region VARCHAR(20)); INSERT INTO temperature_data (temperature, time, region) VALUES (35.2, '2022-06-01 12:00:00', 'Southwest Africa'); | What is the maximum temperature in 'Southwest' Africa in the last week, along with the time it occurred? | SELECT MAX(temperature) as max_temp, time FROM temperature_data WHERE region = 'Southwest Africa' AND time >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK) GROUP BY time LIMIT 1 | gretelai_synthetic_text_to_sql |
CREATE TABLE satellite_launches (country VARCHAR(30), launch_year INT, satellites INT); INSERT INTO satellite_launches VALUES ('USA', 1958, 1), ('USSR', 1957, 1), ('USA', 1959, 3), ('USSR', 1960, 4), ('USA', 1961, 4), ('USSR', 1962, 3); | How many satellites were launched by each country in the satellite_launches table? | SELECT country, COUNT(satellites) OVER (PARTITION BY country) FROM satellite_launches; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accessories (id INT, name VARCHAR(255), material VARCHAR(255), quantity INT, country VARCHAR(255)); INSERT INTO Accessories (id, name, material, quantity, country) VALUES (1, 'Bag', 'Recycled Nylon', 1000, 'Italy'); INSERT INTO Accessories (id, name, material, quantity, country) VALUES (2, 'Belt', 'Recycle... | What is the total quantity of recycled materials used in accessories production in Italy? | SELECT SUM(quantity) FROM Accessories WHERE country = 'Italy' AND material LIKE '%Recycled%' | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, founder TEXT, industry TEXT, funding FLOAT); INSERT INTO company (id, name, founder, industry, funding) VALUES (1, 'Acme Inc', 'Minority', 'Tech', 2000000); | What is the minimum funding amount for companies founded by minorities, in each industry category? | SELECT industry, MIN(funding) FROM company WHERE founder LIKE '%Minority%' GROUP BY industry; | 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.