context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE package_scores (package_id INT, package_name TEXT, location TEXT, sustainability_score INT); INSERT INTO package_scores (package_id, package_name, location, sustainability_score) VALUES (1, 'USA Wildlife Tour', 'USA', 85), (2, 'Mediterranean Cruise', 'Europe', 50); | What is the average sustainability score of tourism packages in the USA? | SELECT AVG(sustainability_score) FROM package_scores WHERE location = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE makeup_reviews (brand VARCHAR(255), product VARCHAR(255), rating DECIMAL(2,1)); INSERT INTO makeup_reviews (brand, product, rating) VALUES ('CeraVe', 'Foundation', 4.5), ('CeraVe', 'Mascara', 3.2), ('Dermalogica', 'Eyeshadow', 4.7), ('Dermalogica', 'Lipstick', 4.3); | What is the average rating for each brand of makeup? | SELECT brand, AVG(rating) as avg_rating FROM makeup_reviews GROUP BY brand; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), international_designator VARCHAR(20), country VARCHAR(50)); CREATE TABLE countries (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO countries (id, name, region) VALUES (1, 'USA', 'North America'), (2, 'Russia', 'Europe'), (3, 'China', 'Asia'); INSERT INTO s... | Update the name of the country 'USA' to 'United States' in the countries table | UPDATE countries SET name = 'United States' WHERE name = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_services (id INT PRIMARY KEY, service VARCHAR(255), location VARCHAR(255), budget DECIMAL(10, 2), provider VARCHAR(255)); | List all public services with a budget greater than $400,000. | SELECT * FROM public_services WHERE budget > 400000; | gretelai_synthetic_text_to_sql |
CREATE TABLE indian_ocean (id INT, name VARCHAR(100), region VARCHAR(50)); CREATE TABLE deep_sea_expeditions (id INT, name VARCHAR(100), agency VARCHAR(100), expedition_year INT, ocean_id INT); INSERT INTO indian_ocean (id, name, region) VALUES (1, 'Indian Ocean', 'Indian'); INSERT INTO deep_sea_expeditions (id, name, ... | How many deep-sea expeditions were conducted in the Indian Ocean by the National Oceanic and Atmospheric Administration (NOAA)? | SELECT COUNT(*) FROM deep_sea_expeditions dse WHERE dse.ocean_id = (SELECT id FROM indian_ocean WHERE name = 'Indian Ocean') AND dse.agency = 'NOAA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dwarf_planets (id INT, name VARCHAR(255), belt VARCHAR(255), diameter FLOAT); CREATE VIEW kuiper_belt_dwarfs AS SELECT * FROM dwarf_planets WHERE belt = 'Kuiper Belt'; | What is the average diameter of dwarf planets in the Kuiper Belt? | SELECT AVG(diameter) FROM kuiper_belt_dwarfs; | gretelai_synthetic_text_to_sql |
CREATE TABLE savings (id INT, client_name VARCHAR(50), country VARCHAR(50), amount DECIMAL(10,2), date DATE); INSERT INTO savings (id, client_name, country, amount, date) VALUES (1, 'Sara', 'Saudi_Arabia', 5000, '2022-01-01'); INSERT INTO savings (id, client_name, country, amount, date) VALUES (2, 'Hassan', 'Saudi_Arab... | What is the average value of savings for clients in Saudi Arabia and UAE? | SELECT AVG(amount) FROM savings WHERE country IN ('Saudi_Arabia', 'UAE'); | gretelai_synthetic_text_to_sql |
CREATE TABLE AI_Algorithms (algorithm_name TEXT, fairness_score INT); INSERT INTO AI_Algorithms (algorithm_name, fairness_score) VALUES ('Algorithm X', 80), ('Algorithm Y', 85), ('Algorithm Z', 90); | What is the maximum fairness score for AI algorithms in the AI_Algorithms table? | SELECT MAX(fairness_score) FROM AI_Algorithms; | gretelai_synthetic_text_to_sql |
CREATE TABLE environmental_impact (site_id INT, date DATE, co2_emissions FLOAT, water_consumption FLOAT); INSERT INTO environmental_impact (site_id, date, co2_emissions, water_consumption) VALUES (6, '2021-04-01', 145.2, 25000), (6, '2021-04-02', 152.1, 26000), (6, '2021-04-03', 148.9, 24500); | What's the total CO2 emissions for site 6 in April 2021? | SELECT SUM(co2_emissions) FROM environmental_impact WHERE site_id = 6 AND date BETWEEN '2021-04-01' AND '2021-04-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FundingSources (funding_source VARCHAR(20), region VARCHAR(20), total_funding DECIMAL(10,2)); INSERT INTO FundingSources (funding_source, region, total_funding) VALUES ('Cultural Trust', 'Northeast', 25000), ('Arts Foundation', 'Northeast', 12000), ('City Grants', 'Southeast', 15000); | List all unique funding sources for arts and culture programs in the 'Northeast' region, excluding those with a total funding amount less than $10,000. | SELECT DISTINCT funding_source FROM FundingSources WHERE region = 'Northeast' AND total_funding >= 10000 | gretelai_synthetic_text_to_sql |
CREATE TABLE southeast_tourism (region TEXT, revenue FLOAT); INSERT INTO southeast_tourism (region, revenue) VALUES ('Thailand', 1000000), ('Vietnam', 1200000); | What is the total revenue of sustainable tourism in Thailand and Vietnam? | SELECT SUM(revenue) FROM southeast_tourism WHERE region IN ('Thailand', 'Vietnam'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID INT, Name TEXT, BirthDate DATE); INSERT INTO Artists (ArtistID, Name, BirthDate) VALUES (1, 'Pablo Picasso', '1881-10-25'), (2, 'Vincent van Gogh', '1853-03-30'); CREATE TABLE Paintings (PaintingID INT, Title TEXT, ArtistID INT, GalleryID INT); INSERT INTO Paintings (PaintingID, Title, Ar... | List all the galleries in the 'Galleries' table that have works by artists born before 1850. | SELECT Galleries.Name FROM Galleries INNER JOIN Paintings ON Galleries.GalleryID = Paintings.GalleryID INNER JOIN Artists ON Artists.ArtistID = Paintings.ArtistID WHERE Artists.BirthDate < '1850-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT PRIMARY KEY, name VARCHAR(255), age INT, gender VARCHAR(10), country VARCHAR(100)); INSERT INTO artists (id, name, age, gender, country) VALUES (1, 'Pablo Picasso', 91, 'Male', 'Spain'); INSERT INTO artists (id, name, age, gender, country) VALUES (2, 'Frida Kahlo', 47, 'Female', 'Mexico'); ... | What's the average age of artists from the United States? | SELECT AVG(age) as avg_age FROM artists WHERE country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE login_attempts (id INT, ip_address VARCHAR(255), success BOOLEAN, date DATE); INSERT INTO login_attempts (id, ip_address, success, date) VALUES (1, '192.168.0.1', FALSE, '2022-01-01'), (2, '192.168.0.1', FALSE, '2022-01-02'), (3, '10.0.0.1', TRUE, '2022-01-03'); | What is the maximum number of failed login attempts from a single IP address in the last month? | SELECT MAX(count) FROM (SELECT ip_address, COUNT(*) AS count FROM login_attempts WHERE success = FALSE AND date >= DATEADD(month, -1, GETDATE()) GROUP BY ip_address) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_name VARCHAR(255), student_university VARCHAR(255), state VARCHAR(255)); CREATE TABLE universities (university_name VARCHAR(255), state VARCHAR(255)); | How many public universities are there in the state of California, and what is the total number of students enrolled in those universities? | SELECT COUNT(*), SUM(students) FROM (SELECT COUNT(*) AS students FROM students JOIN universities ON students.student_university = universities.university_name JOIN states ON universities.state = states.state_abbreviation WHERE states.state_name = 'California' GROUP BY student_university) subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, name TEXT, domain TEXT, members INT); INSERT INTO unions (id, name, domain, members) VALUES (1, 'National Education Association', 'Education', 300000); INSERT INTO unions (id, name, domain, members) VALUES (2, 'American Federation of Teachers', 'Education', 150000); | Delete all records of unions that focus on 'Education' and have less than 50,000 members. | DELETE FROM unions WHERE domain = 'Education' AND members < 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Gender VARCHAR(10), HireDate DATE); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Gender, HireDate) VALUES (1, 'John', 'Doe', 'IT', 'Male', '2020-01-01'), (2, 'Jane', 'Doe', 'IT', 'Female',... | What is the average hire date for employees in the IT department? | SELECT AVG(HireDate) FROM Employees WHERE Department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_literacy_scores (id INT, student_id INT, score INT, school VARCHAR(255), region VARCHAR(255)); INSERT INTO media_literacy_scores (id, student_id, score, school, region) VALUES (4, 111, 90, 'School D', 'Europe'), (5, 222, 95, 'School E', 'Europe'), (6, 333, 88, 'School F', 'Europe'); | What is the maximum media literacy score of high school students in Europe? | SELECT MAX(score) FROM media_literacy_scores WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID INT, VesselType VARCHAR(50), AvgSpeed DECIMAL(5,2)); INSERT INTO Vessels VALUES (1, 'Tanker', 15.2), (2, 'Container Ship', 18.6), (3, 'Tanker', 14.8); | What is the minimum speed of vessels in the tanker category? | SELECT MIN(AvgSpeed) FROM Vessels WHERE VesselType = 'Tanker'; | gretelai_synthetic_text_to_sql |
CREATE TABLE districts (id INT, name VARCHAR(255)); INSERT INTO districts (id, name) VALUES (4, 'Southriver'); CREATE TABLE community_policing_events (id INT, district_id INT, title VARCHAR(255), date DATE); INSERT INTO community_policing_events (id, district_id, title, date) VALUES (201, 4, 'Neighborhood Watch Meeting... | Update community policing event details for event ID 201 in district 4 | UPDATE community_policing_events SET title = 'Community Safety Meeting', date = '2023-03-17' WHERE id = 201; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA labor_unions; CREATE TABLE unions (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(255), union_id INT, FOREIGN KEY (union_id) REFERENCES unions(id)); INSERT INTO unions (id, name) VALUES (1, 'Union A'), (2, 'Union B'); INSERT INTO employees (id, name, union... | List the names of all employees who do not belong to a union | SELECT name FROM labor_unions.employees WHERE union_id IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, EmployeeName VARCHAR(50), Department VARCHAR(50), HireDate DATE); INSERT INTO Employees (EmployeeID, EmployeeName, Department, HireDate) VALUES (1, 'John Doe', 'IT', '2020-01-01'), (2, 'Jane Smith', 'IT', '2021-01-01'), (3, 'Mike Johnson', 'HR', '2019-01-01'), (4, 'Sara Brown', '... | Identify the employees who have been with the company the longest, and the employees who have been with the company the shortest, in each department. | SELECT Department, EmployeeName, ROW_NUMBER() OVER (PARTITION BY Department ORDER BY HireDate ASC) AS Rank, DATEDIFF(YEAR, HireDate, GETDATE()) AS YearsWithCompany FROM Employees; | gretelai_synthetic_text_to_sql |
CREATE TABLE safety_incidents (incident_id INT, incident_date DATE, incident_type VARCHAR(30), description TEXT); INSERT INTO safety_incidents (incident_id, incident_date, incident_type, description) VALUES (1, '2021-03-01', 'landing gear failure', '...'), (2, '2021-03-15', 'fuel leak', '...'); | List safety incidents by type in descending order | SELECT incident_type, COUNT(*) AS incident_count FROM safety_incidents GROUP BY incident_type ORDER BY incident_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Services (City VARCHAR(10), Department VARCHAR(20), Service VARCHAR(20)); INSERT INTO Services (City, Department, Service) VALUES ('CityD', 'Utilities', 'Water'), ('CityD', 'Utilities', 'Electricity'), ('CityE', 'Utilities', 'Gas'); | What are the unique services provided by the 'Utilities' department in 'CityD' and 'CityE'? | SELECT DISTINCT Service FROM Services WHERE City IN ('CityD', 'CityE') AND Department = 'Utilities'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGeneration (Region VARCHAR(50), Waste INT, WasteDate DATETIME); | Identify the bottom 3 regions with the lowest waste generation in the past month? | SELECT Region, SUM(Waste) OVER (PARTITION BY Region ORDER BY WasteDate ROWS BETWEEN 29 PRECEDING AND CURRENT ROW) AS TotalWaste, RANK() OVER (ORDER BY SUM(Waste) ASC) AS Rank FROM WasteGeneration WHERE WasteDate >= DATEADD(month, -1, CURRENT_TIMESTAMP) GROUP BY Region, WasteDate HAVING Rank <= 3 | gretelai_synthetic_text_to_sql |
CREATE TABLE hiv_patients(id INT, age INT, state TEXT); | What is the average age of patients with HIV in each state? | SELECT state, AVG(age) FROM hiv_patients GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE user (id INT, name VARCHAR(50), age INT, gender VARCHAR(10), created_at TIMESTAMP); INSERT INTO user (id, name, age, gender, created_at) VALUES (1, 'John Doe', 25, 'Male', '2021-01-01 10:00:00'); CREATE TABLE post (id INT, user_id INT, content TEXT, posted_at TIMESTAMP); INSERT INTO post (id, user_id, cont... | Show the top 5 users with the most posts in the 'social_media' schema. | SELECT user_id, COUNT(*) as count FROM post GROUP BY user_id ORDER BY count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Spacecrafts (id INT, name VARCHAR(100), manufacturer VARCHAR(100), mass FLOAT); INSERT INTO Spacecrafts (id, name, manufacturer, mass) VALUES (1, 'Voyager 1', 'SpaceTech Inc.', 770), (2, 'Voyager 2', 'SpaceTech Inc.', 770); | What is the average mass of spacecrafts manufactured by SpaceTech Inc.? | SELECT AVG(mass) FROM Spacecrafts WHERE manufacturer = 'SpaceTech Inc.'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cybersecurity_incidents (country TEXT, year INT, num_incidents INT); INSERT INTO cybersecurity_incidents (country, year, num_incidents) VALUES ('USA', 2019, 50000), ('UK', 2019, 7000), ('China', 2019, 12000); | What is the total number of cybersecurity incidents for each country in 2019? | SELECT country, SUM(num_incidents) as total_incidents FROM cybersecurity_incidents WHERE year = 2019 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_costs (project_id INT, labor_cost DECIMAL(10, 2), is_sustainable BOOLEAN); CREATE TABLE project_location (project_id INT, city VARCHAR(255), country VARCHAR(255)); | What was the total construction labor cost for sustainable building projects in the city of Los Angeles in 2020? | SELECT SUM(labor_costs.labor_cost) FROM labor_costs INNER JOIN project_location ON labor_costs.project_id = project_location.project_id WHERE project_location.city = 'Los Angeles' AND labor_costs.is_sustainable = TRUE AND YEAR(labor_costs.start_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT PRIMARY KEY, transaction_date DATE, quantity_sold INT, payment_method VARCHAR(255), country VARCHAR(255)); | What is the total quantity of garments sold online, per payment method, in the USA? | SELECT payment_method, SUM(quantity_sold) as total_quantity_sold_online FROM sales WHERE country = 'USA' AND transaction_date >= '2022-01-01' AND transaction_date <= '2022-12-31' AND payment_method IS NOT NULL GROUP BY payment_method; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (subscriber_id INT, name VARCHAR(50), data_usage FLOAT); | Insert a new record with 'subscriber_id' 10, 'name' 'John Doe', and 'data_usage' 30 in the 'subscribers' table. | INSERT INTO subscribers VALUES (10, 'John Doe', 30); | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, country VARCHAR(255), views INT, date DATE); | Find the top 3 countries with the most virtual tour usage | SELECT country, SUM(views) AS total_views FROM virtual_tours GROUP BY country ORDER BY total_views DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE bus_sales (sale_id INT, sale_date DATE, sale_revenue FLOAT, system_name VARCHAR(20)); CREATE TABLE user_activity (user_id INT, sale_id INT, activity_date DATE); | List the number of unique users who used the bus and subway systems in March 2021. | SELECT COUNT(DISTINCT user_id) FROM user_activity UA JOIN bus_sales BS ON UA.sale_id = BS.sale_id WHERE BS.system_name = 'Bus' OR BS.system_name = 'Subway' AND UA.activity_date BETWEEN '2021-03-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName VARCHAR(100), ProgramCategory VARCHAR(50), StartDate DATE, EndDate DATE, TotalDonation DECIMAL(10,2), TotalExpense DECIMAL(10,2)); INSERT INTO Programs (ProgramID, ProgramName, ProgramCategory, StartDate, EndDate, TotalDonation, TotalExpense) VALUES (1, 'Health Awarenes... | Update the 'ProgramName' of program ID 2 to 'Education and Awareness'. | UPDATE Programs SET ProgramName = 'Education and Awareness' WHERE ProgramID = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_inventory (id INT PRIMARY KEY, species VARCHAR(50), quantity INT, location VARCHAR(50)); INSERT INTO fish_inventory (id, species, quantity, location) VALUES (1, 'Salmon', 50, 'Tank A'), (2, 'Tilapia', 75, 'Tank B'), (3, 'Cod', 100, 'Tank C'); | List all fish species and their respective quantities in the 'fish_inventory' table. | SELECT species, quantity FROM fish_inventory; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_regions (id INT, farm_id INT, region VARCHAR(20)); INSERT INTO farm_regions (id, farm_id, region) VALUES (1, 1, 'rural'), (2, 2, 'urban'), (3, 3, 'rural'); CREATE VIEW organic_farm_regions AS SELECT f.name, f.acres FROM organic_farms f JOIN farm_regions fr ON f.id = fr.farm_id WHERE fr.region = 'rural... | What is the total area of land used for organic farming in 'rural' regions? | SELECT SUM(acres) FROM organic_farm_regions; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID int, Department varchar(20), Salary numeric(10,2)); INSERT INTO Employees (EmployeeID, Department, Salary) VALUES (1, 'IT', 75000.00), (2, 'IT', 70000.00), (3, 'HR', 60000.00); | What is the minimum salary for employees in the IT department? | SELECT MIN(Salary) FROM Employees WHERE Department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Site_A (Artifact_ID INT); INSERT INTO Site_A (Artifact_ID) VALUES (1), (2), (3); CREATE TABLE Site_B (Artifact_ID INT); | How many artifacts are there in each site? (Site A, Site B, Site C, Site D) | SELECT 'Site A' AS Site, COUNT(*) FROM Site_A UNION ALL SELECT 'Site B', COUNT(*) FROM Site_B UNION ALL SELECT 'Site C', COUNT(*) FROM Site_C | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_algorithm_fairness (algorithm_name TEXT, region TEXT, fairness_score FLOAT); INSERT INTO ai_algorithm_fairness (algorithm_name, region, fairness_score) VALUES ('Alg4', 'South America', 0.75), ('Alg5', 'South America', 0.8), ('Alg6', 'North America', 0.9); | Find the AI algorithm with the highest fairness score in South America. | SELECT algorithm_name, fairness_score FROM ai_algorithm_fairness WHERE region = 'South America' ORDER BY fairness_score DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE if NOT EXISTS grants (id INT, facultyid INT, department VARCHAR(20), amount INT, startdate DATE, enddate DATE); CREATE TABLE if NOT EXISTS faculty (id INT, name VARCHAR(50), department VARCHAR(20), rank VARCHAR(20), salary INT); | What is the average number of research grants awarded per faculty member in the Physics department in the past 3 years? | SELECT AVG(num_grants) FROM (SELECT facultyid, COUNT(*) as num_grants FROM grants WHERE startdate >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) GROUP BY facultyid) AS subquery INNER JOIN faculty ON subquery.facultyid = faculty.id WHERE department='Physics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (id INT, program_name TEXT, volunteers INT); INSERT INTO programs (id, program_name, volunteers) VALUES (1, 'Education', 50); INSERT INTO programs (id, program_name, volunteers) VALUES (2, 'Healthcare', 75); | Which programs had the highest and lowest number of volunteers in 2021? | SELECT program_name, volunteers, DENSE_RANK() OVER (ORDER BY volunteers) as rank FROM programs WHERE YEAR(program_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (id INT, location VARCHAR(50), quantity INT, weight FLOAT); INSERT INTO Warehouse (id, location, quantity, weight) VALUES (1, 'USA', 300, 12.5), (2, 'Canada', 250, 11.0), (3, 'France', 500, 13.2), (4, 'Germany', 400, 14.7), (5, 'UK', 300, 15.3); | What is the total weight of items in the UK warehouse? | SELECT SUM(weight) FROM Warehouse WHERE location = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PolicyImpact (Quarter INT, Location VARCHAR(10), Score FLOAT); INSERT INTO PolicyImpact (Quarter, Location, Score) VALUES (202302, 'Rural', 7.8), (202302, 'Urban', 8.3), (202303, 'Rural', 7.6), (202303, 'Urban', 8.1); | What is the average policy impact score for rural and urban areas in Q2 2023? | SELECT AVG(Score) FROM PolicyImpact WHERE Quarter IN (202302, 202303) AND Location IN ('Rural', 'Urban'); | gretelai_synthetic_text_to_sql |
CREATE TABLE HealthEquityMetrics (Patient_ID INT, CHW_ID INT, Score INT); INSERT INTO HealthEquityMetrics (Patient_ID, CHW_ID, Score) VALUES (1, 1, 80), (2, 1, 85), (3, 2, 70), (4, 2, 75), (5, 3, 90), (6, 3, 95), (7, 4, 60), (8, 4, 65); | What is the average health equity metric score for patients in each community health worker's region, excluding scores below 70? | SELECT c.Region, AVG(m.Score) as Avg_Score FROM HealthEquityMetrics m JOIN CommunityHealthWorkers c ON m.CHW_ID = c.CHW_ID WHERE m.Score >= 70 GROUP BY c.Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableBuildings (id INT, buildingName TEXT, state TEXT, squareFootage INT); | What is the total square footage of sustainable buildings in Oregon? | SELECT SUM(squareFootage) FROM SustainableBuildings WHERE state = 'Oregon'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, ProgramID INT, DonationAmount DECIMAL(10,2), DonationDate DATE); CREATE TABLE Programs (ProgramID INT, ProgramName TEXT); INSERT INTO Donations (DonationID, DonorID, ProgramID, DonationAmount, DonationDate) VALUES (1, 1, 1, 1000.00, '2021-04-10'), (2, 2, 2, 500.00, '... | What is the average donation amount for each program in the last month? | SELECT AVG(DonationAmount) AS AvgDonation, Programs.ProgramName FROM Donations INNER JOIN Programs ON Donations.ProgramID = Programs.ProgramID WHERE DonationDate >= DATEADD(month, -1, GETDATE()) GROUP BY Programs.ProgramName | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment (id INT PRIMARY KEY, name VARCHAR(100), type VARCHAR(50), acquisition_date DATE, decommission_date DATE, status VARCHAR(50)); | Insert new records for decommissioned military equipment in the 'equipment' table | INSERT INTO equipment (name, type, acquisition_date, decommission_date, status) VALUES ('M1 Abrams', 'Tank', '1985-01-01', '2022-12-31', 'Decommissioned'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount DECIMAL, donation_date DATE, donor_state TEXT); INSERT INTO donors (donor_id, donor_name, donation_amount, donation_date, donor_state) VALUES (1, 'John Doe', 50.00, '2022-01-01', 'California'); | What was the average donation amount by donors from 'California' in '2022'? | SELECT AVG(donation_amount) FROM donors WHERE donor_state = 'California' AND donation_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE success_rate(id INT, name TEXT, location TEXT, industry TEXT, funding FLOAT, success BOOLEAN); INSERT INTO success_rate VALUES(1, 'Genetech', 'United States', 'Biotechnology', 10000000, true); INSERT INTO success_rate VALUES(2, 'BioAsia', 'India', 'Biotechnology', 7000000, false); | What is the success rate of biotech startups that have received funding of over $5 million in the United States? | SELECT AVG(success) FROM success_rate WHERE industry = 'Biotechnology' AND location = 'United States' AND funding > 5000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (site_id INT, site_name VARCHAR(30), annual_pollution_limit INT); INSERT INTO mining_sites (site_id, site_name, annual_pollution_limit) VALUES (1, 'Site A', 10000), (2, 'Site B', 12000), (3, 'Site C', 15000), (4, 'Site D', 8000); CREATE TABLE pollution_data (site_id INT, pollution_quantity INT... | Which mining sites have exceeded their annual pollution limits? | SELECT site_name FROM mining_sites ms JOIN pollution_data pd ON ms.site_id = pd.site_id WHERE pd.pollution_quantity > ms.annual_pollution_limit | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonationAmount DECIMAL(10, 2), DonationDate DATE); | What is the average donation amount per donor in the 'Donors' table, and the total number of donations they've made? | SELECT DonorID, AVG(DonationAmount) AS AvgDonation, COUNT(*) AS TotalDonations FROM Donors GROUP BY DonorID; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine_operation(year INT, material VARCHAR(10), quantity INT); INSERT INTO mine_operation VALUES (2018, 'coal', 1500), (2019, 'coal', 1800), (2020, 'coal', 2200), (2018, 'iron', 1200), (2019, 'iron', 1400), (2020, 'iron', 1700); | Find the total quantity of coal and iron mined in the year 2020 | SELECT SUM(quantity) FROM mine_operation WHERE year = 2020 AND material IN ('coal', 'iron'); | gretelai_synthetic_text_to_sql |
CREATE TABLE q2_incidents (region VARCHAR(50), incident_count INT); | Cybersecurity incidents per region in Q2 2022 | SELECT region, incident_count FROM q2_incidents WHERE QUARTER(date) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE offenders (id INT, name TEXT, state TEXT, community_service_hours INT); INSERT INTO offenders (id, name, state, community_service_hours) VALUES (1, 'John Doe', 'California', 50); INSERT INTO offenders (id, name, state, community_service_hours) VALUES (2, 'Jane Smith', 'California', 75); | Update the community service hours of offenders in California by adding 10 hours to their current total. | UPDATE offenders SET community_service_hours = community_service_hours + 10 WHERE state = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WildlifeSightings (Location VARCHAR(255), Date DATE, Species VARCHAR(255), Quantity INT); INSERT INTO WildlifeSightings (Location, Date, Species, Quantity) VALUES ('Tundra National Park', '2021-01-01', 'Polar Bear', 1), ('Arctic Circle', '2021-01-01', 'Arctic Fox', 2); | How many wildlife sightings were recorded in 2021, separated by species, at the Arctic Circle? | SELECT Species, SUM(Quantity) FROM WildlifeSightings WHERE Location = 'Arctic Circle' AND YEAR(Date) = 2021 GROUP BY Species; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales (supplier VARCHAR(255), country VARCHAR(255), sale_value INT, sale_year INT); INSERT INTO military_sales (supplier, country, sale_value, sale_year) VALUES ('Boeing', 'India', 100000000, 2021), ('Boeing', 'India', 120000000, 2020), ('Boeing', 'India', 90000000, 2019); | What is the total value of military equipment sales by Boeing to the Indian government in 2021? | SELECT SUM(sale_value) FROM military_sales WHERE supplier = 'Boeing' AND country = 'India' AND sale_year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredient_usage (ingredient_name VARCHAR(50), sale_date DATE, quantity INT); INSERT INTO ingredient_usage (ingredient_name, sale_date, quantity) VALUES ('Lettuce', '2023-03-01', 200), ('Tomatoes', '2023-03-01', 300), ('Cheese', '2023-03-01', 400), ('Lettuce', '2023-03-02', 250), ('Tomatoes', '2023-03-02',... | What is the total quantity of each ingredient used, broken down by day? | SELECT sale_date, ingredient_name, SUM(quantity) FROM ingredient_usage GROUP BY sale_date, ingredient_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing_countries (country VARCHAR(50), manufacturing_sector VARCHAR(50), total_emissions INT); INSERT INTO manufacturing_countries (country, manufacturing_sector, total_emissions) VALUES ('Brazil', 'leather_processing', 120000), ('Italy', 'leather_processing', 95000), ('India', 'leather_processing',... | Show the top 5 countries with the highest total emissions in the 'leather_processing' sector | SELECT country, total_emissions FROM manufacturing_countries WHERE manufacturing_sector = 'leather_processing' ORDER BY total_emissions DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE Disasters (id INT, disaster_name VARCHAR(50), disaster_type VARCHAR(50), disaster_date DATE, affected_country VARCHAR(50)); INSERT INTO Disasters (id, disaster_name, disaster_type, disaster_date, affected_country) VALUES (1, 'Typhoon Haiyan', 'typhoon', '2013-11-08', 'Philippines'); | What are the names and types of natural disasters that have occurred in the Philippines since 2015? | SELECT Disasters.disaster_name, Disasters.disaster_type FROM Disasters WHERE Disasters.affected_country = 'Philippines' AND Disasters.disaster_date >= '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup_funding (id INT, startup_name VARCHAR(50), city VARCHAR(50), funding_year INT, amount FLOAT); INSERT INTO startup_funding (id, startup_name, city, funding_year, amount) VALUES (1, 'GreenGen', 'Seattle', 2021, 3000000), (2, 'BioSolutions', 'Austin', 2022, 4000000), (3, 'NeuroTech', 'Boston', 2022, 5... | How many biotech startups received funding in '2022' from the 'startup_funding' database? | SELECT COUNT(*) FROM startup_funding WHERE funding_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE esports_matches (team1 TEXT, team2 TEXT, prize_money INT, match_date DATETIME); | Show total earnings of eSports team 'Crimson Clash' for the current year | SELECT SUM(prize_money) AS total_earnings FROM esports_matches WHERE (team1 = 'Crimson Clash' OR team2 = 'Crimson Clash') AND YEAR(match_date) = YEAR(NOW()); | gretelai_synthetic_text_to_sql |
CREATE TABLE MentalHealthParity (WorkerID INT, County CHAR(20), ParityScore INT); INSERT INTO MentalHealthParity (WorkerID, County, ParityScore) VALUES (1, 'Los Angeles', 95), (2, 'Harris', 88), (3, 'Los Angeles', 92), (4, 'Harris', 85); | Calculate the percentage of mental health parity scores that are above 90 for each county. | SELECT County, 100.0 * COUNT(CASE WHEN ParityScore > 90 THEN 1 END) OVER (PARTITION BY County) / COUNT(*) OVER (PARTITION BY County) AS Percentage FROM MentalHealthParity; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, consumer_rating DECIMAL(3,1)); | Update the consumer rating for a specific product. | UPDATE products SET products.consumer_rating = 4.5 WHERE products.product_id = 456; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name VARCHAR(50)); CREATE TABLE games (game_id INT, home_team_id INT, away_team_id INT, home_team_second_half_points INT, away_team_second_half_points INT); | Calculate the average points scored by each NBA team in the second half of their games. | SELECT home_team_id, AVG(home_team_second_half_points) AS avg_points FROM games WHERE home_team_id = teams.team_id GROUP BY home_team_id; SELECT away_team_id, AVG(away_team_second_half_points) AS avg_points FROM games WHERE away_team_id = teams.team_id GROUP BY away_team_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE quarters (quarter_id INT, month VARCHAR(10), year INT); INSERT INTO quarters (quarter_id, month, year) VALUES (1, 'January', 2021), (2, 'February', 2021), (3, 'March', 2021); CREATE TABLE feedback_table (feedback_id INT, quarter_id INT, department VARCHAR(20), feedback VARCHAR(10)); INSERT INTO feedback_ta... | What is the total number of positive feedback instances for police and fire services in the last quarter? | SELECT COUNT(f.feedback_id) FROM feedback_table f JOIN quarters q ON f.quarter_id = q.quarter_id WHERE f.department IN ('police', 'fire') AND q.month IN ('January', 'February', 'March') AND q.year = 2021 AND f.feedback IN ('Great', 'Excellent', 'Very good'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Specs (id INT, aircraft_model VARCHAR(50), max_passengers INT); INSERT INTO Aircraft_Specs (id, aircraft_model, max_passengers) VALUES (1, 'Boeing 747', 416), (2, 'Airbus A380', 525), (3, 'Boeing 777', 396); | What is the maximum number of passengers that can be carried by each aircraft model in the Aircraft_Specs table? | SELECT aircraft_model, MAX(max_passengers) as max_capacity FROM Aircraft_Specs GROUP BY aircraft_model; | gretelai_synthetic_text_to_sql |
CREATE TABLE organizations (id INT, name VARCHAR(50), type VARCHAR(50), country VARCHAR(50)); | Insert a new record into the 'organizations' table: 'Accessible AI', 'Non-profit', 'USA' | INSERT INTO organizations (id, name, type, country) VALUES (1, 'Accessible AI', 'Non-profit', 'USA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE plant_locations (id INT, name TEXT, region TEXT, safety_incident_rate INT); INSERT INTO plant_locations (id, name, region, safety_incident_rate) VALUES (1, 'Plant 1', 'Northeast', 12), (2, 'Plant 2', 'Midwest', 9), (3, 'Plant 3', 'South', 15), (4, 'Plant 4', 'West', 10), (5, 'Plant 5', 'Northeast', 14); | What is the maximum safety incident rate for each plant location? | SELECT region, MAX(safety_incident_rate) FROM plant_locations GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_hospitals_beds (hospital_id INT, region VARCHAR(10), num_of_beds INT); INSERT INTO rural_hospitals_beds (hospital_id, region, num_of_beds) VALUES (1, 'Europe', 100), (2, 'Asia', 120), (3, 'Europe', 110), (4, 'Africa', 90); | What is the maximum number of hospital beds in rural hospitals in Europe? | SELECT MAX(num_of_beds) FROM rural_hospitals_beds WHERE region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, name VARCHAR(100), sport VARCHAR(50), position VARCHAR(50), jersey_number INT); INSERT INTO athletes (athlete_id, name, sport, position, jersey_number) VALUES (1, 'John Doe', 'Basketball', 'Guard', 7); | Update the jersey number of a specific athlete. | UPDATE athletes SET jersey_number = 8 WHERE athlete_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE orders (order_id INT, location_id INT, item_id INT, quantity INT, date DATE); CREATE TABLE menu (item_id INT, item_name VARCHAR(50), category VARCHAR(50), cuisine VARCHAR(50), price DECIMAL(5,2)); | List the locations that have sold a specific dish in the past month. | SELECT DISTINCT location_id FROM orders WHERE date >= CURDATE() - INTERVAL 1 MONTH AND item_id = (SELECT item_id FROM menu WHERE item_name = 'Chicken Alfredo Pasta'); | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_programs (id INT, program_name VARCHAR(255), location VARCHAR(255)); CREATE TABLE animal_counts (id INT, program_id INT, animal_count INT); INSERT INTO conservation_programs (id, program_name, location) VALUES (1, 'Bear Trust International', 'USA'), (2, 'Wildlife Conservation Society', 'Global... | Find the average number of animals in each conservation program | SELECT AVG(animal_counts.animal_count) FROM conservation_programs INNER JOIN animal_counts ON conservation_programs.id = animal_counts.program_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name VARCHAR(255), region_id INT, occupancy_rate DECIMAL(5,2)); INSERT INTO hotels (hotel_id, hotel_name, region_id, occupancy_rate) VALUES (1, 'Eco Hotel A', 1, 0.85), (2, 'Green Hotel B', 2, 0.78), (3, 'Sustainable Hotel C', 3, 0.92), (4, 'Eco Resort D', 4, 0.64); | What is the average occupancy rate for eco-friendly hotels in the North region? | SELECT AVG(occupancy_rate) as avg_occupancy FROM hotels WHERE region_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(50), department VARCHAR(20), salary DECIMAL(10,2)); INSERT INTO employees (id, name, department, salary) VALUES (1, 'Alice', 'sales', 80000.00), (2, 'Bob', 'marketing', 70000.00), (3, 'Charlie', 'sales', 85000.00); | What is the minimum salary of employees in the marketing department in the employees table? | SELECT MIN(salary) AS min_salary FROM employees WHERE department = 'marketing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ethical_AI_Budget (Country VARCHAR(50), Budget INT); | What is the average budget allocated for ethical AI initiatives by countries in Europe? | SELECT AVG(Budget) FROM Ethical_AI_Budget WHERE Country IN ('Germany', 'France', 'Spain', 'Italy', 'UK'); | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage (name TEXT, type TEXT, capacity FLOAT); INSERT INTO energy_storage (name, type, capacity) VALUES ('Battery A', 'Lithium-Ion', 50.0), ('Pumped Hydro B', 'Pumped Hydro', 400.0), ('Flywheel C', 'Flywheel', 5.0), ('CAES D', 'CAES', 200.0); | What are the capacities and types of energy storage facilities in Germany? | SELECT type, capacity FROM energy_storage; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name TEXT, material TEXT, production_cost FLOAT); INSERT INTO products (id, name, material, production_cost) VALUES (1, 'Jacket', 'Recycled Polyester', 75.0), (2, 'Shoes', 'Recycled Polyester', 50.0); | What is the maximum production cost for items made of recycled polyester? | SELECT MAX(production_cost) FROM products WHERE material = 'Recycled Polyester'; | gretelai_synthetic_text_to_sql |
CREATE TABLE court_cases_2 (court_type VARCHAR(20), year INT, case_type VARCHAR(10), num_cases INT); INSERT INTO court_cases_2 (court_type, year, case_type, num_cases) VALUES ('Supreme Court', 2021, 'Criminal', 800), ('Supreme Court', 2021, 'Civil', 400), ('District Court', 2021, 'Criminal', 2500), ('District Court', 2... | What was the total number of criminal and civil cases heard in each court last year? | SELECT court_type, SUM(num_cases) as total_cases FROM court_cases_2 WHERE year = 2021 GROUP BY court_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE attendees (attendee_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(100), phone_number VARCHAR(15), date_of_birth DATE); | Insert a new record into the "attendees" table | INSERT INTO attendees (attendee_id, first_name, last_name, email, phone_number, date_of_birth) VALUES (1002, 'María', 'García', 'maria.garcia@ejemplo.com', '555-765-4321', '1990-02-28'); | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_covid_cases (date DATE, cases INT, city VARCHAR(20)); INSERT INTO daily_covid_cases (date, cases, city) VALUES ('2022-01-01', 1500, 'Seoul'); INSERT INTO daily_covid_cases (date, cases, city) VALUES ('2022-01-02', 2200, 'Seoul'); | What is the maximum number of COVID-19 cases reported in a single day in Seoul? | SELECT MAX(cases) FROM daily_covid_cases WHERE city = 'Seoul'; | gretelai_synthetic_text_to_sql |
CREATE TABLE medical_emergencies (id INT, incident_time TIMESTAMP, response_time INT); INSERT INTO medical_emergencies (id, incident_time, response_time) VALUES (1, '2022-02-01 14:30:00', 15), (2, '2022-02-03 09:15:00', 20); | What was the maximum response time for medical emergencies in Miami in 2022? | SELECT MAX(response_time) FROM medical_emergencies WHERE incident_time >= '2022-01-01' AND incident_time < '2022-02-01' AND city = 'Miami'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (id INT, name VARCHAR(255), accessibility_rating INT); | List schools with accessibility ratings above 4. | SELECT id, name FROM schools WHERE accessibility_rating > 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_species (id INT, name TEXT, region TEXT); INSERT INTO fish_species (id, name, region) VALUES (1, 'Herring', 'Baltic Sea'), (2, 'Salmon', 'Baltic Sea'), (3, 'Cod', 'North Atlantic'); CREATE TABLE aquatic_farms (id INT, name TEXT, region TEXT); INSERT INTO aquatic_farms (id, name, region) VALUES (1, 'Fa... | What is the total number of fish species in the 'Baltic Sea' region? | SELECT COUNT(DISTINCT fish_species.name) FROM fish_species INNER JOIN aquatic_farms ON fish_species.region = aquatic_farms.region WHERE aquatic_farms.region = 'Baltic Sea'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (id INT, product TEXT, quantity INT, date DATE); INSERT INTO sales (id, product, quantity, date) VALUES (1, 'eggs', 12, '2021-01-01'), (2, 'milk', 24, '2021-01-05'), (3, 'eggs', 18, '2021-01-07'), (4, 'flour', 36, '2021-01-10'); | What is the total weight of all milk sold last month? | SELECT SUM(quantity) FROM sales WHERE product = 'milk' AND date BETWEEN '2021-01-01' AND '2021-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, industry TEXT, founder_citizenship TEXT); INSERT INTO startup VALUES (1, 'StartupA', 'Edtech', 'US'); INSERT INTO startup VALUES (2, 'StartupB', 'Tech', 'India'); | What is the total funding received by startups founded by immigrants in the edtech industry? | SELECT SUM(funding_amount) FROM investment_round ir JOIN startup s ON ir.startup_id = s.id WHERE s.industry = 'Edtech' AND s.founder_citizenship != 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_vessels (vessel_id INT, name VARCHAR(50), last_measurement_date DATE, ocean_depth INT, region VARCHAR(50)); INSERT INTO research_vessels (vessel_id, name, last_measurement_date, ocean_depth, region) VALUES (1, 'RV Polarstern', '2018-07-23', 5200, 'Arctic'), (2, 'CCGS Amundsen', '2016-02-08', 4500,... | What is the maximum ocean depth measured by research vessels in the Arctic region since 2015? | SELECT MAX(ocean_depth) FROM research_vessels WHERE region = 'Arctic' AND last_measurement_date >= '2015-01-01' AND last_measurement_date <= '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE salmon_farms (id INT, name TEXT, country TEXT); INSERT INTO salmon_farms (id, name, country) VALUES (1, 'Farm A', 'Norway'), (2, 'Farm B', 'Norway'); CREATE TABLE temperature_readings (id INT, farm_id INT, reading_date DATE, water_temp FLOAT); INSERT INTO temperature_readings (id, farm_id, reading_date, wa... | What is the average water temperature in March for all salmon farms in Norway? | SELECT AVG(water_temp) FROM temperature_readings TR JOIN salmon_farms SF ON TR.farm_id = SF.id WHERE SF.country = 'Norway' AND EXTRACT(MONTH FROM TR.reading_date) = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE WellProduction (well_id INT, well_name TEXT, region TEXT, production_qty REAL); INSERT INTO WellProduction (well_id, well_name, region, production_qty) VALUES (1, 'Delta', 'ArabianGulf', 1200), (2, 'Echo', 'ArabianSea', 1000), (3, 'Foxtrot', 'ArabianSea', 1100); | Which wells in the 'ArabianGulf' have a production quantity higher than the average production quantity for wells in the 'ArabianSea'? | SELECT well_name FROM WellProduction WHERE region = 'ArabianGulf' AND production_qty > (SELECT AVG(production_qty) FROM WellProduction WHERE region = 'ArabianSea') | gretelai_synthetic_text_to_sql |
CREATE TABLE phishing_attempts (id INT, ip_address VARCHAR(255), attempt_date DATE); | Which IP addresses have been flagged for phishing attempts in the past week? | SELECT DISTINCT ip_address FROM phishing_attempts WHERE attempt_date >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (program_id INT, program_name VARCHAR(50), program_type VARCHAR(20)); CREATE TABLE funding (funding_id INT, program_id INT, funding_amount DECIMAL(10,2), funding_date DATE); INSERT INTO programs (program_id, program_name, program_type) VALUES (1, 'Art Education', 'Education'), (2, 'Music Education... | What is the total funding received by each program type in Q1 and Q2 for the past two years, grouped by year? | SELECT DATEPART(yy, funding_date) AS year, program_type, SUM(funding_amount) AS total_funding FROM funding f INNER JOIN programs p ON f.program_id = p.program_id WHERE funding_date BETWEEN DATEADD(year, -2, '2022-01-01') AND '2022-06-30' GROUP BY DATEPART(yy, funding_date), program_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityPolicing (id INT, state VARCHAR(20)); | How many community policing programs are there in the state of Texas? | SELECT COUNT(*) FROM CommunityPolicing WHERE state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue(restaurant_id INT, cuisine VARCHAR(255), daily_revenue DECIMAL(10,2), revenue_date DATE); | What was the highest revenue-generating day for 'Mexican Food' cuisine in the city of 'San Francisco' in 2021? | SELECT MAX(daily_revenue) FROM restaurant_revenue WHERE cuisine = 'Mexican Food' AND city = 'San Francisco' AND revenue_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY revenue_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (name VARCHAR(255), region VARCHAR(255), establishment_year INT); INSERT INTO marine_protected_areas (name, region, establishment_year) VALUES ('Heard Island and McDonald Islands', 'Southern', 2002), ('Prince Edward Islands', 'Southern', 2013), ('Crozet Islands', 'Southern', 2016); | What is the total number of marine protected areas in the Southern region that were established after 2000? | SELECT COUNT(*) FROM marine_protected_areas WHERE region = 'Southern' AND establishment_year > 2000; | gretelai_synthetic_text_to_sql |
CREATE TABLE aquatic_species (id INT, species VARCHAR(50), facility_type VARCHAR(50), facility_location VARCHAR(50)); INSERT INTO aquatic_species (id, species, facility_type, facility_location) VALUES (1, 'Trout', 'Fish Farm', 'Freshwater'), (2, 'Salmon', 'Hatchery', 'Freshwater'), (3, 'Carp', 'Fish Farm', 'Freshwater'... | What is the total number of aquatic species in freshwater facilities worldwide? | SELECT COUNT(*) FROM aquatic_species WHERE facility_location = 'Freshwater' AND facility_type IN ('Fish Farm', 'Hatchery'); | gretelai_synthetic_text_to_sql |
CREATE TABLE astronaut_medical (id INT, astronaut_name VARCHAR(30), mission VARCHAR(20), medical_condition VARCHAR(30));INSERT INTO astronaut_medical (id, astronaut_name, mission, medical_condition) VALUES (1, 'John Doe', 'Mars-1', 'Anemia'), (2, 'Jane Smith', 'Mars-2', 'Motion Sickness'); | List the unique medical conditions of astronauts who have flown missions to Mars. | SELECT DISTINCT medical_condition FROM astronaut_medical WHERE mission = 'Mars-1' OR mission = 'Mars-2'; | gretelai_synthetic_text_to_sql |
CREATE TABLE flights (flight_id INT, origin VARCHAR(255), destination VARCHAR(255), co2_emission FLOAT); INSERT INTO flights (flight_id, origin, destination, co2_emission) VALUES (1, 'London', 'Amsterdam', 100), (2, 'Amsterdam', 'London', 110); | What is the average CO2 emission of flights between London and Amsterdam? | SELECT AVG(co2_emission) FROM flights WHERE origin = 'London' AND destination = 'Amsterdam'; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, language VARCHAR(255), comments INT); INSERT INTO posts (id, language, comments) VALUES (1, 'English', 10), (2, 'Italian', 20), (3, 'French', 30), (4, 'Italian', 50); | What is the maximum number of comments for posts in Italian? | SELECT MAX(comments) FROM posts WHERE language = 'Italian'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Paintings (PaintingID INT, Title VARCHAR(50), CreationYear INT, ArtistID INT, ExhibitionID INT); CREATE TABLE Exhibitions (ExhibitionID INT, Title VARCHAR(50)); INSERT INTO Paintings VALUES (1, 'The Two Fridas', 1939, 2, 1); INSERT INTO Exhibitions VALUES (1, 'International Surrealist Exhibition'); INSERT ... | Find paintings that were exhibited in the same exhibition as any artwork by Frida Kahlo, excluding the exhibitions where only Kahlo's works were displayed, and show their title, artist, and exhibition date. | SELECT p.Title, a.Name, e.Title, p.ExhibitionID FROM Paintings p INNER JOIN Exhibitions e ON p.ExhibitionID = e.ExhibitionID INNER JOIN (SELECT ArtistID FROM Paintings WHERE Title = 'The Two Fridas') f ON 1=1 INNER JOIN Artists a ON p.ArtistID = a.ArtistID WHERE p.ExhibitionID = f.ArtistID AND p.ArtistID != f.ArtistID; | gretelai_synthetic_text_to_sql |
CREATE TABLE aus_tourists (id INT, year INT, region VARCHAR(50)); INSERT INTO aus_tourists (id, year, region) VALUES (1, 2019, 'Asia'), (2, 2019, 'Europe'), (3, 2019, 'Asia'); | What is the percentage of tourists who visited Australia in 2019 and came from Asia? | SELECT (COUNT(*) FILTER (WHERE region = 'Asia')) * 100.0 / COUNT(*) FROM aus_tourists WHERE year = 2019; | 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.