context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE renewable_energy_projects (id INT, name TEXT, budget FLOAT); INSERT INTO renewable_energy_projects (id, name, budget) VALUES (1, 'Solar Farm', 5000000.00), (2, 'Wind Farm', 7000000.00); | Increase the budget of a specific renewable energy project by 10% | WITH project_update AS (UPDATE renewable_energy_projects SET budget = budget * 1.10 WHERE id = 1) SELECT * FROM project_update; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (policy_number INT, policy_type VARCHAR(50), coverage_amount INT, state VARCHAR(2)); | Insert a new policy with policy number 222333, policy type 'Commercial', state 'NY', and coverage amount 400000. | INSERT INTO policies (policy_number, policy_type, coverage_amount, state) VALUES (222333, 'Commercial', 400000, 'NY'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget(Year INT, Service VARCHAR(20), Budget FLOAT); INSERT INTO Budget VALUES(2020, 'Education', 15000000), (2020, 'Healthcare', 20000000), (2021, 'Education', 14000000), (2021, 'Healthcare', 21000000), (2020, 'Public Transport', 10000000), (2021, 'Public Transport', 10500000); | List the names of the services for which the budget has decreased in the last 2 years. | SELECT DISTINCT Service FROM Budget WHERE (Budget - LAG(Budget, 1) OVER (PARTITION BY Service ORDER BY Year)) < 0 AND Year IN (2020, 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE security_incidents (id INT, country VARCHAR(50), incident_count INT, incident_date DATE); CREATE TABLE ip_addresses (id INT, incident_id INT, ip_address VARCHAR(50), PRIMARY KEY (id, incident_id)); INSERT INTO security_incidents (id, country, incident_count, incident_date) VALUES (1, 'USA', 25, '2022-01-01... | What is the total number of security incidents and unique IP addresses involved in those incidents for each country in the last month? | SELECT security_incidents.country, SUM(security_incidents.incident_count) as total_incidents, COUNT(DISTINCT ip_addresses.ip_address) as unique_ips FROM security_incidents INNER JOIN ip_addresses ON security_incidents.id = ip_addresses.incident_id WHERE security_incidents.incident_date >= DATE_SUB(CURRENT_DATE, INTERVA... | gretelai_synthetic_text_to_sql |
CREATE TABLE Faculty (FacultyID INT, Name VARCHAR(50), Department VARCHAR(50), Gender VARCHAR(10), Salary INT); INSERT INTO Faculty (FacultyID, Name, Department, Gender, Salary) VALUES (1, 'Alice', 'Biology', 'Female', 80000); INSERT INTO Faculty (FacultyID, Name, Department, Gender, Salary) VALUES (2, 'Bob', 'Biology'... | What is the total amount of research grants awarded to faculty members in the Biology department? | SELECT SUM(rg.Amount) FROM ResearchGrants rg INNER JOIN Faculty f ON rg.FacultyID = f.FacultyID WHERE f.Department = 'Biology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT, name TEXT, start_date DATE, end_date DATE); CREATE TABLE peacekeeping_personnel (id INT, operation_id INT, year INT, personnel INT); INSERT INTO peacekeeping_operations (id, name, start_date, end_date) VALUES (1, 'Operation1', '2010-01-01', '2015-01-01'), (2, 'Operation2', ... | What is the maximum number of peacekeeping personnel deployed for each peacekeeping operation? | SELECT peacekeeping_operations.name, MAX(peacekeeping_personnel.personnel) FROM peacekeeping_operations JOIN peacekeeping_personnel ON peacekeeping_operations.id = peacekeeping_personnel.operation_id GROUP BY peacekeeping_operations.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceX_Projects (project_id INT, name VARCHAR(50), type VARCHAR(50), expenses DECIMAL(10,2));CREATE TABLE NASA_Research (research_id INT, name VARCHAR(50), type VARCHAR(50), expenses DECIMAL(10,2)); INSERT INTO SpaceX_Projects (project_id, name, type, expenses) VALUES (1, 'Starlink', 'Satellite Deployment'... | What are the total expenses for the SpaceX satellite deployment projects and the NASA space exploration research programs? | SELECT SUM(expenses) FROM SpaceX_Projects WHERE type IN ('Satellite Deployment', 'Space Exploration') UNION ALL SELECT SUM(expenses) FROM NASA_Research WHERE type IN ('Space Exploration', 'Space Station'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA IF NOT EXISTS rural_development;CREATE TABLE IF NOT EXISTS rural_development.economic_diversification (name VARCHAR(255), id INT);INSERT INTO rural_development.economic_diversification (name, id) VALUES ('renewable_energy', 1), ('handicraft_promotion', 2), ('local_food_production', 3), ('tourism_developme... | What are the names of all economic diversification efforts in the 'rural_development' schema, excluding those related to 'tourism'? | SELECT name FROM rural_development.economic_diversification WHERE name NOT LIKE '%tourism%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_spending (spending_id INT, amount FLOAT, state VARCHAR(50), spend_date DATE); INSERT INTO construction_spending (spending_id, amount, state, spend_date) VALUES (9, 120000, 'Florida', '2019-01-01'); INSERT INTO construction_spending (spending_id, amount, state, spend_date) VALUES (10, 180000, '... | What was the total construction spending for each month in the state of Florida in 2019? | SELECT EXTRACT(MONTH FROM spend_date) AS month, SUM(amount) AS total_spending FROM construction_spending WHERE state = 'Florida' AND YEAR(spend_date) = 2019 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE accounts (customer_id INT, account_type VARCHAR(20), balance DECIMAL(10, 2)); | Determine the number of customers who have an account balance greater than the 75th percentile for their account type. | SELECT COUNT(DISTINCT customer_id) FROM accounts WHERE balance > PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY balance) OVER (PARTITION BY account_type); | gretelai_synthetic_text_to_sql |
CREATE TABLE housing_policies (id INT, city VARCHAR(50), eco_friendly BOOLEAN); INSERT INTO housing_policies VALUES (1, 'NYC', TRUE); INSERT INTO housing_policies VALUES (2, 'LA', FALSE); INSERT INTO housing_policies VALUES (3, 'Chicago', TRUE); | List all eco-friendly housing policies in cities with a population over 1 million | SELECT city FROM housing_policies WHERE eco_friendly = TRUE INTERSECT SELECT city FROM cities WHERE population > 1000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_consultations (consultation_id INT, consultation_date DATE, consultation_city VARCHAR(50)); INSERT INTO public_consultations (consultation_id, consultation_date, consultation_city) VALUES (1, '2022-02-01', 'Nairobi'); | How many public consultations were held in Nairobi, Kenya between January 1, 2022 and March 31, 2022? | SELECT COUNT(*) FROM public_consultations WHERE consultation_city = 'Nairobi' AND consultation_date BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE soil_samples (id INT, region_id INT, organic_matter_kg FLOAT, date DATE); | What was the total organic matter (in kg) in soil samples from each region in 2020? | SELECT region_id, SUM(organic_matter_kg) FROM soil_samples WHERE YEAR(date) = 2020 GROUP BY region_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE CountryProjects (ProjectID INT, ProjectName VARCHAR(255), Country VARCHAR(255), Capacity FLOAT); INSERT INTO CountryProjects (ProjectID, ProjectName, Country, Capacity) VALUES (1, 'SolarFarm1', 'USA', 5000), (2, 'WindFarm2', 'Germany', 7000), (3, 'HydroPlant3', 'Brazil', 6000), (4, 'GeoThermal4', 'China', ... | What is the total installed capacity of renewable energy projects for each country, ranked by the total capacity? | SELECT Country, SUM(Capacity) AS Total_Capacity FROM CountryProjects GROUP BY Country ORDER BY Total_Capacity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Digital_Initiatives (id INT, museum VARCHAR(255), initiative VARCHAR(255)); INSERT INTO Digital_Initiatives (id, museum, initiative) VALUES (1, 'National Museum of Australia', 'Virtual Tour'), (2, 'British Museum', 'Online Collection'), (3, 'Metropolitan Museum of Art', 'Digital Archive'), (4, 'National Mu... | List all unique digital initiatives by museums located in the Asia-Pacific region. | SELECT DISTINCT initiative FROM Digital_Initiatives WHERE museum LIKE 'National Museum%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE reporters (id INT, city VARCHAR(255), salary DECIMAL(10,2)); INSERT INTO reporters (id, city, salary) VALUES (1, 'NYC', 80000.00), (2, 'LA', 70000.00), (3, 'Chicago', 75000.00), (4, 'Miami', 72000.00), (5, 'Dallas', 78000.00) | Find the top 5 cities with the highest avg salary in the 'reporters' table | SELECT city, AVG(salary) as avg_salary FROM reporters GROUP BY city ORDER BY avg_salary DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_trips (trip_id INT, trip_date DATE, trip_city VARCHAR(50)); INSERT INTO public_trips (trip_id, trip_date, trip_city) VALUES (1, '2020-01-01', 'New York City'), (2, '2020-01-02', 'New York City'); | What is the total number of public transportation trips in New York City for the year 2020? | SELECT SUM(trips) FROM (SELECT COUNT(*) AS trips FROM public_trips WHERE trip_city = 'New York City' AND trip_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY EXTRACT(MONTH FROM trip_date)) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (employee_id INT, department TEXT, salary DECIMAL); INSERT INTO employees (employee_id, department, salary) VALUES (1, 'Marketing', 50000.00), (2, 'IT', 60000.00), (3, 'HR', 55000.00); | What is the average salary of employees in each department, excluding any departments with fewer than 5 employees? | SELECT department, AVG(salary) FROM employees GROUP BY department HAVING COUNT(*) >= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, ProgramID INT, SignUpDate DATE); CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(255)); | How many volunteers signed up in each program in 2020? | SELECT ProgramID, ProgramName, COUNT(VolunteerID) as NumVolunteers FROM Volunteers INNER JOIN Programs ON Volunteers.ProgramID = Programs.ProgramID WHERE YEAR(SignUpDate) = 2020 GROUP BY ProgramID, ProgramName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID INT, SupplierName VARCHAR(50), Country VARCHAR(50), Certification VARCHAR(50), Material VARCHAR(50)); INSERT INTO Suppliers (SupplierID, SupplierName, Country, Certification, Material) VALUES (1, 'Supplier A', 'Vietnam', 'Fair Trade', 'Organic Cotton'), (2, 'Supplier B', 'Bangladesh',... | Find the top 3 countries with the highest number of sustainable material suppliers? | SELECT Country, COUNT(*) AS NumberOfSuppliers FROM Suppliers GROUP BY Country ORDER BY NumberOfSuppliers DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, country TEXT, continent TEXT, eco_friendly BOOLEAN); INSERT INTO hotels (hotel_id, name, country, continent, eco_friendly) VALUES (1, 'Green Hotel', 'Brazil', 'South America', true), (2, 'Eco Lodge', 'France', 'Europe', true), (3, 'Polluting Hotel', 'USA', 'North America', ... | What is the total number of eco-friendly hotels in each continent? | SELECT continent, COUNT(*) FROM hotels WHERE eco_friendly = true GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE dams (id INT, name TEXT, construction_date DATE); INSERT INTO dams (id, name, construction_date) VALUES (1, 'Dam A', '1950-05-15'), (2, 'Dam B', '1965-08-27'); | Show the name and construction date of the oldest dam | SELECT name, MIN(construction_date) FROM dams; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs (drug_id INT, drug_name TEXT); INSERT INTO drugs (drug_id, drug_name) VALUES (1001, 'Ibuprofen'), (1002, 'Paracetamol'), (1003, 'Aspirin'); CREATE TABLE sales (sale_id INT, drug_id INT, sale_date DATE, revenue FLOAT); INSERT INTO sales (sale_id, drug_id, sale_date, revenue) VALUES (1, 1001, '2020-07-... | What are the total sales for each drug in Q3 2020? | SELECT drug_name, SUM(revenue) as total_sales FROM sales JOIN drugs ON sales.drug_id = drugs.drug_id WHERE sale_date BETWEEN '2020-07-01' AND '2020-09-30' GROUP BY drug_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE species(id INT, name VARCHAR(255), common_name VARCHAR(255), population INT, endangered BOOLEAN); | Update the endangered status of the Polar Bear to true | UPDATE species SET endangered = true WHERE common_name = 'Polar Bear'; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_expeditions (leader VARCHAR(255), country VARCHAR(255)); INSERT INTO deep_sea_expeditions (leader, country) VALUES ('Dr. Shinsuke Kawagucci', 'Japan'), ('Dr. Makoto Kuwahara', 'Japan'); | List all deep-sea expeditions led by Japanese researchers. | SELECT * FROM deep_sea_expeditions WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, name VARCHAR(255), city VARCHAR(255)); CREATE TABLE posts (id INT, post_text TEXT, post_date DATETIME); | List the top 5 cities where most users posted about vegan food in the past month. | SELECT city, COUNT(*) AS post_count FROM posts p JOIN users u ON p.user_id = u.id WHERE p.post_text LIKE '%vegan food%' AND DATE(p.post_date) > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY city ORDER BY post_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE tickets (ticket_id INT, game_id INT, price INT, sale_date DATE); INSERT INTO tickets (ticket_id, game_id, price, sale_date) VALUES (1, 1, 50, '2021-09-01'), (2, 2, 60, '2021-10-01'); CREATE TABLE games (game_id INT, sport VARCHAR(20), city VARCHAR(20), game_date DATE); INSERT INTO games (game_id, sport, ci... | How many tickets were sold for basketball games in Los Angeles and Chicago in the last quarter? | SELECT COUNT(tickets.ticket_id) FROM tickets INNER JOIN games ON tickets.game_id = games.game_id WHERE games.sport = 'Basketball' AND (games.city = 'Los Angeles' OR games.city = 'Chicago') AND tickets.sale_date >= DATEADD(quarter, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityHealthWorkers (WorkerID INT, Age INT, GenderIdentity VARCHAR(255)); INSERT INTO CommunityHealthWorkers (WorkerID, Age, GenderIdentity) VALUES (1, 35, 'Transgender Woman'); INSERT INTO CommunityHealthWorkers (WorkerID, Age, GenderIdentity) VALUES (2, 42, 'Cisgender Man'); INSERT INTO CommunityHealt... | What is the average age of community health workers by their gender identity? | SELECT GenderIdentity, AVG(Age) FROM CommunityHealthWorkers GROUP BY GenderIdentity; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(50), launch_status VARCHAR(50), manufacturer VARCHAR(50), launch_date DATE); | Find the number of successful satellite launches by company ABC | SELECT COUNT(*) FROM satellites WHERE launch_status = 'Success' AND manufacturer = 'ABC'; | gretelai_synthetic_text_to_sql |
CREATE TABLE wind_farms (name VARCHAR(50), location VARCHAR(50), capacity FLOAT, production_mwh FLOAT); INSERT INTO wind_farms (name, location, capacity, production_mwh) VALUES ('Farm I', 'Texas', 300, 5000), ('Farm J', 'Oklahoma', 250, 4500), ('Farm K', 'Kansas', 350, 5200), ('Farm L', 'Iowa', 280, 4800); | What is the monthly energy production (in MWh) for each wind farm, ranked by the highest production? | SELECT name, production_mwh, ROW_NUMBER() OVER (ORDER BY production_mwh DESC) as rank FROM wind_farms; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity_violations (id INT, state VARCHAR(50), violation_count INT); INSERT INTO mental_health_parity_violations (id, state, violation_count) VALUES (1, 'California', 10), (2, 'Florida', 5), (3, 'Illinois', 15); | Identify the number of mental health parity violations by state? | SELECT state, SUM(violation_count) as total_violations FROM mental_health_parity_violations GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE providers (provider_id INT, name VARCHAR(50), zip_code VARCHAR(10)); | Update the "providers" table to add a new column for "email" and update the "name" column to "full_name" | ALTER TABLE providers ADD COLUMN email VARCHAR(50); UPDATE providers SET full_name = name; | gretelai_synthetic_text_to_sql |
CREATE VIEW urban_neighborhoods AS SELECT * FROM properties WHERE neighborhood_type = 'urban'; | What is the average walkability score for properties in the urban_neighborhoods view? | SELECT AVG(walkability_score) FROM urban_neighborhoods; | gretelai_synthetic_text_to_sql |
CREATE TABLE Flu_Shots (ID INT, Quantity INT, Location VARCHAR(50), Year INT); INSERT INTO Flu_Shots (ID, Quantity, Location, Year) VALUES (1, 500, 'Los Angeles County', 2019); INSERT INTO Flu_Shots (ID, Quantity, Location, Year) VALUES (2, 300, 'Los Angeles County', 2019); | What is the total number of flu shots administered in Los Angeles County in 2019? | SELECT SUM(Quantity) FROM Flu_Shots WHERE Location = 'Los Angeles County' AND Year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecraft (SpacecraftID INT, Name VARCHAR(50), ManufacturingCountry VARCHAR(50)); INSERT INTO Spacecraft (SpacecraftID, Name, ManufacturingCountry) VALUES (1, 'Space Shuttle Atlantis', 'USA'); INSERT INTO Spacecraft (SpacecraftID, Name, ManufacturingCountry) VALUES (2, 'Space Shuttle Discovery', 'USA'); I... | Find the top 3 countries with the highest number of spacecraft manufactured, along with the number of spacecraft manufactured by each. | SELECT ManufacturingCountry, COUNT(*) AS SpacecraftCount FROM Spacecraft GROUP BY ManufacturingCountry ORDER BY SpacecraftCount DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE risk (id INT PRIMARY KEY, investment_id INT, type VARCHAR(255), level VARCHAR(255)); INSERT INTO risk (id, investment_id, type, level) VALUES (3, 3, 'Operational Risk', 'High'); CREATE TABLE investment (id INT PRIMARY KEY, organization_id INT, amount FLOAT, date DATE); INSERT INTO investment (id, organizat... | What is the total amount invested in organizations located in 'New York, NY' with a 'High' operational risk level? | SELECT investment.amount FROM investment INNER JOIN organization ON investment.organization_id = organization.id INNER JOIN risk ON investment.id = risk.investment_id WHERE organization.location = 'New York, NY' AND risk.type = 'Operational Risk' AND risk.level = 'High'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, severity FLOAT); INSERT INTO vulnerabilities (id, severity) VALUES (1, 7.5); | What is the minimum severity of vulnerabilities found in the last week? | SELECT MIN(severity) FROM vulnerabilities WHERE vulnerabilities.id IN (SELECT MAX(id) FROM vulnerabilities WHERE incident_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK)); | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, art_name VARCHAR(50), style VARCHAR(50), artist_name VARCHAR(50)); CREATE TABLE sales (id INT, artwork_id INT, price DECIMAL(10, 2)); | List all abstract expressionist artists and their highest-selling artwork. | SELECT a.artist_name, MAX(s.price) as highest_selling_price FROM artworks a JOIN sales s ON a.id = s.artwork_id WHERE a.style = 'Abstract Expressionism' GROUP BY a.artist_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_production (source VARCHAR(255), month INT, year INT, production FLOAT); | What is the average monthly energy production (in MWh) for each renewable energy source in 2019? | SELECT source, AVG(production) FROM energy_production WHERE year = 2019 GROUP BY source, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE performing_arts_events (id INT, event_name VARCHAR(255), event_date DATE, attendee_gender VARCHAR(255)); | Which performing arts events had the highest and lowest attendance by gender? | SELECT event_name, attendee_gender, COUNT(attendee_gender) as attendance FROM performing_arts_events GROUP BY event_name, attendee_gender ORDER BY attendance DESC, event_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, case_number VARCHAR(50), client_name VARCHAR(50), attorney_id INT); | Count the number of cases in 'cases' table for each attorney | SELECT attorney_id, COUNT(*) FROM cases GROUP BY attorney_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE nuclear_plants (country VARCHAR(50), operational BOOLEAN, year INT); INSERT INTO nuclear_plants (country, operational, year) VALUES ('France', true, 2020), ('Russia', true, 2020), ('United Kingdom', true, 2020), ('Germany', false, 2020); | List the number of nuclear power plants in France, Russia, and the United Kingdom, as of 2020. | SELECT country, COUNT(*) FROM nuclear_plants WHERE country IN ('France', 'Russia', 'United Kingdom') AND operational = true GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE CriminalJustice (case_id INT, case_status VARCHAR(10)); INSERT INTO CriminalJustice (case_id, case_status) VALUES (1, 'pending'), (2, 'closed'), (3, 'pending'), (4, 'in_progress'), (5, 'closed'), (6, 'in_progress'); | Find the total number of cases in the 'CriminalJustice' table and the number of cases with 'case_status' of 'pending' or 'in_progress' | SELECT COUNT(*) AS total_cases, SUM(CASE WHEN case_status IN ('pending', 'in_progress') THEN 1 ELSE 0 END) AS pending_or_in_progress_cases FROM CriminalJustice; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT, usage FLOAT, purpose VARCHAR(20), date DATE); INSERT INTO water_usage (id, usage, purpose, date) VALUES (1, 50, 'residential', '2021-09-01'); INSERT INTO water_usage (id, usage, purpose, date) VALUES (2, 60, 'residential', '2021-09-02'); | Determine the average daily water usage for 'residential' purposes in 'September 2021' from the 'water_usage' table | SELECT AVG(usage) FROM (SELECT usage FROM water_usage WHERE purpose = 'residential' AND date BETWEEN '2021-09-01' AND '2021-09-30' GROUP BY date) as daily_usage; | gretelai_synthetic_text_to_sql |
CREATE TABLE Athletes (athlete_id INT, athlete_name VARCHAR(255), age INT, team VARCHAR(255)); CREATE VIEW WellbeingPrograms AS SELECT athlete_id, team FROM Programs WHERE program_type IN ('NHL', 'NBA'); | Who are the top 2 oldest athletes in 'NHL' and 'NBA' wellbeing programs? | SELECT Athletes.athlete_name, Athletes.age FROM Athletes INNER JOIN WellbeingPrograms ON Athletes.athlete_id = WellbeingPrograms.athlete_id WHERE (Athletes.team = 'NHL' OR Athletes.team = 'NBA') GROUP BY Athletes.athlete_name ORDER BY Athletes.age DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors(vendor_id INT, vendor_name TEXT, circular_supply_chain BOOLEAN); INSERT INTO vendors(vendor_id, vendor_name, circular_supply_chain) VALUES (1, 'VendorA', TRUE), (2, 'VendorB', FALSE), (3, 'VendorC', TRUE); | What is the maximum price of a product sold by vendors with a circular supply chain? | SELECT MAX(transactions.price) FROM transactions JOIN vendors ON transactions.vendor_id = vendors.vendor_id WHERE vendors.circular_supply_chain = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE impact_projects (id INT, focus_area VARCHAR(20), investment_amount FLOAT); INSERT INTO impact_projects (id, focus_area, investment_amount) VALUES (1, 'gender_equality', 45000), (2, 'gender_equality', 52000), (3, 'gender_equality', 39000); | What is the maximum investment amount for 'gender_equality' focused projects? | SELECT MAX(investment_amount) FROM impact_projects WHERE focus_area = 'gender_equality'; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_institutions (name TEXT, region TEXT); INSERT INTO financial_institutions (name, region) VALUES ('Bank of America', 'USA'), ('Barclays Bank', 'UK'); | Insert a new financial institution 'Green Finance Corporation' in the 'Canada' region. | INSERT INTO financial_institutions (name, region) VALUES ('Green Finance Corporation', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_providers (id INT, name VARCHAR(50), gender VARCHAR(10), location VARCHAR(50)); INSERT INTO healthcare_providers (id, name, gender, location) VALUES (1, 'Dr. Smith', 'Female', 'Rural India'); INSERT INTO healthcare_providers (id, name, gender, location) VALUES (2, 'Dr. Johnson', 'Male', 'Urban N... | What is the percentage of female healthcare providers in rural India? | SELECT ROUND(100.0 * COUNT(*) / (SELECT COUNT(*) FROM healthcare_providers WHERE location = 'Rural India'), 2) FROM healthcare_providers WHERE location = 'Rural India' AND gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccinations (id INT, state VARCHAR(2), vaccine VARCHAR(50), rate DECIMAL(5,2)); INSERT INTO vaccinations (id, state, vaccine, rate) VALUES (1, 'NY', 'Measles', 0.95), (2, 'CA', 'Measles', 0.96), (3, 'TX', 'Measles', 0.92), (4, 'FL', 'Measles', 0.94), (5, 'AK', 0.98), (6, 'MS', 0.91); | Which states have the highest and lowest vaccination rates for measles? | SELECT state, rate FROM vaccinations WHERE vaccine = 'Measles' ORDER BY rate DESC, state ASC LIMIT 1; SELECT state, rate FROM vaccinations WHERE vaccine = 'Measles' ORDER BY rate ASC, state ASC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Songs (song_id INT, title TEXT, genre TEXT, release_date DATE, price DECIMAL(5,2)); | Update the price of jazz songs released before 2000 to $1.99 | UPDATE Songs SET price = 1.99 WHERE genre = 'jazz' AND release_date < '2000-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE beauty_products_italy (product_cruelty_free BOOLEAN, sales_quantity INT); INSERT INTO beauty_products_italy (product_cruelty_free, sales_quantity) VALUES (TRUE, 800), (FALSE, 1200); | What is the percentage of cruelty-free beauty products in the overall beauty product sales in Italy? | SELECT (SUM(CASE WHEN product_cruelty_free = TRUE THEN sales_quantity ELSE 0 END) / SUM(sales_quantity)) * 100 AS cruelty_free_percentage FROM beauty_products_italy; | gretelai_synthetic_text_to_sql |
CREATE TABLE program_impact (program_id INT, country VARCHAR(50), impact INT); INSERT INTO program_impact VALUES (1, 'India', 100), (2, 'Brazil', 150), (3, 'USA', 200), (4, 'India', 120), (5, 'Brazil', 180); | Find the top 2 countries with the most program impact in 2022? | SELECT country, SUM(impact) as total_impact FROM program_impact WHERE program_id IN (SELECT program_id FROM program_impact WHERE program_id IN (SELECT program_id FROM program_impact WHERE year = 2022 GROUP BY country HAVING COUNT(*) > 1) GROUP BY country HAVING COUNT(*) > 1) GROUP BY country ORDER BY total_impact DESC ... | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, location VARCHAR(50), operation_type VARCHAR(50), monthly_co2_emission INT); INSERT INTO mining_operations (id, location, operation_type, monthly_co2_emission) VALUES (1, 'USA', 'Coal', 12000), (2, 'China', 'Coal', 18000), (3, 'Canada', 'Gold', 8000); | What is the total CO2 emission from coal mining operations in the USA and China? | SELECT SUM(CASE WHEN operation_type = 'Coal' AND location IN ('USA', 'China') THEN monthly_co2_emission ELSE 0 END) as total_coal_emission FROM mining_operations; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tourism_extended_2 (country TEXT, revenue FLOAT, date DATE); INSERT INTO virtual_tourism_extended_2 (country, revenue, date) VALUES ('Spain', 25000.0, '2022-03-01'), ('Spain', 28000.0, '2022-04-01'), ('Italy', 18000.0, '2022-03-01'), ('Italy', 20000.0, '2022-04-01'), ('Germany', 30000.0, '2022-02-0... | Virtual tourism revenue by quarter for each country? | SELECT country, DATE_TRUNC('quarter', date) AS quarter, SUM(revenue) FROM virtual_tourism_extended_2 GROUP BY country, quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE future_trends (country VARCHAR(50), year INT, projected_visitors INT); INSERT INTO future_trends (country, year, projected_visitors) VALUES ('France', 2025, 25000000), ('Spain', 2025, 20000000), ('Italy', 2025, 18000000), ('Japan', 2025, 16000000), ('Germany', 2025, 15000000); | List the top 3 countries with the most tourists in 2025 based on current trends. | SELECT country, projected_visitors FROM future_trends WHERE year = 2025 ORDER BY projected_visitors DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Loans (Id INT, Lender VARCHAR(20), Location VARCHAR(20), LoanType VARCHAR(20), LoanAmount DECIMAL(10,2), LoanYear INT); INSERT INTO Loans (Id, Lender, Location, LoanType, LoanAmount, LoanYear) VALUES (1, 'LenderA', 'Asia', 'Socially Responsible', 500.00, 2020), (2, 'LenderB', 'Asia', 'Socially Responsible'... | What is the average loan amount for socially responsible lenders in Asia, grouped by year? | SELECT AVG(LoanAmount) AS Avg_Loan_Amount, LoanYear FROM Loans WHERE LoanType = 'Socially Responsible' AND Location = 'Asia' GROUP BY LoanYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_initiatives (initiative_id INT, initiative_name VARCHAR(50), location VARCHAR(50), carbon_offsets FLOAT); INSERT INTO smart_city_initiatives (initiative_id, initiative_name, location, carbon_offsets) VALUES (1, 'Smart Grid 1', 'CityC', 1000.0), (2, 'Smart Lighting 1', 'CityD', 500.0), (3, 'Smart... | What is the number of smart city initiatives and their average carbon offsets by location? | SELECT location, COUNT(*), AVG(carbon_offsets) FROM smart_city_initiatives GROUP BY location; | gretelai_synthetic_text_to_sql |
cars (id, make, model, year, fuel_type) | Delete records of cars with no fuel type specified in the cars table. | DELETE FROM cars WHERE cars.fuel_type IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (country VARCHAR(255), element VARCHAR(255), quantity INT, year INT); INSERT INTO production (country, element, quantity, year) VALUES ('China', 'Europium', 2000, 2018), ('China', 'Europium', 2500, 2018), ('United States', 'Europium', 1000, 2018), ('United States', 'Europium', 1200, 2018); | What is the average production of Europium per country in 2018? | SELECT country, AVG(quantity) as avg_production FROM production WHERE element = 'Europium' AND year = 2018 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS carbon_offset_initiatives ( initiative_id INT, initiative_name VARCHAR(255), co2_offset FLOAT, PRIMARY KEY (initiative_id)); INSERT INTO carbon_offset_initiatives (initiative_id, initiative_name, co2_offset) VALUES (1, 'Tree Planting', 50), (2, 'Solar Power Installation', 100), (3, 'Wi... | What is the average CO2 offset for each carbon offset initiative in the carbon_offset_initiatives table? | SELECT AVG(co2_offset) FROM carbon_offset_initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_by_region (region VARCHAR(20), quarter VARCHAR(2), year INT, sales_amount FLOAT); INSERT INTO sales_by_region (region, quarter, year, sales_amount) VALUES ('Europe', 'Q3', 2022, 90000.0), ('Asia', 'Q3', 2022, 85000.0), ('Africa', 'Q3', 2022, 95000.0); | Which region had the highest sales in Q3 2022? | SELECT region, MAX(sales_amount) FROM sales_by_region WHERE quarter = 'Q3' AND year = 2022 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE export_info (id INT, element TEXT, location TEXT, company TEXT, date DATE, quantity INT, revenue INT); INSERT INTO export_info (id, element, location, company, date, quantity, revenue) VALUES (1, 'dysprosium', 'Africa', 'Company A', '2019-01-01', 500, 2000000000), (2, 'dysprosium', 'Africa', 'Company B', '... | What is the total amount of dysprosium exported to Africa in the past 3 years by companies with a revenue greater than $1 billion? | SELECT SUM(quantity) FROM export_info WHERE element = 'dysprosium' AND location = 'Africa' AND company IN (SELECT company FROM export_info WHERE revenue > 1000000000) AND extract(year from date) >= 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (Region VARCHAR(255), ParityIndexScore INT); INSERT INTO MentalHealthParity (Region, ParityIndexScore) VALUES ('North', 80), ('South', 85), ('East', 70), ('West', 90); | List the top 3 regions with the highest mental health parity index scores, along with their corresponding scores. | SELECT Region, ParityIndexScore FROM (SELECT Region, ParityIndexScore, ROW_NUMBER() OVER (ORDER BY ParityIndexScore DESC) as Rank FROM MentalHealthParity) as RankedData WHERE Rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE AutoShows (name VARCHAR(20), country VARCHAR(10), year INT); INSERT INTO AutoShows (name, country, year) VALUES ('Tokyo Auto Salon', 'Japan', 2023); | List the auto show events happening in Japan in 2023. | SELECT name FROM AutoShows WHERE country = 'Japan' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractValues (company TEXT, contract_date DATE, contract_value FLOAT); INSERT INTO ContractValues (company, contract_date, contract_value) VALUES ('Contractor D', '2022-03-01', 3000000), ('Contractor E', '2022-07-15', 4000000), ('Contractor F', '2022-11-30', 2500000); | What is the maximum contract value awarded to a defense contractor in Texas in 2022? | SELECT MAX(contract_value) FROM ContractValues WHERE company LIKE '%defense%' AND contract_date BETWEEN '2022-01-01' AND '2022-12-31' AND state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE beneficiaries (program VARCHAR(10), gender VARCHAR(6), date DATE); INSERT INTO beneficiaries (program, gender, date) VALUES ('ProgA', 'Female', '2020-01-01'), ('ProgA', 'Male', '2020-01-05'), ('ProgB', 'Female', '2020-03-02'); | How many female and male beneficiaries were served by each program in 2020? | SELECT program, gender, COUNT(*) FROM beneficiaries WHERE YEAR(date) = 2020 GROUP BY program, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE Performances (id INT, name TEXT, year INT, location TEXT, type TEXT); INSERT INTO Performances (id, name, year, location, type) VALUES (1, 'Performance1', 2015, 'Japan', 'dance'), (2, 'Performance2', 2005, 'USA', 'theater'), (3, 'Performance3', 2018, 'Australia', 'music'); | How many performances were held in Asia or Oceania between 2010 and 2020? | SELECT COUNT(*) FROM Performances WHERE location IN ('Asia', 'Oceania') AND year BETWEEN 2010 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Feedback (Date DATE, Region VARCHAR(50), Service VARCHAR(50), Comment TEXT); INSERT INTO Feedback (Date, Region, Service, Comment) VALUES ('2021-01-01', 'Central', 'Healthcare', 'Great service'), ('2021-01-02', 'Central', 'Healthcare', 'Poor service'), ('2021-02-01', 'North', 'Education', 'Excellent educat... | What is the total number of citizen feedback records received for the 'Housing' service? | SELECT COUNT(*) FROM Feedback WHERE Service = 'Housing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_spending (country VARCHAR(50), continent VARCHAR(50), amount DECIMAL(10,2)); INSERT INTO defense_spending (country, continent, amount) VALUES ('USA', 'North America', 73200000000), ('China', 'Asia', 26100000000), ('Russia', 'Europe', 61000000000), ('Japan', 'Asia', 50500000000), ('India', 'Asia', 5... | What is the total defense spending for each continent? | SELECT continent, SUM(amount) as total_defense_spending FROM defense_spending GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, username VARCHAR(255), followers INT, follow_date DATE); | Get the number of new followers for each user in the last month, pivoted by day of the week in the "users" table | SELECT username, SUM(CASE WHEN DATE_FORMAT(follow_date, '%W') = 'Monday' THEN 1 ELSE 0 END) AS Monday, SUM(CASE WHEN DATE_FORMAT(follow_date, '%W') = 'Tuesday' THEN 1 ELSE 0 END) AS Tuesday, SUM(CASE WHEN DATE_FORMAT(follow_date, '%W') = 'Wednesday' THEN 1 ELSE 0 END) AS Wednesday, SUM(CASE WHEN DATE_FORMAT(follow_date... | gretelai_synthetic_text_to_sql |
CREATE TABLE Humanitarian_Assistance_Missions (id INT, organization VARCHAR(50), year INT, missions INT); | What is the average number of humanitarian assistance missions carried out by each organization in the last 2 years? | SELECT organization, AVG(missions) as avg_missions FROM Humanitarian_Assistance_Missions WHERE year BETWEEN (YEAR(CURRENT_DATE) - 2) AND YEAR(CURRENT_DATE) GROUP BY organization; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (id INT, case_number INT, opened_date DATE); | How many cases were opened for each month in the year 2020? | SELECT MONTH(opened_date) AS Month, COUNT(*) AS NumberOfCases FROM Cases WHERE YEAR(opened_date) = 2020 GROUP BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerDonors (VolunteerID INT, VolunteerName TEXT, DonationAmount DECIMAL(10,2), DonationDate DATE); INSERT INTO VolunteerDonors (VolunteerID, VolunteerName, DonationAmount, DonationDate) VALUES (1, 'Ravi Patel', 1200.00, '2022-06-01'); | Show the details of volunteers who have donated more than $1000? | SELECT * FROM VolunteerDonors WHERE DonationAmount > 1000; | gretelai_synthetic_text_to_sql |
CREATE VIEW JobTitlesDepartments AS SELECT JobTitle, Department FROM TalentAcquisition; | Display the view JobTitlesDepartments | SELECT * FROM JobTitlesDepartments; | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity (id INT, company_id INT, founder_race VARCHAR(255)); INSERT INTO diversity SELECT 1, 1, 'Hispanic'; INSERT INTO diversity SELECT 2, 2, 'Asian'; INSERT INTO diversity SELECT 3, 3, 'Black'; INSERT INTO companies (id, industry, founding_date) SELECT 2, 'Finance', '2005-01-01'; INSERT INTO companies ... | List the number of unique industries and total funding for companies founded by people of color before 2010 | SELECT diversity.founder_race, COUNT(DISTINCT companies.industry) AS unique_industries, SUM(funding.amount) AS total_funding FROM diversity JOIN companies ON diversity.company_id = companies.id JOIN funding ON companies.id = funding.company_id WHERE companies.founding_date < '2010-01-01' AND diversity.founder_race IN (... | gretelai_synthetic_text_to_sql |
CREATE TABLE malware_activity (id INT, ip_address VARCHAR(15), malware_type VARCHAR(255), region VARCHAR(100), last_seen DATE); INSERT INTO malware_activity (id, ip_address, malware_type, region, last_seen) VALUES (1, '192.168.1.1', 'ransomware', 'Asia-Pacific', '2021-11-01'), (2, '10.0.0.1', 'virut', 'North America', ... | Find the number of unique IP addresses associated with malware activity in the 'South America' region in the past month. | SELECT COUNT(DISTINCT ip_address) FROM malware_activity WHERE region = 'South America' AND last_seen >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Brands (Brand_ID INT PRIMARY KEY, Brand_Name TEXT); CREATE TABLE Certifications (Certification_ID INT PRIMARY KEY, Certification_Name TEXT, Brand_ID INT); INSERT INTO Brands (Brand_ID, Brand_Name) VALUES (1, 'Ethical Beauty'), (2, 'Pure Cosmetics'), (3, 'Green Earth'), (4, 'Eco Living'), (5, 'Sustainable S... | Which brands have received the most cruelty-free certifications? | SELECT b.Brand_Name, COUNT(c.Certification_ID) AS Cruelty_Free_Certifications_Count FROM Brands b JOIN Certifications c ON b.Brand_ID = c.Brand_ID GROUP BY b.Brand_ID; | gretelai_synthetic_text_to_sql |
CREATE TABLE bali_tourism (id INT, year INT, revenue INT); INSERT INTO bali_tourism (id, year, revenue) VALUES (1, 2019, 10000000), (2, 2020, 5000000); | What is the total revenue generated by tourism in Bali in 2020? | SELECT SUM(revenue) FROM bali_tourism WHERE year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT); CREATE TABLE fundings (id INT, company_id INT, round TEXT); INSERT INTO companies (id, name) VALUES (1, 'Acme Inc'), (2, 'Zebra Corp'), (3, 'Dino Tech'), (4, 'Elephant Inc'); INSERT INTO fundings (id, company_id, round) VALUES (1, 1, 'Seed'), (2, 1, 'Series A'), (3, 2, 'Seed'... | List the companies that have not received any funding. | SELECT companies.name FROM companies LEFT JOIN fundings ON companies.id = fundings.company_id WHERE fundings.id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_donations_category (id INT, donor_category VARCHAR(50), donor_name VARCHAR(50), donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO monthly_donations_category (id, donor_category, donor_name, donation_amount, donation_date) VALUES (1, 'Regular', 'John Doe', 50, '2022-01-01'), (2, 'One-t... | What is the average monthly donation per donor category? | SELECT donor_category, AVG(donation_amount) as avg_monthly_donation FROM monthly_donations_category GROUP BY donor_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (sale_id INT PRIMARY KEY, sale_date DATE, item_sold VARCHAR(255), quantity INT, sale_price DECIMAL(5,2)); | What is the average revenue per day for the month of January for a given year? | SELECT AVG(SUM(quantity * sale_price)) FROM Sales WHERE sale_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (id INT, name VARCHAR(50), project VARCHAR(50)); INSERT INTO researchers (id, name, project) VALUES (1, 'Alice', 'gene sequencing'), (2, 'Bob', 'biosensor development'), (3, 'Charlie', 'gene sequencing'); | Insert a new row with id '4', name 'Dana', project 'protein folding' into the 'researchers' table. | INSERT INTO researchers (id, name, project) VALUES (4, 'Dana', 'protein folding'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels_4 (id INT, name VARCHAR(255), region VARCHAR(255), year INT); INSERT INTO Vessels_4 (id, name, region, year) VALUES (1, 'African Wave', 'Africa', 2021); INSERT INTO Vessels_4 (id, name, region, year) VALUES (2, 'Ocean Splash', 'Africa', 2022); INSERT INTO Vessels_4 (id, name, region, year) VALUES (... | List all vessels inspected in 'Africa' during 2021 and 2022. | SELECT name FROM Vessels_4 WHERE region = 'Africa' AND year IN (2021, 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (name VARCHAR(25), budget INT, funding_source VARCHAR(15)); | Insert new records of art programs for underrepresented communities, each with a budget of 10000 and a public funding source. | INSERT INTO programs (name, budget, funding_source) VALUES ('Art for Indigenous Youth', 10000, 'public'), ('Art for Disability Community', 10000, 'public'); | gretelai_synthetic_text_to_sql |
CREATE TABLE asia_lang_progs (id INT, org_name TEXT, year INT, num_progs INT); INSERT INTO asia_lang_progs (id, org_name, year, num_progs) VALUES (1, 'Shanghai Language Institute', 2015, 100), (2, 'Tokyo Language School', 2016, 120), (3, 'Beijing Language University', 2017, 150), (4, 'New Delhi Language Academy', 2018,... | What is the percentage change in the number of language preservation programs offered in Asia between 2015 and 2020? | SELECT (SUM(CASE WHEN year = 2020 THEN num_progs ELSE 0 END) - SUM(CASE WHEN year = 2015 THEN num_progs ELSE 0 END)) * 100.0 / SUM(CASE WHEN year = 2015 THEN num_progs ELSE 0 END) as pct_change FROM asia_lang_progs WHERE org_name IN ('Shanghai Language Institute', 'Tokyo Language School', 'Beijing Language University',... | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, user_country VARCHAR(255)); CREATE TABLE streams (stream_id INT, song_id INT, user_id INT, stream_date DATE); | Find the number of unique users who have streamed a song on each day in the US. | SELECT stream_date, COUNT(DISTINCT user_id) as unique_users FROM streams st JOIN users u ON st.user_id = u.user_id WHERE u.user_country = 'United States' GROUP BY stream_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_storage (country VARCHAR(50), operational BOOLEAN, year INT); INSERT INTO carbon_storage (country, operational, year) VALUES ('United States', true, 2020), ('Germany', true, 2020), ('Saudi Arabia', true, 2020), ('Norway', false, 2020); | List the number of carbon capture and storage facilities in the United States, Germany, and Saudi Arabia, as of 2020. | SELECT country, COUNT(*) FROM carbon_storage WHERE country IN ('United States', 'Germany', 'Saudi Arabia') AND operational = true GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE immigrants (id INT, name VARCHAR(100), education VARCHAR(50)); INSERT INTO immigrants (id, name, education) VALUES (1, 'Immigrant 1', 'High School'); INSERT INTO immigrants (id, name, education) VALUES (2, 'Immigrant 2', 'Bachelor’s Degree'); | What is the highest level of education achieved by immigrants in Germany? | SELECT education FROM (SELECT education, ROW_NUMBER() OVER (ORDER BY education DESC) as row_num FROM immigrants) immigrants_ranked WHERE row_num = 1; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists mining;CREATE TABLE mining.impact (id INT, site STRING, ias_score INT);INSERT INTO mining.impact (id, site, ias_score) VALUES (1, 'site Z', 65), (2, 'site W', 75), (3, 'site X', 85); | Show environmental impact score for site 'Z' and 'W'. | SELECT ias_score FROM mining.impact WHERE site IN ('site Z', 'site W'); | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_lending (id INT, loan_amount FLOAT, country VARCHAR(255)); INSERT INTO socially_responsible_lending (id, loan_amount, country) VALUES (1, 5000, 'USA'), (2, 7000, 'USA'), (3, 8000, 'USA'); | What is the maximum loan amount for socially responsible lending in the United States? | SELECT MAX(loan_amount) FROM socially_responsible_lending WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE r_d_expenditure (drug VARCHAR(20), division VARCHAR(20), date DATE, expenditure NUMERIC(12, 2)); INSERT INTO r_d_expenditure (drug, division, date, expenditure) VALUES ('DrugA', 'Oncology', '2023-01-01', 150000.00), ('DrugB', 'Cardiology', '2023-01-01', 120000.00), ('DrugA', 'Neurology', '2023-01-01', 9000... | What was the R&D expenditure for each drug in Q1 2023, pivoted by division? | SELECT drug, SUM(CASE WHEN division = 'Oncology' THEN expenditure ELSE 0 END) AS oncology_expenditure, SUM(CASE WHEN division = 'Cardiology' THEN expenditure ELSE 0 END) AS cardiology_expenditure FROM r_d_expenditure WHERE date BETWEEN '2023-01-01' AND '2023-03-31' GROUP BY drug; | gretelai_synthetic_text_to_sql |
CREATE TABLE TrainingData (EmployeeID INT, Department TEXT, Training TEXT); INSERT INTO TrainingData (EmployeeID, Department, Training) VALUES (1, 'Sales', 'Diversity'); | How many employees have undergone diversity training in the Sales department? | SELECT COUNT(*) FROM TrainingData WHERE Department = 'Sales' AND Training = 'Diversity'; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_products (id INT PRIMARY KEY, name TEXT, safety_recall BOOLEAN); | Update the name of food product with id 1 to 'Organic Quinoa Puffs' | UPDATE food_products SET name = 'Organic Quinoa Puffs' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ratings (hotel_id INT, ota TEXT, city TEXT, hotel_class TEXT, rating FLOAT); INSERT INTO Ratings (hotel_id, ota, city, hotel_class, rating) VALUES (1, 'Agoda', 'Sydney', 'boutique', 4.7), (2, 'Agoda', 'Sydney', 'boutique', 4.6), (3, 'Agoda', 'Sydney', 'non-boutique', 4.3); | What is the average rating for 'boutique' hotels in 'Sydney' on 'Agoda'? | SELECT AVG(rating) FROM Ratings WHERE ota = 'Agoda' AND city = 'Sydney' AND hotel_class = 'boutique'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, caseworker_id INT, date DATE); INSERT INTO cases (id, caseworker_id, date) VALUES (1, 101, '2020-01-01'), (2, 101, '2020-01-10'), (3, 102, '2020-02-01'); | How many cases were handled by each caseworker in the justice department, with the total number of cases and cases per caseworker? | SELECT COUNT(*) OVER (PARTITION BY caseworker_id) AS cases_per_caseworker, COUNT(*) AS total_cases FROM cases; | gretelai_synthetic_text_to_sql |
CREATE TABLE language_preservation (id INT PRIMARY KEY, name TEXT, location TEXT); | Add a new language preservation project in 'Mexico' | INSERT INTO language_preservation (id, name, location) VALUES (1, 'Mixtec Language', 'Mexico'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredient (product_id INT, ingredient TEXT, origin TEXT); | Find brands that use ingredients from 'India' and have no safety records after 2022-01-01 | SELECT brand FROM ingredient INNER JOIN (SELECT product_id FROM safety_record WHERE report_date > '2022-01-01' EXCEPT SELECT product_id FROM safety_record) ON ingredient.product_id = product_id WHERE origin = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_projects (project_id SERIAL PRIMARY KEY, square_footage INTEGER, is_sustainable BOOLEAN); INSERT INTO sustainable_projects (project_id, square_footage, is_sustainable) VALUES (1, 15000, true), (2, 20000, false), (3, 25000, true); | What is the total square footage of sustainable building projects? | SELECT SUM(square_footage) FROM sustainable_projects WHERE is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpaceAgency (ID INT, Name VARCHAR(50), Country VARCHAR(50)); CREATE TABLE SpaceMission (AgencyID INT, Name VARCHAR(50), LaunchDate DATE, Duration INT); | What is the average duration of space missions per agency? | SELECT sa.Name, AVG(sm.Duration) AS AvgDuration FROM SpaceAgency sa JOIN SpaceMission sm ON sa.ID = sm.AgencyID GROUP BY sa.Name; | 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.