context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Company_Projects_WA (Company TEXT, Project_ID INT, Funding TEXT, Sustainable BOOLEAN, Cost FLOAT, Timeline INT); INSERT INTO Company_Projects_WA (Company, Project_ID, Funding, Sustainable, Cost, Timeline) VALUES ('Miller & Sons', 1, 'Government', true, 1500000, 365), ('Miller & Sons', 2, 'Private', true, 2... | What are the total construction costs and average project timelines for companies that have worked on both government-funded and privately-funded projects in the state of Washington, grouped by sustainability status? | SELECT cp.Sustainable, cp.Company, AVG(cp.Cost), AVG(cp.Timeline) FROM Company_Projects_WA cp WHERE cp.Funding = 'Government' OR cp.Funding = 'Private' GROUP BY cp.Sustainable, cp.Company; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_policing_metrics (id INT, city TEXT, metric_date DATE, metric_value INT); INSERT INTO community_policing_metrics (id, city, metric_date, metric_value) VALUES (1, 'New York', '2021-12-01', 20), (2, 'Los Angeles', '2021-12-02', 15), (3, 'Chicago', '2021-12-03', 18); | Insert new community policing metric for 'Boston' in '2022-01-01'. | INSERT INTO community_policing_metrics (city, metric_date, metric_value) VALUES ('Boston', '2022-01-01', 17); | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_customers (customer_id INT, name VARCHAR(50), device_4g BOOLEAN, device_5g BOOLEAN, state VARCHAR(20)); INSERT INTO mobile_customers (customer_id, name, device_4g, device_5g, state) VALUES (1, 'Juan Garcia', true, true, 'Florida'); | How many mobile customers are there in Florida, and how many have devices compatible with both 4G and 5G networks? | SELECT COUNT(*), SUM(device_4g AND device_5g) FROM mobile_customers WHERE state = 'Florida'; | gretelai_synthetic_text_to_sql |
CREATE TABLE waste_generation (id INT, sector VARCHAR(20), year INT, amount INT); INSERT INTO waste_generation (id, sector, year, amount) VALUES (1, 'residential', 2020, 15000); | What is the total waste generation in the residential sector for the year 2020? | SELECT SUM(amount) FROM waste_generation WHERE sector = 'residential' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_data (id INT, vehicle_type VARCHAR(20), avg_speed FLOAT); | What is the average speed of electric vehicles in 'vehicle_data' table? | SELECT AVG(avg_speed) FROM vehicle_data WHERE vehicle_type = 'Electric Vehicle'; | 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', 55000); INSERT INTO EmployeeData VALUES (3, 'Finance', 60000); | Update the salaries of employees in the IT department with a 3% increase. | UPDATE EmployeeData SET Salary = Salary * 1.03 WHERE Department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, organization_id INT, donation_amount DECIMAL(10,2), sector VARCHAR(255)); INSERT INTO donations (id, donor_id, organization_id, donation_amount, sector) VALUES (1, 1, 1, 1000.00, 'healthcare'), (2, 2, 2, 500.00, 'education'), (3, 1, 1, 2000.00, 'healthcare'); | What is the maximum donation amount given to a single organization in the healthcare sector? | SELECT MAX(donation_amount) FROM donations WHERE sector = 'healthcare' GROUP BY organization_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(100), department VARCHAR(50), publication_count INT, disability VARCHAR(50)); INSERT INTO students VALUES (1, 'Harper Brown', 'Music', 2, 'Yes'); | What is the average publication rate of graduate students in the Music department who identify as disabled? | SELECT department, AVG(publication_rate) FROM (SELECT department, disability, AVG(publication_count) AS publication_rate FROM students WHERE department = 'Music' GROUP BY department, disability) AS subquery WHERE disability = 'Yes' GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE latest_investments (id INT, company_id INT, round_number INT, investment_amount INT); CREATE TABLE companies_funding (id INT, company_id INT, funding_amount INT); CREATE TABLE companies (id INT, name TEXT, industry TEXT); | Update the funding amount for the latest investment round of a company in the AI sector. | UPDATE companies_funding JOIN latest_investments ON companies_funding.company_id = latest_investments.company_id SET companies_funding.funding_amount = latest_investments.investment_amount WHERE companies_funding.company_id = latest_investments.company_id AND latest_investments.round_number = (SELECT MAX(round_number) ... | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, department VARCHAR(50), manager VARCHAR(50)); | Delete a department from the "departments" table | DELETE FROM departments WHERE department = 'Marketing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE HeritageSites (SiteID INT PRIMARY KEY, SiteName VARCHAR(50), Location VARCHAR(50), VisitorCount INT); INSERT INTO HeritageSites (SiteID, SiteName, Location, VisitorCount) VALUES (1, 'Angkor Wat', 'Cambodia', 2500000), (2, 'Taj Mahal', 'India', 3000000); | Identify the heritage site in 'Asia' with the highest visitor count. | SELECT SiteName, MAX(VisitorCount) FROM HeritageSites WHERE Location LIKE '%Asia%' GROUP BY SiteName; | gretelai_synthetic_text_to_sql |
CREATE TABLE maintenance_requests (request_id INT, date DATE, type VARCHAR(255)); INSERT INTO maintenance_requests (request_id, date, type) VALUES (1, '2020-01-01', 'equipment'); INSERT INTO maintenance_requests (request_id, date, type) VALUES (2, '2020-01-15', 'facility'); | How many military equipment maintenance requests were there in Q2 2020? | SELECT COUNT(*) FROM maintenance_requests WHERE date BETWEEN '2020-04-01' AND '2020-06-30' AND type = 'equipment'; | gretelai_synthetic_text_to_sql |
CREATE TABLE pollution_data (location VARCHAR(255), pollution_level FLOAT); INSERT INTO pollution_data (location, pollution_level) VALUES ('Indian Ocean', 12.5), ('Atlantic Ocean', 15.6); | What is the maximum pollution level recorded in the Indian Ocean? | SELECT MAX(pollution_level) FROM pollution_data WHERE location = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (id INT, type VARCHAR(50)); INSERT INTO vehicles VALUES (1, 'sedan'); | Insert a new electric vehicle model "Tesla X" into the "vehicles" table with an id of 2. | INSERT INTO vehicles (id, type) VALUES (2, 'electric vehicle'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species_2 (id INT, species VARCHAR(255), conservation_status VARCHAR(255), region VARCHAR(255)); INSERT INTO marine_species_2 (id, species, conservation_status, region) VALUES (1, 'Blue Whale', 'Endangered', 'Arctic'); INSERT INTO marine_species_2 (id, species, conservation_status, region) VALUES (2... | What is the number of marine species, grouped by conservation status and region? | SELECT conservation_status, region, COUNT(*) FROM marine_species_2 GROUP BY conservation_status, region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicle_Safety_Testing (vehicle_id INT, manufacturer VARCHAR(50), safety_rating VARCHAR(20)); | What is the total number of vehicles tested in 'Vehicle Safety Testing' table by manufacturer? | SELECT manufacturer, COUNT(*) FROM Vehicle_Safety_Testing GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE VolunteerHours (VolunteerHourID INT, VolunteerName TEXT, Hours DECIMAL, Program TEXT); INSERT INTO VolunteerHours (VolunteerHourID, VolunteerName, Hours, Program) VALUES (1, 'Juan', 5.00, 'Feeding Program'), (2, 'Juan', 3.00, 'Education Program'), (3, 'Maria', 4.00, 'Feeding Program'), (4, 'Pedro', 6.00, '... | What is the total number of volunteer hours for a specific volunteer? | SELECT VolunteerName, SUM(Hours) AS TotalVolunteerHours FROM VolunteerHours GROUP BY VolunteerName; | gretelai_synthetic_text_to_sql |
CREATE TABLE events (id INT, name TEXT, location TEXT, tickets_sold INT); INSERT INTO events (id, name, location, tickets_sold) VALUES (1, 'Broadway Show', 'New York', 200), (2, 'Museum Exhibit', 'London', 150), (3, 'Concert', 'Paris', 300); | What is the total number of tickets sold for cultural events in 'New York' and 'London'? | SELECT SUM(tickets_sold) FROM events WHERE location IN ('New York', 'London'); | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donation_id INT, donor_id INT, donation_amount FLOAT, donation_category TEXT); INSERT INTO donations (donation_id, donor_id, donation_amount, donation_category) VALUES (1, 1, 1000.00, 'Impact Investing'), (2, 2, 500.00, 'Education'); | Find the number of unique non-profit organizations that received donations in the impact investing category from donors in the United Kingdom. | SELECT COUNT(DISTINCT donation_recipient_id) FROM (SELECT donation_recipient_id FROM donations WHERE donation_category = 'Impact Investing' AND EXISTS (SELECT 1 FROM donors WHERE donors.donor_id = donations.donor_id AND donors.donor_country = 'United Kingdom')) AS donation_subset; | gretelai_synthetic_text_to_sql |
CREATE TABLE Fish_Farms (Farm_ID INT, Farm_Name TEXT, Region TEXT, Number_of_Fish INT); INSERT INTO Fish_Farms (Farm_ID, Farm_Name, Region, Number_of_Fish) VALUES (1, 'Farm S', 'Northern', 5000); INSERT INTO Fish_Farms (Farm_ID, Farm_Name, Region, Number_of_Fish) VALUES (2, 'Farm T', 'Southern', 6000); INSERT INTO Fish... | What is the total number of fish in each region? | SELECT Region, SUM(Number_of_Fish) FROM Fish_Farms GROUP BY Region; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, industry TEXT, founding_date DATE, founder_country TEXT);CREATE TABLE founders (id INT, company_id INT); | Identify the number of unique countries represented by the founders of companies in the tech industry. | SELECT COUNT(DISTINCT founder_country) FROM companies INNER JOIN founders ON companies.id = founders.company_id WHERE companies.industry = 'tech'; | gretelai_synthetic_text_to_sql |
CREATE TABLE BankruptcyCases (CaseID INT, CaseType VARCHAR(20), AttorneyLastName VARCHAR(20), BillingAmount DECIMAL(10,2)); INSERT INTO BankruptcyCases (CaseID, CaseType, AttorneyLastName, BillingAmount) VALUES (1, 'Bankruptcy', 'Davis', 8000.00), (2, 'Bankruptcy', 'Miller', 4000.00); | List all unique attorney last names who have billed for cases in the 'Bankruptcy' case type, sorted alphabetically. | SELECT DISTINCT AttorneyLastName FROM BankruptcyCases WHERE CaseType = 'Bankruptcy' ORDER BY AttorneyLastName; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicles (vehicle_id INT, wheelchair_accessible BOOLEAN); INSERT INTO vehicles VALUES (1, TRUE); INSERT INTO vehicles VALUES (2, FALSE); INSERT INTO vehicles VALUES (3, TRUE); INSERT INTO vehicles VALUES (4, FALSE); INSERT INTO vehicles VALUES (5, TRUE); | What is the total number of wheelchair accessible and non-accessible vehicles in the fleet? | SELECT SUM(IF(vehicles.wheelchair_accessible = TRUE, 1, 0)) as wheelchair_accessible_vehicles, SUM(IF(vehicles.wheelchair_accessible = FALSE, 1, 0)) as non_wheelchair_accessible_vehicles FROM vehicles; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (id INT, client_name VARCHAR(50), country VARCHAR(50), type VARCHAR(50), value DECIMAL(10,2), date DATE); INSERT INTO investments (id, client_name, country, type, value, date) VALUES (1, 'Ahmad', 'Malaysia', 'stocks', 12000, '2022-01-01'); INSERT INTO investments (id, client_name, country, type... | Who are the top 3 clients with the highest total investments in Malaysia? | SELECT client_name, SUM(value) as total_investments, ROW_NUMBER() OVER (ORDER BY SUM(value) DESC) as rank FROM investments WHERE country = 'Malaysia' GROUP BY client_name HAVING rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts_initiatives (id INT, initiative VARCHAR(50), budget INT, location VARCHAR(50)); INSERT INTO traditional_arts_initiatives (id, initiative, budget, location) VALUES (1, 'Mexican Folk Art Revival', 5000, 'Americas'), (2, 'Brazilian Capoeira Restoration', 7000, 'Americas'); | What is the minimum and maximum budget for traditional arts initiatives in the 'Americas'? | SELECT MIN(budget), MAX(budget) FROM traditional_arts_initiatives WHERE location = 'Americas'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, loan_id INT, name TEXT, city TEXT); INSERT INTO customers (id, loan_id, name, city) VALUES (1, 1, 'Fatima', 'New York'), (2, 1, 'Ali', 'New York'), (3, 2, 'Aisha', 'Los Angeles'), (4, 3, 'Zayd', 'Chicago'); | Find the number of unique customers who benefited from socially responsible lending? | SELECT COUNT(DISTINCT customers.id) FROM customers JOIN loans ON customers.loan_id = loans.id WHERE loans.is_shariah_compliant = FALSE AND loans.type = 'Socially responsible'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy (policy_id INT, policy_type VARCHAR(20), effective_date DATE); INSERT INTO policy VALUES (1, 'Commercial Auto', '2018-01-01'); INSERT INTO policy VALUES (2, 'Personal Auto', '2020-01-01'); | Delete policy records with a policy type of 'Commercial Auto' and effective date before '2019-01-01' | DELETE FROM policy WHERE policy_type = 'Commercial Auto' AND effective_date < '2019-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Satellite_Imagery (id INT, farm_id INT, date DATE, moisture INT, temperature INT); INSERT INTO Satellite_Imagery (id, farm_id, date, moisture, temperature) VALUES (1, 1, '2022-05-01', 60, 75); INSERT INTO Satellite_Imagery (id, farm_id, date, moisture, temperature) VALUES (2, 1, '2022-05-05', 70, 80); INSE... | Find the temperature difference between the highest and lowest temperature records for each farm. | SELECT farm_id, MAX(temperature) - MIN(temperature) FROM Satellite_Imagery GROUP BY farm_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_for_women (fund_id INT, project_name VARCHAR(100), country VARCHAR(50), sector VARCHAR(50), amount FLOAT, gender_flag BOOLEAN); INSERT INTO climate_finance_for_women (fund_id, project_name, country, sector, amount, gender_flag) VALUES (1, 'Solar Power for Women', 'Kenya', 'Energy', 3000000,... | What is the total climate finance for women-led projects in Africa in the energy sector? | SELECT SUM(amount) FROM climate_finance_for_women WHERE country = 'Africa' AND sector = 'Energy' AND gender_flag = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, cause VARCHAR(255), sector VARCHAR(255), date DATE); INSERT INTO incidents (id, cause, sector, date) VALUES (1, 'insider threat', 'financial', '2021-01-01'); INSERT INTO incidents (id, cause, sector, date) VALUES (2, 'phishing', 'government', '2021-02-01'); | Calculate the percentage of security incidents caused by insider threats in the government sector in the second half of 2021. | SELECT 100.0 * SUM(CASE WHEN cause = 'insider threat' AND sector = 'government' THEN 1 ELSE 0 END) / COUNT(*) as percentage FROM incidents WHERE date >= '2021-07-01' AND date < '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE event_attendance (id INT, event_id INT, attendee_count INT); INSERT INTO event_attendance (id, event_id, attendee_count) VALUES (1, 1, 250), (2, 2, 320), (3, 3, 175); CREATE TABLE events (id INT, category VARCHAR(10)); INSERT INTO events (id, category) VALUES (1, 'Dance'), (2, 'Music'), (3, 'Theater'), (4,... | What was the average number of attendees for events in the 'Exhibitions' category? | SELECT AVG(attendee_count) FROM event_attendance JOIN events ON event_attendance.event_id = events.id WHERE events.category = 'Exhibitions'; | gretelai_synthetic_text_to_sql |
CREATE TABLE battery_storage (id INT, system_type TEXT, state TEXT, capacity_mwh FLOAT); INSERT INTO battery_storage (id, system_type, state, capacity_mwh) VALUES (1, 'Lithium-ion', 'California', 50.0), (2, 'Flow', 'California', 75.0), (3, 'Sodium-ion', 'California', 40.0); | What is the minimum energy storage capacity (in MWh) of battery storage systems in California, grouped by system type? | SELECT system_type, MIN(capacity_mwh) FROM battery_storage WHERE state = 'California' GROUP BY system_type; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA BiotechStartups; CREATE TABLE StartupFunding (startup_name VARCHAR(50), country VARCHAR(50), funding DECIMAL(10, 2)); INSERT INTO StartupFunding VALUES ('StartupA', 'USA', 500000), ('StartupB', 'Canada', 750000); | Find the average funding received by startups in each country in the 'StartupFunding' table? | SELECT country, AVG(funding) as avg_funding FROM BiotechStartups.StartupFunding GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm (FarmID int, FarmType varchar(20), Country varchar(50)); INSERT INTO Farm (FarmID, FarmType, Country) VALUES (1, 'Organic', 'USA'), (2, 'Conventional', 'Canada'), (3, 'Urban', 'Mexico'), (4, 'Organic', 'USA'), (5, 'Organic', 'Mexico'); | Calculate the percentage of organic farms out of all farms for each country. | SELECT Country, 100.0 * COUNT(*) FILTER (WHERE FarmType = 'Organic') / COUNT(*) as PctOrganic FROM Farm GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu (item_name TEXT, quantity_sold INTEGER, sale_date DATE); INSERT INTO menu (item_name, quantity_sold, sale_date) VALUES ('Veggie Delight', 15, '2022-01-01'); INSERT INTO menu (item_name, quantity_sold, sale_date) VALUES ('Veggie Delight', 12, '2022-01-02'); | What is the total quantity of 'Veggie Delight' sandwiches sold in January 2022? | SELECT SUM(quantity_sold) FROM menu WHERE item_name = 'Veggie Delight' AND sale_date BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), dept_id INT, salary DECIMAL(10, 2), gender VARCHAR(50)); | What is the average salary of female employees? | SELECT AVG(salary) FROM employees WHERE gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Yield (id INT PRIMARY KEY, crop VARCHAR(50), country VARCHAR(50), year INT, yield INT); INSERT INTO Yield (id, crop, country, year, yield) VALUES (1, 'Soybeans', 'Brazil', 2021, 3500); INSERT INTO Yield (id, crop, country, year, yield) VALUES (2, 'Soybeans', 'USA', 2021, 3300); INSERT INTO Yield (id, crop,... | Which country has the highest soybean yield in 2021? | SELECT country, MAX(yield) FROM Yield WHERE crop = 'Soybeans' AND year = 2021 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE analysts (analyst_id INT, name VARCHAR(50), start_date DATE); INSERT INTO analysts (analyst_id, name, start_date) VALUES (1, 'John Doe', '2020-01-01'); CREATE TABLE artifacts (artifact_id INT, analyst_id INT, category VARCHAR(50)); | Which analysts have excavated artifacts in the 'Ancient Civilizations' category? | SELECT a.name FROM analysts a JOIN artifacts art ON a.analyst_id = art.analyst_id WHERE art.category = 'Ancient Civilizations' GROUP BY a.analyst_id, a.name HAVING COUNT(art.artifact_id) > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_products (product_id INT, product_name VARCHAR(50), price DECIMAL(5,2), certification VARCHAR(20)); INSERT INTO organic_products (product_id, product_name, price, certification) VALUES (1, 'Bananas', 1.50, 'Fair Trade'), (2, 'Quinoa', 7.99, 'USDA Organic'), (3, 'Coffee', 9.99, 'Fair Trade'); | What is the average price of Fair Trade certified products in the 'organic_products' table? | SELECT AVG(price) FROM organic_products WHERE certification = 'Fair Trade'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FoodInspections (id INT PRIMARY KEY, facility_name VARCHAR(255), inspection_date DATE, violation_count INT); INSERT INTO FoodInspections (id, facility_name, inspection_date, violation_count) VALUES (1, 'Tasty Burgers', '2021-03-15', 3), (2, 'Fresh Greens', '2021-03-17', 0), (3, 'Pizza Palace', '2021-03-18'... | How many violations did each facility have on average during their inspections? | SELECT facility_name, AVG(violation_count) FROM FoodInspections GROUP BY facility_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE appeals (appeal_id INT, case_id INT, case_type VARCHAR(50), appeal_outcome VARCHAR(50)); INSERT INTO appeals (appeal_id, case_id, case_type, appeal_outcome) VALUES (1, 1, 'juvenile', 'successful'), (2, 2, 'criminal', 'unsuccessful'), (3, 3, 'juvenile', 'successful'); | What is the percentage of successful appeals for juvenile cases? | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM appeals WHERE case_type = 'juvenile')) AS percentage_successful FROM appeals WHERE appeal_outcome = 'successful' AND case_type = 'juvenile'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (id INT, name VARCHAR(255)); INSERT INTO Warehouse (id, name) VALUES (1, 'New York'), (2, 'Los Angeles'); CREATE TABLE Shipments (id INT, type VARCHAR(10), warehouse_id INT, shipment_date DATE); INSERT INTO Shipments (id, type, warehouse_id, shipment_date) VALUES (1, 'Delivery', 1, '2021-01-01'),... | How many returns were made from California to the Los Angeles warehouse in Q2 2021? | SELECT COUNT(*) FROM Shipments WHERE type = 'Return' AND warehouse_id = (SELECT id FROM Warehouse WHERE name = 'Los Angeles') AND shipment_date BETWEEN '2021-04-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organization (id INT, name VARCHAR(255)); INSERT INTO organization (id, name) VALUES (1, 'Habitat for Humanity'), (2, 'American Red Cross'); CREATE TABLE volunteer (id INT, name VARCHAR(255), organization_id INT); INSERT INTO volunteer (id, name, organization_id) VALUES (1, 'John Doe', 1), (2, 'Jane Smith'... | Find the total number of volunteers for each organization. | SELECT organization_id, COUNT(*) as total_volunteers FROM volunteer GROUP BY organization_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors (vendor_id INT, vendor_name TEXT, country TEXT);CREATE TABLE products (product_id INT, product_name TEXT, price DECIMAL, CO2_emission INT, vendor_id INT); INSERT INTO vendors (vendor_id, vendor_name, country) VALUES (1, 'VendorA', 'Canada'), (2, 'VendorB', 'USA'); INSERT INTO products (product_id, ... | What is the average CO2 emission for products sold in Canada? | SELECT AVG(CO2_emission) FROM products JOIN vendors ON products.vendor_id = vendors.vendor_id WHERE country = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE policy_holder (policy_holder_id INT, first_name VARCHAR(20), last_name VARCHAR(20), address VARCHAR(50)); | Update the address of policyholder with policy_holder_id 222 in the 'policy_holder' table to '456 Elm St, Los Angeles, CA 90001'. | UPDATE policy_holder SET address = '456 Elm St, Los Angeles, CA 90001' WHERE policy_holder_id = 222; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities.buildings (id INT, city VARCHAR(255), co2_emissions INT); CREATE VIEW smart_cities.buildings_view AS SELECT id, city, co2_emissions FROM smart_cities.buildings; | What is the maximum CO2 emission for buildings in each city in the 'smart_cities' schema? | SELECT city, MAX(co2_emissions) FROM smart_cities.buildings_view GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (id INT, strain TEXT, state TEXT); INSERT INTO Inventory (id, strain, state) VALUES (1, 'Strain A', 'Oregon'), (2, 'Strain B', 'Oregon'), (3, 'Strain C', 'Oregon'); CREATE TABLE Sales (id INT, inventory_id INT, sold_date DATE); INSERT INTO Sales (id, inventory_id, sold_date) VALUES (1, 1, '2021-0... | Which strains were sold in Oregon in Q3 2021 and Q4 2021? | SELECT i.strain FROM Inventory i INNER JOIN Sales s ON i.id = s.inventory_id WHERE s.sold_date BETWEEN '2021-07-01' AND '2021-12-31' AND i.state = 'Oregon' GROUP BY i.strain; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_good_orgs (org_id INT, employees INT, region VARCHAR(20)); INSERT INTO social_good_orgs (org_id, employees, region) VALUES (1, 100, 'South America'), (2, 200, 'Africa'), (3, 150, 'South America'), (4, 250, 'Europe'); | What is the minimum number of employees in organizations that have implemented technology for social good initiatives in South America? | SELECT MIN(employees) FROM social_good_orgs WHERE region = 'South America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE organic_skincare (product_id INT, product_name VARCHAR(50), price DECIMAL(5,2), is_organic BOOLEAN); | What is the average price of organic skincare products in the 'organic_skincare' table? | SELECT AVG(price) FROM organic_skincare WHERE is_organic = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_operations (id INT, mine_name TEXT, location TEXT, material TEXT, quantity INT, date DATE); INSERT INTO mining_operations (id, mine_name, location, material, quantity, date) VALUES (9, 'Aluminum Atlas', 'Canada', 'aluminum', 4000, '2021-01-01'); | Calculate the total amount of aluminum mined globally in 2021 | SELECT SUM(quantity) FROM mining_operations WHERE material = 'aluminum' AND date = '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, europium_production FLOAT, timestamp DATE); INSERT INTO mines (id, name, location, europium_production, timestamp) VALUES (1, 'Mine A', 'China', 120.5, '2022-01-01'), (2, 'Mine B', 'Japan', 150.7, '2022-02-01'), (3, 'Mine C', 'USA', 200.3, '2022-03-01'); | What is the minimum Europium production in 2022 from mines in Asia? | SELECT MIN(europium_production) FROM mines WHERE location = 'Asia' AND YEAR(mines.timestamp) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure_projects (id INT, project VARCHAR(50), investment FLOAT); INSERT INTO rural_infrastructure_projects (id, project, investment) VALUES (1, 'Rural Road Construction', 50000.0); INSERT INTO rural_infrastructure_projects (id, project, investment) VALUES (2, 'Rural Water Supply', 60000.0); I... | What is the maximum investment per project in the 'rural_infrastructure_projects' table? | SELECT MAX(investment) FROM rural_infrastructure_projects; | gretelai_synthetic_text_to_sql |
CREATE TABLE memberships (id INT, user_id INT, start_date DATE, end_date DATE); INSERT INTO memberships (id, user_id, start_date, end_date) VALUES (1, 1, '2021-01-01', '2022-01-01'), (2, 2, '2020-01-01', '2021-01-01'), (3, 3, '2019-01-01', '2020-01-01'); CREATE TABLE user_preferences (id INT, user_id INT, preferred_wor... | How many users have a membership longer than 1 year, grouped by their preferred workout time? | SELECT COUNT(*), preferred_workout_time FROM memberships m JOIN user_preferences p ON m.user_id = p.user_id WHERE DATEDIFF(m.end_date, m.start_date) > 365 GROUP BY preferred_workout_time; | gretelai_synthetic_text_to_sql |
CREATE TABLE EsportsEvents (EventID INT, EventName TEXT, EventType TEXT, EventDate DATE); INSERT INTO EsportsEvents (EventID, EventName, EventType, EventDate) VALUES (1, 'ELC', 'League', '2022-01-01'), (2, 'DAC', 'Championship', '2022-02-15'), (3, 'GCS', 'Cup', '2021-12-10'), (4, 'WCS', 'Series', '2022-04-20'), (5, 'EP... | Identify the number of unique esports events and their types in the last 6 months. | SELECT COUNT(DISTINCT EventID), EventType FROM EsportsEvents WHERE EventDate >= DATEADD(month, -6, GETDATE()) GROUP BY EventType; | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramName TEXT, Location TEXT); INSERT INTO Programs (ProgramID, ProgramName, Location) VALUES (1, 'Health Education', 'Asia-Pacific'), (2, 'Clean Water Initiative', 'Africa'); CREATE TABLE ProgramOutcomes (OutcomeID INT, ProgramID INT, Outcome TEXT, Expenses DECIMAL(10, 2)); INS... | List all programs with their respective outcomes and total expenses in the Asia-Pacific region. | SELECT programs.ProgramName, outcomes.Outcome, SUM(outcomes.Expenses) AS TotalExpenses FROM Programs programs INNER JOIN ProgramOutcomes outcomes ON programs.ProgramID = outcomes.ProgramID WHERE programs.Location = 'Asia-Pacific' GROUP BY programs.ProgramName, outcomes.Outcome; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_spending (id INT PRIMARY KEY, amount FLOAT, year INT, country VARCHAR(255)); | What is the total amount of defense spending by country and year? | SELECT country, year, SUM(amount) as total_spending FROM defense_spending GROUP BY country, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, donor_name VARCHAR(255), donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO Donations (id, donor_name, donation_amount, donation_date) VALUES (1, 'ABC Corporation Nigeria', 500.00, '2021-04-12'), (2, 'XYZ Foundation Nigeria', 700.00, '2021-06-02'); | What was the average donation amount by organizations in Nigeria in Q2 2021? | SELECT AVG(donation_amount) FROM Donations WHERE donor_name LIKE '%Nigeria%' AND donation_date BETWEEN '2021-04-01' AND '2021-06-30' AND donor_name NOT LIKE '%individual%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_yearly (id INT, incident_date DATE, category VARCHAR(10)); INSERT INTO incident_yearly (id, incident_date, category) VALUES (1, '2021-01-01', 'Malware'), (2, '2021-01-15', 'Phishing'), (3, '2022-01-01', 'Insider Threat'), (4, '2022-01-01', 'DDoS'), (5, '2022-02-01', 'Phishing'), (6, '2023-03-01', ... | Show the number of security incidents and their category by year | SELECT EXTRACT(YEAR FROM incident_date) as year, category, COUNT(*) as incidents FROM incident_yearly GROUP BY year, category; | gretelai_synthetic_text_to_sql |
CREATE TABLE properties (id INT, property_id INT, city TEXT, size INT); INSERT INTO properties (id, property_id, city, size) VALUES (1, 101, 'Austin', 1200), (2, 102, 'Seattle', 900), (3, 103, 'Austin', 1500), (4, 106, 'Portland', 1400), (5, 107, 'Portland', 1600); | What is the total number of properties in the city of Portland? | SELECT COUNT(*) FROM properties WHERE city = 'Portland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE workplace_safety (id INT, company VARCHAR, incident_date DATE, description VARCHAR, severity VARCHAR); INSERT INTO workplace_safety (id, company, incident_date, description, severity) VALUES (9, 'LMN Inc', '2022-02-03', 'Fire', 'Major'); INSERT INTO workplace_safety (id, company, incident_date, description... | Which companies had workplace safety incidents in the past year? | SELECT company, COUNT(*) OVER (PARTITION BY company) as incidents_past_year FROM workplace_safety WHERE incident_date BETWEEN DATEADD(year, -1, CURRENT_DATE) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE services (id INT, school_id INT, service VARCHAR(255), budget INT); INSERT INTO services (id, school_id, service, budget) VALUES (1, 1, 'Service1', 10000), (2, 1, 'Service2', 12000), (3, 2, 'Service1', 11000); CREATE TABLE schools (id INT, name VARCHAR(255), academic_year INT); INSERT INTO schools (id, nam... | Identify the unique services provided by schools in the last academic year, along with their respective budgets. | SELECT DISTINCT s.service, sc.budget FROM services s JOIN schools sc ON s.school_id = sc.id WHERE sc.academic_year = 2021 | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_pricing (country TEXT, level REAL); INSERT INTO carbon_pricing (country, level) VALUES ('Switzerland', 105.86), ('Sweden', 123.36), ('Norway', 62.26), ('United Kingdom', 30.15), ('Germany', 29.81), ('France', 32.37), ('Italy', 27.04), ('Spain', 25.76), ('Finland', 24.56), ('Ireland', 20.00); | What are the top 3 countries with the highest carbon pricing levels? | SELECT country, level FROM carbon_pricing ORDER BY level DESC LIMIT 3 | gretelai_synthetic_text_to_sql |
CREATE TABLE species_info (id INT, species TEXT, region TEXT, min_temp DECIMAL(5,2), max_temp DECIMAL(5,2)); INSERT INTO species_info (id, species, region, min_temp, max_temp) VALUES (1, 'Salmon', 'Pacific', 8.0, 16.0), (2, 'Tilapia', 'Atlantic', 20.0, 30.0), (3, 'Shrimp', 'Pacific', 18.0, 28.0), (4, 'Trout', 'Atlantic... | What is the minimum water temperature required for each species in the Pacific region? | SELECT species, min_temp as min_required_temp FROM species_info WHERE region = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycled_materials(company VARCHAR(50), material VARCHAR(50), quantity INT); | What is the total quantity of recycled materials used in production by each company? | SELECT company, SUM(quantity) FROM recycled_materials GROUP BY company; | gretelai_synthetic_text_to_sql |
CREATE TABLE vaccinations(id INT, patient_id INT, country TEXT, date DATE); | What is the number of vaccinations administered in each country? | SELECT country, COUNT(*) FROM vaccinations GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE CoffeeMenu(menu_item VARCHAR(50), price DECIMAL(5,2)); CREATE TABLE Orders(order_id INT, customer_id INT, menu_item VARCHAR(50), order_date DATE); INSERT INTO CoffeeMenu VALUES('Espresso', 2.99), ('Latte', 3.99), ('Cappuccino', 3.49); INSERT INTO Orders VALUES(1, 1, 'Espresso', '2022-01-01'), (2, 2, 'Latte... | How many customers have ordered more than 10 drinks from the coffee menu in the last month? | SELECT COUNT(DISTINCT customer_id) FROM Orders JOIN CoffeeMenu ON Orders.menu_item = CoffeeMenu.menu_item WHERE order_date >= '2022-01-01' AND order_date < '2022-02-01' GROUP BY customer_id HAVING COUNT(*) > 10; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, PlayerName VARCHAR(50), Game VARCHAR(50), Wins INT); INSERT INTO Players (PlayerID, PlayerName, Game, Wins) VALUES (1, 'John Doe', 'Shooter Game 2022', 25), (2, 'Jane Smith', 'Shooter Game 2022', 30), (3, 'Alice Johnson', 'Shooter Game 2022', 22); | What is the minimum number of wins for players who play "Shooter Game 2022"? | SELECT MIN(Wins) FROM Players WHERE Game = 'Shooter Game 2022'; | gretelai_synthetic_text_to_sql |
CREATE TABLE taxi_routes (route_id INT, vehicle_type VARCHAR(10), fare DECIMAL(5,2)); CREATE TABLE taxi_fares (fare_id INT, route_id INT, fare_amount DECIMAL(5,2), fare_collection_date DATE, is_accessible BOOLEAN); INSERT INTO taxi_routes VALUES (1, 'Taxi', 700), (2, 'Accessible Taxi', 900); INSERT INTO taxi_fares VALU... | What is the minimum fare collected for accessible taxis in Tokyo in the month of April 2022? | SELECT MIN(f.fare_amount) FROM taxi_fares f JOIN taxi_routes br ON f.route_id = br.route_id WHERE f.is_accessible = true AND f.fare_collection_date BETWEEN '2022-04-01' AND '2022-04-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE teacher_professional_development (teacher_id INT, professional_development_score INT); | Create a table for teacher professional development data | CREATE TABLE teacher_professional_development (teacher_id INT, professional_development_score INT); | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_projects (id INT, name VARCHAR(100), country VARCHAR(50), capacity_mw FLOAT); INSERT INTO renewable_energy_projects (id, name, country, capacity_mw) VALUES (1, 'Project 1', 'India', 30.5), (2, 'Project 2', 'India', 15.2); | Identify the smallest Renewable Energy Project in India by capacity | SELECT name, MIN(capacity_mw) FROM renewable_energy_projects WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE bookings (id INT PRIMARY KEY, user_id INT, country_id INT, FOREIGN KEY (country_id) REFERENCES countries(id)); CREATE TABLE tours (id INT PRIMARY KEY, tour_type VARCHAR(255)); ALTER TABLE bookings ADD FOREIGN KEY (tour_type) REFERENCES tours(i... | How many users have booked tours in each country? | SELECT countries.name, COUNT(bookings.id) FROM countries INNER JOIN bookings ON countries.id = bookings.country_id GROUP BY countries.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Tourist (Tourist_ID INT PRIMARY KEY, Tourist_Name VARCHAR(100)); INSERT INTO Tourist (Tourist_ID, Tourist_Name) VALUES (1, 'John Doe'); CREATE TABLE Accommodation (Accommodation_ID INT PRIMARY KEY, Accommodation_Name VARCHAR(100), Country_ID INT, FOREIGN KEY (Country_ID) REFERENCES Country(Country_ID)); IN... | Who has booked the 'Rickshaw Bangkok' accommodation and what are their names? | SELECT Tourist_Name FROM Tourist INNER JOIN Booking ON Tourist.Tourist_ID = Booking.Tourist_ID WHERE Accommodation_ID = (SELECT Accommodation_ID FROM Accommodation WHERE Accommodation_Name = 'Rickshaw Bangkok'); | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, country TEXT); INSERT INTO hotels (hotel_id, hotel_name, country) VALUES (1, 'Hotel A', 'Japan'), (2, 'Hotel B', 'China'), (3, 'Hotel C', 'India'); CREATE TABLE virtual_tours (hotel_id INT, tour_name TEXT); INSERT INTO virtual_tours (hotel_id, tour_name) VALUES (1, 'T... | What is the adoption rate of virtual tours in Asian hotels? | SELECT country, (COUNT(DISTINCT hotels.hotel_id) / (SELECT COUNT(DISTINCT hotel_id) FROM hotels WHERE country = hotels.country) * 100) as adoption_rate FROM hotels INNER JOIN virtual_tours ON hotels.hotel_id = virtual_tours.hotel_id GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurant (id INT, name VARCHAR(50)); INSERT INTO Restaurant (id, name) VALUES (1, 'Fresh Harvest'); INSERT INTO Restaurant (id, name) VALUES (2, 'Green Living'); INSERT INTO Restaurant (id, name) VALUES (3, 'Taste of Nature'); CREATE TABLE FoodInspections (id INT, restaurant_id INT, inspection_date DATE,... | Which restaurants have had more than 3 inspections with a rating below 80? | SELECT Restaurant.name FROM Restaurant LEFT JOIN FoodInspections ON Restaurant.id = FoodInspections.restaurant_id WHERE FoodInspections.rating < 80 GROUP BY Restaurant.name HAVING COUNT(FoodInspections.id) > 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE EconomicDiversification (id INT PRIMARY KEY, project_name VARCHAR(255), budget DECIMAL(10,2)); | Delete all records in the "EconomicDiversification" table where the budget is less than $100,000 | DELETE FROM EconomicDiversification WHERE budget < 100000; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, detection_date DATE, software_vendor VARCHAR(255), risk_score INT); INSERT INTO vulnerabilities (id, detection_date, software_vendor, risk_score) VALUES (1, '2022-01-01', 'VendorA', 7), (2, '2022-01-05', 'VendorB', 5), (3, '2022-01-10', 'VendorA', 9); | What is the average risk score of vulnerabilities detected in the last 30 days, grouped by software vendor? | SELECT software_vendor, AVG(risk_score) as avg_risk_score FROM vulnerabilities WHERE detection_date >= DATE(NOW()) - INTERVAL 30 DAY GROUP BY software_vendor; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (department VARCHAR(50), avg_publications FLOAT); INSERT INTO departments VALUES ('Computer Science', 3.5), ('Mathematics', 2.8), ('Physics', 4.2); | What is the average number of publications per graduate student in each department? | SELECT d.department, AVG(gs.publications) FROM (SELECT department, COUNT(publication) AS publications FROM graduate_students GROUP BY department) gs JOIN departments d ON gs.department = d.department GROUP BY d.department; | gretelai_synthetic_text_to_sql |
CREATE TABLE german_sites (site_id INT, site_name TEXT, state TEXT, environmental_score FLOAT); INSERT INTO german_sites (site_id, site_name, state, environmental_score) VALUES (1, 'Site E', 'Bavaria', 85.2), (2, 'Site F', 'Baden-Württemberg', 88.7), (3, 'Site G', 'Bavaria', 90.1), (4, 'Site H', 'Hesse', 82.6); | List the environmental impact scores of production sites in Germany, partitioned by state in ascending order. | SELECT state, environmental_score, RANK() OVER (PARTITION BY state ORDER BY environmental_score) as rank FROM german_sites WHERE country = 'Germany' GROUP BY state, environmental_score; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (ingredient_id INT, ingredient_name TEXT, sourcing_frequency INT); INSERT INTO ingredients (ingredient_id, ingredient_name, sourcing_frequency) VALUES (1, 'Water', 100), (2, 'Glycerin', 80), (3, 'Shea Butter', 60); | What is the average cost of the top 5 most frequently sourced ingredients? | SELECT AVG(cost) FROM (SELECT * FROM (SELECT ingredient_name, sourcing_frequency, ROW_NUMBER() OVER (ORDER BY sourcing_frequency DESC) AS rn FROM ingredients) sub WHERE rn <= 5) sub2 JOIN ingredients ON sub2.ingredient_name = ingredients.ingredient_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (id INT, sector TEXT, year INT, emissions_mt FLOAT); INSERT INTO co2_emissions (id, sector, year, emissions_mt) VALUES (1, 'Power', 2018, 1200.1), (2, 'Power', 2019, 1300.2); | What was the total CO2 emissions (Mt) from the power sector in India in 2019? | SELECT SUM(emissions_mt) FROM co2_emissions WHERE sector = 'Power' AND year = 2019; | gretelai_synthetic_text_to_sql |
INSERT INTO claims (id, policyholder_id, claim_amount, claim_date) VALUES (9, 7, 100, '2021-03-05'); | What is the minimum claim amount for policyholders in Arizona? | SELECT MIN(claim_amount) FROM claims JOIN policyholders ON claims.policyholder_id = policyholders.id WHERE policyholders.state = 'Arizona'; | gretelai_synthetic_text_to_sql |
CREATE TABLE avg_mobile_usage (id INT, name VARCHAR(50), data_usage FLOAT); INSERT INTO avg_mobile_usage (id, name, data_usage) VALUES (1, 'Janet Smith', 12.5); | What is the average data usage for mobile subscribers? | SELECT AVG(data_usage) FROM avg_mobile_usage WHERE data_usage > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_data (visitor_country VARCHAR(50), destination_country VARCHAR(50), visit_year INT); INSERT INTO tourism_data (visitor_country, destination_country, visit_year) VALUES ('France', 'Japan', 2020), ('Germany', 'Japan', 2020), ('Italy', 'Japan', 2020); | What is the total number of tourists who visited Japan in 2020 from European countries? | SELECT SUM(*) FROM tourism_data WHERE visitor_country LIKE 'Europe%' AND visit_year = 2020 AND destination_country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_ships (id INT, name VARCHAR(50), capacity INT, owner_id INT); INSERT INTO cargo_ships (id, name, capacity, owner_id) VALUES (1, 'Sea Titan', 150000, 1), (2, 'Ocean Marvel', 200000, 1), (3, 'Cargo Master', 120000, 2); CREATE TABLE owners (id INT, name VARCHAR(50)); INSERT INTO owners (id, name) VALUES... | What is the total capacity of all cargo ships owned by the ACME corporation? | SELECT SUM(capacity) FROM cargo_ships JOIN owners ON cargo_ships.owner_id = owners.id WHERE owners.name = 'ACME Corporation'; | gretelai_synthetic_text_to_sql |
CREATE TABLE authors (id INT, name VARCHAR(255), articles_written INT); CREATE TABLE articles_authors (article_id INT, author_id INT); INSERT INTO authors (id, name, articles_written) VALUES (1, 'Author 1', 50), (2, 'Author 2', 30); INSERT INTO articles_authors (article_id, author_id) VALUES (1, 1), (2, 1); CREATE VIEW... | Who are the top 5 authors with the highest number of published articles on media ethics in the last year? | SELECT a.name, COUNT(av.article_id) AS articles_count FROM authors a JOIN articles_view av ON a.id = av.author_id GROUP BY a.id ORDER BY articles_count DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_volume (chemical_category VARCHAR(255), production_date DATE, production_volume INT); INSERT INTO production_volume (chemical_category, production_date, production_volume) VALUES ('Polymers', '2023-03-01', 200), ('Polymers', '2023-03-02', 250), ('Dyes', '2023-03-01', 150); | What is the production volume trend for each chemical category over time? | SELECT chemical_category, production_date, SUM(production_volume) OVER (PARTITION BY chemical_category ORDER BY production_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total FROM production_volume; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturers (Id INT, Name VARCHAR(50), Country VARCHAR(50)); INSERT INTO Manufacturers (Id, Name, Country) VALUES (1, 'Boeing', 'USA'), (2, 'Airbus', 'France'), (3, 'Embraer', 'Brazil'), (4, 'Bombardier', 'Canada'); CREATE TABLE Aircraft (Id INT, Name VARCHAR(50), ManufacturerId INT); INSERT INTO Aircraf... | What are the names of all aircraft manufactured by companies based in the USA? | SELECT Aircraft.Name FROM Aircraft JOIN Manufacturers ON Aircraft.ManufacturerId = Manufacturers.Id WHERE Manufacturers.Country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE stadiums (stadium_id INT, stadium_name TEXT, region TEXT); INSERT INTO stadiums (stadium_id, stadium_name, region) VALUES (1, 'Freedom Field', 'Central'), (2, 'Eagle Stadium', 'Northeast'), (3, 'Thunder Dome', 'Southwest'); CREATE TABLE matches (match_id INT, stadium_id INT, sport TEXT, ticket_price DECIMA... | What is the average ticket price for football matches in the 'Central' region? | SELECT AVG(ticket_price) FROM matches WHERE sport = 'Football' AND stadium_id IN (SELECT stadium_id FROM stadiums WHERE region = 'Central'); | gretelai_synthetic_text_to_sql |
CREATE TABLE bridges (id INT, name VARCHAR(50), district VARCHAR(50), length FLOAT); INSERT INTO bridges VALUES (1, 'Golden Gate', 'San Francisco', 2737), (2, 'Brooklyn', 'New York', 1825), (3, 'Tower', 'London', 244); | How many bridges are there in each district? | SELECT district, COUNT(*) FROM bridges GROUP BY district; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_lending (bank_name TEXT, activity_name TEXT, activity_date DATE); INSERT INTO socially_responsible_lending (bank_name, activity_name, activity_date) VALUES ('GreenBank', 'Solar Panel Loans', '2021-02-15'), ('GreenBank', 'Education Loans', '2021-05-10'), ('GreenBank', 'Affordable Housin... | List all socially responsible lending activities by GreenBank in 2021. | SELECT * FROM socially_responsible_lending WHERE bank_name = 'GreenBank' AND activity_date BETWEEN '2021-01-01' AND '2021-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ConstructionProjects (id INT, city VARCHAR(50), country VARCHAR(50), cost FLOAT); | What is the maximum construction cost of any project in the city of Sydney, Australia? | SELECT MAX(cost) FROM ConstructionProjects WHERE city = 'Sydney' AND country = 'Australia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (CaseID int, AttorneyID int); INSERT INTO Cases (CaseID, AttorneyID) VALUES (1, 1), (2, 3), (3, 2), (4, 1), (5, 3), (6, 2), (7, 1); INSERT INTO Attorneys (AttorneyID, ExperienceYears) VALUES (1, 12), (2, 8), (3, 4); | How many cases were handled by attorneys with less than 5 years of experience? | SELECT COUNT(*) FROM Cases c JOIN Attorneys a ON c.AttorneyID = a.AttorneyID WHERE a.ExperienceYears < 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(255), department VARCHAR(255)); INSERT INTO employees (id, name, department) VALUES (1, 'Alice', 'Genetics'), (2, 'Bob', 'Bioengineering'); | Update the department of a principal investigator in the genetic research team | UPDATE employees SET department = 'Synthetic Biology' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (id INT, product_id INT, price DECIMAL(5,2), is_sustainable BOOLEAN); INSERT INTO sales_data (id, product_id, price, is_sustainable) VALUES (1, 1, 10.00, true), (2, 2, 20.00, true); ALTER TABLE fashion_trend_data ADD COLUMN id INT PRIMARY KEY; ALTER TABLE sales_data ADD COLUMN product_id INT REF... | What is the total revenue generated from sustainable fashion sales in the 'sales_data' table? | SELECT SUM(price) FROM sales_data WHERE is_sustainable = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE area (area_id INT, area_type TEXT); CREATE TABLE workshop (workshop_id INT, area_id INT, num_participants INT); INSERT INTO area (area_id, area_type) VALUES (1, 'urban'), (2, 'suburban'), (3, 'rural'); INSERT INTO workshop (workshop_id, area_id, num_participants) VALUES (101, 1, 30), (102, 1, 45), (103, 2,... | How many professional development workshops were held in urban areas? | SELECT COUNT(*) FROM workshop INNER JOIN area ON workshop.area_id = area.area_id WHERE area.area_type = 'urban'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Name VARCHAR(50)); INSERT INTO Attorneys (AttorneyID, Name) VALUES (1, 'Jose Garcia'), (2, 'Lee Kim'); CREATE TABLE Cases (CaseID INT, AttorneyID INT, BillingAmount DECIMAL(10,2)); INSERT INTO Cases (CaseID, AttorneyID, BillingAmount) VALUES (1, 1, 5000.00), (2, 1, 3000.00), (3, ... | What is the average billing amount per case for each attorney? | SELECT Attorneys.Name, AVG(Cases.BillingAmount) FROM Attorneys INNER JOIN Cases ON Attorneys.AttorneyID = Cases.AttorneyID GROUP BY Attorneys.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability (id INT, location VARCHAR(50), score FLOAT); INSERT INTO financial_capability (id, location, score) VALUES (1, 'Rural', 6.5), (2, 'Urban', 7.2), (3, 'Suburban', 8.0); | What is the average financial capability score for clients in urban areas? | SELECT AVG(score) as avg_score FROM financial_capability WHERE location = 'Urban'; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget_allocation (department TEXT, year INT, allocation DECIMAL(10,2)); | Insert a new record of budget allocation for the 'Transportation' department for the year 2023 | INSERT INTO budget_allocation (department, year, allocation) VALUES ('Transportation', 2023, 500000.00); | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_conditions (state TEXT, date DATE, status TEXT); INSERT INTO drought_conditions (state, date, status) VALUES ('California', '2022-01-01', 'Drought'), ('California', '2022-04-01', 'Drought'), ('Texas', '2022-01-01', 'No Drought'), ('Texas', '2022-04-01', 'No Drought'), ('Florida', '2022-01-01', 'No ... | List the states with no drought conditions in the last 3 months. | SELECT state FROM drought_conditions WHERE status = 'No Drought' AND date BETWEEN '2022-01-01' AND '2022-04-01' GROUP BY state HAVING COUNT(*) = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (id INT, name VARCHAR(255), year_built INT, incidents INT, region VARCHAR(255)); INSERT INTO vessels (id, name, year_built, incidents, region) VALUES (1, 'Arctic Hunter', 2005, 2, 'Arctic'); | What is the minimum year of construction for vessels that have reported incidents of illegal fishing activities in the Arctic Ocean? | SELECT MIN(year_built) FROM vessels WHERE region = 'Arctic' AND incidents > 0; | 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.