context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE mapping_projects (project_id INT, name VARCHAR(255), area_km FLOAT);
Get the total area of each ocean floor mapping project in square kilometers.
SELECT name, SUM(area_km) AS total_area FROM mapping_projects GROUP BY name;
gretelai_synthetic_text_to_sql
CREATE TABLE autonomous_vehicles (vehicle_id INT, manufacturer VARCHAR(20), has_autonomous_features BOOLEAN); CREATE TABLE accidents (accident_id INT, vehicle_id INT, date DATE);
What is the total number of accidents for vehicles with autonomous driving features?
SELECT COUNT(*) FROM accidents a JOIN autonomous_vehicles av ON a.vehicle_id = av.vehicle_id WHERE av.has_autonomous_features = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE mlb_games (team TEXT, wins INT, year INT); CREATE TABLE nba_games (team TEXT, wins INT, year INT); CREATE TABLE nfl_games (team TEXT, wins INT, year INT);
Which teams have the most wins in the MLB, NBA, and NFL in the last 5 years?
SELECT team, SUM(wins) FROM (SELECT team, wins FROM mlb_games WHERE year BETWEEN 2017 AND 2021 UNION ALL SELECT team, wins FROM nba_games WHERE year BETWEEN 2017 AND 2021 UNION ALL SELECT team, wins FROM nfl_games WHERE year BETWEEN 2017 AND 2021) combined_games GROUP BY team ORDER BY SUM(wins) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE ai_models (model_name TEXT, explainable_ai_technique TEXT, usage_count INT); INSERT INTO ai_models (model_name, explainable_ai_technique, usage_count) VALUES ('ModelA', 'Feature Importance', 20), ('ModelA', 'SHAP', 15), ('ModelB', 'Partial Dependence Plot', 18), ('ModelB', 'Feature Importance', 25);
Which explainable AI techniques were used in each AI model and how many times were they used?
SELECT model_name, explainable_ai_technique, usage_count FROM ai_models;
gretelai_synthetic_text_to_sql
CREATE TABLE artifact_categories (category_id INT, category_name TEXT); INSERT INTO artifact_categories (category_id, category_name) VALUES (1, 'Pottery'), (2, 'Stone Tools'), (3, 'Jewelry'); CREATE TABLE artifacts (artifact_id INT, site_id INT, category_id INT, weight FLOAT); INSERT INTO artifacts (artifact_id, site_i...
What is the total weight of all artifacts in the 'Stone' category from the 'Peru' excavation sites?
SELECT SUM(weight) as total_weight FROM artifacts a JOIN excavation_sites s ON a.site_id = s.site_id WHERE s.country = 'Peru' AND a.category_id = 2;
gretelai_synthetic_text_to_sql
CREATE TABLE wearable_owners (member_id INT, has_wearable BOOLEAN);
List all members who have attended a workout and own a wearable device
SELECT DISTINCT m.member_id FROM member_profiles m INNER JOIN wearable_owners wo ON m.member_id = wo.member_id INNER JOIN workout_records wr ON m.member_id = wr.member_id WHERE wo.has_wearable = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_building_projects (project_id INT, project_name VARCHAR(100), state VARCHAR(50), completion_year INT); INSERT INTO sustainable_building_projects (project_id, project_name, state, completion_year) VALUES (1, 'GreenTowers', 'California', 2021), (2, 'EcoHQ', 'Texas', 2020), (3, 'SolarVilla', 'Wash...
What is the count of sustainable building projects with a completion year after 2019?
SELECT COUNT(*) FROM sustainable_building_projects WHERE completion_year > 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE AutonomousDrivingGrants (Id INT, Country VARCHAR(255), Amount FLOAT, Year INT); INSERT INTO AutonomousDrivingGrants (Id, Country, Amount, Year) VALUES (1, 'USA', 1000000, 2021), (2, 'Canada', 800000, 2021), (3, 'Germany', 1200000, 2021), (4, 'Japan', 900000, 2021);
What are the total autonomous driving research grants awarded by country in 2021?
SELECT Country, SUM(Amount) AS TotalGrants FROM AutonomousDrivingGrants WHERE Year = 2021 GROUP BY Country;
gretelai_synthetic_text_to_sql
CREATE TABLE Chemicals (Id INT, Name VARCHAR(255), Manufacturing_Country VARCHAR(255)); CREATE TABLE Safety_Protocols (Id INT, Chemical_Id INT, Safety_Measure VARCHAR(255)); INSERT INTO Chemicals (Id, Name, Manufacturing_Country) VALUES (1, 'Potassium Chloride', 'Germany'); INSERT INTO Safety_Protocols (Id, Chemical_Id...
What safety measures are required for handling chemicals manufactured in Germany?
SELECT Chemicals.Name, Safety_Protocols.Safety_Measure FROM Chemicals INNER JOIN Safety_Protocols ON Chemicals.Id = Safety_Protocols.Chemical_Id WHERE Chemicals.Manufacturing_Country = 'Germany';
gretelai_synthetic_text_to_sql
CREATE TABLE Suppliers (id INT, name TEXT, community TEXT); INSERT INTO Suppliers VALUES (1, 'Supplier1', 'Indigenous'), (2, 'Supplier2', 'Black-owned'), (3, 'Supplier3', 'Women-owned'), (4, 'Supplier4', 'LGBTQ+'), (5, 'Supplier5', 'Refugee-owned'); CREATE TABLE SustainableMaterials (id INT, supplier_id INT, material T...
List the names of suppliers from historically underrepresented communities that provide sustainable materials.
SELECT s.name FROM Suppliers s INNER JOIN SustainableMaterials sm ON s.id = sm.supplier_id WHERE s.community IN ('Indigenous', 'Black-owned', 'Women-owned', 'LGBTQ+', 'Refugee-owned');
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_forest(country VARCHAR(255), area INT); INSERT INTO sustainable_forest(country, area) VALUES ('Canada', 120000), ('USA', 90000), ('Brazil', 70000), ('Indonesia', 60000);
How many hectares of forest are managed sustainably in the entire dataset?
SELECT SUM(area) FROM sustainable_forest;
gretelai_synthetic_text_to_sql
CREATE TABLE cybersecurity_strategies (year INT, strategy_name TEXT); INSERT INTO cybersecurity_strategies (year, strategy_name) VALUES (2018, 'Firewall Implementation'), (2019, 'Intrusion Detection'), (2020, 'Penetration Testing'), (2021, 'Security Information and Event Management');
Which cybersecurity strategies were implemented in 'year_2020' from the 'cybersecurity_strategies' table?
SELECT strategy_name FROM cybersecurity_strategies WHERE year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE tourism_impact (city TEXT, economic_impact INT); INSERT INTO tourism_impact (city, economic_impact) VALUES ('Venice', 1500000), ('Rome', 2000000);
What is the local economic impact of tourism in Venice?
SELECT economic_impact FROM tourism_impact WHERE city = 'Venice';
gretelai_synthetic_text_to_sql
CREATE TABLE virtual_tours (hotel_id INT, views INT, clicks INT); CREATE TABLE hotels_geo (id INT PRIMARY KEY, hotel_id INT, country VARCHAR(255));
What is the total number of virtual tour views for hotels in 'Canada'?
SELECT SUM(views) FROM virtual_tours v JOIN hotels_geo hg ON v.hotel_id = hg.hotel_id WHERE hg.country = 'Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE waste_treatment_methods (id INT, name VARCHAR(255), state VARCHAR(255)); INSERT INTO waste_treatment_methods (id, name, state) VALUES (1, 'Landfill', 'California'), (2, 'Incineration', 'California'), (3, 'Recycling', 'California'), (4, 'Composting', 'California'); CREATE TABLE co2_emissions (treatment_meth...
What is the total CO2 emissions for each waste treatment method in the state of California?
SELECT wtm.name as treatment_method, SUM(ce.emissions) as total_emissions FROM waste_treatment_methods wtm JOIN co2_emissions ce ON wtm.id = ce.treatment_method_id WHERE wtm.state = 'California' GROUP BY wtm.name;
gretelai_synthetic_text_to_sql
CREATE TABLE staff (id INT PRIMARY KEY, name VARCHAR(255), role VARCHAR(255), department VARCHAR(255)); INSERT INTO staff (id, name, role, department) VALUES (1, 'Eve', 'Data Manager', 'climate_adaptation'), (2, 'Frank', 'Project Manager', 'climate_mitigation'), (3, 'Grace', 'Finance Analyst', 'climate_finance'), (4, '...
Who is responsible for climate adaptation data?
SELECT name FROM staff WHERE role = 'Data Manager' AND department = 'climate_adaptation';
gretelai_synthetic_text_to_sql
CREATE TABLE lifelong_learning (id INT, program_name VARCHAR(50), start_date DATE, gender VARCHAR(10)); INSERT INTO lifelong_learning (id, program_name, start_date, gender) VALUES (1, 'Explore 101', '2022-01-01', 'Female'), (2, 'Discover 202', '2021-10-15', 'Male');
How many lifelong learning programs started by gender?
SELECT gender, COUNT(*) FROM lifelong_learning GROUP BY gender;
gretelai_synthetic_text_to_sql
CREATE TABLE mobile_subscribers (subscriber_id INT, network_type VARCHAR(10), state VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id, network_type, state) VALUES (1, '4G', 'WA'), (2, '3G', 'NY'), (3, '4G', 'WA'), (4, '5G', 'CA'), (5, '3G', 'NY');
What is the percentage of mobile subscribers who are using 4G or higher network in each state?
SELECT state, 100.0 * SUM(CASE WHEN network_type IN ('4G', '5G') THEN 1 ELSE 0 END) / COUNT(*) as pct_4g_or_higher FROM mobile_subscribers GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE labor_hours (project_id INT, state VARCHAR(2), building_type VARCHAR(20), labor_hours INT); INSERT INTO labor_hours (project_id, state, building_type, labor_hours) VALUES (1, 'TX', 'Residential', 1500), (2, 'TX', 'Residential', 1600), (3, 'TX', 'Commercial', 2000);
How many hours of labor are required on average to complete a sustainable residential building project in Texas?
SELECT AVG(labor_hours) FROM labor_hours WHERE state = 'TX' AND building_type = 'Residential';
gretelai_synthetic_text_to_sql
CREATE TABLE UnionMembership (id INT, sector VARCHAR(255), members INT); INSERT INTO UnionMembership (id, sector, members) VALUES (1, 'Transportation', 7000);
What is the total number of Union members in the Transportation sector?
SELECT SUM(members) FROM UnionMembership WHERE sector = 'Transportation';
gretelai_synthetic_text_to_sql
CREATE TABLE Concerts (year INT, revenue FLOAT); INSERT INTO Concerts (year, revenue) VALUES (2018, 1000000), (2019, 1500000), (2020, 800000), (2021, 1200000);
What was the total revenue for concert ticket sales in 2020?
SELECT SUM(revenue) FROM Concerts WHERE year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE cases (case_id INT, open_date DATE, close_date DATE); INSERT INTO cases (case_id, open_date, close_date) VALUES (1, '2022-04-01', '2022-04-15'), (2, '2022-05-01', NULL), (3, '2022-02-01', '2022-02-28');
How many cases have been opened and closed in the last 3 months?
SELECT COUNT(*) FROM cases WHERE open_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH) AND (close_date IS NULL OR close_date < DATE_SUB(CURRENT_DATE, INTERVAL 3 MONTH));
gretelai_synthetic_text_to_sql
CREATE TABLE Hospitals (HospitalID INT, CulturalCompetencyScore DECIMAL(5,2), HospitalSystem VARCHAR(255), ReportDate DATE); INSERT INTO Hospitals (HospitalID, CulturalCompetencyScore, HospitalSystem, ReportDate) VALUES (1, 85.6, 'Mount Sinai Health System', '2022-01-01'); INSERT INTO Hospitals (HospitalID, CulturalCom...
What is the cultural competency score for each hospital system in the last quarter?
SELECT ReportDate, CulturalCompetencyScore, HospitalSystem FROM Hospitals WHERE ReportDate >= DATEADD(quarter, -1, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE smart_cities (city_name TEXT, adoption_date DATE, budget INT, location TEXT); INSERT INTO smart_cities (city_name, adoption_date, budget, location) VALUES ('Nairobi', '2020-01-01', 8000000, 'Africa'), ('Accra', '2019-06-15', 12000000, 'Africa'), ('Cairo', '2018-09-20', 3000000, 'Africa');
What are the adoption dates for smart city technologies in cities with budgets less than $5 million in Africa?
SELECT city_name, adoption_date FROM smart_cities WHERE budget < 5000000 AND location = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE players (player_id INT, name VARCHAR(50), last_name VARCHAR(50), career_home_runs INT); INSERT INTO players (player_id, name, last_name, career_home_runs) VALUES (1, 'Hank', 'Aaron', 755), (2, 'Babe', 'Ruth', 714);
Which players have the most home runs in their career?
SELECT last_name, career_home_runs FROM players ORDER BY career_home_runs DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE military_patents (country VARCHAR(50), patent_number INTEGER); INSERT INTO military_patents (country, patent_number) VALUES ('USA', 12345), ('USA', 67890), ('UK', 34567), ('Canada', 90123), ('Australia', 45678);
Find the total number of military innovation patents filed by the USA and its allies?
SELECT SUM(patent_number) FROM military_patents WHERE country IN ('USA', 'UK', 'Canada', 'Australia');
gretelai_synthetic_text_to_sql
CREATE TABLE DispensaryStrainPrices (DispensaryName TEXT, StrainName TEXT, PricePerPound FLOAT); INSERT INTO DispensaryStrainPrices (DispensaryName, StrainName, PricePerPound) VALUES ('Euphoria', 'Gelato', 2000.00), ('Elevate', 'Gelato', 2100.00), ('Essence', 'Gelato', 1900.00);
How can I update the price of a specific strain in all dispensaries?
UPDATE DispensaryStrainPrices SET PricePerPound = 2200.00 WHERE StrainName = 'Gelato';
gretelai_synthetic_text_to_sql
CREATE TABLE donors (id INT, name TEXT, region TEXT); INSERT INTO donors (id, name, region) VALUES (1, 'John Doe', 'Asia'), (2, 'Jane Smith', 'Europe'), (3, 'Pedro Alvarez', 'Americas'), (4, 'Sophia Lee', 'Asia'), (5, 'Ali Mohammed', 'Africa');
What's the total number of donors from each region?
SELECT region, COUNT(*) FROM donors GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE pakistan_projects (org_id INT, org_name VARCHAR(50), project_type VARCHAR(30), project_value INT); INSERT INTO pakistan_projects (org_id, org_name, project_type, project_value) VALUES (1, 'World Bank', 'infrastructure', 2000000), (2, 'ADB', 'infrastructure', 1500000), (3, 'EU', 'education', 1000000); CREAT...
What is the total value of infrastructure projects in Pakistan and Nepal funded by international organizations?
SELECT SUM(p.project_value + n.project_value) FROM pakistan_projects p INNER JOIN nepal_projects n ON p.org_name = n.org_name AND p.project_type = n.project_type;
gretelai_synthetic_text_to_sql
CREATE TABLE nasa_missions (id INT, mission_cost FLOAT);
What is the total cost of all NASA missions?
SELECT SUM(mission_cost) FROM nasa_missions;
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (supplier_id INT, supplier_name TEXT, country TEXT); INSERT INTO suppliers (supplier_id, supplier_name, country) VALUES (1, 'Supplier 4', 'Brazil'), (2, 'Supplier 5', 'India'), (3, 'Supplier 6', 'Germany'), (4, 'Supplier 7', 'Japan'); CREATE TABLE certifications (certification_id INT, supplier_id...
Display the number of distinct certifications held by each supplier, arranged in descending order by the count?
SELECT suppliers.supplier_name, COUNT(DISTINCT certifications.certification_type) AS certification_count FROM suppliers JOIN certifications ON suppliers.supplier_id = certifications.supplier_id GROUP BY suppliers.supplier_name ORDER BY certification_count DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE national_security_budget (id INT, country TEXT, budget INT, region TEXT); INSERT INTO national_security_budget (id, country, budget, region) VALUES (1, 'USA', 10000000, 'North America'), (2, 'Canada', 8000000, 'North America');
What is the total budget for national security in the North American region and the budget for each country?
SELECT ns.region, ns.country, AVG(ns.budget) as avg_budget FROM national_security_budget ns GROUP BY ns.region, ns.country;
gretelai_synthetic_text_to_sql
CREATE TABLE UpcycledClothing (id INT, revenue DECIMAL);
What is the total revenue generated by upcycled clothing sales?
select sum(revenue) from UpcycledClothing;
gretelai_synthetic_text_to_sql
CREATE TABLE products (product_id INT, price DECIMAL(5,2), is_cruelty_free BOOLEAN); INSERT INTO products (product_id, price, is_cruelty_free) VALUES (1, 25.99, true), (2, 30.99, false), (3, 15.99, true), (4, 35.99, true), (5, 12.99, false);
Get the number of cruelty-free products with a price above $30.
SELECT COUNT(*) FROM products WHERE is_cruelty_free = true AND price > 30;
gretelai_synthetic_text_to_sql
CREATE TABLE visit_summary (destination_code CHAR(5), year INT, visitor_count INT); INSERT INTO visit_summary VALUES ('PARIS', 2020, 600), ('PARIS', 2021, 700), ('LOND', 2020, 550), ('LOND', 2021, 650);
What is the percentage change in visitor count for each destination between 2020 and 2021?
SELECT destination_code, ((visitor_count_2021 - visitor_count_2020) * 100.0 / NULLIF(visitor_count_2020, 0)) AS percentage_change FROM (SELECT destination_code, SUM(CASE WHEN year = 2021 THEN visitor_count ELSE 0 END) AS visitor_count_2021, SUM(CASE WHEN year = 2020 THEN visitor_count ELSE 0 END) AS visitor_count_2020 ...
gretelai_synthetic_text_to_sql
CREATE TABLE event_dates (event_date DATE, event_id INT);
What is the total number of tickets sold by date for a specific event?
SELECT e.event_name, COUNT(t.ticket_id) FROM event_dates ed JOIN tickets t ON ed.event_date = t.event_date JOIN events e ON t.event_id = e.event_id WHERE e.event_id = 1 GROUP BY ed.event_date;
gretelai_synthetic_text_to_sql
CREATE TABLE SportsCars (VIN VARCHAR(20), Model VARCHAR(20), Horsepower INT, ProductionYear INT); INSERT INTO SportsCars (VIN, Model, Horsepower, ProductionYear) VALUES ('AA11BB2233', 'ModelX', 500, 2022), ('CC22DD3344', 'ModelY', 600, 2022);
What is the maximum horsepower of sports cars released in 2022?
SELECT MAX(Horsepower) FROM SportsCars WHERE ProductionYear = 2022 AND Model LIKE '%Sports Car%';
gretelai_synthetic_text_to_sql
CREATE TABLE Employees (Employee_ID INT, Department VARCHAR(50), Salary DECIMAL(5,2)); INSERT INTO Employees (Employee_ID, Department, Salary) VALUES (1, 'Engineering', 80000.00), (2, 'Marketing', 65000.00), (3, 'Engineering', 85000.00), (4, 'Marketing', 70000.00);
What are the average salaries for employees in the 'Engineering' department, compared to those in the 'Marketing' department?
SELECT AVG(Salary) FROM Employees WHERE Department = 'Engineering' UNION ALL SELECT AVG(Salary) FROM Employees WHERE Department = 'Marketing'
gretelai_synthetic_text_to_sql
CREATE TABLE unions (id INT, name VARCHAR(255), industry VARCHAR(255), member_age INT); INSERT INTO unions (id, name, industry, member_age) VALUES (1, 'Union A', 'healthcare', 40), (2, 'Union B', 'healthcare', 45), (3, 'Union C', 'healthcare', 35);
What is the average age of all members in unions with a 'healthcare' industry classification?
SELECT AVG(member_age) FROM unions WHERE industry = 'healthcare';
gretelai_synthetic_text_to_sql
CREATE SCHEMA IF NOT EXISTS arctic_db; CREATE TABLE IF NOT EXISTS arctic_animals (id INT PRIMARY KEY, species TEXT, population INT);
Add a new species to the arctic_animals table
INSERT INTO arctic_animals (id, species, population) VALUES (1, 'polar bear cub', 500);
gretelai_synthetic_text_to_sql
CREATE TABLE user_posts (user_id INT, age INT, country VARCHAR(255), brand VARCHAR(255));
What are the top 5 most mentioned brands in user posts from users aged 18-24 in the USA?
SELECT brand, COUNT(*) AS mentions FROM user_posts WHERE age BETWEEN 18 AND 24 AND country = 'USA' GROUP BY brand LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE sites (id INT, name TEXT, country TEXT, admission_fee FLOAT); INSERT INTO sites (id, name, country, admission_fee) VALUES (1, 'Alhambra', 'Spain', 15), (2, 'Sagrada Familia', 'Spain', 20);
Update the admission fee for the 'Alhambra' in Spain to 18 Euros.
UPDATE sites SET admission_fee = 18 WHERE name = 'Alhambra' AND country = 'Spain';
gretelai_synthetic_text_to_sql
CREATE TABLE Equipment (id INT, equipment_type VARCHAR(255), manufacturer VARCHAR(255), production_year INT, unit_cost DECIMAL(10,2)); CREATE TABLE Shipments (id INT, equipment_type VARCHAR(255), quantity INT, destination VARCHAR(255), delivery_date DATE, equipment_id INT); INSERT INTO Equipment (id, equipment_type, ma...
What is the total cost of all shipments to the UK?
SELECT Equipment.equipment_type, (Equipment.unit_cost * Shipments.quantity) AS total_cost FROM Equipment INNER JOIN Shipments ON Equipment.id = Shipments.equipment_id WHERE Shipments.destination = 'UK';
gretelai_synthetic_text_to_sql
CREATE TABLE news_articles (article_id INT PRIMARY KEY, title TEXT, topic TEXT, author TEXT, publication_date DATE);
What is the earliest publication date for each topic?
SELECT topic, MIN(publication_date) FROM news_articles GROUP BY topic;
gretelai_synthetic_text_to_sql
CREATE TABLE european_conservation_areas (id INT, name VARCHAR(255), country VARCHAR(255)); CREATE TABLE community_education_programs (id INT, conservation_area_id INT, program_type VARCHAR(255), date DATE, attendees INT);
How many community education programs were conducted in the European conservation areas, broken down by country and program type?
SELECT eca.country, pe.program_type, COUNT(pe.id) as program_count FROM european_conservation_areas eca JOIN community_education_programs pe ON eca.id = pe.conservation_area_id GROUP BY eca.country, pe.program_type;
gretelai_synthetic_text_to_sql
CREATE TABLE ProgramBudget (ProgramID int, ProgramName varchar(50), BudgetAmount numeric, BudgetYear int);
What was the total budget for each program in the year 2020?
SELECT ProgramName, SUM(BudgetAmount) as TotalBudget FROM ProgramBudget WHERE BudgetYear = 2020 GROUP BY ProgramName;
gretelai_synthetic_text_to_sql
CREATE TABLE Accidents (Id INT, VesselId INT, Date DATE, Injuries INT); INSERT INTO Accidents (Id, VesselId, Date, Injuries) VALUES (2, 2, '2021-02-01', 2);
List all accidents for vessels from Indonesia, if any.
SELECT V.Name, A.Date, A.Injuries FROM Vessels V INNER JOIN Accidents A ON V.Id = A.VesselId WHERE V.Flag = 'Indonesia';
gretelai_synthetic_text_to_sql
CREATE TABLE fishing_vessels (id INT, name VARCHAR(255), location VARCHAR(255), length FLOAT); INSERT INTO fishing_vessels (id, name, location, length) VALUES (1, 'Indian Ocean Tuna Fleet', 'Indian Ocean', 500); INSERT INTO fishing_vessels (id, name, location, length) VALUES (2, 'South Pacific Squid Fleet', 'South Paci...
What is the total number of fishing vessels in the Indian Ocean and South Pacific regions?
SELECT SUM(length) FROM fishing_vessels WHERE location IN ('Indian Ocean', 'South Pacific');
gretelai_synthetic_text_to_sql
CREATE TABLE DonorHistory (donor_id INT, donation_date DATE, donation_amount DECIMAL(10,2)); INSERT INTO DonorHistory (donor_id, donation_date, donation_amount) VALUES (1, '2021-01-01', 50.00), (1, '2021-02-01', 100.00), (2, '2021-03-01', 25.00);
What was the total number of donations made by each donor in '2021'?
SELECT donor_id, COUNT(*) AS total_donations FROM DonorHistory WHERE YEAR(donation_date) = 2021 GROUP BY donor_id;
gretelai_synthetic_text_to_sql
CREATE SCHEMA asia; CREATE TABLE asia.hotels (hotel_id INT, hotel_name VARCHAR(50), city VARCHAR(50), country VARCHAR(50));
What is the number of hotels in each city for the asia schema?
SELECT city, COUNT(*) FROM asia.hotels GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE africa_tourism (country VARCHAR(50), year INT, ecotourism_visitors INT); INSERT INTO africa_tourism (country, year, ecotourism_visitors) VALUES ('Kenya', 2025, 500000), ('Tanzania', 2025, 400000), ('South Africa', 2025, 600000), ('Namibia', 2025, 300000), ('Botswana', 2025, 350000);
Find the top 3 most visited African countries for ecotourism in 2025.
SELECT country, ecotourism_visitors FROM africa_tourism WHERE year = 2025 ORDER BY ecotourism_visitors DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE project_types (project_id INT, name VARCHAR(50), location VARCHAR(50), project_type VARCHAR(50)); INSERT INTO project_types (project_id, name, location, project_type) VALUES (1, 'India Project 1', 'India', 'Solar');
List all the projects in India with their types
SELECT * FROM project_types WHERE location = 'India';
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);
What is the total budget allocated for education and healthcare services in 2020?
SELECT SUM(Budget) FROM Budget WHERE Year = 2020 AND Service IN ('Education', 'Healthcare');
gretelai_synthetic_text_to_sql
CREATE TABLE MentalHealthParity (LawID INT PRIMARY KEY, LawName TEXT, LawDescription TEXT, PassedDate DATE); INSERT INTO MentalHealthParity (LawID, LawName, LawDescription, PassedDate) VALUES (1, 'Parity Act 2020', 'Requires insurers to cover mental health at the same level as physical health', '2020-01-01');
Update mental health parity laws description
UPDATE MentalHealthParity SET LawDescription = 'Requires insurers to cover mental and behavioral health equally with physical health' WHERE LawName = 'Parity Act 2020';
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy (country VARCHAR(50), year INT, solar_generation FLOAT, wind_generation FLOAT, hydro_generation FLOAT);
Insert new records for renewable energy generation in 2021 for Australia, India, and Brazil
INSERT INTO renewable_energy (country, year, solar_generation, wind_generation, hydro_generation) VALUES ('Australia', 2021, 25.6, 12.8, 38.9), ('India', 2021, 45.3, 32.1, 118.4), ('Brazil', 2021, 18.7, 14.6, 321.5);
gretelai_synthetic_text_to_sql
CREATE TABLE wind_farms (id INT, country VARCHAR(255), name VARCHAR(255), capacity FLOAT, start_date DATE, end_date DATE); INSERT INTO wind_farms (id, country, name, capacity, start_date, end_date) VALUES (4, 'France', 'Windfarm C', 60.5, '2021-01-01', '2026-12-31'), (5, 'France', 'Windfarm D', 45.3, '2022-01-01', '202...
Delete all wind farms in France from the 'wind_farms' table that have an installed capacity of more than 55.0
DELETE FROM wind_farms WHERE country = 'France' AND capacity > 55.0;
gretelai_synthetic_text_to_sql
CREATE TABLE broadband_subscribers (subscriber_id INT PRIMARY KEY, country_code CHAR(3), data_usage FLOAT); INSERT INTO broadband_subscribers (subscriber_id, country_code, data_usage) VALUES (1, 'USA', 50.0), (2, 'USA', 60.0), (3, 'CAN', 80.0), (4, 'CAN', 90.0);
What is the average monthly data usage per customer in each country?
SELECT s.country_code, AVG(s.data_usage) as avg_data_usage FROM broadband_subscribers s GROUP BY s.country_code;
gretelai_synthetic_text_to_sql
CREATE TABLE ArtCollection (id INT, artist VARCHAR(50), title VARCHAR(100), year INT, type VARCHAR(50), PRIMARY KEY (id));
Delete all records with 'Unknown' artists from the 'ArtCollection' table.
DELETE FROM ArtCollection WHERE artist = 'Unknown';
gretelai_synthetic_text_to_sql
CREATE TABLE Spacecraft_Missions_Count (id INT, spacecraft_id INT, astronaut_id INT, mission_name VARCHAR(100), mission_date DATE); INSERT INTO Spacecraft_Missions_Count (id, spacecraft_id, astronaut_id, mission_name, mission_date) VALUES (1, 1, 1, 'Apollo 11', '1969-07-16');
List astronauts who have flown spacecraft with the most missions, along with the number of missions.
SELECT astronaut_id, COUNT(*) as mission_count FROM Spacecraft_Missions_Count GROUP BY astronaut_id ORDER BY mission_count DESC LIMIT 1
gretelai_synthetic_text_to_sql
CREATE TABLE SafetyIncidents (id INT, vessel_id INT, incident_type VARCHAR(20), incident_time TIMESTAMP); INSERT INTO SafetyIncidents (id, vessel_id, incident_type, incident_time) VALUES (1, 101, 'Equipment Failure', '2021-03-11 09:30:00');
Count the number of safety incidents for each vessel in the SafetyIncidents table, for the first half of 2021.
SELECT vessel_id, COUNT(*) as num_incidents FROM SafetyIncidents WHERE incident_time > '2021-01-01 00:00:00' AND incident_time < '2021-07-01 00:00:00' GROUP BY vessel_id;
gretelai_synthetic_text_to_sql
CREATE TABLE cases (case_id INT, case_number VARCHAR(50), client_name VARCHAR(50), attorney_id INT); CREATE TABLE billing (billing_id INT, attorney_id INT, client_id INT, hours_billed INT, billing_rate DECIMAL(5,2));
List the names and case numbers of cases in 'cases' table that have billing records in 'billing' table
SELECT cases.case_number, cases.client_name FROM cases INNER JOIN billing ON cases.attorney_id = billing.attorney_id;
gretelai_synthetic_text_to_sql
CREATE TABLE flights (id INT, flight_type VARCHAR(50), flight_hours DECIMAL(10,2), flight_date DATE);
Delete all test flight records that occurred before 2010
DELETE FROM flights WHERE flight_type = 'Test Flight' AND flight_date < '2010-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE employees (id INT, name VARCHAR(255), department VARCHAR(255), country VARCHAR(255)); CREATE TABLE training (id INT, employee_id INT, course VARCHAR(255)); INSERT INTO employees (id, name, department, country) VALUES (1, 'John Doe', 'IT', 'USA'); INSERT INTO employees (id, name, department, country) VALUES...
How many employees from each department have completed the 'Cybersecurity' course in the 'training' table?
SELECT e.department, COUNT(t.id) FROM employees e JOIN training t ON e.id = t.employee_id WHERE t.course = 'Cybersecurity' GROUP BY e.department;
gretelai_synthetic_text_to_sql
CREATE SCHEMA if not exists bioprocess; USE bioprocess; CREATE TABLE if not exists engineering_projects (id INT PRIMARY KEY, project_name VARCHAR(255), budget FLOAT); INSERT INTO engineering_projects (id, project_name, budget) VALUES (1, 'Bio-Manufacturing Plant', 15000000.00), (2, 'Wastewater Treatment', 8000000.00), ...
What is the minimum budget for bioprocess engineering projects in Europe?
SELECT MIN(budget) FROM bioprocess.engineering_projects WHERE region = 'Europe';
gretelai_synthetic_text_to_sql
CREATE TABLE media_content (id INT, title VARCHAR(255), release_year INT, runtime INT, genre VARCHAR(255), format VARCHAR(50), country VARCHAR(255), director VARCHAR(255));
What is the total runtime of movies and TV shows produced in Africa, and how many unique directors are there?
SELECT country, SUM(runtime) AS total_runtime, COUNT(DISTINCT director) AS unique_directors FROM media_content WHERE country LIKE '%Africa%' GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE garment_manufacturing (garment_id INT, garment_type VARCHAR(50), production_date DATE, units_manufactured INT); CREATE TABLE garments (garment_id INT, garment_name VARCHAR(50));
What is the number of units manufactured for each garment type by month in 2022?
SELECT garment_type, EXTRACT(MONTH FROM production_date) AS month, SUM(units_manufactured) FROM garment_manufacturing JOIN garments ON garment_manufacturing.garment_id = garments.garment_id WHERE EXTRACT(YEAR FROM production_date) = 2022 GROUP BY garment_type, month;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (id INT, species_name VARCHAR(255), location VARCHAR(255)); INSERT INTO marine_species (id, species_name, location) VALUES (1, 'Crabeater Seal', 'Southern Ocean');
How many marine species have been identified in the Southern Ocean?
SELECT COUNT(*) FROM marine_species WHERE marine_species.location = 'Southern Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE mental_health_parity_reports (report_id INT, state VARCHAR(255), year INT, total_complaints INT);
Insert a new mental health parity report for the state of Illinois in 2022
INSERT INTO mental_health_parity_reports (report_id, state, year, total_complaints) VALUES (4, 'Illinois', 2022, 225);
gretelai_synthetic_text_to_sql
CREATE TABLE workforce_diversity (id INT, state VARCHAR(50), position VARCHAR(50), gender VARCHAR(50)); INSERT INTO workforce_diversity (id, state, position, gender) VALUES (1, 'Nevada', 'Miner', 'Female'); INSERT INTO workforce_diversity (id, state, position, gender) VALUES (2, 'Nevada', 'Miner', 'Male'); INSERT INTO ...
What is the percentage of female workers in mining operations in the state of Nevada?
SELECT (COUNT(*) FILTER (WHERE gender = 'Female')) * 100.0 / COUNT(*) FROM workforce_diversity WHERE state = 'Nevada';
gretelai_synthetic_text_to_sql
CREATE TABLE Meals (MealID INT, MealName VARCHAR(50), Region VARCHAR(50), Calories INT); INSERT INTO Meals (MealID, MealName, Region, Calories) VALUES (1, 'Spaghetti Bolognese', 'Europe', 650), (2, 'Chicken Tikka Masala', 'Asia', 850);
Which region has the highest total calorie count?
SELECT Region, SUM(Calories) as TotalCalories FROM Meals GROUP BY Region ORDER BY TotalCalories DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE solar_power (country VARCHAR(20), capacity INT); INSERT INTO solar_power (country, capacity) VALUES ('Spain', 12000), ('Spain', 15000), ('Italy', 8000), ('Italy', 11000), ('Italy', 14000);
Count the number of solar power plants in Spain and Italy with a capacity greater than 10 MW?
SELECT COUNT(*) FROM solar_power WHERE country IN ('Spain', 'Italy') AND capacity > 10000;
gretelai_synthetic_text_to_sql
CREATE TABLE articles (id INT, title VARCHAR(50), category VARCHAR(20), author_id INT); INSERT INTO articles (id, title, category, author_id) VALUES (1, 'Oil Prices Rising', 'politics', 1), (2, 'Government Corruption', 'politics', 2), (3, 'Baseball Game', 'sports', 3), (4, 'Football Match', 'sports', 1); CREATE TABLE a...
What is the total number of articles about politics and sports, and which reporters wrote them?
SELECT COUNT(articles.id), authors.name FROM articles INNER JOIN authors ON articles.author_id = authors.id WHERE articles.category IN ('politics', 'sports') GROUP BY authors.name;
gretelai_synthetic_text_to_sql
CREATE TABLE neighborhoods (id INT, name TEXT);CREATE TABLE crimes (id INT, neighborhood_id INT, date DATE);
How many crimes were committed in each neighborhood in the last month?
SELECT n.name, COUNT(c.id) FROM neighborhoods n JOIN crimes c ON n.id = c.neighborhood_id WHERE c.date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY n.id;
gretelai_synthetic_text_to_sql
CREATE TABLE artist_revenue (artist VARCHAR(255), revenue FLOAT); INSERT INTO artist_revenue (artist, revenue) VALUES ('Taylor Swift', 6000000), ('BTS', 3000000), ('Billie Eilish', 6000000), ('Ariana Grande', 4000000), ('The Weeknd', 2000000), ('Dua Lipa', 2500000);
Who is the top selling artist by total revenue?
SELECT artist, revenue FROM artist_revenue ORDER BY revenue DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE warehouse (id INT, city VARCHAR(20), capacity INT); INSERT INTO warehouse (id, city, capacity) VALUES (1, 'Chicago', 1000), (2, 'Houston', 1500), (3, 'Miami', 800);
Delete records from the "warehouse" table where the "city" is "Chicago"
DELETE FROM warehouse WHERE city = 'Chicago';
gretelai_synthetic_text_to_sql
CREATE TABLE regulatory_compliance (compliance_id INT, vessel_name VARCHAR(50), compliance_status VARCHAR(50)); INSERT INTO regulatory_compliance (compliance_id, vessel_name, compliance_status) VALUES (1, 'VesselA', 'Non-compliant'), (2, 'VesselB', 'Compliant'), (3, 'VesselC', 'Non-compliant');
Which vessels have regulatory compliance issues in the 'regulatory_compliance' table?
SELECT vessel_name FROM regulatory_compliance WHERE compliance_status = 'Non-compliant';
gretelai_synthetic_text_to_sql
CREATE TABLE waste_generation_trend (country VARCHAR(50), year INT, waste_quantity INT); INSERT INTO waste_generation_trend (country, year, waste_quantity) VALUES ('India', 2018, 12000), ('India', 2019, 13000), ('India', 2020, 14000), ('India', 2021, 15000);
What is the waste generation trend in India from 2018 to 2021?
SELECT year, waste_quantity, (LAG(waste_quantity) OVER (ORDER BY year)) AS previous_year_waste FROM waste_generation_trend WHERE country = 'India';
gretelai_synthetic_text_to_sql
CREATE TABLE Programs (id INT, program_name VARCHAR(50), budget_category VARCHAR(50)); CREATE TABLE Budget (id INT, budget_category VARCHAR(50), budget_amount DECIMAL(10,2), budget_date DATE);
List all unique program names and their associated budget categories.
SELECT DISTINCT Programs.program_name, Programs.budget_category FROM Programs;
gretelai_synthetic_text_to_sql
CREATE TABLE audience_demographics (article_id INT, category VARCHAR(30), word_count INT, age INT, gender VARCHAR(10)); INSERT INTO audience_demographics (article_id, category, word_count, age, gender) VALUES (1, 'Politics', 500, 30, 'Male'), (2, 'Sports', 700, 25, 'Female'), (3, 'Politics', 800, 35, 'Non-binary');
Which categories have the most and least average word count in the 'audience_demographics' table?
SELECT category, AVG(word_count) AS avg_word_count FROM audience_demographics GROUP BY category ORDER BY avg_word_count DESC, category;
gretelai_synthetic_text_to_sql
CREATE TABLE cultural_sites (site_id INT, name TEXT, country TEXT, url TEXT); INSERT INTO cultural_sites (site_id, name, country, url) VALUES (1, 'Mount Fuji', 'Japan', 'www.virtualtourjapan1.com'), (2, 'Hiroshima Peace Memorial Park', 'Japan', 'www.virtualtourjapan2.com'), (3, 'Fushimi Inari Shrine', 'Japan', 'www.vir...
List all cultural heritage sites in Japan with their respective virtual tour URLs.
SELECT name, url FROM cultural_sites WHERE country = 'Japan';
gretelai_synthetic_text_to_sql
CREATE TABLE BudgetAllocation (CityId INT, Category VARCHAR(50), Amount DECIMAL(10,2)); INSERT INTO BudgetAllocation (CityId, Category, Amount) VALUES (1, 'Transportation', 5000000), (1, 'Infrastructure', 3000000), (1, 'Education', 4000000), (2, 'Transportation', 6000000), (2, 'Infrastructure', 5000000), (2, 'Education...
What is the ranking of cities based on their total budget allocation for all categories, and what is the total budget allocated for each category in the top 3 cities?
SELECT CityId, ROW_NUMBER() OVER (ORDER BY SUM(Amount) DESC) AS CityRank, SUM(Amount) AS TotalBudget FROM BudgetAllocation GROUP BY CityId HAVING CityRank <= 3;
gretelai_synthetic_text_to_sql
CREATE TABLE sales(id INT PRIMARY KEY, garment_type VARCHAR(50), quantity INT, sale_date DATE); INSERT INTO sales(id, garment_type, quantity, sale_date) VALUES (1, 't-shirt', 10, '2022-01-01'), (2, 'jeans', 8, '2022-02-01'), (3, 'eco-friendly t-shirt', 15, '2022-03-01');
What is the total quantity of eco-friendly garments sold in the last quarter?
SELECT SUM(quantity) FROM sales WHERE garment_type LIKE '%eco-friendly%' AND sale_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance (initiative_name TEXT, year INTEGER, amount FLOAT, country TEXT); INSERT INTO climate_finance (initiative_name, year, amount, country) VALUES ('Green Grants', 2019, 50000.0, 'Brazil'), ('Climate Innovation Fund', 2020, 100000.0, 'India'), ('Renewable Energy Loans', 2018, 75000.0, 'China');
Which countries have received climate finance in the 'climate_finance' table?
SELECT DISTINCT country FROM climate_finance;
gretelai_synthetic_text_to_sql
CREATE TABLE NigerianRegions (Region VARCHAR(50), Population INT, LifeExpectancy INT); INSERT INTO NigerianRegions (Region, Population, LifeExpectancy) VALUES ('North', 20000000, 55), ('South', 25000000, 60), ('East', 22000000, 58), ('West', 18000000, 57);
What is the average life expectancy in each region of Nigeria?
SELECT Region, AVG(LifeExpectancy) AS AverageLifeExpectancy FROM NigerianRegions GROUP BY Region;
gretelai_synthetic_text_to_sql
CREATE TABLE factories (id INT, sector TEXT, location TEXT); INSERT INTO factories (id, sector, location) VALUES (1, 'chemicals', 'Asia'), (2, 'chemicals', 'Europe'), (3, 'textiles', 'South America'), (4, 'electronics', 'Asia'), (5, 'textiles', 'North America');
Find the number of factories in the 'textiles' sector that are located in South America.
SELECT COUNT(*) FROM factories WHERE sector = 'textiles' AND location = 'South America';
gretelai_synthetic_text_to_sql
CREATE TABLE suppliers (supplier_id INT, supplier_name TEXT, supplier_region TEXT); INSERT INTO suppliers (supplier_id, supplier_name, supplier_region) VALUES (1, 'Supplier X', 'Asia-Pacific'), (2, 'Supplier Y', 'Europe'), (3, 'Supplier Z', 'Asia-Pacific'); CREATE TABLE raw_material_purchases (supplier_id INT, purchase...
What is the total amount of raw materials purchased from suppliers in the Asia-Pacific region in H1 2022?
SELECT SUM(purchase_amount) as total_purchase_amount FROM raw_material_purchases JOIN suppliers ON raw_material_purchases.supplier_id = suppliers.supplier_id WHERE suppliers.supplier_region = 'Asia-Pacific' AND purchase_date >= '2022-01-01' AND purchase_date < '2022-07-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Ocean (OceanID INT, OceanName TEXT); CREATE TABLE Farm (FarmID INT, FarmName TEXT, OceanID INT, EstablishedDate DATE); INSERT INTO Ocean VALUES (1, 'Atlantic'); INSERT INTO Ocean VALUES (2, 'Pacific'); INSERT INTO Farm VALUES (1, 'Farm E', 1, '2018-01-01'); INSERT INTO Farm VALUES (2, 'Farm F', 2, '2019-01...
How many fish were farmed in each ocean for the past 3 years?
SELECT OceanName, EXTRACT(YEAR FROM DATE_ADD(EstablishedDate, INTERVAL (YEAR(CURRENT_DATE) - YEAR(EstablishedDate)) YEAR)) AS Year, COUNT(*) AS FarmCount FROM Ocean INNER JOIN Farm ON Ocean.OceanID = Farm.OceanID GROUP BY OceanName, Year;
gretelai_synthetic_text_to_sql
CREATE TABLE policy_violations (id INT, policy VARCHAR(50), violations INT, year INT);
Which policies have been violated the most in the past year from the 'policy_violations' table?
SELECT policy, violations FROM policy_violations WHERE year = YEAR(CURRENT_DATE) - 1 GROUP BY policy ORDER BY violations DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE Chemical_Plant (plant_name VARCHAR(255), location VARCHAR(255), chemical VARCHAR(255), quantity INT);INSERT INTO Chemical_Plant (plant_name, location, chemical, quantity) VALUES ('Chemical Plant H', 'California', 'Hydrogen Peroxide', 700), ('Chemical Plant I', 'California', 'Hydrogen Peroxide', 900);
Which plants in 'California' produce 'Hydrogen Peroxide' and what are their quantities?
SELECT plant_name, quantity FROM Chemical_Plant WHERE location = 'California' AND chemical = 'Hydrogen Peroxide';
gretelai_synthetic_text_to_sql
CREATE TABLE destinations (destination_id INT, name VARCHAR(50), country_id INT, is_eco_certified BOOLEAN); INSERT INTO destinations (destination_id, name, country_id, is_eco_certified) VALUES (5, 'Galápagos National Park', 10, true); INSERT INTO destinations (destination_id, name, country_id, is_eco_certified) VALUES ...
What is the total number of eco-certified destinations in South America?
SELECT COUNT(*) FROM destinations d WHERE d.is_eco_certified = true AND d.country_id IN (SELECT country_id FROM countries WHERE continent = 'South America');
gretelai_synthetic_text_to_sql
CREATE TABLE inventory (inventory_id INT, ingredient_id INT, quantity FLOAT, reorder_threshold FLOAT);
What is the total quantity of each ingredient used in the last month?
SELECT i.ingredient_id, i.ingredient_name, SUM(quantity) as total_quantity FROM inventory i JOIN (SELECT ingredient_id, ingredient_name FROM ingredients WHERE date(created_at) >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 MONTH)) i2 ON i.ingredient_id = i2.ingredient_id GROUP BY i.ingredient_id;
gretelai_synthetic_text_to_sql
CREATE TABLE excavation_sites (site_id INT, site_name TEXT); CREATE TABLE artifacts (artifact_id INT, site_id INT, artifact_type TEXT); INSERT INTO excavation_sites (site_id, site_name) VALUES (1, 'Site A'), (2, 'Site B'), (3, 'Site C'), (4, 'Site D'), (5, 'Site E'), (6, 'Site F'), (7, 'Site G'), (8, 'Site H'); INSERT ...
How many metal and ceramic artifacts are in 'Site H'?
SELECT SUM(artifact_type IN ('metal', 'ceramic')) FROM artifacts a JOIN excavation_sites e ON a.site_id = e.site_id WHERE e.site_name = 'Site H';
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy_finance (country VARCHAR(50), year INT, amount FLOAT); INSERT INTO renewable_energy_finance (country, year, amount) VALUES ('Germany', 2017, 500000), ('Spain', 2018, 600000), ('France', 2019, 700000), ('Italy', 2020, 800000), ('UK', 2021, 900000);
Which countries have received climate finance for renewable energy projects in the last 5 years?
SELECT DISTINCT country FROM renewable_energy_finance WHERE year BETWEEN 2017 AND 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE wastewater_plants (id INT, name VARCHAR(50), location VARCHAR(50), capacity INT);
Insert a new record into the wastewater_plants table
INSERT INTO wastewater_plants (id, name, location, capacity) VALUES (1, 'Treatment Plant 1', 'City A', 500000);
gretelai_synthetic_text_to_sql
CREATE TABLE users (user_id INT, username VARCHAR(20), email VARCHAR(50)); CREATE TABLE posts (post_id INT, user_id INT, content TEXT, post_time TIMESTAMP); CREATE TABLE comments (comment_id INT, post_id INT, user_id INT, comment TEXT, comment_time TIMESTAMP); CREATE TABLE reactions (reaction_id INT, post_id INT, user_...
What is the total number of posts, comments, and reactions for each user in the social_media database?
SELECT u.username, COUNT(p.post_id) AS posts, COUNT(c.comment_id) AS comments, COUNT(r.reaction_id) AS reactions FROM users u LEFT JOIN posts p ON u.user_id = p.user_id LEFT JOIN comments c ON p.post_id = c.post_id LEFT JOIN reactions r ON p.post_id = r.post_id GROUP BY u.username;
gretelai_synthetic_text_to_sql
CREATE TABLE movies (id INT, title VARCHAR(255), director_name VARCHAR(255), release_year INT, watch_time FLOAT); INSERT INTO movies (id, title, director_name, release_year, watch_time) VALUES (1, 'Movie1', 'DirectorA', 2000, 120.5), (2, 'Movie2', 'DirectorB', 2010, 180.7);
What is the total watch time for movies produced by women directors?
SELECT SUM(watch_time) FROM movies WHERE director_name IN (SELECT director_name FROM directors WHERE gender = 'female');
gretelai_synthetic_text_to_sql
CREATE TABLE Clients (ClientID INT, ClientName VARCHAR(100), Region VARCHAR(50), FinanciallyCapable BOOLEAN, LastDepositDate DATE); INSERT INTO Clients (ClientID, ClientName, Region, FinanciallyCapable, LastDepositDate) VALUES (1, 'AB Johnson', 'North America', FALSE, '2020-02-01'), (2, 'CD Smith', 'North America', TRU...
Delete records of financially incapable clients from the North American region who have not made any deposits in the past 12 months.
DELETE FROM Clients WHERE FinanciallyCapable = FALSE AND Region = 'North America' AND LastDepositDate < DATE_SUB(CURDATE(), INTERVAL 12 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE funding (id INT, startup_name VARCHAR(50), funding_amount INT, date DATE, country VARCHAR(50)); INSERT INTO funding (id, startup_name, funding_amount, date, country) VALUES (1, 'Startup A', 1000000, '2022-01-01', 'USA'); INSERT INTO funding (id, startup_name, funding_amount, date, country) VALUES (2, 'Star...
Determine the total funding received by startups in the USA from the funding table
SELECT SUM(funding_amount) FROM funding WHERE country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE Timber_Production (id INT, year INT, volume INT, forest_id INT); INSERT INTO Timber_Production (id, year, volume, forest_id) VALUES (1, 2020, 10000, 1), (2, 2021, 12000, 1), (3, 2020, 15000, 2), (4, 2021, 18000, 2);
What was the total volume of timber produced in each forest in Canada in 2021?
SELECT Forests.name, SUM(Timber_Production.volume) as total_volume FROM Forests INNER JOIN Timber_Production ON Forests.id = Timber_Production.forest_id WHERE Forests.country = 'Canada' AND Timber_Production.year = 2021 GROUP BY Forests.name;
gretelai_synthetic_text_to_sql
CREATE TABLE dishes (dish_id INT, name VARCHAR(255), calories INT, cuisine_type VARCHAR(255)); INSERT INTO dishes (dish_id, name, calories, cuisine_type) VALUES (1, 'Pizza', 300, 'Italian'), (2, 'Pasta', 400, 'Italian'), (3, 'Salad', 200, 'Salad'), (4, 'Burger', 500, 'American'), (5, 'Sushi', 250, 'Japanese'), (6, 'Cur...
Find the top 3 cuisine types with the highest average calories per dish?
SELECT cuisine_type, AVG(calories) AS avg_calories FROM dishes GROUP BY cuisine_type ORDER BY avg_calories DESC LIMIT 3;
gretelai_synthetic_text_to_sql