context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE companies (id INT, name TEXT, sector TEXT, ESG_rating FLOAT); INSERT INTO companies (id, name, sector, ESG_rating) VALUES (1, 'JPMorgan Chase', 'Financial', 7.4), (2, 'Visa', 'Financial', 8.1), (3, 'BlackRock', 'Financial', 8.0), (4, 'Bank of America', 'Financial', 7.2), (5, 'Wells Fargo', 'Financial', 7.1... | List the companies with the lowest ESG ratings in the financial sector. | SELECT * FROM companies WHERE sector = 'Financial' ORDER BY ESG_rating ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE organization_info (name VARCHAR(50), focus VARCHAR(30), location VARCHAR(30)); INSERT INTO organization_info (name, focus, location) VALUES ('Green Earth', 'Environment', 'California'); | What is the total donation amount for non-profit organizations focused on 'Environment' in 'California'? | SELECT SUM(donation_amount) FROM donations JOIN organization_info ON donations.org_id = organization_info.id WHERE organization_info.focus = 'Environment' AND organization_info.location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ChemicalSubstances (SubstanceID INT, SubstanceName VARCHAR(50), AdditionDate DATE); INSERT INTO ChemicalSubstances (SubstanceID, SubstanceName, AdditionDate) VALUES (1, 'Ethylene', '2021-01-02'), (2, 'Propylene', '2021-03-14'), (3, 'Benzenene', '2020-11-09'); | How many new chemical substances have been added to the database in the past 6 months? | SELECT COUNT(*) FROM ChemicalSubstances WHERE AdditionDate >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing_machines (id INT, region VARCHAR(255), number_of_machines INT); INSERT INTO manufacturing_machines (id, region, number_of_machines) VALUES (1, 'North', 2000), (2, 'South', 3000), (3, 'East', 1500), (4, 'West', 2500); | What is the minimum number of machines in the manufacturing industry for each region? | SELECT region, MIN(number_of_machines) FROM manufacturing_machines GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development_projects (id INT, name VARCHAR(100), region VARCHAR(50), status VARCHAR(20)); INSERT INTO community_development_projects (id, name, region, status) VALUES (1, 'Project A', 'South America', 'Completed'), (2, 'Project B', 'North America', 'In Progress'), (3, 'Project C', 'South America'... | How many community development projects were successfully completed in South America? | SELECT COUNT(*) FROM community_development_projects WHERE region = 'South America' AND status = 'Completed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_program (id INT PRIMARY KEY, animal_name VARCHAR, num_animals INT); | How many animals are in the 'conservation_program' table? | SELECT SUM(num_animals) FROM conservation_program; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_oil_production (platform_id INT, production_month DATE, oil_production FLOAT); INSERT INTO monthly_oil_production (platform_id, production_month, oil_production) VALUES (1, '2020-01-01', 500), (1, '2020-02-01', 600), (1, '2020-03-01', 700), (2, '2020-01-01', 800), (2, '2020-02-01', 900), (2, '2020-... | Determine the monthly oil production for all platforms in Q1 2020 | SELECT platform_id, EXTRACT(MONTH FROM production_month) AS month, SUM(oil_production) FROM monthly_oil_production WHERE YEAR(production_month) = 2020 GROUP BY platform_id, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_taxis (taxi_id INT, trip_id INT, trip_start_time TIMESTAMP, trip_end_time TIMESTAMP, start_latitude DECIMAL(9,6), start_longitude DECIMAL(9,6), end_latitude DECIMAL(9,6), end_longitude DECIMAL(9,6), distance DECIMAL(10,2)); | What is the minimum distance traveled by an autonomous taxi in Mexico City? | SELECT MIN(distance) FROM autonomous_taxis WHERE start_longitude BETWEEN -99.3 AND -98.9 AND start_latitude BETWEEN 19.1 AND 19.7; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (id INT, name VARCHAR(50), city VARCHAR(50), state VARCHAR(50), country VARCHAR(50), type VARCHAR(10), donation_amount DECIMAL(10, 2)); | What is the total number of donors and total number of unique organizations donated to, in the 'Donors' and 'Organizations' tables? | SELECT COUNT(DISTINCT Donors.id) as total_donors, COUNT(DISTINCT Donations.organization_id) as unique_orgs_donated FROM Donors, Donations; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_categories (category_id INT, category TEXT); INSERT INTO menu_categories (category_id, category) VALUES (1, 'appetizers'), (2, 'entrees'), (3, 'desserts'); | Delete the 'appetizers' category | DELETE FROM menu_categories WHERE category = 'appetizers'; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name TEXT, target TEXT, start_date DATETIME, end_date DATETIME, revenue INT); INSERT INTO campaigns (id, name, target, start_date, end_date, revenue) VALUES (1, 'Clean Energy', 'renewable energy', '2021-07-01 00:00:00', '2021-09-30 23:59:59', 5000); | What is the total advertising revenue generated from campaigns targeting users interested in "renewable energy" in Q3 2021? | SELECT SUM(revenue) FROM campaigns WHERE target = 'renewable energy' AND start_date BETWEEN '2021-07-01 00:00:00' AND '2021-09-30 23:59:59'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, name VARCHAR(255), major VARCHAR(255), gpa DECIMAL(3,2)); | Create a view named "top_students" that contains only students with a GPA greater than or equal to 3.5 from the "students" table. | CREATE VIEW top_students AS SELECT * FROM students WHERE gpa >= 3.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE FishGrowth (SiteID INT, Species VARCHAR(255), DailyGrowthRate FLOAT, Region VARCHAR(255)); INSERT INTO FishGrowth (SiteID, Species, DailyGrowthRate, Region) VALUES (1, 'Tilapia', 0.02, 'Americas'), (2, 'Salmon', 0.03, 'Americas'), (3, 'Tilapia', 0.015, 'Asia-Pacific'), (4, 'Salmon', 0.008, 'Europe'); | Which species of fish has the lowest daily growth rate in the European region? | SELECT Species, MIN(DailyGrowthRate) as MinDailyGrowthRate FROM FishGrowth WHERE Region = 'Europe' GROUP BY Species ORDER BY MinDailyGrowthRate; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (city_name VARCHAR(255), population INT, state_abbreviation VARCHAR(255)); INSERT INTO cities (city_name, population, state_abbreviation) VALUES ('CityD', 700000, 'CA'), ('CityE', 1200000, 'CA'), ('CityF', 600000, 'CA'); CREATE TABLE schools (school_name VARCHAR(255), city_name VARCHAR(255), annual_... | What is the average annual budget for schools in cities with populations between 500,000 and 1,000,000? | SELECT AVG(annual_budget) FROM schools WHERE city_name IN (SELECT city_name FROM cities WHERE population BETWEEN 500000 AND 1000000); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammals (id INT, name VARCHAR(255), biomass FLOAT, location VARCHAR(255)); | What is the total biomass of all marine mammals in the Antarctic? | SELECT SUM(biomass) FROM marine_mammals WHERE location = 'Antarctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID int, Name varchar(50), Specialty varchar(50)); INSERT INTO Attorneys (AttorneyID, Name, Specialty) VALUES (4, 'Sophia Lee', 'Immigration'); CREATE TABLE Billing (CaseID int, AttorneyID int, HoursFraction decimal(3,2)); INSERT INTO Billing (CaseID, AttorneyID, HoursFraction) VALUES (60... | Which attorneys have billed the least for cases in the 'immigration' category? | SELECT A.Name, MIN(B.HoursFraction) as LeastHoursBilled FROM Attorneys A INNER JOIN Billing B ON A.AttorneyID = B.AttorneyID INNER JOIN Cases CA ON B.CaseID = CA.CaseID WHERE A.Specialty = 'Immigration' GROUP BY A.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (tx_id INT, rf_id INT, transaction_volume DECIMAL(10,2), transaction_date DATE); CREATE TABLE regulatory_frameworks (rf_id INT, name VARCHAR(255)); | What is the total transaction volume for each regulatory framework in the last 30 days? | SELECT rf_id, name, SUM(transaction_volume) OVER (PARTITION BY rf_id) as total_transaction_volume FROM transactions t JOIN regulatory_frameworks rf ON t.rf_id = rf.rf_id WHERE transaction_date >= DATEADD(day, -30, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (show_id INT PRIMARY KEY, name VARCHAR(255), country VARCHAR(2), viewers INT); INSERT INTO tv_shows (show_id, name, country, viewers) VALUES (1, 'Stranger Things', 'Canada', 1200000), (2, 'The Crown', 'Canada', 950000), (3, 'The Mandalorian', 'Canada', 800000); | Which TV shows have the highest viewership from Canada? | SELECT * FROM tv_shows WHERE country = 'Canada' ORDER BY viewers DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicles (VehicleID INT, VehicleType VARCHAR(50), YearAdded INT); INSERT INTO Vehicles (VehicleID, VehicleType, YearAdded) VALUES (1, 'Bus', 2021), (2, 'Tram', 2020), (3, 'Train', 2019), (4, 'Bus', 2022); | How many vehicles were added to the fleet each year? | SELECT YearAdded, COUNT(*) as VehiclesAdded FROM Vehicles GROUP BY YearAdded; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (operation_id INT, name VARCHAR(50)); INSERT INTO mining_operations (operation_id, name) VALUES (1, 'Operation C'); INSERT INTO mining_operations (operation_id, name) VALUES (2, 'Operation D'); CREATE TABLE water_consumption (operation_id INT, water_consumption INT); INSERT INTO water_con... | Find the total water consumption by mining operation and the percentage of total water consumption for each operation in the 'mining_operations' and 'water_consumption' tables, ordered by water consumption percentage. | SELECT mining_operations.name, ROUND(water_consumption.water_consumption * 100.0 / (SELECT SUM(water_consumption) FROM water_consumption), 2) AS water_consumption_percentage FROM mining_operations INNER JOIN water_consumption ON mining_operations.operation_id = water_consumption.operation_id ORDER BY water_consumption_... | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, name VARCHAR(50), location VARCHAR(50)); CREATE TABLE volunteers (id INT, name VARCHAR(50), program_id INT); INSERT INTO programs (id, name, location) VALUES (1, 'Education', 'Caribbean'), (2, 'Environment', 'Caribbean'), (3, 'Arts', 'Caribbean'); INSERT INTO volunteers (id, name, program... | How many volunteers are needed for each program in the Caribbean region? | SELECT p.name, COUNT(v.id) FROM programs p INNER JOIN volunteers v ON p.id = v.program_id WHERE p.location = 'Caribbean' GROUP BY p.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE extraction_monthly (mine_id INT, extraction_month TEXT, mineral TEXT, quantity INT); INSERT INTO extraction_monthly (mine_id, extraction_month, mineral, quantity) VALUES (1, 'January', 'Gold', 50), (1, 'January', 'Silver', 75), (1, 'February', 'Gold', 55), (1, 'February', 'Silver', 80), (2, 'January', 'Gol... | What is the total quantity of minerals extracted per month? | SELECT extraction_month, SUM(quantity) FROM extraction_monthly GROUP BY extraction_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE SafetyTests (Vehicle VARCHAR(50), Year INT); INSERT INTO SafetyTests (Vehicle, Year) VALUES ('Corvette', 2018), ('Corvette', 2019), ('Corvette', 2020), ('Corvette', 2021), ('Corvette', 2022), ('Mustang', 2018), ('Mustang', 2019), ('Mustang', 2020), ('Mustang', 2021), ('Mustang', 2022), ('Camaro', 2018), ('... | How many safety tests were conducted on sports cars in the last 5 years? | SELECT COUNT(*) FROM SafetyTests WHERE Vehicle LIKE '%Corvette%' OR Vehicle LIKE '%Mustang%' OR Vehicle LIKE '%Camaro%' AND Year >= YEAR(CURRENT_DATE) - 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Country TEXT, Continent TEXT, JoinYear INT); INSERT INTO Volunteers (VolunteerID, VolunteerName, Country, Continent, JoinYear) VALUES (1, 'Alex', 'Morocco', 'Africa', 2019), (2, 'Bella', 'Argentina', 'South America', 2020), (3, 'Charlie', 'Indonesia', 'Asia'... | List the number of volunteers who joined each year for each continent. | SELECT Continent, JoinYear, COUNT(*) FROM Volunteers GROUP BY Continent, JoinYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE tracks (id INT, title VARCHAR(255), artist VARCHAR(255), genre VARCHAR(255)); CREATE TABLE streams (id INT, track_id INT, user_id INT, region VARCHAR(255), genre VARCHAR(255), revenue DECIMAL(10,2), timestamp TIMESTAMP); | Insert new records for streams of a new album by 'Artist Name' in the genre of rock in the United States. The album has 10 tracks, and each track was streamed once with a revenue of $0.99. | INSERT INTO tracks (id, title, artist, genre) SELECT NULL, CONCAT('Track ', ROW_NUMBER() OVER (ORDER BY (SELECT NULL))), 'Artist Name', 'rock' FROM UNNEST(GENERATE_ARRAY(1, 10)) AS x; INSERT INTO streams (id, track_id, user_id, region, genre, revenue, timestamp) SELECT NULL, id, 12345, 'United States', genre, 0.99, TIM... | gretelai_synthetic_text_to_sql |
CREATE TABLE pacific_farms (id INT, farm_name TEXT, region TEXT, water_temperature DECIMAL(5,2)); INSERT INTO pacific_farms (id, farm_name, region, water_temperature) VALUES (1, 'FarmA', 'Pacific', 12.5), (2, 'FarmB', 'Pacific', 13.2), (3, 'FarmC', 'Atlantic', 16.0); | What is the average water temperature in the Pacific region for salmon farms? | SELECT AVG(water_temperature) FROM pacific_farms WHERE region = 'Pacific' AND water_temperature IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_supplies (id INT PRIMARY KEY, region_id INT, medical_supplies INT, delivery_date DATE); INSERT INTO medical_supplies (id, region_id, medical_supplies, delivery_date) VALUES (1, 1, 1000, '2022-01-04'); INSERT INTO medical_supplies (id, region_id, medical_supplies, delivery_date) VALUES (2, 3, 2000, ... | What is the total number of medical supplies delivered to region_id 3 in the medical_supplies table, excluding the records with delivery dates before '2022-01-05'? | SELECT SUM(medical_supplies) FROM medical_supplies WHERE region_id = 3 AND delivery_date >= '2022-01-05'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_specs (make VARCHAR(50), model VARCHAR(50), year INT, horsepower INT); | What is the minimum horsepower for electric vehicles in the 'vehicle_specs' table? | SELECT MIN(horsepower) FROM vehicle_specs WHERE make = 'Tesla' AND horsepower IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Labor_Violations (violation_id INT, violation_date DATE, region TEXT, violation_type TEXT); | What is the number of ethical labor violations in the last year in the Asian region? | SELECT COUNT(*) FROM Labor_Violations WHERE violation_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND CURRENT_DATE AND region = 'Asian Region' AND violation_type = 'Ethical Labor Violation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ports (port_id INT, port_name VARCHAR(20)); INSERT INTO ports VALUES (1, 'Seattle'), (2, 'Tokyo'); CREATE TABLE cargo (cargo_id INT, port_id INT, container_weight FLOAT, handling_date DATE); INSERT INTO cargo VALUES (1, 1, 2000.5, '2022-01-01'), (2, 1, 3000.2, '2022-01-02'), (3, 2, 1500.3, '2022-01-03'), (... | How many containers were handled per day in 'Tokyo' port? | SELECT handling_date, COUNT(*) FROM cargo WHERE port_id = (SELECT port_id FROM ports WHERE port_name = 'Tokyo') GROUP BY handling_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_wellbeing (id INT, individual_id INT, score INT, country VARCHAR(255)); INSERT INTO financial_wellbeing (id, individual_id, score, country) VALUES (1, 4001, 60, 'Indonesia'), (2, 4002, 75, 'Indonesia'), (3, 4003, 80, 'Indonesia'); | What is the minimum financial wellbeing score for individuals in Indonesia? | SELECT MIN(score) FROM financial_wellbeing WHERE country = 'Indonesia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT, name VARCHAR(255), sustainable_material_orders INT); INSERT INTO suppliers (id, name, sustainable_material_orders) VALUES (1, 'GreenSupplies', 200), (2, 'EcoSource', 150), (3, 'SustainableGoods', 300), (4, 'FairTradeWarehouse', 100), (5, 'ResponsibleResources', 250); | Who are the top 5 suppliers with the most sustainable material orders? | SELECT name, sustainable_material_orders FROM suppliers ORDER BY sustainable_material_orders DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels(id INT, name TEXT, speed FLOAT, timestamp TIMESTAMP); INSERT INTO vessels VALUES (1, 'VesselA', 20.5, '2022-04-01 10:00:00'), (6, 'VesselF', 18.3, '2022-04-02 15:30:00'); | What is the average speed of VesselF in the last month? | SELECT AVG(speed) FROM vessels WHERE name = 'VesselF' AND timestamp BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE eu_countries (country VARCHAR(255), carbon_price FLOAT); INSERT INTO eu_countries (country, carbon_price) VALUES ('Germany', 25.3), ('France', 30.1), ('Italy', 18.9), ('Spain', 22.7); | Show the carbon pricing for each country in the EU | SELECT country, carbon_price FROM eu_countries; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, sector VARCHAR(20), date DATE); INSERT INTO investments (id, sector, date) VALUES (1, 'Renewable Energy', '2018-01-01'), (2, 'Finance', '2016-01-01'), (3, 'Renewable Energy', '2017-01-01'); | Identify the number of investments made in the renewable energy sector since 2015. | SELECT COUNT(*) FROM investments WHERE sector = 'Renewable Energy' AND date >= '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE garments (garment_type VARCHAR(50), size VARCHAR(10), color VARCHAR(20)); INSERT INTO garments (garment_type, size, color) VALUES ('Dress', 'S', 'Red'), ('Shirt', 'M', 'Blue'), ('Pants', 'L', 'Black'); | Delete all records for garments that are not dresses? | DELETE FROM garments WHERE garment_type != 'Dress'; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_id INT, species_name VARCHAR(100), conservation_status VARCHAR(50), max_depth FLOAT, order_name VARCHAR(50)); | List all marine species that are threatened or endangered and have been recorded at a depth greater than 2000 meters. | SELECT species_name FROM marine_species WHERE conservation_status IN ('Threatened', 'Endangered') AND max_depth > 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), type VARCHAR(50), start_date DATE, end_date DATE); | Create a table named 'rural_infrastructure' | CREATE TABLE rural_infrastructure (id INT PRIMARY KEY, name VARCHAR(100), location VARCHAR(50), type VARCHAR(50), start_date DATE, end_date DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE sourcing (id INT, fabric_type TEXT, quantity INT, country TEXT, sourcing_date DATE); INSERT INTO sourcing (id, fabric_type, quantity, country, sourcing_date) VALUES (1, 'organic cotton', 500, 'India', '2021-06-01'), (2, 'recycled polyester', 300, 'China', '2021-07-15'), (3, 'hemp', 700, 'India', '2021-08-0... | What is the average quantity of sustainable fabric sourced from India in the past year? | SELECT AVG(quantity) FROM sourcing WHERE fabric_type = 'sustainable fabric' AND country = 'India' AND sourcing_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE Claims_Global (id INT, country VARCHAR(20), amount FLOAT); INSERT INTO Claims_Global (id, country, amount) VALUES (1, 'USA', 5000), (2, 'Canada', 4000), (3, 'Mexico', 6000), (4, 'Brazil', 7000); | What is the average claim amount in each country? | SELECT country, AVG(amount) as avg_claim_amount FROM Claims_Global GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_projects (id INT, project_name TEXT, duration INT, state TEXT, sustainable BOOLEAN); INSERT INTO sustainable_projects (id, project_name, duration, state, sustainable) VALUES (1, 'GreenVille', 120, 'Oregon', true), (2, 'Eco-Town', 180, 'Texas', true); | What is the maximum project duration for sustainable building projects in 'Oregon'? | SELECT MAX(duration) FROM sustainable_projects WHERE state = 'Oregon' AND sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE marinefarms (country VARCHAR(20), uses_ras BOOLEAN); INSERT INTO marinefarms (country, uses_ras) VALUES ('Indonesia', true), ('Indonesia', false), ('Philippines', true); | How many marine fish farms in Indonesia use recirculating aquaculture systems (RAS)? | SELECT COUNT(*) FROM marinefarms WHERE country = 'Indonesia' AND uses_ras = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors (vendor_id INT, name TEXT, sustainable_materials_percentage DECIMAL(3,2)); INSERT INTO vendors (vendor_id, name, sustainable_materials_percentage) VALUES (1, 'Vendor A', 0.75), (2, 'Vendor B', 0.85), (3, 'Vendor C', 0.65); | Which vendors have the highest percentage of sustainable materials? | SELECT name, sustainable_materials_percentage FROM vendors ORDER BY sustainable_materials_percentage DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(255)); INSERT INTO regions (id, name) VALUES (1, 'Northeast'), (2, 'Southeast'), (3, 'Midwest'), (4, 'South'), (5, 'West'); CREATE TABLE support_programs (id INT, region_id INT, name VARCHAR(255), type VARCHAR(255)); INSERT INTO support_programs (id, region_id, name, type) VAL... | What is the total number of disability support programs offered by each region? | SELECT regions.name AS region, COUNT(support_programs.id) AS total_programs FROM regions LEFT JOIN support_programs ON regions.id = support_programs.region_id GROUP BY regions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccination_centers (id INT, name VARCHAR(50), location VARCHAR(50)); INSERT INTO vaccination_centers (id, name, location) VALUES (1, 'Vaccination Center A', 'City A'); INSERT INTO vaccination_centers (id, name, location) VALUES (2, 'Vaccination Center B', 'City B'); CREATE TABLE testing_sites (id INT, nam... | What is the total number of vaccination centers and testing sites in the public health database? | SELECT COUNT(*) FROM vaccination_centers UNION SELECT COUNT(*) FROM testing_sites; | gretelai_synthetic_text_to_sql |
CREATE TABLE LegalAidRequests (Category TEXT, Request INT, Cost FLOAT); INSERT INTO LegalAidRequests (Category, Request, Cost) VALUES ('Domestic Violence', 500, 25000), ('Public Defender', 300, 15000), ('Immigration', 200, 10000), ('Housing', 150, 7500), ('Debt', 100, 5000); | Get the top 3 legal aid request categories by total requests and total costs | SELECT Category, SUM(Request) AS TotalRequests, SUM(Cost) AS TotalCosts FROM LegalAidRequests GROUP BY Category ORDER BY TotalRequests DESC, TotalCosts DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE species_introductions (id INT, species VARCHAR(255), date DATE); INSERT INTO species_introductions (id, species, date) VALUES (1, 'Trout', '2018-01-01'), (2, 'Catfish', '2019-05-15'), (3, 'Bass', '2020-12-31'), (4, 'Perch', '2021-03-14'); | Find the total number of aquatic species that have been introduced to a new habitat in the last 5 years. | SELECT COUNT(*) FROM species_introductions WHERE date >= DATE_SUB(CURDATE(), INTERVAL 5 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows(id INT PRIMARY KEY, name VARCHAR(255), rating INT); | get tv shows with rating greater than 7 in the tv_shows table | SELECT name FROM tv_shows WHERE rating > 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (subscriber_id INT, name VARCHAR(50), data_usage FLOAT); | Update the 'data_usage' value to 40 for the record with 'subscriber_id' 10 in the 'subscribers' table. | UPDATE subscribers SET data_usage = 40 WHERE subscriber_id = 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE machines (machine_id INT, last_inspection DATE); INSERT INTO machines VALUES (1, '2022-01-01'), (2, '2022-02-15'), (3, '2022-03-05'), (4, '2022-04-10'), (5, '2022-05-02'); | Identify any machines in the manufacturing process that have not been inspected in the past month. | SELECT machine_id FROM machines WHERE last_inspection < DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20), Gender VARCHAR(20), IdentifiesAsWomenOfColor BOOLEAN, Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, Department, Gender, IdentifiesAsWomenOfColor, Salary) VALUES (1, 'Engineering', 'Female', true, 80000.00), (2, 'Finance', 'Male', false, 90000.0... | What is the minimum salary for employees in the Engineering department who identify as women of color? | SELECT MIN(Salary) FROM Employees WHERE Department = 'Engineering' AND IdentifiesAsWomenOfColor = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, founding_year INT, diversity_score INT); INSERT INTO company (id, name, industry, founding_year, diversity_score) VALUES (1, 'InnoTech', 'Tech', 2018, 80); INSERT INTO company (id, name, industry, founding_year, diversity_score) VALUES (2, 'GreenEnergy', 'Energy',... | What is the average diversity score of startups that have received funding in the last 3 years, grouped by industry? | SELECT industry, AVG(diversity_score) FROM company INNER JOIN funding ON company.id = funding.company_id WHERE funding.funding_date >= DATEADD(year, -3, GETDATE()) GROUP BY industry; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, Program TEXT); INSERT INTO Volunteers (VolunteerID, VolunteerName, Program) VALUES (1, 'John Doe', 'Feeding Program'), (2, 'Jane Smith', 'Education Program'), (3, 'Bob Johnson', 'Feeding Program'), (4, 'Alice Davis', 'Education Program'), (5, 'Charlie Brown'... | List the volunteers who have volunteered for more than one program, in alphabetical order by volunteer name. | SELECT VolunteerName, Program FROM (SELECT VolunteerName, Program, COUNT(*) OVER (PARTITION BY VolunteerName) AS CountVolunteer FROM Volunteers) AS SubQuery WHERE CountVolunteer > 1 ORDER BY VolunteerName; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (project_id INT, project_name TEXT, location TEXT); CREATE TABLE carbon_offsets (project_id INT, initiative_name TEXT, location TEXT); INSERT INTO renewable_energy (project_id, project_name, location) VALUES (1, 'Solar Field One', 'Europe'), (2, 'Wind Farm Two', 'North America'); INSERT IN... | Which renewable energy projects in Europe do not have any associated carbon offset initiatives? | SELECT project_name FROM renewable_energy WHERE project_id NOT IN (SELECT project_id FROM carbon_offsets WHERE renewable_energy.location = carbon_offsets.location); | gretelai_synthetic_text_to_sql |
CREATE TABLE Schools (name VARCHAR(50), state VARCHAR(20), rating INT); INSERT INTO Schools (name, state, rating) VALUES ('SchoolA', 'California', 8), ('SchoolB', 'California', 7), ('SchoolC', 'Texas', 9); | Find the number of public schools in the state of California and Texas, excluding any schools with a rating below 7. | SELECT COUNT(*) FROM Schools WHERE state IN ('California', 'Texas') AND rating >= 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE gym_members(member_id INT, name VARCHAR(50), start_date DATE, end_date DATE); INSERT INTO gym_members(member_id, name, start_date, end_date) VALUES (1, 'John Doe', '2021-01-01', '2022-12-31'); INSERT INTO gym_members(member_id, name, start_date, end_date) VALUES (2, 'Jane Smith', '2021-05-15', '2023-05-14'... | Which members have a gym membership and a yoga membership? | SELECT gm.member_id, gm.name FROM gym_members gm INNER JOIN yoga_members ym ON gm.member_id = ym.member_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue (initiative_id INT, city TEXT, country TEXT, revenue FLOAT); INSERT INTO revenue (initiative_id, city, country, revenue) VALUES (5, 'Tokyo Sustainable Tour', 'Tokyo', 500000); | What is the total revenue generated by sustainable tourism initiatives in Tokyo? | SELECT SUM(revenue) FROM revenue WHERE city = 'Tokyo' AND country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, genre VARCHAR(50), player_count INT, revenue DECIMAL(10, 2)); INSERT INTO games VALUES (1, 'Action', 10000, 50000.00), (2, 'Adventure', 8000, 45000.00), (3, 'Simulation', 12000, 60000.00); | What is the total revenue and player count for each game genre? | SELECT genre, SUM(player_count) as total_players, SUM(revenue) as total_revenue FROM games GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (name TEXT, affected_by_acidification BOOLEAN, ocean TEXT, min_depth FLOAT); CREATE TABLE ocean_regions (name TEXT, area FLOAT); | What is the average depth of marine species in the Southern Ocean that are affected by ocean acidification? | SELECT AVG(min_depth) FROM marine_species WHERE affected_by_acidification = TRUE AND ocean = (SELECT name FROM ocean_regions WHERE area = 'Southern Ocean'); | gretelai_synthetic_text_to_sql |
CREATE TABLE forests (id INT, state VARCHAR(255), area_ha INT, year INT); | find the percentage of forest area in each state in the year 2020 | SELECT state, ROUND(100.0 * area_ha / (SELECT SUM(area_ha) FROM forests WHERE year = 2020 AND state = forests.state), 2) as percentage FROM forests WHERE year = 2020 GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE disaster_preparedness (id INT, state VARCHAR(50), year INT, drills INT); INSERT INTO disaster_preparedness (id, state, year, drills) VALUES (1, 'Florida', 2019, 50); INSERT INTO disaster_preparedness (id, state, year, drills) VALUES (2, 'Florida', 2018, 40); | What is the total number of disaster preparedness drills conducted in the state of Florida in 2019? | SELECT SUM(drills) FROM disaster_preparedness WHERE state = 'Florida' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE aquafarms (id INT, name TEXT); INSERT INTO aquafarms (id, name) VALUES (1, 'Farm A'), (2, 'Farm B'), (3, 'Farm C'); CREATE TABLE fish_movement (aquafarm_id INT, timestamp TIMESTAMP, movement_type TEXT, quantity INT); | How many fish were added to or removed from each aquafarm daily? | SELECT aquafarm_id, DATE(timestamp) AS date, SUM(quantity) AS daily_movement FROM fish_movement JOIN aquafarms ON fish_movement.aquafarm_id = aquafarms.id GROUP BY aquafarm_id, date; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_events (id INT, name VARCHAR(255), state VARCHAR(255), attendance INT); CREATE VIEW state_events AS SELECT * FROM cultural_events WHERE attendance = (SELECT MAX(attendance) FROM cultural_events e WHERE e.state = cultural_events.state); | What is the most attended cultural event in each state, along with the event's name and the number of attendees? | SELECT state, name, attendance FROM state_events; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, city VARCHAR(255), coowners INT); INSERT INTO properties (id, city, coowners) VALUES (1, 'Los Angeles', 2), (2, 'Los Angeles', 1), (3, 'Los Angeles', 3), (4, 'San Diego', 1); | What is the number of properties co-owned by two or more people in the city of Los Angeles? | SELECT COUNT(*) FROM properties WHERE city = 'Los Angeles' AND coowners > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (patient_id INT, patient_age INT, patient_name TEXT, condition TEXT, therapist_id INT, treatment TEXT); INSERT INTO patients (patient_id, patient_age, patient_name, condition, therapist_id, treatment) VALUES (1, 35, 'John Smith', 'Depression', 1, 'CBT'); INSERT INTO patients (patient_id, patient_a... | What is the average age of patients who have been treated with CBT for depression in New York? | SELECT AVG(patients.patient_age) FROM patients JOIN therapists ON patients.therapist_id = therapists.therapist_id WHERE patients.condition = 'Depression' AND patients.treatment = 'CBT' AND therapists.state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_spending (region VARCHAR(50), spending NUMERIC(10,2)); INSERT INTO defense_spending (region, spending) VALUES ('Africa', 4000000000), ('Asia', 10000000000), ('Europe', 8000000000), ('North America', 12000000000), ('South America', 5000000000); | What is the total defense spending for each region? | SELECT region, spending FROM defense_spending; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists claims (claim_id INT PRIMARY KEY, policyholder_id INT, claim_amount DECIMAL(10,2), claim_date DATE); | Create a view named 'recent_claims' that shows claims from the last 30 days | CREATE VIEW recent_claims AS SELECT * FROM claims WHERE claim_date >= CURDATE() - INTERVAL 30 DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, MaximumTemperature FLOAT); | What is the maximum temperature recorded by any spacecraft during a space mission? | SELECT MAX(MaximumTemperature) FROM Spacecraft; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorID int, DonationDate date, DonationAmount decimal(10,2)); INSERT INTO Donations (DonationID, DonorID, DonationDate, DonationAmount) VALUES (1, 1, '2021-01-01', 50.00); | What is the total number of donations in 'Russia' for the year 2021? | SELECT COUNT(*) FROM Donations WHERE Country = 'Russia' AND YEAR(DonationDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (province VARCHAR(20), year INT, material VARCHAR(20), weight FLOAT); INSERT INTO waste_generation (province, year, material, weight) VALUES ('Ontario', 2020, 'Plastic', 15000), ('Quebec', 2020, 'Plastic', 12000), ('British Columbia', 2020, 'Plastic', 9000), ('Alberta', 2020, 'Plastic', 18... | What is the total plastic waste generation (in tonnes) by province in Canada in 2020? | SELECT province, SUM(weight) as total_plastic_waste FROM waste_generation WHERE year = 2020 AND material = 'Plastic' GROUP BY province; | gretelai_synthetic_text_to_sql |
CREATE TABLE MarineLife (LifeID INT, LifeName VARCHAR(255), Species VARCHAR(255), Habitat VARCHAR(255), ConservationStatus VARCHAR(255)); | Update the 'ConservationStatus' of the 'Dugong' species in the 'MarineLife' table | UPDATE MarineLife SET ConservationStatus = 'Vulnerable' WHERE Species = 'Dugong'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, warehouse_id INT, shipped_date DATE, packages INT); INSERT INTO Shipments (id, warehouse_id, shipped_date, packages) VALUES (1, 1, '2022-01-01', 50), (2, 1, '2022-01-02', 75), (3, 2, '2022-01-03', 100); CREATE TABLE Warehouses (id INT, name VARCHAR(50), city VARCHAR(50), country VARCHAR(... | What is the average number of packages shipped daily from each warehouse? | SELECT w.name, AVG(s.packages) FROM Shipments s JOIN Warehouses w ON s.warehouse_id = w.id GROUP BY w.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (id INT, name TEXT, region TEXT, budget FLOAT); INSERT INTO support_programs (id, name, region, budget) VALUES (1, 'Accessible Tech', 'Pacific', 50000.00), (2, 'Mobility Training', 'Atlantic', 75000.00); | What is the average budget for support programs in the Pacific region? | SELECT AVG(budget) FROM support_programs WHERE region = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (region VARCHAR(255), waste_type VARCHAR(255), year INT, amount INT); CREATE TABLE RecyclingRates (waste_type VARCHAR(255), material_type VARCHAR(255), year INT, recycling_rate DECIMAL(5,4)); INSERT INTO WasteGeneration (region, waste_type, year, amount) VALUES ('North', 'Recyclables', 2019... | What is the recycling rate for each material type for the year 2019? | SELECT wg.waste_type, AVG(rr.recycling_rate) as AvgRecyclingRate FROM WasteGeneration wg INNER JOIN RecyclingRates rr ON wg.waste_type = rr.waste_type WHERE wg.year = 2019 GROUP BY wg.waste_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE communication_budget (country VARCHAR(50), year INT, budget FLOAT); INSERT INTO communication_budget (country, year, budget) VALUES ('Germany', 2017, 1000000), ('France', 2018, 1200000), ('Spain', 2019, 1500000), ('Italy', 2020, 1100000); | What is the average communication budget for climate change initiatives in Europe between 2017 and 2020? | SELECT AVG(budget) FROM communication_budget WHERE country IN (SELECT name FROM countries WHERE region = 'Europe') AND year BETWEEN 2017 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_worker_programs (id INT, program_name VARCHAR(50), location VARCHAR(20), health_equity_score INT); INSERT INTO community_health_worker_programs (id, program_name, location, health_equity_score) VALUES (1, 'CHW Program 1', 'New York', 90), (2, 'CHW Program 2', 'California', 95), (3, 'CHW Pr... | Which community health worker programs have the highest health equity metrics? | SELECT program_name, location, health_equity_score FROM community_health_worker_programs ORDER BY health_equity_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_cases (id INT, case_id INT, fine_amount INT); INSERT INTO criminal_cases (id, case_id, fine_amount) VALUES (1, 1001, 500), (2, 1002, 1000), (3, 1003, 1500); | What is the minimum fine amount for criminal cases in Florida? | SELECT MIN(fine_amount) FROM criminal_cases WHERE case_id = 1001; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsEventsYearly (EventYear INT, Region VARCHAR(10), EventCount INT); INSERT INTO EsportsEventsYearly (EventYear, Region, EventCount) VALUES (2022, 'NA', 5); INSERT INTO EsportsEventsYearly (EventYear, Region, EventCount) VALUES (2021, 'EU', 7); | What is the average number of esports events held in the NA region each year? | SELECT AVG(EventCount) FROM EsportsEventsYearly WHERE Region = 'NA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE elections (year INT, state VARCHAR(20), voters INT); INSERT INTO elections (year, state, voters) VALUES (2020, 'New York', 8000000); | How many people voted in the presidential election of 2020 in the state of New York? | SELECT voters FROM elections WHERE year = 2020 AND state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetics;CREATE TABLE if not exists genetics.research_projects(id INT, name TEXT, location TEXT, type TEXT);INSERT INTO genetics.research_projects (id, name, location, type) VALUES (1, 'ProjectX', 'UK', 'Genetic'), (2, 'ProjectY', 'USA', 'Genetic'), (3, 'ProjectZ', 'Canada', 'Genomic'); | How many genetic research projects are there in the UK? | SELECT COUNT(*) FROM genetics.research_projects WHERE location = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (id INT PRIMARY KEY, name VARCHAR(255), manufacturer VARCHAR(255), category VARCHAR(255)); INSERT INTO drugs (id, name, manufacturer, category) VALUES (1, 'DrugA', 'Manufacturer1', 'Cardiovascular'); CREATE TABLE market_access (id INT PRIMARY KEY, drug_id INT, country VARCHAR(255), approval_date DATE... | What drugs have been approved in both the USA and UK? | SELECT drugs.name FROM drugs INNER JOIN market_access ON drugs.id = market_access.drug_id WHERE market_access.country IN ('USA', 'UK') GROUP BY drugs.name HAVING COUNT(DISTINCT market_access.country) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Country) VALUES (1, 25, 'USA'), (2, 30, 'Canada'), (3, 22, 'Germany'), (4, 35, 'Japan'); CREATE TABLE GameLibrary (GameID INT, GameName VARCHAR(50), GameType VARCHAR(50)); INSERT INTO GameLibrary (GameID, GameName, Ga... | What is the maximum age of players who play non-VR games and are from Japan? | SELECT MAX(Players.Age) FROM Players JOIN PlayerGameLibrary ON Players.PlayerID = PlayerGameLibrary.PlayerID JOIN GameLibrary ON PlayerGameLibrary.GameID = GameLibrary.GameID WHERE Players.Country = 'Japan' AND GameLibrary.GameType = 'Non-VR'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Trees (id INT, species VARCHAR(255), age INT); INSERT INTO Trees (id, species, age) VALUES (1, 'Oak', 50), (2, 'Pine', 30), (3, 'Maple', 40); | What is the total carbon sequestration of all the trees in the Trees table, if each tree sequesters 48.19 pounds of carbon per year on average? | SELECT SUM(48.19 * age) FROM Trees; | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, timestamp TIMESTAMP, country VARCHAR(255), incident_type VARCHAR(255)); INSERT INTO security_incidents (id, timestamp, country, incident_type) VALUES (1, '2022-01-01 10:00:00', 'USA', 'malware'), (2, '2022-01-02 15:00:00', 'Canada', 'phishing'), (3, '2022-01-03 08:00:00', 'USA',... | What are the top 5 countries with the most security incidents in the past month? | SELECT country, COUNT(*) as incident_count FROM security_incidents WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 MONTH) GROUP BY country ORDER BY incident_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (id INT, order_value DECIMAL(10,2), device VARCHAR(20)); INSERT INTO orders (id, order_value, device) VALUES (1, 150.50, 'mobile'), (2, 75.20, 'desktop'), (3, 225.00, 'desktop'); | What is the maximum order value for purchases made using a desktop device? | SELECT MAX(order_value) FROM orders WHERE device = 'desktop'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE); INSERT INTO Spacecraft (id, name, country, launch_date) VALUES (1, 'Falcon 9', 'USA', '2010-06-04'); INSERT INTO Spacecraft (id, name, country, launch_date) VALUES (2, 'Soyuz-FG', 'Russia', '2001-11-02'); INSERT INTO Spacecraft (... | What is the name and launch date of all spacecraft that have launched satellites with the type 'Communication'? | SELECT sp.name, sp.launch_date FROM Spacecraft sp JOIN Satellites s ON sp.id = s.spacecraft_id WHERE s.type = 'Communication'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Papers (id INT, title VARCHAR(255), year INT, conference VARCHAR(255)); INSERT INTO Papers (id, title, year, conference) VALUES (1, 'Ethical considerations in AI safety', 2021, 'NeurIPS'), (2, 'Safe and fair AI algorithms', 2022, 'ICML'), (3, 'Towards explainable AI systems', 2022, 'AAAI'), (4, 'AI creativ... | Show me the AI safety papers that were published in 2021 or 2022 and have the word 'ethics' in the title. | SELECT * FROM Papers WHERE year IN (2021, 2022) AND title LIKE '%ethics%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE inspections (inspection_id INT, location_id INT, score INT, inspection_date DATE); INSERT INTO inspections (inspection_id, location_id, score, inspection_date) VALUES (1, 201, 95, '2021-01-01'), (2, 201, 78, '2021-02-01'); | Delete food safety inspection records with a score below 80 for location 201. | DELETE FROM inspections WHERE location_id = 201 AND score < 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE CultivationLicenses (id INT, state VARCHAR(50), year INT, num_licenses INT); INSERT INTO CultivationLicenses (id, state, year, num_licenses) VALUES (1, 'Washington', 2019, 1500), (2, 'Washington', 2018, 1200), (3, 'Oregon', 2019, 1800), (4, 'Oregon', 2018, 1600); | How many cultivation licenses were issued in the state of Washington by the end of 2019? | SELECT SUM(num_licenses) FROM CultivationLicenses WHERE state = 'Washington' AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, event_type VARCHAR(20), event_date DATE, num_attendees INT); INSERT INTO events (id, event_type, event_date, num_attendees) VALUES (1, 'Fundraising', '2023-02-01', 50); INSERT INTO events (id, event_type, event_date, num_attendees) VALUES (2, 'Awareness', '2023-03-15', 75); | What was the number of events and total attendees for each event type in Q1 and Q3 of 2023? | SELECT event_type, COUNT(DISTINCT id) as total_events, SUM(num_attendees) as total_attendees FROM events WHERE EXTRACT(QUARTER FROM event_date) IN (1, 3) GROUP BY event_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS defense_contracts (contract_id INT, contract_value FLOAT, contract_date DATE, contracting_agency VARCHAR(255)); | What is the distribution of defense contract values by contracting agency since 2019? | SELECT contracting_agency, AVG(contract_value) as avg_contract_value, COUNT(*) as num_contracts, MIN(contract_value) as min_contract_value, MAX(contract_value) as max_contract_value FROM defense_contracts WHERE contract_date >= '2019-01-01' GROUP BY contracting_agency; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Department VARCHAR(20)); INSERT INTO Employees (EmployeeID, Department) VALUES (1, 'IT'), (2, 'IT'), (3, 'HR'), (4, 'IT'), (5, 'Marketing'), (6, 'Finance'), (7, 'IT'), (8, 'Marketing'); | What is the total number of employees in the IT and Marketing departments? | SELECT COUNT(*) FROM Employees WHERE Department IN ('IT', 'Marketing'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Tunnel (id INT, name TEXT, location TEXT, height FLOAT, length FLOAT); INSERT INTO Tunnel (id, name, location, height, length) VALUES (1, 'Severn Tunnel', 'Wales, UK', 50, 7000); | What is the minimum height for tunnels in the United Kingdom? | SELECT MIN(height) FROM Tunnel WHERE location LIKE '%UK%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE season_penalties (id INT, player_name VARCHAR(50), team VARCHAR(50), season VARCHAR(10), penalty_minutes INT); | What is the average number of penalty minutes served by a hockey player in a season? | SELECT AVG(penalty_minutes) FROM season_penalties WHERE sport = 'Hockey' GROUP BY player_name, season; | gretelai_synthetic_text_to_sql |
CREATE TABLE certifications (certification_id INT, factory_id INT, certification TEXT); INSERT INTO certifications VALUES (1, 1, 'Fair Trade'), (2, 1, 'B Corp'), (3, 2, 'Fair Trade'), (4, 3, 'ISO 14001'), (5, 3, 'OHSAS 18001'); CREATE TABLE factories (factory_id INT, name TEXT, location TEXT); INSERT INTO factories VAL... | List all ethical manufacturing certifications held by factories in the Asia-Pacific region. | SELECT factories.name, certifications.certification FROM certifications JOIN factories ON certifications.factory_id = factories.factory_id WHERE factories.location LIKE '%Asia%' OR factories.location LIKE '%Pacific%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (site_id INT, site_name TEXT, location TEXT); INSERT INTO mining_sites (site_id, site_name, location) VALUES (1, 'Site A', 'Country X'), (2, 'Site B', 'Country Y'), (3, 'Site C', 'Country X'), (4, 'Site D', 'Country W'); | How many mining sites are located in each country? | SELECT location, COUNT(DISTINCT site_id) AS num_sites FROM mining_sites GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, has_fragrance BOOLEAN); INSERT INTO products (product_id, product_name, has_fragrance) VALUES (1, 'Soap', false), (2, 'Lotion', true), (3, 'Deodorant', false); | What percentage of cosmetic products do not have 'fragrance' as an ingredient? | SELECT (COUNT(*) - SUM(has_fragrance)) * 100.0 / COUNT(*) as percentage FROM products; | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (CompanyID int, CompanyName varchar(50)); CREATE TABLE OilRig (RigID int, CompanyID int, RigName varchar(50), DrillingType varchar(50), WaterDepth int); | Display the number of drilling rigs for each company, including companies without any rigs | SELECT Company.CompanyName, COUNT(OilRig.RigID) as Num_Rigs FROM Company LEFT JOIN OilRig ON Company.CompanyID = OilRig.CompanyID GROUP BY Company.CompanyName; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investor_id INT, company_id INT, ESG_score FLOAT); INSERT INTO investments (investor_id, company_id, ESG_score) VALUES (1, 1, 86.0), (2, 2, 78.0), (3, 3, 82.5); CREATE TABLE companies (id INT, ESG_score FLOAT); INSERT INTO companies (id, ESG_score) VALUES (1, 90.0), (2, 60.0), (3, 82.5); | List all investors who have invested in companies with an ESG score greater than 85.0. | SELECT DISTINCT i.name FROM investments AS i JOIN companies AS c ON i.company_id = c.id WHERE c.ESG_score > 85.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE us_states (state VARCHAR(255), wastewater_treated INT); INSERT INTO us_states (state, wastewater_treated) VALUES ('California', 2000000), ('Texas', 3000000); | What is the total wastewater treated in California and Texas? | SELECT SUM(wastewater_treated) FROM us_states WHERE state IN ('California', 'Texas'); | 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.