context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE patients (patient_id INT, age INT, gender TEXT, treatment TEXT, state TEXT); INSERT INTO patients (patient_id, age, gender, treatment, state) VALUES (1, 30, 'Female', 'CBT', 'Texas'); INSERT INTO patients (patient_id, age, gender, treatment, state) VALUES (2, 45, 'Male', 'DBT', 'California'); INSERT INTO p... | What is the number of patients who identified as male and received therapy in Texas? | SELECT COUNT(*) FROM patients WHERE gender = 'Male' AND treatment = 'Therapy' AND state = 'Texas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemical_table (chemical_id INT, chemical_name VARCHAR(50), safety_rating INT); CREATE TABLE environmental_impact_table (record_id INT, chemical_id INT, environmental_impact_float); | Insert records for a new chemical named 'Isopropyl Alcohol' in the chemical_table and environmental_impact_table | INSERT INTO chemical_table (chemical_name) VALUES ('Isopropyl Alcohol'); INSERT INTO environmental_impact_table (chemical_id, environmental_impact_float) VALUES ((SELECT chemical_id FROM chemical_table WHERE chemical_name = 'Isopropyl Alcohol'), 3.1); | gretelai_synthetic_text_to_sql |
CREATE TABLE cargos(id INT, vessel_id INT, num_containers INT); CREATE TABLE vessel_locations(id INT, vessel_id INT, location VARCHAR(50), timestamp TIMESTAMP); | What is the total number of containers transported from India to the US west coast in the past month? | SELECT SUM(num_containers) FROM cargos JOIN vessel_locations ON cargos.vessel_id = vessel_locations.vessel_id WHERE source_country = 'India' AND destination_country = 'US' AND location LIKE '%US West Coast%' AND timestamp > DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) | gretelai_synthetic_text_to_sql |
CREATE TABLE supplier (supplier_id VARCHAR(10), name VARCHAR(50), country VARCHAR(50), primary key (supplier_id)); | Get all suppliers that have 'Fair Trade' in 'labor_practice' table | SELECT DISTINCT s.* FROM supplier s JOIN supplier_labor_practice slp ON s.supplier_id = slp.supplier_id JOIN labor_practice lp ON slp.practice_id = lp.practice_id WHERE lp.name = 'Fair Trade'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DailySpotifyStreams (StreamID INT, TrackID INT, PlatformID INT, Date DATE, Streams INT); INSERT INTO DailySpotifyStreams (StreamID, TrackID, PlatformID, Date, Streams) VALUES (1, 1, 2, '2022-01-02', 200); | What is the total number of streams for Latin music on Spotify, grouped by day? | SELECT EXTRACT(DAY FROM Date) as Day, EXTRACT(MONTH FROM Date) as Month, EXTRACT(YEAR FROM Date) as Year, SUM(Streams) as TotalStreams FROM DailySpotifyStreams JOIN Tracks ON DailySpotifyStreams.TrackID = Tracks.TrackID JOIN StreamingPlatforms ON DailySpotifyStreams.PlatformID = StreamingPlatforms.PlatformID WHERE Genr... | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_investments (id INT PRIMARY KEY, institution_id INT, sukuk_type VARCHAR(255), value DECIMAL(10,2)); CREATE TABLE financial_institutions (id INT PRIMARY KEY, name VARCHAR(255), type VARCHAR(255), country VARCHAR(255)); | What are the names and SUKUK types of all Shariah-compliant investments in Malaysia worth more than 1000000? | SELECT financial_institutions.name, shariah_compliant_investments.sukuk_type, shariah_compliant_investments.value FROM financial_institutions JOIN shariah_compliant_investments ON financial_institutions.id = shariah_compliant_investments.institution_id WHERE financial_institutions.country = 'Malaysia' AND shariah_compl... | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, name TEXT, is_cruelty_free BOOLEAN, price DECIMAL); INSERT INTO products (product_id, name, is_cruelty_free, price) VALUES (1, 'Lipstick', TRUE, 12.99); INSERT INTO products (product_id, name, is_cruelty_free, price) VALUES (2, 'Eye Shadow', TRUE, 9.49); | What is the sum of the prices of all cruelty-free cosmetics? | SELECT SUM(price) FROM products WHERE is_cruelty_free = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE pedestrian_accidents (id INT, city VARCHAR(20), year INT, involved_pedestrian BOOLEAN, number_of_accidents INT); INSERT INTO pedestrian_accidents (id, city, year, involved_pedestrian, number_of_accidents) VALUES (1, 'Toronto', 2021, true, 120), (2, 'Toronto', 2022, true, 150), (3, 'Montreal', 2021, false, ... | How many traffic accidents involved pedestrians in the city of Toronto during 2021 and 2022? | SELECT SUM(number_of_accidents) FROM pedestrian_accidents WHERE city = 'Toronto' AND involved_pedestrian = true AND year IN (2021, 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, program VARCHAR(50), volunteer_count INT, engagement_date DATE); INSERT INTO Volunteers (id, program, volunteer_count, engagement_date) VALUES (1, 'Education', 15, '2022-01-05'), (2, 'Health', 20, '2022-01-12'), (3, 'Education', 25, '2022-03-20'), (4, 'Health', 18, '2022-03-27'), (5, 'E... | Which programs had more than 25 volunteers in any month of 2022? | SELECT program, DATE_FORMAT(engagement_date, '%Y-%m') as engagement_month, SUM(volunteer_count) as total_volunteers FROM Volunteers WHERE engagement_date BETWEEN '2022-01-01' AND '2022-12-31' GROUP BY program, engagement_month HAVING total_volunteers > 25; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_projects (project_id INT, region VARCHAR(10), technology VARCHAR(20), installed_capacity INT); INSERT INTO renewable_projects (project_id, region, technology, installed_capacity) VALUES (1, 'EU', 'Wind', 5000), (2, 'EU', 'Solar', 7000), (3, 'AS', 'Wind', 3000), (4, 'AS', 'Solar', 4000); | Which renewable energy projects in Europe have a higher installed capacity than the average capacity in Asia? | SELECT region, technology, installed_capacity FROM renewable_projects WHERE region = 'EU' AND installed_capacity > (SELECT AVG(installed_capacity) FROM renewable_projects WHERE region = 'AS') | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS veteran_employment (employee_id INT, veteran_status VARCHAR(10), hire_date DATE, job_title VARCHAR(50), department VARCHAR(50)); | What is the percentage of veteran and non-veteran employees hired per quarter since 2017? | SELECT TO_CHAR(hire_date, 'YYYY-Q'), veteran_status, COUNT(*) as num_employees, COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (PARTITION BY TO_CHAR(hire_date, 'YYYY-Q')) as hire_percentage FROM veteran_employment WHERE hire_date >= '2017-01-01' GROUP BY TO_CHAR(hire_date, 'YYYY-Q'), veteran_status; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, city VARCHAR(20), country VARCHAR(20)); INSERT INTO Exhibitions (exhibition_id, city, country) VALUES (1, 'Rio de Janeiro', 'Brazil'), (2, 'São Paulo', 'Brazil'), (3, 'Brasilia', 'Brazil'); CREATE TABLE Visitors (visitor_id INT, exhibition_id INT, age INT); INSERT INTO Visit... | What is the total number of visitors who attended exhibitions in 'Rio de Janeiro' or 'São Paulo' and are above 30 years of age? | SELECT COUNT(visitor_id) FROM Visitors v JOIN Exhibitions e ON v.exhibition_id = e.exhibition_id WHERE e.city IN ('Rio de Janeiro', 'São Paulo') AND v.age > 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE museum_revenue (museum_id INT, museum_name VARCHAR(100), year INT, virtual_tour_revenue FLOAT); INSERT INTO museum_revenue (museum_id, museum_name, year, virtual_tour_revenue) VALUES (1, 'Louvre Museum', 2021, 2000000); INSERT INTO museum_revenue (museum_id, museum_name, year, virtual_tour_revenue) VALUES ... | What is the virtual tour revenue for the Louvre Museum in 2021? | SELECT virtual_tour_revenue FROM museum_revenue WHERE museum_name = 'Louvre Museum' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (donation_id INT, donor_type VARCHAR(10), art_id INT, donation_date DATE); CREATE TABLE TraditionalArt (art_id INT, art_name VARCHAR(20), art_type VARCHAR(20)); | Insert new records of traditional art pieces donated by individuals and organizations. | INSERT INTO Donations (donation_id, donor_type, art_id, donation_date) VALUES (1, 'Individual', 1, '2022-01-01'), (2, 'Organization', 2, '2022-02-01'); INSERT INTO TraditionalArt (art_id, art_name, art_type) VALUES (1, 'Drum', 'Wood'), (2, 'Mask', 'Clay'); | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (id INT, item_id INT, material VARCHAR(255)); INSERT INTO materials (id, item_id, material) VALUES (1, 1, 'cotton'), (2, 2, 'polyester'), (3, 3, 'cotton'); | Show the total price of all items that are made of a particular material and are produced using a particular manufacturing process | SELECT SUM(price) FROM sales s JOIN processes p ON s.item_id = p.item_id JOIN materials m ON s.item_id = m.item_id WHERE p.process = 'process A' AND m.material = 'cotton'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investors (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), investment_amount DECIMAL(10,2)); INSERT INTO investors (id, name, location, investment_amount) VALUES (1, 'Alice', 'USA', 5000.00), (2, 'Bob', 'Canada', 3000.00), (3, 'Charlie', 'UK', 4000.00), (4, 'Diana', 'Germany', 6000.00); | Who are the top 3 investors in terms of investment amount? | SELECT id, name, SUM(investment_amount) AS total_investment FROM investors GROUP BY id ORDER BY total_investment DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID INT, VendorID INT, ProductID INT, ProductName VARCHAR(50), ProductCategory VARCHAR(50), Year INT, Revenue INT); INSERT INTO Sales VALUES (1, 1, 1, 'ProductA', 'CategoryA', 2020, 1000), (2, 2, 2, 'ProductB', 'CategoryB', 2021, 1500), (3, 1, 1, 'ProductA', 'CategoryA', 2020, 500); | Find the vendor with the lowest total sales for each product category, partitioned by year, ordered by product name? | SELECT ProductName, ProductCategory, Year, VendorID, MIN(Revenue) OVER (PARTITION BY ProductCategory, Year) AS LowestRevenue FROM Sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers(id INT PRIMARY KEY, name VARCHAR(50), certified_date DATE, certification_expiration_date DATE); INSERT INTO suppliers(id, name, certified_date, certification_expiration_date) VALUES (1, 'Supplier A', '2020-01-01', '2022-12-31'), (2, 'Supplier B', '2019-06-15', '2021-06-14'), (3, 'Supplier C', '20... | List all the suppliers providing "free-range eggs", along with their certification date and expiration date. | SELECT s.name, s.certified_date, s.certification_expiration_date FROM suppliers s JOIN products p ON s.id = p.id WHERE p.name = 'free-range eggs'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_price (region VARCHAR(20), price FLOAT); INSERT INTO carbon_price (region, price) VALUES ('European Union', 25.1), ('European Union', 25.4), ('United Kingdom', 30.2), ('United Kingdom', 30.5); | What is the average carbon price in the European Union and United Kingdom? | SELECT AVG(price) as avg_price, region FROM carbon_price GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Budget_Allocation (id INT, department VARCHAR(50), year INT, allocation DECIMAL(10,2)); INSERT INTO Budget_Allocation (id, department, year, allocation) VALUES (1, 'Student Services', 2020, 50000.00), (2, 'Faculty Development', 2020, 35000.00); | What is the average budget allocation for inclusion efforts by department and year? | SELECT AVG(Budget_Allocation.allocation) as average, Budget_Allocation.department, Budget_Allocation.year FROM Budget_Allocation GROUP BY Budget_Allocation.department, Budget_Allocation.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE research_vessels (id INT, name VARCHAR(50), type VARCHAR(20), launch_date DATE); INSERT INTO research_vessels (id, name, type, launch_date) VALUES (1, 'RV Ocean Explorer', 'Oceanographic', '2017-01-01'), (2, 'RV Deep Diver', 'Underwater', '2016-05-15'), (3, 'RV Sea Rover', 'Hydrographic', '2021-02-28'); | What is the total number of research vessels that were launched in the last 5 years? | SELECT COUNT(*) FROM research_vessels WHERE launch_date BETWEEN '2016-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Species (Name VARCHAR(50) PRIMARY KEY, Population INT); INSERT INTO Species (Name, Population) VALUES ('Coral', 1000); | Delete the "Species" record with a name of Coral | DELETE FROM Species WHERE Name = 'Coral'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, is_cruelty_free BOOLEAN, country TEXT); CREATE TABLE sales (sale_id INT, product_id INT, sale_country TEXT); INSERT INTO products VALUES (1, 'ProductA', true, 'US'), (2, 'ProductB', false, 'Canada'), (3, 'ProductC', true, 'Canada'), (4, 'ProductD', true, 'US'... | Which cruelty-free certified products were sold in the US and Canada? | SELECT products.product_name FROM products JOIN sales ON products.product_id = sales.product_id WHERE products.is_cruelty_free = true AND (sales.sale_country = 'US' OR sales.sale_country = 'Canada') | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Name TEXT, Wins INT); INSERT INTO Attorneys VALUES (1, 'Smith', 10), (2, 'Johnson', 5), (3, 'Williams', 15); CREATE TABLE NYCases (CaseID INT, AttorneyID INT, Outcome TEXT); INSERT INTO NYCases VALUES (1, 1, 'Won'), (2, 2, 'Lost'), (3, 3, 'Won'); CREATE TABLE CACases (CaseID INT,... | What are the names of attorneys who have won cases in both New York and California? | SELECT a.Name FROM Attorneys a INNER JOIN NYCases n ON a.AttorneyID = n.AttorneyID WHERE n.Outcome = 'Won' INTERSECT SELECT a.Name FROM Attorneys a INNER JOIN CACases c ON a.AttorneyID = c.AttorneyID WHERE c.Outcome = 'Won'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (name VARCHAR(255), founder_underrepresented BOOLEAN, founder_name VARCHAR(100)); INSERT INTO company (name, founder_underrepresented, founder_name) VALUES ('CompanyA', FALSE, 'John Smith'), ('CompanyB', TRUE, 'Jane Doe'), ('CompanyC', TRUE, 'Michael Brown'), ('CompanyD', FALSE, 'Sarah Johnson'), (... | Who are the founders of the startups that have received funding of over 3000000 and are from underrepresented communities? | SELECT company.founder_name FROM company INNER JOIN funding ON company.name = funding.company_name WHERE funding.amount > 3000000 AND company.founder_underrepresented = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturers (ManufacturerID INT, ManufacturerName VARCHAR(50));CREATE TABLE GarmentDates (GarmentID INT, ManufacturerID INT, AddedDate DATE); | Show the number of garments added per month for a specific manufacturer. | SELECT M.ManufacturerName, EXTRACT(MONTH FROM G.AddedDate) AS Month, COUNT(G.GarmentID) AS NewGarments FROM Manufacturers M JOIN GarmentDates G ON M.ManufacturerID = G.ManufacturerID WHERE M.ManufacturerName = 'GreenThreads' GROUP BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm_soil_moisture (farm_id INT, timestamp TIMESTAMP, soil_moisture INT); | Determine the change in soil moisture for each farm, partitioned by month. | SELECT farm_id, EXTRACT(MONTH FROM timestamp) AS month, soil_moisture - LAG(soil_moisture) OVER (PARTITION BY farm_id ORDER BY EXTRACT(MONTH FROM timestamp)) AS moisture_change FROM farm_soil_moisture; | gretelai_synthetic_text_to_sql |
CREATE TABLE electronics_advanced_training (country VARCHAR(50), min_salary NUMERIC, max_salary NUMERIC, master_degree BOOLEAN); INSERT INTO electronics_advanced_training (country, min_salary, max_salary, master_degree) VALUES ('China', 12000, 22000, true), ('Vietnam', 9000, 19000, true), ('Malaysia', 14000, 26000, tru... | What is the average salary for workers in the electronics industry who have completed a master's degree, by country? | SELECT country, AVG( (max_salary + min_salary) / 2.0) as avg_salary FROM electronics_advanced_training WHERE master_degree = true GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, country VARCHAR(20)); CREATE TABLE tickets (ticket_id INT, fan_id INT, team_id INT); CREATE TABLE teams (team_id INT, team_name VARCHAR(20)); INSERT INTO teams (team_id, team_name) VALUES (2, 'LA Lakers'); INSERT INTO fans (fan_id, country) VALUES (2, 'USA'); INSERT INTO tickets (ticket_i... | How many fans from each country have purchased tickets to see the LA Lakers? | SELECT COUNT(DISTINCT fans.fan_id), fans.country FROM fans INNER JOIN tickets ON fans.fan_id = tickets.fan_id INNER JOIN teams ON tickets.team_id = teams.team_id WHERE teams.team_name = 'LA Lakers' GROUP BY fans.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE bakken_wells (well text); INSERT INTO bakken_wells VALUES ('Well1'), ('Well2'), ('Well3'), ('Well4'), ('Well5'), ('Well6'), ('Well7'), ('Well8'), ('Well9'), ('Well10'); | Find the total number of wells in the 'Bakken' shale play. | SELECT COUNT(well) FROM bakken_wells; | gretelai_synthetic_text_to_sql |
CREATE TABLE products_vegan (id INT, product_name TEXT, vegan BOOLEAN); INSERT INTO products_vegan (id, product_name, vegan) VALUES (1, 'Lotion', false), (2, 'Shampoo', true), (3, 'Soap', false); | What is the total number of vegan and non-vegan products? | SELECT vegan, COUNT(*) FROM products_vegan GROUP BY vegan; | gretelai_synthetic_text_to_sql |
CREATE TABLE production (item_name VARCHAR(255), material VARCHAR(255), quantity INT, supplier VARCHAR(255)); INSERT INTO production (item_name, material, quantity, supplier) VALUES ('T-Shirt', 'Organic Cotton', 10, 'Supplier A'), ('Shirt', 'Organic Cotton', 15, 'Supplier A'), ('Pants', 'Organic Cotton', 20, 'Supplier ... | What is the total quantity of sustainable materials used in production by supplier? | SELECT supplier, SUM(quantity) FROM production GROUP BY supplier; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_temperature (id INT, datetime DATE, temperature FLOAT, sea TEXT); INSERT INTO water_temperature (id, datetime, temperature, sea) VALUES (1, '2022-01-01', 10.5, 'Black Sea'), (2, '2022-02-01', 9.8, 'Black Sea'), (3, '2022-03-01', 8.9, 'Black Sea'); | What is the average water temperature in the Black Sea by month? | SELECT EXTRACT(MONTH FROM datetime) AS month, AVG(temperature) FROM water_temperature WHERE sea = 'Black Sea' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, DonationDate DATE, DonationAmount DECIMAL(10,2)); | List all donations made in the month of January 2022 | SELECT * FROM Donations WHERE DonationDate BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE citizen_feedback (state VARCHAR(20), service VARCHAR(20)); INSERT INTO citizen_feedback (state, service) VALUES ('New York', 'public transportation'); INSERT INTO citizen_feedback (state, service) VALUES ('New York', 'public transportation'); INSERT INTO citizen_feedback (state, service) VALUES ('New York'... | What is the total number of citizen feedback records for public services in the state of New York? | SELECT COUNT(*) FROM citizen_feedback WHERE state = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_usage (id INT PRIMARY KEY, region VARCHAR(20), usage FLOAT); | Delete all records from the 'water_usage' table where the 'region' is 'Southwest' | DELETE FROM water_usage WHERE region = 'Southwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ap_projects (organization_name TEXT, region TEXT, budget INTEGER); INSERT INTO ap_projects (organization_name, region, budget) VALUES ('TechCorp', 'Asia-Pacific', 1500000), ('InnoAI', 'Asia-Pacific', 1200000), ('GreenTech', 'Asia-Pacific', 1800000); | What is the average budget spent on AI projects by organizations in the Asia-Pacific region? | SELECT AVG(budget) FROM ap_projects WHERE region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shipments (shipment_id INT, warehouse_id VARCHAR(5), quantity INT); CREATE TABLE warehouses (warehouse_id VARCHAR(5), city VARCHAR(5), state VARCHAR(3)); INSERT INTO shipments VALUES (1, 'LAX', 200), (2, 'NYC', 300), (3, 'LAX', 100), (4, 'JFK', 50); INSERT INTO warehouses VALUES ('LAX', 'Los', ' Angeles'),... | What is the total number of shipments for each warehouse? | SELECT warehouses.warehouse_id, COUNT(shipments.shipment_id) FROM warehouses LEFT JOIN shipments ON warehouses.warehouse_id = shipments.warehouse_id GROUP BY warehouses.warehouse_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (item VARCHAR(10), quantity INT); | Add a new record for item 'C303' with a quantity of 120 pieces to the Warehouse table | INSERT INTO Warehouse (item, quantity) VALUES ('C303', 120); | gretelai_synthetic_text_to_sql |
CREATE TABLE fairness_algorithms (transaction_id INT, user_id INT, algorithm_type VARCHAR(255)); INSERT INTO fairness_algorithms (transaction_id, user_id, algorithm_type) VALUES (1, 1001, 'bias-mitigation'), (2, 1002, 'explainability'), (3, 1001, 'bias-mitigation'); CREATE TABLE safety_algorithms (transaction_id INT, u... | Find users who have interacted with both fairness and safety algorithms. | SELECT f.user_id FROM fairness_algorithms f INNER JOIN safety_algorithms s ON f.user_id = s.user_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, content TEXT, post_date DATETIME); | Find the total number of posts in the "ocean_conservation" schema that were published after January 1, 2021, and contain the word "marine". | SELECT COUNT(*) FROM posts WHERE post_date > '2021-01-01' AND content LIKE '%marine%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Port (port_id INT, port_name TEXT, country TEXT); INSERT INTO Port (port_id, port_name, country) VALUES (1, 'Port of Shanghai', 'China'); INSERT INTO Port (port_id, port_name, country) VALUES (2, 'Port of Singapore', 'Singapore'); INSERT INTO Port (port_id, port_name, country) VALUES (3, 'Port of Oakland',... | How many containers were shipped from the Port of Oakland to Canada in the first quarter of 2022? | SELECT COUNT(*) FROM Container c JOIN Shipment s ON c.container_id = s.container_id JOIN Port p ON s.port_id = p.port_id WHERE p.port_name = 'Port of Oakland' AND c.container_id IN (SELECT container_id FROM Shipment WHERE shipping_date >= '2022-01-01' AND shipping_date < '2022-04-01' AND port_id IN (SELECT port_id FROM... | gretelai_synthetic_text_to_sql |
CREATE TABLE projects(name VARCHAR(50), location VARCHAR(20), biosensor_used BOOLEAN);INSERT INTO projects(name, location, biosensor_used) VALUES('ProjectX', 'US', true), ('ProjectY', 'Germany', false), ('ProjectZ', 'US', false); | Which genetic research projects did not use biosensor technologies in the US? | SELECT name FROM projects WHERE location = 'US' AND biosensor_used = false; | gretelai_synthetic_text_to_sql |
CREATE TABLE wells (well_id INT, well_name VARCHAR(50), region VARCHAR(20), production FLOAT, year INT); INSERT INTO wells (well_id, well_name, region, production, year) VALUES (1, 'Well A', 'onshore', 100.0, 2024); INSERT INTO wells (well_id, well_name, region, production, year) VALUES (2, 'Well B', 'offshore', 200.0,... | What is the average production for wells in the 'sahara' region in 2024? | SELECT AVG(production) FROM wells WHERE region = 'sahara' AND year = 2024; | gretelai_synthetic_text_to_sql |
CREATE TABLE Meditation (MemberID INT, Duration INT); INSERT INTO Meditation (MemberID, Duration) VALUES (1, 30), (1, 45); | Find the max duration of meditation sessions for each member. | SELECT MemberID, MAX(Duration) FROM Meditation GROUP BY MemberID; | gretelai_synthetic_text_to_sql |
CREATE TABLE world_series (year INT, attendance INT); CREATE TABLE super_bowl (year INT, attendance INT); | What is the difference in attendance between the World Series and the Super Bowl in the last 10 years? | SELECT YEAR(world_series.year), AVG(world_series.attendance) - AVG(super_bowl.attendance) as attendance_difference FROM world_series, super_bowl WHERE world_series.year BETWEEN 2012 AND 2021 AND super_bowl.year BETWEEN 2012 AND 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Shipments (id INT, source VARCHAR(50), destination VARCHAR(50), weight FLOAT, ship_date DATE); INSERT INTO Shipments (id, source, destination, weight, ship_date) VALUES (18, 'Brazil', 'Germany', 600, '2022-07-01'); INSERT INTO Shipments (id, source, destination, weight, ship_date) VALUES (19, 'Argentina', ... | What was the total weight of shipments from South America to Europe in July 2022? | SELECT SUM(weight) FROM Shipments WHERE (source = 'Brazil' OR source = 'Argentina' OR source = 'Colombia') AND (destination = 'Germany' OR destination = 'France' OR destination = 'Spain') AND ship_date = '2022-07-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (researcher_id INT PRIMARY KEY, name VARCHAR(255), region VARCHAR(255), experience INT); | Insert a new record into the "researchers" table with the following information: "researcher_id": 301, "name": "Amina Ali", "region": "Asia", "experience": 5. | INSERT INTO researchers (researcher_id, name, region, experience) VALUES (301, 'Amina Ali', 'Asia', 5); | gretelai_synthetic_text_to_sql |
CREATE TABLE ca_events (id INT, num_attendees INT, avg_age FLOAT); CREATE TABLE ca_event_types (id INT, event_type VARCHAR(15)); INSERT INTO ca_events (id, num_attendees, avg_age) VALUES (1, 1200, 35.5), (2, 1800, 40.2); INSERT INTO ca_event_types (id, event_type) VALUES (1, 'Dance'), (2, 'Music'); | What is the average age of attendees at arts events in California and how many unique events have there been? | SELECT AVG(ce.avg_age), COUNT(DISTINCT cet.event_type) FROM ca_events ce INNER JOIN ca_event_types cet ON TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE construction_labor (id INT, worker_name VARCHAR(50), hours_worked INT, project_type VARCHAR(20), state VARCHAR(20)); INSERT INTO construction_labor (id, worker_name, hours_worked, project_type, state) VALUES (1, 'John Doe', 100, 'Sustainable', 'California'); INSERT INTO construction_labor (id, worker_name,... | Calculate the average number of labor hours worked per sustainable project in the state of California. | SELECT AVG(hours_worked) FROM (SELECT SUM(hours_worked) as hours_worked FROM construction_labor WHERE project_type = 'Sustainable' AND state = 'California' GROUP BY project_type, state) as subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, name VARCHAR(255), severity VARCHAR(50), description TEXT, affected_products TEXT, date_discovered DATE); | What is the total number of vulnerabilities in the 'vulnerabilities' table? | SELECT COUNT(*) FROM vulnerabilities; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_sales (id INT PRIMARY KEY, garment_id INT, store_id INT, sale_date DATE, quantity INT, price DECIMAL(5,2)); INSERT INTO garment_sales (id, garment_id, store_id, sale_date, quantity, price) VALUES (1, 1001, 101, '2022-01-01', 5, 150.00), (2, 1002, 101, '2022-01-02', 10, 120.00), (3, 1003, 102, '2022... | Which stores have generated a total revenue of more than $50,000 between January 1, 2022 and January 14, 2022? | SELECT store_id, SUM(quantity * price) AS total_revenue FROM garment_sales WHERE sale_date BETWEEN '2022-01-01' AND '2022-01-14' GROUP BY store_id HAVING total_revenue > 50000; | gretelai_synthetic_text_to_sql |
CREATE TABLE farm (id INT, name VARCHAR(255), type VARCHAR(255), region VARCHAR(255)); INSERT INTO farm (id, name, type, region) VALUES (1, 'Smith Farm', 'organic', 'Midwest'), (2, 'Johnson Farm', 'conventional', 'South'), (3, 'Brown Farm', 'organic', 'Midwest'), (4, 'Davis Farm', 'conventional', 'West'); | List the names and types of all farms in the 'farming' database that are located in a specific region. | SELECT name, type FROM farm WHERE region = 'Midwest'; | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_supplier (id INT, name TEXT, qty_sustainable_material FLOAT, q2_2021_revenue FLOAT); | Which textile suppliers provided the most sustainable materials in Q2 of 2021? | SELECT name, SUM(qty_sustainable_material) AS total_sustainable_material FROM textile_supplier WHERE EXTRACT(QUARTER FROM date) = 2 AND YEAR(date) = 2021 GROUP BY name ORDER BY total_sustainable_material DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, name TEXT, city TEXT, ai_concierge BOOLEAN); | What is the number of hotels in 'Dubai' with an AI concierge? | SELECT city, COUNT(*) as num_hotels FROM hotels WHERE city = 'Dubai' AND ai_concierge = TRUE GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(10), Department VARCHAR(20)); INSERT INTO Employees (EmployeeID, Gender, Department) VALUES (1, 'Female', 'Sales'), (2, 'Male', 'IT'), (3, 'Female', 'IT'), (4, 'Male', 'Finance'); | How many female employees are there in the Sales department? | SELECT COUNT(*) FROM Employees WHERE Gender = 'Female' AND Department = 'Sales'; | gretelai_synthetic_text_to_sql |
CREATE TABLE hiring (id INT, employee_id INT, hire_date DATE, department VARCHAR(255)); INSERT INTO hiring (id, employee_id, hire_date, department) VALUES (1, 101, '2020-01-02', 'HR'); INSERT INTO hiring (id, employee_id, hire_date, department) VALUES (2, 102, '2019-12-20', 'IT'); | Find the number of employees hired in 2020 from the 'hiring' table | SELECT COUNT(*) FROM hiring WHERE YEAR(hire_date) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE food_suppliers (supplier_id INT PRIMARY KEY, name VARCHAR(255), rating INT); | Calculate the average rating of food suppliers in 'Florida' | SELECT AVG(rating) FROM food_suppliers WHERE state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dances (id INT, name VARCHAR(50), description VARCHAR(100), origin_country VARCHAR(50)); | Insert records of new traditional dances | INSERT INTO dances (id, name, description, origin_country) VALUES (5, 'Sankirtana', 'Manipuri religious dance drama', 'India'), (6, 'Hula', 'Hawaiian storytelling dance', 'USA') | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name TEXT, location TEXT, water_type TEXT, water_temperature DECIMAL(5,2)); INSERT INTO fish_farms (id, name, location, water_type, water_temperature) VALUES (1, 'Tropical Reef Aquaculture', 'Indonesia', 'tropical', 28.5), (2, 'Atlantic Salmon Farm', 'Norway', 'cold', 8.0); | What is the average water temperature in February for tropical fish farms? | SELECT AVG(water_temperature) FROM fish_farms WHERE EXTRACT(MONTH FROM date) = 2 AND water_type = 'tropical'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (SupplierID int, SupplierName varchar(50)); INSERT INTO Suppliers VALUES (1, 'SupplierA'), (2, 'SupplierB'); CREATE TABLE Sales (SaleID int, SupplierID int, TimberVolume float, SaleYear int); INSERT INTO Sales VALUES (1, 1, 500, 2020), (2, 1, 700, 2019), (3, 2, 600, 2020); | What is the total volume of timber sold by each supplier in a specific year? | SELECT Suppliers.SupplierName, Sales.SaleYear, SUM(Sales.TimberVolume) as TotalTimberVolume FROM Suppliers INNER JOIN Sales ON Suppliers.SupplierID = Sales.SupplierID GROUP BY Suppliers.SupplierName, Sales.SaleYear; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donor_id INT, donation_amount DECIMAL(10, 2), cause_category VARCHAR(255)); INSERT INTO donations (donor_id, donation_amount, cause_category) VALUES (1, 5000.00, 'Education'), (2, 3000.00, 'Health'), (3, 7000.00, 'Environment'); | What is the distribution of donation amounts by cause category, ranked by total donation amount? | SELECT cause_category, SUM(donation_amount) AS total_donation, ROW_NUMBER() OVER (ORDER BY SUM(donation_amount) DESC) AS rank FROM donations GROUP BY cause_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE GamePlayers (GameID int, GameName varchar(50), Category varchar(50), PlayerID int); | What is the number of players who have played each game in the "RPG" category? | SELECT Category, COUNT(DISTINCT PlayerID) OVER(PARTITION BY Category) as PlayersCount FROM GamePlayers; | gretelai_synthetic_text_to_sql |
CREATE TABLE LegalTech (case_id INT, case_status VARCHAR(10)); INSERT INTO LegalTech (case_id, case_status) VALUES (1, 'open'), (2, 'closed'), (3, 'in_progress'), (4, 'closed'); | Show the 'case_status' for cases in the 'LegalTech' table where the 'case_status' is not 'closed' | SELECT DISTINCT case_status FROM LegalTech WHERE case_status != 'closed'; | gretelai_synthetic_text_to_sql |
CREATE TABLE alerts (id INT, rule VARCHAR(255), alert_date DATE); | How many times was the rule 'Unusual Outbound Traffic' triggered in the last week? | SELECT COUNT(*) FROM alerts WHERE rule = 'Unusual Outbound Traffic' AND alert_date >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, program_id INT, donation_amount DECIMAL, donation_date DATE); | What is the average donation amount per program by donors from the US? | SELECT programs.name as program_name, AVG(donations.donation_amount) as avg_donation_amount FROM donations INNER JOIN donors ON donations.donor_id = donors.id INNER JOIN programs ON donations.program_id = programs.id WHERE donors.country = 'US' GROUP BY programs.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup_founders (id INT PRIMARY KEY, name VARCHAR(255), veteran_status VARCHAR(255), industry VARCHAR(255), total_funding FLOAT); | What is the total funding for startups founded by veterans? | SELECT SUM(total_funding) FROM startup_founders WHERE veteran_status = 'yes'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (id INT, state VARCHAR(2), policy_type VARCHAR(20), sale_date DATE); INSERT INTO policies (id, state, policy_type, sale_date) VALUES (1, 'NY', 'Home', '2021-05-15'), (2, 'NY', 'Auto', '2022-06-23'), (3, 'TX', 'Home', '2021-11-28'); | How many home insurance policies were sold in New York in the last year? | SELECT COUNT(*) FROM policies WHERE state = 'NY' AND policy_type = 'Home' AND YEAR(sale_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE makeup_products(product_name TEXT, rating INTEGER, cruelty_free BOOLEAN, sale_country TEXT); INSERT INTO makeup_products(product_name, rating, cruelty_free, sale_country) VALUES ('Liquid Eyeliner', 5, true, 'US'); | List all cruelty-free makeup products with a 4-star rating or higher sold in the US. | SELECT product_name FROM makeup_products WHERE rating >= 4 AND cruelty_free = true AND sale_country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID INT, VolunteerName TEXT, ServiceHours INT, City TEXT); INSERT INTO Volunteers (VolunteerID, VolunteerName, ServiceHours, City) VALUES (1, 'Alice Johnson', 50, 'Chicago'); INSERT INTO Volunteers (VolunteerID, VolunteerName, ServiceHours, City) VALUES (2, 'Bob Brown', 75, 'San Francis... | What is the average number of hours served by volunteers in the city of Chicago? | SELECT AVG(ServiceHours) FROM Volunteers WHERE City = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AthleteWellbeing (AthleteID INT, ProgramName VARCHAR(50)); CREATE TABLE AthleteInjuries (AthleteID INT, InjuryDate DATE); | List all athletes who participated in the wellbeing program but did not have any injuries in the last season. | SELECT AthleteID FROM AthleteWellbeing WHERE AthleteID NOT IN (SELECT AthleteID FROM AthleteInjuries WHERE InjuryDate >= DATEADD(YEAR, -1, GETDATE())); | gretelai_synthetic_text_to_sql |
CREATE TABLE BankruptcyCases (CaseID INT, CaseType VARCHAR(20), BillingAmount DECIMAL(10,2)); INSERT INTO BankruptcyCases (CaseID, CaseType, BillingAmount) VALUES (1, 'Bankruptcy', 8000.00), (2, 'Bankruptcy', 4000.00); | What is the maximum billing amount for cases in the 'Bankruptcy' case type? | SELECT MAX(BillingAmount) FROM BankruptcyCases WHERE CaseType = 'Bankruptcy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE weddell_sea_species (species_name TEXT, habitat TEXT); INSERT INTO weddell_sea_species (species_name, habitat) VALUES ('Weddell Seal', 'Weddell Sea'), ('Crabeater Seal', 'Weddell Sea'), ('Antarctic Krill', 'Weddell Sea'); | What is the number of marine species observed in the Weddell Sea? | SELECT COUNT(*) FROM weddell_sea_species; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID int, ArtistName text, Specialization text); INSERT INTO Artists (ArtistID, ArtistName, Specialization) VALUES (1, 'Amina Ahmed', 'Indian Miniature Painting'), (2, 'Bertina Lopes', 'Mozambican Modern Art'), (3, 'Fernando de Szyszlo', 'Peruvian Abstract Art'); | Find artists who have mastered traditional arts from Africa, Asia, and South America. | SELECT ArtistName FROM Artists WHERE Specialization LIKE '%African%' INTERSECT SELECT ArtistName FROM Artists WHERE Specialization LIKE '%Asian%' INTERSECT SELECT ArtistName FROM Artists WHERE Specialization LIKE '%South% American%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE EmployeeData (EmployeeID INT, Department VARCHAR(50), Salary DECIMAL(10, 2)); INSERT INTO EmployeeData VALUES (1, 'IT', 50000); INSERT INTO EmployeeData VALUES (2, 'HR', 45000); INSERT INTO EmployeeData VALUES (3, 'Finance', 60000); INSERT INTO EmployeeData VALUES (4, 'IT', 40000); | Delete all employee records with a salary below the minimum for their respective departments. | DELETE FROM EmployeeData WHERE Salary < (SELECT MIN(Salary) FROM EmployeeData e2 WHERE EmployeeData.Department = e2.Department); | gretelai_synthetic_text_to_sql |
CREATE TABLE environment (mine_id INT, impact_score DECIMAL); INSERT INTO environment (mine_id, impact_score) VALUES (1, 4.2), (2, 4.8), (3, 4.5), (4, 3.9), (5, 5.1); | What is the environmental impact score per mine? | SELECT mine_id, impact_score FROM environment; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_sites (site_name VARCHAR(255), continent VARCHAR(64), visitors INT); INSERT INTO cultural_sites (site_name, continent, visitors) VALUES ('Acropolis', 'Europe', 3000), ('Taj Mahal', 'Asia', 5000), ('Pyramids of Giza', 'Africa', 4000), ('Angkor Wat', 'Asia', 6000), ('Machu Picchu', 'South America', ... | What is the total number of tourists visiting cultural heritage sites in Europe, Asia, and Africa, grouped by continent? | SELECT continent, SUM(visitors) as total_visitors FROM cultural_sites GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE aircraft (maker TEXT, model TEXT, mass INTEGER); INSERT INTO aircraft (maker, model, mass) VALUES ('Boeing', '747', 350000), ('Boeing', '777', 400000), ('Airbus', 'A320', 280000), ('Airbus', 'A350', 320000); | What is the total mass of aircraft manufactured by Airbus? | SELECT SUM(mass) FROM aircraft WHERE maker = 'Airbus'; | gretelai_synthetic_text_to_sql |
CREATE TABLE manufacturing_processes (process_id INT, name TEXT); CREATE TABLE waste_generation (process_id INT, waste_amount INT, date DATE); | Show the total amount of waste generated by each manufacturing process in the past year. | SELECT manufacturing_processes.name, SUM(waste_generation.waste_amount) FROM manufacturing_processes INNER JOIN waste_generation ON manufacturing_processes.process_id = waste_generation.process_id WHERE waste_generation.date > DATEADD(year, -1, GETDATE()) GROUP BY manufacturing_processes.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (subscriber_id INT, join_date DATE); INSERT INTO subscribers (subscriber_id, join_date) VALUES (1, '2021-01-05'), (2, '2021-03-17'), (3, '2020-12-28'); CREATE TABLE usage (subscriber_id INT, data_usage INT, usage_date DATE); INSERT INTO usage (subscriber_id, data_usage, usage_date) VALUES (1, 3... | What is the average monthly data usage for customers who joined in Q1 2021? | SELECT AVG(data_usage) FROM usage JOIN subscribers ON usage.subscriber_id = subscribers.subscriber_id WHERE YEAR(join_date) = 2021 AND QUARTER(join_date) = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE mine (name VARCHAR(255), location VARCHAR(255)); CREATE TABLE gold_mine_production (mine_name VARCHAR(255), quantity INT); CREATE TABLE silver_mine_production (mine_name VARCHAR(255), quantity INT); | Find the average gold and silver production quantities for each mine, excluding mines with missing data. | SELECT gold_mine_production.mine_name, AVG(gold_mine_production.quantity) AS avg_gold_quantity, AVG(silver_mine_production.quantity) AS avg_silver_quantity FROM gold_mine_production INNER JOIN silver_mine_production ON gold_mine_production.mine_name = silver_mine_production.mine_name GROUP BY gold_mine_production.mine_... | gretelai_synthetic_text_to_sql |
CREATE TABLE Investments (id INT, company_id INT, investment_amount INT, investment_date DATE); | Insert a new investment into the Investments table. | INSERT INTO Investments (id, company_id, investment_amount, investment_date) VALUES (3, 1, 3000000, '2022-03-01'); | gretelai_synthetic_text_to_sql |
CREATE TABLE charging_stations (id INT, cs_type VARCHAR(50), cs_city VARCHAR(50), cs_count INT); | Calculate the total number of EV charging stations in Berlin | SELECT SUM(cs_count) AS total_cs_count FROM charging_stations WHERE cs_city = 'Berlin' AND cs_type = 'EV'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cause (id INT PRIMARY KEY, name VARCHAR(255));CREATE TABLE donation (id INT PRIMARY KEY, cause_id INT, donor_id INT); | Which causes have the most unique donors? | SELECT c.name, COUNT(DISTINCT d.donor_id) AS total_donors FROM cause c JOIN donation d ON c.id = d.cause_id GROUP BY c.id ORDER BY total_donors DESC LIMIT 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_name VARCHAR(255), sport VARCHAR(255)); INSERT INTO players (player_name, sport) VALUES ('Federer', 'Tennis'); INSERT INTO players (player_name, sport) VALUES ('Nadal', 'Tennis'); CREATE TABLE wins (player_name VARCHAR(255), match_id INT); INSERT INTO wins (player_name, match_id) VALUES ('F... | Show tennis players who have won more than 10 matches | SELECT player_name FROM (SELECT player_name, COUNT(*) as wins FROM wins GROUP BY player_name) AS subquery WHERE wins > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE npos (id INT, name VARCHAR(50), sector VARCHAR(50), country VARCHAR(50), total_donations FLOAT); INSERT INTO npos (id, name, sector, country, total_donations) VALUES (1, 'UNESCO', 'Education', 'Nigeria', 100000), (2, 'Save the Children', 'Education', 'Kenya', 200000); | What is the total amount donated to education-focused NPOs in Africa in the last 2 years? | SELECT SUM(total_donations) FROM npos WHERE sector = 'Education' AND country IN ('Nigeria', 'Kenya', 'South Africa', 'Egypt', 'Algeria') AND total_donations BETWEEN '2020-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (id INT, name VARCHAR(50), division VARCHAR(50), age INT, enrollment FLOAT); INSERT INTO schools (id, name, division, age, enrollment) VALUES (1, 'School A', 'Education', 10, 500), (2, 'School B', 'Education', 15, 700), (3, 'School C', 'Education', 12, 600); | What is the average age of all schools and their current enrollment levels in the education division? | SELECT AVG(age), enrollment FROM schools WHERE division = 'Education' GROUP BY enrollment; | gretelai_synthetic_text_to_sql |
CREATE VIEW Eco_Friendly_Products AS SELECT product_id, product_name, environmental_impact_score FROM Products; INSERT INTO Products (product_id, product_name, transportation_emissions, production_emissions, packaging_emissions, labor_conditions_score, environmental_impact_score) VALUES (1101, 'Jacket', 1, 2, 1, 5, 2);... | What is the maximum environmental impact score for products in the Eco_Friendly_Products view? | SELECT MAX(environmental_impact_score) FROM Eco_Friendly_Products; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetics (product_id INT, product_name VARCHAR(100), subcategory VARCHAR(50), vegan BOOLEAN); INSERT INTO cosmetics (product_id, product_name, subcategory, vegan) VALUES (1, 'Lipstick', 'Matte', true), (2, 'Foundation', 'Liquid', false); | What is the percentage of vegan cosmetics by subcategory? | SELECT subcategory, COUNT(*) FILTER (WHERE vegan = true) * 100.0 / COUNT(*) AS percentage_vegan_cosmetics FROM cosmetics WHERE category = 'Cosmetics' GROUP BY subcategory; | gretelai_synthetic_text_to_sql |
CREATE TABLE property_sizes (id INT, size INT, property_id INT, measurement_time TIMESTAMP); INSERT INTO property_sizes (id, size, property_id, measurement_time) VALUES (1, 1500, 1, '2022-01-01 00:00:00'), (2, 1600, 1, '2022-02-01 00:00:00'), (3, 1800, 2, '2022-01-01 00:00:00'); | What is the change in property size for each property in the USA over time? | SELECT property_id, size, measurement_time, LEAD(size) OVER (PARTITION BY property_id ORDER BY measurement_time) - size as size_change FROM property_sizes WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Auto_Shows (id INT, manufacturer VARCHAR(50), show_name VARCHAR(50), year INT); CREATE TABLE Manufacturers (id INT, name VARCHAR(50)); | What is the total number of auto shows attended by a specific manufacturer? | SELECT COUNT(DISTINCT show_name) FROM Auto_Shows JOIN Manufacturers ON Auto_Shows.manufacturer = Manufacturers.name WHERE Manufacturers.name = 'Tesla'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidity (date DATE, location TEXT, acidity FLOAT); CREATE TABLE sea_surface_temperature (date DATE, location TEXT, temperature FLOAT); | What is the maximum ocean acidity level and the average sea surface temperature for each month in the Pacific Ocean over the past decade? | SELECT MONTH(ocean_acidity.date) AS month, MAX(ocean_acidity.acidity) AS max_acidity, AVG(sea_surface_temperature.temperature) AS avg_temperature FROM ocean_acidity INNER JOIN sea_surface_temperature ON ocean_acidity.date = sea_surface_temperature.date WHERE ocean_acidity.location = 'Pacific Ocean' AND sea_surface_temp... | gretelai_synthetic_text_to_sql |
CREATE TABLE habitat_preservation (id INT, animal_name VARCHAR(255), preserve_name VARCHAR(255)); | What is the total number of animals in the habitat_preservation table that have been relocated to a specific preserve? | SELECT COUNT(animal_name) FROM habitat_preservation WHERE preserve_name = 'Yellowstone National Park'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (org_name TEXT, donation_amount INTEGER, donation_date DATE); INSERT INTO Donations (org_name, donation_amount, donation_date) VALUES ('Organization A', 5000, '2020-01-01'); INSERT INTO Donations (org_name, donation_amount, donation_date) VALUES ('Organization B', 7000, '2020-02-15'); | What was the total amount of donations received by each organization in 2020? | SELECT org_name, SUM(donation_amount) FROM Donations WHERE donation_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY org_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE revenues (line VARCHAR(10), revenue FLOAT); INSERT INTO revenues (line, revenue) VALUES ('red', 15000.00), ('blue', 20000.00), ('green', 12000.00); | What is the total revenue for each line? | SELECT line, SUM(revenue) FROM revenues GROUP BY line; | gretelai_synthetic_text_to_sql |
CREATE TABLE content (id INT, title VARCHAR(50), location VARCHAR(50), literacy_score INT); INSERT INTO content (id, title, location, literacy_score) VALUES (1, 'Article 1', 'Asia', 65), (2, 'Article 2', 'Europe', 75), (3, 'News 1', 'Asia', 80); | What is the average media literacy score for content published in 'Asia'? | SELECT AVG(literacy_score) FROM content WHERE location = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fan_attendance (id INT, fan_id INT, team VARCHAR(50), conference VARCHAR(50), game_date DATE); | How many unique fans attended games of teams in the eastern_conference in the fan_attendance table? | SELECT COUNT(DISTINCT fan_id) FROM fan_attendance WHERE conference = 'eastern_conference'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (id INT, title VARCHAR(255), location VARCHAR(255), viewers INT); | Find the average viewership for concerts held in Asia. | SELECT AVG(viewers) FROM Concerts WHERE location LIKE '%Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE communication_campaign (campaign_id INT, campaign_name TEXT, sector TEXT); INSERT INTO communication_campaign (campaign_id, campaign_name, sector) VALUES (1, 'European Climate Communication Initiative', 'Public'); | What is the total number of climate communication campaigns targeting the public sector in Europe? | SELECT COUNT(*) FROM communication_campaign WHERE sector = 'Public' AND region = 'Europe'; | gretelai_synthetic_text_to_sql |
CREATE TABLE planets (id INT PRIMARY KEY, name VARCHAR(50), distance_to_sun FLOAT); INSERT INTO planets (id, name, distance_to_sun) VALUES (1, 'Mercury', 0.39), (2, 'Venus', 0.72), (3, 'Earth', 1), (4, 'Mars', 1.52); | What is the name of the planet with id 3? | SELECT name FROM planets WHERE id = 3; | 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.