context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount DECIMAL(10,2), country TEXT); INSERT INTO donors (donor_id, donor_name, donation_amount, country) VALUES (1, 'John Doe', 500.00, 'United States'); INSERT INTO donors (donor_id, donor_name, donation_amount, country) VALUES (2, 'Jane Smith', 300.00, 'Can... | What is the sum of donation amounts for donors living in 'Australia'? | SELECT SUM(donation_amount) FROM donors WHERE country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, VR TEXT); INSERT INTO Players (PlayerID, VR) VALUES (1, 'Yes'), (2, 'No'), (3, 'Yes'), (4, 'No'), (5, 'Yes'), (6, 'No'); CREATE TABLE PlayerAges (PlayerID INT, Age INT); INSERT INTO PlayerAges (PlayerID, Age) VALUES (1, 25), (2, 30), (3, 22), (4, 35), (5, 28), (6, 20); | Find the average age of players who have played VR games and those who have not. | SELECT AVG(CASE WHEN VR = 'Yes' THEN Age END) AS AvgAgeVRPlayers, AVG(CASE WHEN VR = 'No' THEN Age END) AS AvgAgeNonVRPlayers FROM Players INNER JOIN PlayerAges ON Players.PlayerID = PlayerAges.PlayerID; | gretelai_synthetic_text_to_sql |
CREATE TABLE FarmersMarket (farmer_id INT, product VARCHAR(20), quantity INT, price FLOAT); | What is the total production of 'Broccoli' by each farmer in 'FarmersMarket' table? | SELECT farmer_id, SUM(quantity) as total_broccoli FROM FarmersMarket WHERE product = 'Broccoli' GROUP BY farmer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_farms (id INT, country VARCHAR(50), region VARCHAR(50), no_farms INT, area_ha FLOAT); INSERT INTO organic_farms (id, country, region, no_farms, area_ha) VALUES (1, 'France', 'Europe', 1000, 2345.6); INSERT INTO organic_farms (id, country, region, no_farms, area_ha) VALUES (2, 'Germany', 'Europe', 2... | What is the average area of organic farming per farm in 'Europe'? | SELECT AVG(area_ha/no_farms) FROM organic_farms WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_customers (customer_id INT, name VARCHAR(50), voice_call_duration FLOAT, state VARCHAR(20), payment_type VARCHAR(20)); INSERT INTO mobile_customers (customer_id, name, voice_call_duration, state, payment_type) VALUES (1, 'James Johnson', 500, 'California', 'postpaid'); | What is the average monthly voice call duration for postpaid mobile customers in California? | SELECT AVG(voice_call_duration) FROM mobile_customers WHERE state = 'California' AND payment_type = 'postpaid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, valuation INT); INSERT INTO company (id, name, industry, valuation) VALUES (1, 'LearnUp', 'Edtech', 1000000); CREATE TABLE investment_round (id INT, company_id INT, round_type TEXT, amount_raised FLOAT); INSERT INTO investment_round (id, company_id, round_type, am... | What is the average valuation for startups in the edtech sector that have received Series A funding? | SELECT AVG(c.valuation) FROM company c JOIN investment_round ir ON c.id = ir.company_id WHERE c.industry = 'Edtech' AND ir.round_type = 'Series A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Chemicals (chemical_id INT, chemical_name VARCHAR(20), is_active BOOLEAN); | Delete the records of all inactive chemicals from the 'Chemicals' table. | DELETE FROM Chemicals WHERE is_active = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50)); CREATE TABLE points (game_id INT, team_id INT, points INT); | Rank the NFL teams based on their total points scored in descending order. | SELECT team_id, RANK() OVER (ORDER BY SUM(points) DESC) AS rank FROM points GROUP BY team_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE workplaces (id INT, name TEXT, state TEXT, safety_violation BOOLEAN); | Insert a new record for a workplace in the state of Arizona without safety violations. | INSERT INTO workplaces (id, name, state, safety_violation) VALUES (1, 'VWX Company', 'Arizona', false); | gretelai_synthetic_text_to_sql |
CREATE TABLE Orgs (OrgID INT, Name TEXT, Type TEXT); INSERT INTO Orgs (OrgID, Name, Type) VALUES (1, 'Association pour la Promotion des Langues Anciennes', 'Language Preservation'); INSERT INTO Orgs (OrgID, Name, Type) VALUES (2, 'Survival International', 'Language Preservation'); | Who are the language preservation organizations in France? | SELECT Name FROM Orgs WHERE Type = 'Language Preservation' AND Country = 'France'; | gretelai_synthetic_text_to_sql |
CREATE TABLE city (id INT, name VARCHAR(255)); INSERT INTO city (id, name) VALUES (1, 'Chicago'); CREATE TABLE water_meter_readings (id INT, city_id INT, consumption FLOAT, reading_date DATE); INSERT INTO water_meter_readings (id, city_id, consumption, reading_date) VALUES (1, 1, 100, '2022-01-01'); INSERT INTO water_m... | Calculate the monthly water savings due to conservation initiatives in the city of Chicago | SELECT EXTRACT(MONTH FROM water_meter_readings.reading_date) as month, SUM(conservation_initiatives.savings) as monthly_savings FROM water_meter_readings JOIN city ON water_meter_readings.city_id = city.id JOIN conservation_initiatives ON city.id = conservation_initiatives.city_id WHERE city.name = 'Chicago' AND water_... | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, subject VARCHAR(255), pd_date DATE); INSERT INTO teacher_pd (teacher_id, subject, pd_date) VALUES (1, 'Mathematics', '2010-01-01'), (2, 'Computer Science', '2015-01-01'), (2, 'Computer Science', '2016-01-01'), (3, 'English', '2005-01-01'), (3, 'English', '2006-01-01'), (3, 'Engl... | What is the number of professional development sessions per teacher, with the top 10 ranked by total sessions? | SELECT teacher_id, COUNT(*) as total_sessions, RANK() OVER (ORDER BY COUNT(*) DESC) as rank FROM teacher_pd GROUP BY teacher_id ORDER BY rank LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT, city VARCHAR(255), state VARCHAR(255), country VARCHAR(255), waste_type VARCHAR(255), amount INT); | Delete all records from the 'waste_generation' table where the 'waste_type' is 'plastic' | DELETE FROM waste_generation WHERE waste_type = 'plastic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Complaints (City VARCHAR(10), Date DATE, Department VARCHAR(20), Complaint INT); INSERT INTO Complaints (City, Date, Department, Complaint) VALUES ('CityK', '2021-07-01', 'Police', 100), ('CityL', '2021-07-02', 'Fire', 50), ('CityK', '2021-07-03', 'Police', 120); | How many citizen complaints were there in Q3 2021, separated by department, in 'CityK' and 'CityL'? | SELECT City, Department, COUNT(Complaint) FROM Complaints WHERE City IN ('CityK', 'CityL') AND Date BETWEEN '2021-07-01' AND '2021-09-30' GROUP BY City, Department; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_mammal (mammal_id INT, name TEXT, ocean TEXT); INSERT INTO marine_mammal (mammal_id, name, ocean) VALUES (1, 'Bottlenose Dolphin', 'Pacific'), (2, 'Blue Whale', 'Atlantic'); | How many marine mammals are there in each ocean? | SELECT ocean, COUNT(*) FROM marine_mammal GROUP BY ocean | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_projects (id INT PRIMARY KEY, project_type VARCHAR(50), country VARCHAR(50), year INT, budget DECIMAL(10,2)); | Calculate the average annual investment in climate communication initiatives in Sub-Saharan Africa since 2010. | SELECT AVG(budget) AS avg_annual_investment FROM climate_finance_projects WHERE project_type = 'Climate Communication' AND country LIKE 'Sub-Saharan Africa%' AND year >= 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (id INT, title TEXT, length FLOAT, genre TEXT); INSERT INTO songs (id, title, length, genre) VALUES (1, 'Rock1', 120.0, 'Rock'), (2, 'Rock2', 180.0, 'Rock'), (3, 'Rock3', 240.0, 'Rock'), (4, 'Rock4', 90.0, 'Rock'), (5, 'Rock5', 150.0, 'Rock'), (6, 'Rock6', 210.0, 'Rock'); | What is the minimum length (in seconds) of all rock songs? | SELECT MIN(length) FROM songs WHERE genre = 'Rock'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (region VARCHAR(20), year INT, revenue DECIMAL(5,2)); INSERT INTO Concerts (region, year, revenue) VALUES ('Asia', 2023, 900000.00), ('Asia', 2023, 650000.00), ('Europe', 2023, 400000.00); | What is the total revenue for concerts in Asia in 2023? | SELECT SUM(revenue) FROM Concerts WHERE region = 'Asia' AND year = 2023; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_projects (project VARCHAR(50), budget INT); INSERT INTO environmental_projects (project, budget) VALUES ('Tree Planting Campaign', 700000); INSERT INTO environmental_projects (project, budget) VALUES ('Pollution Control Equipment', 1000000); INSERT INTO environmental_projects (project, budget... | What is the minimum budget for a project in the 'environmental_projects' table? | SELECT MIN(budget) FROM environmental_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_projects(id INT, organization VARCHAR(255), project VARCHAR(255), start_year INT, technology VARCHAR(255)); INSERT INTO humanitarian_projects(id, organization, project, start_year, technology) VALUES (1, 'AU', 'Solar Powered Water Pumps', 2018, 'Solar Energy'), (2, 'EU', 'Wind Turbine Powered ... | How many humanitarian assistance projects were initiated by the African Union using renewable energy between 2018 and 2022, inclusive? | SELECT COUNT(*) FROM humanitarian_projects WHERE organization = 'AU' AND technology LIKE '%renewable%' AND start_year BETWEEN 2018 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_trip (trip_id INT, pickup_location VARCHAR(50), dropoff_location VARCHAR(50), trip_date DATE); | Identify the most popular pick-up and drop-off locations for bus trips | SELECT pickup_location AS most_popular_pickup, dropoff_location AS most_popular_dropoff, COUNT(*) AS trip_count FROM bus_trip GROUP BY pickup_location, dropoff_location ORDER BY trip_count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ticket_Sales (id INT, exhibition VARCHAR(20), revenue INT, num_tickets INT); INSERT INTO Ticket_Sales (id, exhibition, revenue, num_tickets) VALUES (1, 'Modern Art', 2000, 500), (2, 'Natural History', 3000, 700); | What was the total revenue generated from ticket sales for each exhibition, and how many tickets were sold? | SELECT exhibition, SUM(revenue) AS total_revenue, SUM(num_tickets) AS total_tickets FROM Ticket_Sales GROUP BY exhibition; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryBudgets (country VARCHAR(255), year INT, month INT, budget DECIMAL(10, 2)); INSERT INTO MilitaryBudgets (country, year, month, budget) VALUES ('France', 2015, 1, 5000000); INSERT INTO MilitaryBudgets (country, year, month, budget) VALUES ('Germany', 2015, 1, 7000000); | What is the average monthly budget for military innovation in NATO countries since 2015, with the budgets of each country ordered by the highest average? | SELECT country, AVG(budget) as avg_monthly_budget, ROW_NUMBER() OVER (ORDER BY AVG(budget) DESC) as budget_rank FROM MilitaryBudgets WHERE country LIKE 'NATO%' AND year >= 2015 GROUP BY country ORDER BY budget_rank; | gretelai_synthetic_text_to_sql |
CREATE TABLE power_plants (name VARCHAR(50), technology VARCHAR(50), capacity FLOAT, country VARCHAR(50)); INSERT INTO power_plants (name, technology, capacity, country) VALUES ('Coal Plant 1', 'Coal', 300.0, 'Germany'), ('Gas Plant 1', 'Gas', 250.2, 'Spain'), ('Wind Plant 1', 'Wind', 100.5, 'Germany'), ('Solar Plant 1... | Find the difference between the total installed capacity (in MW) of non-renewable and renewable power plants in the 'power_plants' table | SELECT SUM(CASE WHEN technology IN ('Coal', 'Gas') THEN capacity ELSE 0 END) - SUM(CASE WHEN technology IN ('Wind', 'Solar') THEN capacity ELSE 0 END) FROM power_plants; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget_2022 (service TEXT, budget INTEGER); INSERT INTO budget_2022 (service, budget) VALUES ('Education', 1500000), ('Healthcare', 1200000); | What are the total budgets for education and healthcare services in 2022? | SELECT SUM(budget) FROM budget_2022 WHERE service IN ('Education', 'Healthcare'); | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biotech; USE biotech; CREATE TABLE if not exists startups (id INT, name VARCHAR(100), location VARCHAR(100), funding DECIMAL(10,2)); INSERT INTO startups (id, name, location, funding) VALUES (1, 'StartupA', 'California', 5000000.00), (2, 'StartupB', 'Texas', 7000000.00), (3, 'StartupC', 'Cal... | What is the average funding received by biotech startups located in the US, grouped by the state they are based in? | SELECT startups.location, AVG(startups.funding) FROM biotech.startups WHERE startups.location = ANY(ARRAY['California', 'Texas', 'New York']) GROUP BY startups.location; | gretelai_synthetic_text_to_sql |
CREATE TABLE tree_age (forest_type VARCHAR(30), age FLOAT); INSERT INTO tree_age (forest_type, age) VALUES ('Tropical Dry Forest - Africa', 12.34); | What is the average age, in years, of trees in the tropical dry forests of Africa? | SELECT AVG(age) FROM tree_age WHERE forest_type = 'Tropical Dry Forest - Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE participations (initiative_id INT, num_participants INT); INSERT INTO participations (initiative_id, num_participants) VALUES (1, 500), (2, 700), (3, 300), (4, 800), (5, 600); | What is the maximum number of public participations in a single initiative? | SELECT MAX(num_participants) FROM participations; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_type VARCHAR(10), location VARCHAR(20), production_rate FLOAT); INSERT INTO wells (well_id, well_type, location, production_rate) VALUES (1, 'offshore', 'Gulf of Mexico', 1000), (2, 'onshore', 'Texas', 800), (3, 'offshore', 'North Sea', 1200), (4, 'onshore', 'Alberta', 900); | Find the well with the second highest production rate. | SELECT * FROM (SELECT well_id, well_type, location, production_rate, ROW_NUMBER() OVER (ORDER BY production_rate DESC) rn FROM wells) t WHERE rn = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE Games (GameID int, GameName varchar(20), Genre varchar(10), VR boolean); INSERT INTO Games (GameID, GameName, Genre, VR) VALUES (1, 'Game1', 'Action', false); INSERT INTO Games (GameID, GameName, Genre, VR) VALUES (2, 'Game2', 'Adventure', true); | What is the total number of games in each genre, and what is the genre with the most games? | SELECT Genre, COUNT(*) AS GameCount, RANK() OVER (ORDER BY COUNT(*) DESC) AS Rank FROM Games GROUP BY Genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students(StudentID int, DepartmentID int, Name varchar(50), RaceEthnicity varchar(50)); INSERT INTO Students(StudentID, DepartmentID, Name, RaceEthnicity) VALUES (1001, 1, 'Alice Johnson', 'Asian'); INSERT INTO Students(StudentID, DepartmentID, Name, RaceEthnicity) VALUES (1002, 1, 'Bob Brown', 'White'); I... | What is the distribution of graduate students by race/ethnicity? | SELECT RaceEthnicity, COUNT(StudentID) as NumberOfStudents FROM Students GROUP BY RaceEthnicity; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPersonnel (Country VARCHAR(50), Personnel INT); INSERT INTO MilitaryPersonnel (Country, Personnel) VALUES ('France', 200000), ('Germany', 180000), ('Italy', 150000), ('Spain', 120000), ('Poland', 100000), ('Ukraine', 250000); | What is the average number of military personnel in each European country, excluding microstates? | SELECT AVG(Personnel) FROM MilitaryPersonnel WHERE Country IN ('France', 'Germany', 'Italy', 'Spain', 'Poland', 'Ukraine') AND Personnel > 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteID INT, SiteName TEXT, Country TEXT); INSERT INTO ExcavationSites (SiteID, SiteName, Country) VALUES (1, 'MayanRuins', 'Guatemala'), (2, 'Tenochtitlan', 'Mexico'); CREATE TABLE Artifacts (ArtifactID INT, SiteID INT, ArtifactName TEXT, ArtifactType TEXT, Quantity INT); INSERT INTO Artif... | List all excavation sites and their number of artifacts. | SELECT e.SiteName, COUNT(a.ArtifactID) as ArtifactCount FROM ExcavationSites e LEFT JOIN Artifacts a ON e.SiteID = a.SiteID GROUP BY e.SiteName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (Employee_ID INT, First_Name VARCHAR(20), Last_Name VARCHAR(20), Department VARCHAR(20), Country VARCHAR(20), Join_Date DATE); | Insert new employee records from a recent diverse hiring wave. | INSERT INTO Employees (Employee_ID, First_Name, Last_Name, Department, Country, Join_Date) VALUES (101, 'Sophia', 'Mendoza', 'Marketing', 'Mexico', '2022-06-15'), (102, 'Tariq', 'Ahmed', 'IT', 'Pakistan', '2022-07-02'), (103, 'Emi', 'Watanabe', 'Finance', 'Japan', '2022-07-10'), (104, 'Alex', 'Shaw', 'Sales', 'Canada',... | gretelai_synthetic_text_to_sql |
CREATE TABLE product_sales (product_id VARCHAR(10), sale_date DATE, units INT); INSERT INTO product_sales (product_id, sale_date, units) VALUES ('ProductC', '2022-01-05', 100), ('ProductC', '2022-04-12', 150), ('ProductC', '2022-07-20', 200); | How many units of product 'ProductC' were sold in each quarter of 2022? | SELECT DATE_FORMAT(sale_date, '%Y-%m') AS quarter, SUM(units) FROM product_sales WHERE product_id = 'ProductC' GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE strains (type VARCHAR(10), price DECIMAL(5,2)); INSERT INTO strains (type, price) VALUES ('indica', 12.50), ('indica', 14.75), ('hybrid', 10.99); CREATE TABLE dispensaries (state VARCHAR(20), sales INT); INSERT INTO dispensaries (state, sales) VALUES ('California', 3000), ('California', 3500); CREATE TABLE... | Find the average price per gram of indica strains sold in California dispensaries in Q2 2022. | SELECT AVG(strains.price) FROM strains JOIN dispensaries ON TRUE WHERE strains.type = 'indica' AND dispensaries.state = 'California' AND time_periods.quarter BETWEEN 2 AND 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_policies (id INT PRIMARY KEY, policy_name TEXT, policy_text TEXT, last_updated DATE); | Which cybersecurity policies in the 'cybersecurity_policies' table were last updated before 2020? | SELECT policy_name, last_updated FROM cybersecurity_policies WHERE last_updated < '2020-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT PRIMARY KEY, volunteer_name VARCHAR(255), hours_volunteered DECIMAL(10,2)); INSERT INTO Volunteers (id, volunteer_name, hours_volunteered) VALUES (1, 'Alice Lee', 3.00), (2, 'Brian Chen', 5.00); | Update the hours volunteered for the volunteer named 'Alice Lee' in the 'Volunteers' table to 4.5 | UPDATE Volunteers SET hours_volunteered = 4.5 WHERE volunteer_name = 'Alice Lee'; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (claim_id INT, policy_type VARCHAR(20), claim_amount INT); INSERT INTO claims (claim_id, policy_type, claim_amount) VALUES (1, 'Auto', 500), (2, 'Home', 1200), (3, 'Auto', 2500), (4, 'Life', 3000); | Find the top 3 expensive policies by claim amount | SELECT policy_type, SUM(claim_amount) AS total_claim_amount FROM claims GROUP BY policy_type ORDER BY total_claim_amount DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName VARCHAR(50), IncentivePaid DATE); INSERT INTO Volunteers (VolunteerID, VolunteerName, IncentivePaid) VALUES (1, 'James Brown', '2021-02-15'), (2, 'Jessica White', NULL); CREATE TABLE VolunteerHours (VolunteerID INT, Hours INT, VolunteerDate DATE); INSERT INTO Volu... | Identify volunteers who have not yet received their incentive payments for the month, and list them along with their total volunteer hours for the current year. | SELECT Volunteers.VolunteerName, SUM(VolunteerHours.Hours) AS TotalHoursForYear FROM Volunteers LEFT OUTER JOIN VolunteerHours ON Volunteers.VolunteerID = VolunteerHours.VolunteerID AND VolunteerHours.VolunteerDate <= CURDATE() AND YEAR(VolunteerHours.VolunteerDate) = YEAR(CURDATE()) WHERE Volunteers.IncentivePaid IS N... | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonationDate DATE, DonationAmount DECIMAL(10,2)); INSERT INTO Donors (DonorID, DonationDate, DonationAmount) VALUES (1, '2021-01-01', 50.00), (2, '2021-02-03', 100.00), (3, '2021-05-05', 25.00); | What was the average donation amount by new donors in 2021? | SELECT AVG(DonationAmount) FROM Donors WHERE YEAR(DonationDate) = 2021 AND DonorID NOT IN (SELECT DonorID FROM Donors GROUP BY DonorID HAVING COUNT(*) > 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (id INT, name VARCHAR(50), department VARCHAR(50), billing_amount DECIMAL(10,2)); | What is the maximum billing amount for each attorney in the "litigation" department? | SELECT department, MAX(billing_amount) FROM Attorneys WHERE department = 'litigation' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenue (id INT, source VARCHAR(50), amount INT); INSERT INTO revenue (id, source, amount) VALUES (1, 'Conventional', 5000), (2, 'Sustainable', 3000), (3, 'Conventional', 6000), (4, 'Sustainable', 4000), (5, 'Conventional', 7000), (6, 'Sustainable', 5000); | What is the total revenue generated from sustainable sources? | SELECT SUM(amount) FROM revenue WHERE source = 'Sustainable'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sites (site_id INT, site_name VARCHAR(50), country VARCHAR(50), year INT, visitors INT); INSERT INTO sites (site_id, site_name, country, year, visitors) VALUES (1, 'Taj Mahal', 'India', 2021, 30000), (2, 'Qutub Minar', 'India', 2021, 25000), (3, 'Great Pyramid of Giza', 'Egypt', 2021, 22000), (4, 'Sphinx',... | How many cultural heritage sites in India and Egypt were visited by more than 20000 people in 2021? | SELECT COUNT(*) FROM sites WHERE country IN ('India', 'Egypt') AND year = 2021 AND visitors > 20000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Polar_Bears_Arctic (ID INT, Name VARCHAR(50), Age INT, Health VARCHAR(50), Gender VARCHAR(10), Region VARCHAR(50)); INSERT INTO Polar_Bears_Arctic VALUES (1, 'Svalbard_1', 8, 'Healthy', 'Male', 'Svalbard'); INSERT INTO Polar_Bears_Arctic VALUES (2, 'Greenland_1', 5, 'Healthy', 'Male', 'Greenland'); INSERT ... | What is the average age of healthy male polar bears in the Arctic, excluding any from the Svalbard region? | SELECT AVG(Age) FROM Polar_Bears_Arctic WHERE Health = 'Healthy' AND Gender = 'Male' AND Region != 'Svalbard'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_launches(launch_id INT, product_id INT, launch_date DATE, category TEXT, country TEXT); | Identify the number of new hair care product launches in the US in Q4 2021, compared to the number of launches in Q3 2021. | SELECT (SELECT COUNT(*) FROM product_launches WHERE DATE_PART('year', launch_date) = 2021 AND DATE_PART('quarter', launch_date) = 4 AND category = 'hair care' AND country = 'US') - (SELECT COUNT(*) FROM product_launches WHERE DATE_PART('year', launch_date) = 2021 AND DATE_PART('quarter', launch_date) = 3 AND category =... | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID int, DonorName varchar(50), Country varchar(50)); INSERT INTO Donors (DonorID, DonorName, Country) VALUES (1, 'John Doe', 'USA'), (2, 'Jane Smith', 'Canada'); CREATE TABLE Donations (DonationID int, DonorID int, DonationAmount decimal(10,2)); INSERT INTO Donations (DonationID, DonorID, Do... | What is the total amount donated by individuals in the US and Canada? | SELECT SUM(Donations.DonationAmount) FROM Donors INNER JOIN Donations ON Donors.DonorID = Donations.DonorID WHERE Donors.Country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, state VARCHAR(50), quarter INT, revenue FLOAT); INSERT INTO sales (id, state, quarter, revenue) VALUES (1, 'California', 1, 25000.0), (2, 'California', 2, 30000.0), (3, 'Colorado', 1, 20000.0), (4, 'Colorado', 2, 28000.0); | What was the total revenue for the state of Colorado in the second quarter of 2022? | SELECT SUM(revenue) FROM sales WHERE state = 'Colorado' AND quarter = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, employees INT); INSERT INTO company (id, name, industry, employees) VALUES (1, 'Acme Inc', 'technology', 10), (2, 'Beta Corp', 'retail', 2), (3, 'Gamma Startup', 'technology', 6); | How many female founders started companies in the "technology" sector with more than 5 employees? | SELECT COUNT(*) FROM company WHERE industry = 'technology' AND employees > 5 AND gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name TEXT, state TEXT, num_beds INT); INSERT INTO hospitals (id, name, state, num_beds) VALUES (1, 'Hospital A', 'California', 500), (2, 'Hospital B', 'Texas', 750), (3, 'Hospital C', 'California', 600); | How many hospitals are there in each state, and what is the average number of beds in those hospitals? | SELECT hospitals.state, COUNT(hospitals.id), AVG(hospitals.num_beds) FROM hospitals GROUP BY hospitals.state; | gretelai_synthetic_text_to_sql |
CREATE TABLE cardano_transactions (transaction_id INTEGER, regulatory_framework VARCHAR(20)); | Show the number of transactions for each regulatory framework in the Cardano blockchain. | SELECT regulatory_framework, COUNT(*) FROM cardano_transactions GROUP BY regulatory_framework; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, name VARCHAR(255), country VARCHAR(255)); INSERT INTO cities (id, name, country) VALUES (1, 'New York', 'USA'), (2, 'Los Angeles', 'USA'), (3, 'London', 'UK'), (4, 'Paris', 'France'), (5, 'Tokyo', 'Japan'); CREATE TABLE properties (id INT, city_id INT, size INT); INSERT INTO properties (id,... | Find the top 3 cities with the largest difference in size between the smallest and largest properties. | SELECT city_id, MAX(size) - MIN(size) as size_diff FROM properties GROUP BY city_id ORDER BY size_diff DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_equipment (equipment_id INT, branch VARCHAR(50), maintenance_cost FLOAT, date DATE); | Find the average maintenance cost of military equipment for each branch in the last 3 years. | SELECT branch, AVG(maintenance_cost) FROM military_equipment WHERE date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY branch; | gretelai_synthetic_text_to_sql |
CREATE TABLE ThreatIntelligence (Country TEXT, Metrics INT, Year INT); INSERT INTO ThreatIntelligence (Country, Metrics, Year) VALUES ('United States', 8500, 2021), ('China', 6000, 2021), ('Russia', 5000, 2021), ('Iran', 4500, 2021), ('North Korea', 3000, 2021), ('India', 2500, 2021); | List the top 5 countries with the highest threat intelligence metrics in 2021. | SELECT Country, Metrics FROM ThreatIntelligence WHERE Year = 2021 ORDER BY Metrics DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_pd (teacher_id INT, course_name VARCHAR(50), location VARCHAR(20)); INSERT INTO teacher_pd (teacher_id, course_name, location) VALUES (101, 'Python for Educators', 'New York'), (102, 'Data Science for Teachers', 'Chicago'), (103, 'Open Pedagogy', 'New York'); | List the unique professional development courses attended by teachers in 'Chicago'? | SELECT DISTINCT course_name FROM teacher_pd WHERE location = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_lending (client_id INT, loan_type VARCHAR(50), country VARCHAR(50)); | Insert new records into the 'socially_responsible_lending' table for clients in South Africa and Brazil who have taken out socially responsible loans. | INSERT INTO socially_responsible_lending VALUES (9, 'Socially Responsible Loan', 'South Africa'); INSERT INTO socially_responsible_lending VALUES (10, 'Socially Responsible Loan', 'Brazil'); | gretelai_synthetic_text_to_sql |
CREATE TABLE SmartCityInvestment (id INT, country VARCHAR(50), investment FLOAT); INSERT INTO SmartCityInvestment (id, country, investment) VALUES (1, 'UAE', 5000000), (2, 'Saudi Arabia', 7000000), (3, 'Qatar', 6000000); | What is the total investment in smart city projects in the Middle East? | SELECT SUM(investment) FROM SmartCityInvestment WHERE country IN ('UAE', 'Saudi Arabia', 'Qatar', 'Oman', 'Bahrain'); | gretelai_synthetic_text_to_sql |
CREATE TABLE inventory (restaurant VARCHAR(255), item VARCHAR(255), organic BOOLEAN, cost FLOAT); INSERT INTO inventory (restaurant, item, organic, cost) VALUES ('Farm Fresh', 'tomato', 1, 2.5), ('Farm Fresh', 'lettuce', 1, 1.5); | What is the sum of the 'organic' food costs at 'Farm Fresh'? | SELECT SUM(cost) FROM inventory WHERE restaurant = 'Farm Fresh' AND organic = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artifacts (ArtifactID INT, SiteName TEXT, Description TEXT, Analysis TEXT); | Describe the structure of the Artifacts table. | DESCRIBE Artifacts; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, account_id INT, amount DECIMAL(10, 2)); INSERT INTO transactions (transaction_id, account_id, amount) VALUES (1, 1, 1000000.00); INSERT INTO transactions (transaction_id, account_id, amount) VALUES (2, 2, 500.00); | Delete all transactions with values greater than $1,000,000.00. | DELETE FROM transactions WHERE amount > 1000000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name VARCHAR(255), type VARCHAR(255), country VARCHAR(255)); INSERT INTO organizations (id, name, type, country) VALUES (1, 'Green Asia', 'NGO', 'China'), (2, 'SolarAfrica', 'For-Profit', 'Kenya'); | How many organizations of each type are there in Asia and Africa? | SELECT country, type, COUNT(*) as organization_count FROM organizations GROUP BY country, type HAVING country IN ('Asia', 'Africa'); | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_efficiency (country VARCHAR(20), year INT, efficiency_improvement DECIMAL(4,2)); INSERT INTO energy_efficiency (country, year, efficiency_improvement) VALUES ('Japan', 2015, 2.50), ('Japan', 2016, 2.75), ('Japan', 2017, 2.90), ('Japan', 2018, 3.05), ('Japan', 2019, 3.15), ('Japan', 2020, 3.30); | What was the energy efficiency improvement in Japan between 2015 and 2020? | SELECT efficiency_improvement FROM energy_efficiency WHERE country = 'Japan' AND year BETWEEN 2015 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_meetings(meeting_id INT, meeting_date DATE, agency VARCHAR(255)); INSERT INTO public_meetings(meeting_id, meeting_date, agency) VALUES (1, '2019-01-01', 'San Francisco City Council'), (2, '2019-02-01', 'San Francisco City Council'); | What is the total number of public meetings held by the City Council of San Francisco from January 2019 to December 2019? | SELECT COUNT(*) FROM public_meetings WHERE agency = 'San Francisco City Council' AND EXTRACT(YEAR FROM meeting_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE international_tourists (id INT, destination VARCHAR(50), visitors INT, visit_date DATE); INSERT INTO international_tourists (id, destination, visitors, visit_date) VALUES (1, 'Bali', 0, '2023-01-01'); INSERT INTO international_tourists (id, destination, visitors, visit_date) VALUES (2, 'Paris', 500, '2023-... | Delete records for destinations with no visitors in 2023. | DELETE FROM international_tourists WHERE destination IN (SELECT destination FROM international_tourists WHERE visit_date = '2023-01-01' GROUP BY destination HAVING SUM(visitors) = 0); | gretelai_synthetic_text_to_sql |
CREATE TABLE space_debris (id INT, debris_id VARCHAR(50), mass FLOAT, size FLOAT, orbit_around VARCHAR(20)); | What is the total mass (in kg) of all space debris larger than 1 cm in size, orbiting Earth? | SELECT SUM(mass) FROM space_debris WHERE size > 1 AND orbit_around = 'Earth'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (satellite_id INT, satellite_name TEXT, launch_date DATE, organization TEXT); INSERT INTO satellites (satellite_id, satellite_name, launch_date, organization) VALUES (1, 'Starlink-1', '2018-05-24', 'SpaceX'), (2, 'Starlink-2', '2018-05-25', 'SpaceX'), (3, 'Galileo-1', '2011-10-21', 'ESA'), (4, '... | What is the latest satellite deployed by each space organization? | SELECT satellite_name, launch_date, organization FROM (SELECT satellite_name, launch_date, organization, ROW_NUMBER() OVER (PARTITION BY organization ORDER BY launch_date DESC) as rn FROM satellites) t WHERE rn = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE borough (name VARCHAR(20), num_libraries INT); INSERT INTO borough (name, num_libraries) VALUES ('Manhattan', 35), ('Brooklyn', 58), ('Queens', 62), ('Bronx', 37), ('Staten Island', 16); | Find the number of public libraries in each borough of New York City | SELECT name, num_libraries FROM borough; | gretelai_synthetic_text_to_sql |
CREATE TABLE GreenBuildings (id INT, name VARCHAR(50), location VARCHAR(50), energyConsumption DECIMAL(5,2)); CREATE TABLE MaxMin (location VARCHAR(50), max_consumption DECIMAL(5,2), min_consumption DECIMAL(5,2)); INSERT INTO MaxMin (location, max_consumption, min_consumption) SELECT location, MAX(energyConsumption) as... | What is the difference between the highest and lowest energy consumption of buildings in each location in the 'GreenBuildings' table? | SELECT location, (max_consumption - min_consumption) as diff FROM MaxMin; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_rights_violations (id INT, sector VARCHAR(20), state VARCHAR(20), num_violations INT); INSERT INTO labor_rights_violations (id, sector, state, num_violations) VALUES (1, 'retail', 'New York', 10), (2, 'retail', 'California', 5), (3, 'manufacturing', 'Texas', 8); | How many labor rights violations have been reported in the 'retail' sector in each state? | SELECT sector, state, COUNT(*) as num_violations FROM labor_rights_violations WHERE sector = 'retail' GROUP BY sector, state; | gretelai_synthetic_text_to_sql |
CREATE TABLE infrastructure.bridges (bridge_id INT, name VARCHAR(255), length FLOAT); INSERT INTO infrastructure.bridges (bridge_id, name, length) VALUES (1, 'Golden Gate', 2737.4), (2, 'Verrazano-Narrows', 4868.6); | What is the maximum bridge length in the 'infrastructure' schema? | SELECT MAX(length) FROM infrastructure.bridges; | gretelai_synthetic_text_to_sql |
CREATE TABLE Maintenance (MaintenanceID INT, VehicleID INT, MaintenanceCost DECIMAL(5,2)); INSERT INTO Maintenance (MaintenanceID, VehicleID, MaintenanceCost) VALUES (1, 1, 200.00), (2, 1, 250.00), (3, 2, 300.00), (4, 3, 400.00), (5, 4, 150.00), (6, 4, 175.00), (7, 5, 350.00); | What are the average maintenance costs for each vehicle type in the 'Bus' service? | SELECT v.VehicleType, AVG(m.MaintenanceCost) as AvgMaintenanceCost FROM Vehicles v JOIN Maintenance m ON v.VehicleID = m.VehicleID WHERE v.Service = 'Bus' GROUP BY v.VehicleType; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (id INT, name VARCHAR(255), accessibility_rating INT); | Get the names of schools with accessibility ratings below 3. | SELECT name FROM schools WHERE accessibility_rating < 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_trainings (training_id INT, teacher_id INT, training_date DATE, course_completed INT); INSERT INTO teacher_trainings (training_id, teacher_id, training_date, course_completed) VALUES (1, 1, '2022-01-01', 1), (2, 1, '2022-02-01', 2), (3, 2, '2022-01-01', 3), (4, 2, '2022-02-01', 1); CREATE TABLE tea... | What is the number of professional development courses completed by teachers in each department per month? | SELECT department, EXTRACT(MONTH FROM training_date) AS month, SUM(course_completed) FROM teacher_trainings JOIN teachers ON teacher_trainings.teacher_id = teachers.teacher_id GROUP BY department, month; | gretelai_synthetic_text_to_sql |
CREATE VIEW Education_Programs AS SELECT 'Wildlife_Explorers' AS program, 12000 AS budget UNION SELECT 'Nature_Guardians', 18000; | List all education programs with their corresponding budgets. | SELECT * FROM Education_Programs; | gretelai_synthetic_text_to_sql |
CREATE TABLE libraries (library_id INT, name VARCHAR(255), location VARCHAR(255), district VARCHAR(255)); CREATE TABLE schools (school_id INT, name VARCHAR(255), location VARCHAR(255), district VARCHAR(255)); INSERT INTO libraries (library_id, name, location, district) VALUES (1, 'Chicago Public Library', '400 S State ... | Present the number of public libraries and public schools in each district of Chicago | SELECT libraries.district, COUNT(libraries.library_id) AS libraries_count, COUNT(schools.school_id) AS schools_count FROM libraries INNER JOIN schools ON libraries.district = schools.district GROUP BY libraries.district; | gretelai_synthetic_text_to_sql |
CREATE TABLE books (id INT, title VARCHAR(255), genre VARCHAR(255), press_location VARCHAR(255)); INSERT INTO books (id, title, genre, press_location) VALUES (1, 'Book1', 'Fiction', 'India'), (2, 'Book2', 'Non-fiction', 'Nigeria'); CREATE TABLE presses (id INT, name VARCHAR(255), location VARCHAR(255)); INSERT INTO pre... | What is the total number of books, by genre, published by presses in India and Nigeria? | SELECT genre, COUNT(*) as total FROM books JOIN presses ON books.press_location = presses.location WHERE presses.location IN ('India', 'Nigeria') GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, division VARCHAR(255), response_time INT); INSERT INTO incidents (id, division, response_time) VALUES (1, 'NYPD', 30), (2, 'LAPD', 45); | What is the average response time for each division? | SELECT division, AVG(response_time) as avg_response_time FROM incidents GROUP BY division; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT PRIMARY KEY, name VARCHAR(50), launch_year INT, country VARCHAR(50)); INSERT INTO satellites (id, name, launch_year, country) VALUES (1, 'ERS-1', 1991, 'Europe'), (2, 'ERS-2', 1995, 'Europe'), (3, 'Envisat', 2002, 'Europe'), (4, 'CryoSat', 2010, 'Europe'), (5, 'SMOS', 2009, 'Europe'); | Delete all records from the 'satellites' table that were launched before 2000 | DELETE FROM satellites WHERE launch_year < 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Species_Weight (Species_Name TEXT, Year INT, Fish_Weight FLOAT); INSERT INTO Species_Weight (Species_Name, Year, Fish_Weight) VALUES ('Tuna', 2019, 1200000), ('Cod', 2019, 800000), ('Herring', 2019, 600000), ('Tuna', 2020, 1400000), ('Cod', 2020, 900000), ('Herring', 2020, 700000); | What is the total fish weight for each species in 2020? | SELECT Species_Name, Year, SUM(Fish_Weight) OVER (PARTITION BY Species_Name) AS Total_Fish_Weight FROM Species_Weight; | gretelai_synthetic_text_to_sql |
CREATE TABLE LegalAid (ApplicationID INT, Applicant VARCHAR(20), Community VARCHAR(20), Approval BOOLEAN); INSERT INTO LegalAid (ApplicationID, Applicant, Community, Approval) VALUES (1, 'John Doe', 'Hispanic', TRUE), (2, 'Jane Smith', 'African American', FALSE), (3, 'Jim Brown', 'Asian', TRUE); | What is the percentage of legal aid applications approved for minority communities? | SELECT (COUNT(*) FILTER (WHERE Approval = TRUE)) * 100.0 / COUNT(*) FROM LegalAid WHERE Community IN ('Hispanic', 'African American', 'Asian'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Farmers (id INT, name TEXT, crop TEXT, harvest_quantity INT, harvest_date DATE);INSERT INTO Farmers (id, name, crop, harvest_quantity, harvest_date) VALUES (1, 'John', 'Corn', 500, '2021-07-01'), (2, 'John', 'Potatoes', 300, '2021-06-15'), (3, 'Jane', 'Carrots', 250, '2021-09-15'), (4, 'Jane', 'Beans', 400... | What was the total quantity of each crop harvested in 2021? | SELECT crop, SUM(harvest_quantity) Total_Harvest_Quantity FROM Farmers WHERE YEAR(harvest_date) = 2021 GROUP BY crop; | gretelai_synthetic_text_to_sql |
CREATE TABLE victims (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), race VARCHAR(20), ethnicity VARCHAR(20)); | Update the "victims" table to reflect a new victim ethnicity | UPDATE victims SET ethnicity = 'Asian American' WHERE id = 1001; | gretelai_synthetic_text_to_sql |
CREATE TABLE age_visitors (visitor_id INT, exhibition_id INT, age INT); INSERT INTO age_visitors (visitor_id, exhibition_id, age) VALUES (1, 8, 25), (2, 8, 17), (3, 8, 30); | How many visitors attended the "Photography" exhibition in the last month who are above the age of 18? | SELECT COUNT(*) FROM age_visitors WHERE exhibition_id = 8 AND age > 18 AND visit_date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE ports ( id INT, name VARCHAR(255), location VARCHAR(255), operated_by VARCHAR(255)); INSERT INTO ports (id, name, location, operated_by) VALUES (1, 'Port A', 'New York', 'Company A'); | How can I update the location of a port? | UPDATE ports SET location = 'New York City' WHERE name = 'Port A'; | gretelai_synthetic_text_to_sql |
CREATE TABLE education_programs (id INT, program_name VARCHAR(50), location VARCHAR(50), participants INT); INSERT INTO education_programs (id, program_name, location, participants) VALUES (1, 'Wildlife Conservation', 'New York', 100), (2, 'Habitat Restoration', 'Los Angeles', 150), (3, 'Bird Watching', 'Chicago', 75);... | List all the community education programs from 'education_programs' table that are not present in 'successful_programs' table? | SELECT * FROM education_programs WHERE program_name NOT IN (SELECT program_name FROM successful_programs) | gretelai_synthetic_text_to_sql |
CREATE TABLE reports (id INT, date DATE, source VARCHAR(255), threat_level INT);INSERT INTO reports (id, date, source, threat_level) VALUES (1, '2021-01-01', 'Open Source', 3), (2, '2021-01-15', 'SIGINT', 5), (3, '2021-02-01', 'HUMINT', 2), (4, '2021-02-15', 'Open Source', 4), (5, '2021-03-01', 'OSINT', 5); | What is the average number of threat intelligence reports per month? | SELECT AVG(number_of_reports) as avg_reports_per_month FROM (SELECT COUNT(*) as number_of_reports, EXTRACT(MONTH FROM date) as month FROM reports GROUP BY month) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE item_info (id INT, menu_item_id INT, is_sustainable BOOLEAN, is_organic BOOLEAN); INSERT INTO item_info (id, menu_item_id, is_sustainable, is_organic) VALUES (1, 1, true, false); INSERT INTO item_info (id, menu_item_id, is_sustainable, is_organic) VALUES (2, 2, true, true); | Find the total number of sustainable and organic menu items | SELECT COUNT(*) FROM item_info WHERE is_sustainable = true AND is_organic = true; | gretelai_synthetic_text_to_sql |
top_5_goal_scorers | Delete the top 5 goal scorers view | DROP VIEW IF EXISTS top_5_goal_scorers; | gretelai_synthetic_text_to_sql |
CREATE TABLE local_economy (city VARCHAR(255), year INT, revenue FLOAT); INSERT INTO local_economy (city, year, revenue) VALUES ('Barcelona', 2021, 5000000), ('Barcelona', 2020, 4000000); | What is the local economic impact of tourism in Barcelona in 2021? | SELECT revenue FROM local_economy WHERE city = 'Barcelona' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_spending (country VARCHAR(255), year INT, amount FLOAT); INSERT INTO military_spending (country, year, amount) VALUES ('India', 2017, 51.1); | Update the military spending amount for a specific country in the "military_spending" table | UPDATE military_spending SET amount = 55.3 WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (supplier_id INT, supplier_name TEXT);CREATE TABLE regions (region_id INT, region_name TEXT);CREATE TABLE timber_sales (sale_id INT, supplier_id INT, region_id INT, volume_sold FLOAT); INSERT INTO suppliers (supplier_id, supplier_name) VALUES (1, 'Supplier A'), (2, 'Supplier B'); INSERT INTO regi... | What is the average timber production for each supplier in each region? | SELECT s.supplier_id, s.supplier_name, r.region_id, r.region_name, AVG(volume_sold) FROM timber_sales AS ts JOIN suppliers AS s ON ts.supplier_id = s.supplier_id JOIN regions AS r ON ts.region_id = r.region_id GROUP BY s.supplier_id, s.supplier_name, r.region_id, r.region_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (sustainable BOOLEAN, quantity INT); INSERT INTO production (sustainable, quantity) VALUES (true, 5000), (false, 3000); | What is the total quantity of sustainable textiles used in the production of clothing? | SELECT SUM(quantity) FROM production WHERE sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE mitigation_projects (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), budget FLOAT, start_date DATE, end_date DATE); INSERT INTO mitigation_projects (id, name, location, budget, start_date, end_date) VALUES (1, 'Solar Farm', 'San Francisco, USA', 1000000, '2022-01-01', '2023-12-31'), (2, 'Wind... | Get total budget for projects in 'mitigation_projects' table | SELECT SUM(budget) FROM mitigation_projects; | gretelai_synthetic_text_to_sql |
CREATE VIEW NewHiresByQuarter AS SELECT DATE_TRUNC('quarter', HireDate) as Quarter, COUNT(*) as NewHires FROM TalentAcquisition GROUP BY Quarter; | Create a view for new hires by quarter | CREATE VIEW NewHiresByQuarter AS SELECT DATE_TRUNC('quarter', HireDate) as Quarter, COUNT(*) as NewHires FROM TalentAcquisition GROUP BY Quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_irrigation_systems (id INT, country VARCHAR(255), installed_date DATE); INSERT INTO smart_irrigation_systems (id, country, installed_date) VALUES (1, 'India', '2021-12-18'), (2, 'Canada', '2021-11-24'), (3, 'Argentina', '2022-01-05'), (4, 'India', '2022-01-02'); | Identify the number of smart irrigation systems installed in India, Canada and Argentina. | SELECT COUNT(*) FROM smart_irrigation_systems WHERE country IN ('India', 'Canada', 'Argentina'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Name VARCHAR(50), Age INT, Game VARCHAR(50), Country VARCHAR(50)); INSERT INTO Players (PlayerID, Name, Age, Game, Country) VALUES (1, 'John Doe', 25, 'Cybernetic Showdown', 'USA'); INSERT INTO Players (PlayerID, Name, Age, Game, Country) VALUES (2, 'Jane Smith', 30, 'Cybernetic Show... | What is the total number of players from each country who have played the game "Cybernetic Showdown" in the last year? | SELECT Country, COUNT(*) as TotalPlayers FROM Players WHERE Game = 'Cybernetic Showdown' AND Transactions.TransactionDate >= DATEADD(year, -1, GETDATE()) GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE workforce (id INT, name VARCHAR(50), ethnicity VARCHAR(50), position VARCHAR(50), department VARCHAR(50)); INSERT INTO workforce (id, name, ethnicity, position, department) VALUES (1, 'John Doe', 'Caucasian', 'Engineer', 'Mining'), (2, 'Jane Smith', 'African American', 'Technician', 'Environment'), (3, 'Al... | What is the percentage of employees from underrepresented racial groups in the mining industry? | SELECT (COUNT(CASE WHEN ethnicity IN ('African American', 'Hispanic', 'Native American', 'Asian', 'Pacific Islander') THEN 1 ELSE 0 END) * 100.0 / COUNT(*)) as underrepresented_percentage FROM workforce; | gretelai_synthetic_text_to_sql |
CREATE TABLE european_region_table (id INT, operation_name VARCHAR(100), country VARCHAR(50), budget INT); INSERT INTO european_region_table (id, operation_name, country, budget) VALUES (1, 'Operation Barkhane', 'France', 700000000); CREATE TABLE african_region_table (id INT, operation_name VARCHAR(100), country VARCHA... | What is the total number of peacekeeping operations in 'european_region_table' and 'african_region_table'? | SELECT COUNT(*) FROM (SELECT * FROM european_region_table UNION SELECT * FROM african_region_table) AS region_table; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_nutrition_info (food_id INT, food_name VARCHAR(255), fiber_content DECIMAL(5,2)); | Get the names and nutrient information of all food items with a high fiber content (>=7g) in the food_nutrition_info table. | SELECT food_name, fiber_content FROM food_nutrition_info WHERE fiber_content >= 7.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE gadolinium_production (country VARCHAR(255), year INT, kilograms_produced INT); INSERT INTO gadolinium_production (country, year, kilograms_produced) VALUES ('China', 2015, 50000), ('China', 2016, 52000), ('China', 2017, 55000), ('Australia', 2015, 2500), ('Australia', 2016, 3000), ('Australia', 2017, 3500... | How many Kilograms of Gadolinium were produced in each country between 2015 and 2017? | SELECT country, year, SUM(kilograms_produced) FROM gadolinium_production WHERE year BETWEEN 2015 AND 2017 GROUP BY ROLLUP(country, year); | 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.