context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE education_programs (name VARCHAR(255), city VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO education_programs (name, city, budget) VALUES ('NYC Public Schools', 'New York', 12000000.00), ('CUNY', 'New York', 3000000.00); CREATE TABLE health_programs (name VARCHAR(255), city VARCHAR(255), budget DECIMAL(1... | What is the total budget allocated to education and health programs in the city of New York? | SELECT SUM(budget) FROM ( SELECT budget FROM education_programs WHERE city = 'New York' UNION ALL SELECT budget FROM health_programs WHERE city = 'New York' ) AS combined_budgets; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (route_name VARCHAR(255), line_color VARCHAR(255)); INSERT INTO routes (route_name, line_color) VALUES ('Red Line', 'Red'), ('Blue Line', 'Blue'); CREATE TABLE fares (route_name VARCHAR(255), fare_amount DECIMAL(5,2), collection_date DATE); INSERT INTO fares (route_name, fare_amount, collection_date... | What was the total fare collected from the Red Line on January 3rd, 2022? | SELECT SUM(fare_amount) FROM fares INNER JOIN routes ON fares.route_name = routes.route_name WHERE routes.line_color = 'Red' AND fares.collection_date = '2022-01-03'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Terbium_Exports (id INT PRIMARY KEY, year INT, importing_country VARCHAR(20), quantity INT); INSERT INTO Terbium_Exports (id, year, importing_country, quantity) VALUES (1, 2018, 'USA', 50), (2, 2019, 'USA', 60), (3, 2020, 'USA', 70), (4, 2018, 'Canada', 40), (5, 2019, 'Canada', 45), (6, 2020, 'Canada', 50)... | What is the total quantity of Terbium exported by India to all countries from 2018 to 2020? | SELECT SUM(quantity) FROM Terbium_Exports WHERE exporting_country = 'India' AND year BETWEEN 2018 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investment_id INT, sector VARCHAR(50), esg_score INT, investment_date DATE); INSERT INTO investments (investment_id, sector, esg_score, investment_date) VALUES (1, 'Healthcare', 4, '2022-01-01'), (2, 'Healthcare', 2, '2022-02-01'), (3, 'Healthcare', 5, '2022-03-01'), (4, 'Healthcare', 3, '2022... | Delete investments with an ESG score lower than 3 in the healthcare sector. | DELETE FROM investments WHERE sector = 'Healthcare' AND esg_score < 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, donation_amount DECIMAL(10,2), transaction_date DATE); INSERT INTO Donations (id, donation_amount, transaction_date) VALUES (1, 500, '2021-01-01'), (2, 300, '2021-04-15'), (3, 700, '2021-07-03'), (4, 800, '2021-10-17'), (5, 600, '2021-12-02'); | What was the average donation amount in each quarter of 2021? | SELECT DATE_FORMAT(transaction_date, '%Y-%m') as quarter, AVG(donation_amount) as avg_donation_amount FROM Donations GROUP BY quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE exhibitions_history (exhibition_history_id INT PRIMARY KEY, work_id INT, exhibition_id INT, sale_price FLOAT, FOREIGN KEY (work_id) REFERENCES works(work_id), FOREIGN KEY (exhibition_id) REFERENCES exhibitions(exhibition_id)); | Which are the top 5 venues by total value of works exhibited? | SELECT e.location, SUM(eh.sale_price) AS total_value FROM exhibitions e JOIN exhibitions_history eh ON e.exhibition_id = eh.exhibition_id GROUP BY e.location ORDER BY total_value DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation_projects (project_id INT, project_name VARCHAR(255), location VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO climate_mitigation_projects (project_id, project_name, location, budget) VALUES (1, 'Carbon Capture in South Africa', 'South Africa', 4000000.00), (2, 'Forest Conservation in Mo... | What is the average budget for climate mitigation projects in Africa? | SELECT AVG(budget) FROM climate_mitigation_projects WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE museum_visitors(id INT, museum_name TEXT, country TEXT, visitor_count INT); INSERT INTO museum_visitors (id, museum_name, country, visitor_count) VALUES (1, 'British Museum', 'UK', 2000), (2, 'Louvre Museum', 'France', 3000), (3, 'Metropolitan Museum of Art', 'USA', 4000); | What is the maximum visitor count of a museum? | SELECT MAX(visitor_count) FROM museum_visitors; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (id INT, country VARCHAR(50), visit_date DATE); | Identify the top 5 countries with the most returning visitors. | SELECT country, COUNT(DISTINCT id) AS num_returning_visitors FROM Visitors GROUP BY country ORDER BY num_returning_visitors DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_engineering(menu_item VARCHAR(255), category VARCHAR(255), location VARCHAR(255), revenue INT); INSERT INTO menu_engineering(menu_item, category, location, revenue) VALUES ('Burger', 'Meat', 'Location1', 5000), ('Fries', 'Sides', 'Location1', 1000), ('Salad', 'Vegetables', 'Location1', 2000); | What is the total revenue for each menu category in Location1? | SELECT category, SUM(revenue) FROM menu_engineering WHERE location = 'Location1' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE teachers (id INT, name VARCHAR(255), last_workshop_date DATE); INSERT INTO teachers (id, name, last_workshop_date) VALUES (1, 'Teacher A', '2021-06-01'), (2, 'Teacher B', '2020-12-15'), (3, 'Teacher C', NULL); | What are the details of the teachers who have attended professional development workshops in the last year? | SELECT id, name, last_workshop_date FROM teachers WHERE last_workshop_date >= DATEADD(year, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_institutions (institution_id INT, institution_name TEXT, region TEXT, offers_financial_capability BOOLEAN); | Find the number of financial institutions offering financial capability programs in the South American region. | SELECT COUNT(institution_id) FROM financial_institutions WHERE region = 'South American' AND offers_financial_capability = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_data (id INT PRIMARY KEY, model VARCHAR(100), manufacturer VARCHAR(100), year INT, total_sales INT); | List all EVs with total sales greater than 20000 | SELECT * FROM ev_data WHERE total_sales > 20000; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers(id INT, name VARCHAR(50), has_latest_network_technology BOOLEAN); CREATE TABLE broadband_subscribers(id INT, name VARCHAR(50), has_latest_network_technology BOOLEAN); | What is the percentage of mobile and broadband subscribers who are using the latest network technology? | SELECT 'mobile' as type, AVG(has_latest_network_technology) * 100.0 as pct_latest_mobile FROM mobile_subscribers UNION ALL SELECT 'broadband' as type, AVG(has_latest_network_technology) * 100.0 as pct_latest_broadband FROM broadband_subscribers; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA Government;CREATE TABLE Government.Agency (name VARCHAR(255), budget INT);CREATE TABLE Government.Department (name VARCHAR(255), agency VARCHAR(255), employees INT, budget INT); | What is the maximum number of employees in each department in the 'Transportation' agency? | SELECT agency, MAX(employees) FROM Government.Department WHERE agency IN (SELECT name FROM Government.Agency WHERE budget > 2000000) GROUP BY agency; | gretelai_synthetic_text_to_sql |
CREATE TABLE DinnerIngredients (id INT, dish_id INT, ingredient_id INT, cost INT); | What is the total cost of ingredients for each dish in the dinner menu? | SELECT d.name, SUM(di.cost) FROM DinnerIngredients di INNER JOIN DinnerMenu d ON di.dish_id = d.id GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE meal_schedule (meal_name TEXT, vegan_meal BOOLEAN, servings_per_day INTEGER); INSERT INTO meal_schedule (meal_name, vegan_meal, servings_per_day) VALUES ('Veggie Wrap', true, 150), ('Chicken Sandwich', false, 200), ('Lentil Soup', true, 120); | How many vegan meals are served in the school_cafeteria per day according to the meal_schedule table? | SELECT SUM(servings_per_day) FROM meal_schedule WHERE vegan_meal = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE astrobiology_experiments (experiment_id INT, name VARCHAR(100), spacecraft VARCHAR(100), launch_date DATE, experiments_conducted INT); CREATE TABLE mission_data (mission_id INT, name VARCHAR(100), organization VARCHAR(100), launch_date DATE, mission_cost FLOAT); | What is the average number of experiments conducted per mission by SpaceX in the astrobiology_experiments and mission_data tables? | SELECT AVG(experiments_conducted/1.0) FROM astrobiology_experiments, mission_data WHERE astrobiology_experiments.spacecraft = mission_data.name AND mission_data.organization = 'SpaceX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE videos (id INT, title VARCHAR(50), has_captions BOOLEAN, creator_name VARCHAR(50), creator_region VARCHAR(50)); INSERT INTO videos (id, title, has_captions, creator_name, creator_region) VALUES (1, 'Video1', true, 'Maria Garcia', 'North America'), (2, 'Video2', false, 'David Kim', 'Oceania'), (3, 'Video3',... | What is the percentage of videos with captions from indigenous creators in North America and Oceania, in the last year? | SELECT creator_region, 100.0 * COUNT(CASE WHEN has_captions = true THEN 1 END) / COUNT(*) as pct FROM videos WHERE creator_region IN ('North America', 'Oceania') AND post_date >= NOW() - INTERVAL 365 DAY AND creator_name IN (SELECT name FROM creators WHERE is_indigenous = true) GROUP BY creator_region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Articles (article_id INT, title VARCHAR(255), topic VARCHAR(255), word_count INT, publication_date DATE); INSERT INTO Articles (article_id, title, topic, word_count, publication_date) VALUES (1, 'Article1', 'underrepresented communities', 800, '2022-05-01'), (2, 'Article2', 'media literacy', 1200, '2022-03... | What is the average word count for articles about underrepresented communities in the past month? | SELECT AVG(word_count) FROM Articles WHERE topic = 'underrepresented communities' AND publication_date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (client_id INT, name VARCHAR(50), region VARCHAR(20), account_balance DECIMAL(10,2)); INSERT INTO clients (client_id, name, region, account_balance) VALUES (1, 'John Smith', 'West', 30000.00), (2, 'Jane Doe', 'Northeast', 22000.00), (3, 'Mike Johnson', 'West', 35000.00), (4, 'Sara Jones', 'Southeas... | Find the top 5 clients with the highest account balance across all regions. | SELECT client_id, name, account_balance FROM clients ORDER BY account_balance DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE applications (id INT, application_id INT, submission_date DATE); CREATE TABLE applicant (id INT, application_id INT, gender TEXT); | Show the number of job applications submitted by gender from the "applications" and "applicant" tables | SELECT applicant.gender, COUNT(*) as count FROM applications JOIN applicant ON applications.application_id = applicant.application_id GROUP BY applicant.gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE accessibility_features (name TEXT, description TEXT, platform TEXT); | Insert a new record in the "accessibility_features" table for "Closed Captioning" with a description of "Closed captions for hearing-impaired users" and platform as "Television" | INSERT INTO accessibility_features (name, description, platform) VALUES ('Closed Captioning', 'Closed captions for hearing-impaired users', 'Television'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, Gender VARCHAR(20), HireDate DATE); INSERT INTO Employees (EmployeeID, Gender, HireDate) VALUES (1, 'Non-binary', '2022-07-15'); INSERT INTO Employees (EmployeeID, Gender, HireDate) VALUES (2, 'Male', '2022-08-01'); | What is the count of new hires who identify as non-binary in Q3 2022? | SELECT COUNT(*) FROM Employees WHERE Gender = 'Non-binary' AND HireDate BETWEEN '2022-07-01' AND '2022-09-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (department_id INT, department_name VARCHAR(20)); INSERT INTO departments (department_id, department_name) VALUES (1, 'Computer Science'), (2, 'Mathematics'), (3, 'Physics'); CREATE TABLE students (student_id INT, name VARCHAR(50), gender VARCHAR(10), department_VARCHAR(20), enrollment_date DAT... | Create a view named "student_count_by_gender" that shows the total number of male and female students in each department | CREATE VIEW student_count_by_gender AS SELECT d.department_name, SUM(CASE WHEN s.gender = 'Male' THEN 1 ELSE 0 END) AS male_count, SUM(CASE WHEN s.gender = 'Female' THEN 1 ELSE 0 END) AS female_count FROM departments d LEFT JOIN students s ON d.department_name = s.department GROUP BY d.department_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_sales (id INT PRIMARY KEY, sale_date DATE, product_category VARCHAR(255), quantity INT); INSERT INTO monthly_sales (id, sale_date, product_category, quantity) VALUES (1, '2021-12-01', 'Accessories', 15); INSERT INTO monthly_sales (id, sale_date, product_category, quantity) VALUES (2, '2021-12-05', ... | How many items were sold per month in the 'Accessories' category? | SELECT MONTH(sale_date) as sale_month, SUM(quantity) as total_quantity_sold FROM monthly_sales WHERE product_category = 'Accessories' GROUP BY sale_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_transportation (id INT, project_name TEXT, location TEXT, cost INT, completion_date DATE); INSERT INTO public_transportation (id, project_name, location, cost, completion_date) VALUES (1, 'Chicago L Line', 'Chicago', 30000000, '2019-03-23'); INSERT INTO public_transportation (id, project_name, locat... | What is the average cost of public transportation improvements in 'Chicago' that were completed in 2019? | SELECT AVG(cost) FROM public_transportation WHERE location = 'Chicago' AND YEAR(completion_date) = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE EnergyStorageProjects (Country VARCHAR(255), Year INT, Project VARCHAR(255), Status VARCHAR(255)); INSERT INTO EnergyStorageProjects (Country, Year, Project, Status) VALUES ('India', 2022, 'Project A', 'Completed'), ('India', 2022, 'Project B', 'In Progress'), ('India', 2022, 'Project C', 'Announced'), ('I... | How many energy storage projects were announced in India in 2022? | SELECT COUNT(*) AS NumberOfProjects FROM EnergyStorageProjects WHERE Country = 'India' AND Year = 2022 AND Status = 'Announced'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (ArtworkID INT, Title VARCHAR(50), Gallery VARCHAR(50), ArtistID INT, Size INT); INSERT INTO Artworks (ArtworkID, Title, Gallery, ArtistID, Size) VALUES (1, 'Starry Night', 'ImpressionistGallery', 1, 100); INSERT INTO Artworks (ArtworkID, Title, Gallery, ArtistID, Size) VALUES (2, 'Sunflowers', 'I... | Which artist has the largest artwork in the database? | SELECT ArtistID, MAX(Size) as MaxSize FROM Artworks GROUP BY ArtistID; | gretelai_synthetic_text_to_sql |
CREATE TABLE products(product_id INT, transparency_rating INT, production_process_rating INT, supply_chain_rating INT, labor_practices_rating INT); INSERT INTO products(product_id, transparency_rating, production_process_rating, supply_chain_rating, labor_practices_rating) VALUES (1, 80, 85, 90, 70), (2, 85, 90, 80, 95... | Update product transparency ratings based on a weighted average | UPDATE products SET transparency_rating = (production_process_rating + supply_chain_rating + labor_practices_rating) / 3 WHERE product_id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions(id INT, mission_name VARCHAR(50), leader_name VARCHAR(50), leader_country VARCHAR(50), duration INT); INSERT INTO space_missions VALUES(1, 'Vostok 1', 'Yuri Gagarin', 'Russia', 108.), (2, 'Soyuz 11', 'Vladimir Shatalov', 'Russia', 241.); | What is the minimum duration of space missions led by astronauts from Russia? | SELECT MIN(duration) FROM space_missions WHERE leader_country = 'Russia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE strains (type VARCHAR(10), price DECIMAL(5,2)); INSERT INTO strains (type, price) VALUES ('Sativa', 12.50), ('Sativa', 15.00), ('Indica', 10.50); | What is the average retail price per gram of Sativa strains sold in California dispensaries in Q1 2022? | SELECT AVG(price) FROM strains WHERE type = 'Sativa' AND price IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE puzzle_games (puzzle_games_id INT, game_id INT, genre VARCHAR(50), year INT, sales DECIMAL(10, 2)); INSERT INTO puzzle_games VALUES (1, 1, 'Puzzle', 2018, 5000.00), (2, 2, 'Puzzle', 2019, 6000.00), (3, 3, 'Puzzle', 2020, 7000.00), (4, 4, 'Puzzle', 2021, 8000.00), (5, 5, 'Puzzle', 2018, 4000.00), (6, 6, 'Pu... | What is the maximum and minimum number of games released per year for the 'Puzzle' genre? | SELECT genre, MIN(year) as min_year, MAX(year) as max_year, MIN(sales) as min_sales, MAX(sales) as max_sales FROM puzzle_games WHERE genre = 'Puzzle' GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy (project_id INT, project_name TEXT, location TEXT); CREATE TABLE carbon_offsets (project_id INT, initiative_name TEXT, location TEXT); INSERT INTO renewable_energy (project_id, project_name, location) VALUES (1, 'Solar Field One', 'South America'), (2, 'Wind Farm Two', 'North America'); IN... | Identify the renewable energy projects that do not intersect with carbon offset initiatives in South America. | SELECT project_name FROM renewable_energy WHERE project_id NOT IN (SELECT project_id FROM carbon_offsets WHERE renewable_energy.location = carbon_offsets.location); | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (id INT, name VARCHAR(50)); CREATE TABLE weather (id INT, region_id INT, year INT, rainfall FLOAT, temperature FLOAT); | What is the average annual rainfall and temperature for each region in the "regions" and "weather" tables? | SELECT regions.name AS region, AVG(weather.rainfall) AS avg_rainfall, AVG(weather.temperature) AS avg_temperature FROM regions INNER JOIN weather ON regions.id = weather.region_id GROUP BY regions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (id INT, city VARCHAR(50), rate FLOAT, quarter INT, year INT); INSERT INTO recycling_rates (id, city, rate, quarter, year) VALUES (1, 'London', 25.6, 1, 2020), (2, 'London', 26.2, 2, 2020), (3, 'London', 27.1, 3, 2020); | Show the recycling rate per quarter for the city of London in 2020, with the highest rate at the top. | SELECT city, AVG(rate) as avg_rate FROM recycling_rates WHERE city = 'London' AND year = 2020 GROUP BY city, quarter ORDER BY avg_rate DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Music_Sales (title VARCHAR(255), genre VARCHAR(50), release_date DATE, revenue INT); | Top 3 music genres with highest revenue in the US? | SELECT genre, SUM(revenue) as total_revenue FROM Music_Sales WHERE release_date BETWEEN '2010-01-01' AND '2020-12-31' GROUP BY genre ORDER BY total_revenue DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (Year INT, Policy VARCHAR(255), Amount INT); INSERT INTO Policies (Year, Policy, Amount) VALUES (2019, 'PolicyA', 8000000), (2019, 'PolicyB', 6000000), (2019, 'PolicyC', 9000000), (2020, 'PolicyA', 8500000), (2020, 'PolicyB', 6500000), (2020, 'PolicyC', 9500000); | What is the maximum budget allocated for a single policy in the year 2019? | SELECT MAX(Amount) FROM Policies WHERE Year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE criminal_justice_reform_initiatives (initiative_id INT, year INT, individuals_impacted INT); INSERT INTO criminal_justice_reform_initiatives (initiative_id, year, individuals_impacted) VALUES (1, 2020, 5000), (2, 2019, 7000), (3, 2018, 8000), (4, 2017, 6000), (5, 2016, 9000); | What is the total number of individuals impacted by criminal justice reform initiatives in Texas in the past 3 years? | SELECT SUM(individuals_impacted) FROM criminal_justice_reform_initiatives WHERE year >= 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name VARCHAR(255), region VARCHAR(255), water_salinity FLOAT, biomass FLOAT); INSERT INTO fish_farms (id, name, region, water_salinity, biomass) VALUES (1, 'Farm X', 'South America', 28.9, 1800), (2, 'Farm Y', 'South America', 29.7, 2100), (3, 'Farm Z', 'South America', 25.2, 1500); | What is the maximum fish biomass (in kg) in fish farms located in South America, with a water salinity of less than 30 ppt? | SELECT MAX(biomass) FROM fish_farms WHERE region = 'South America' AND water_salinity < 30; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (emission_id INT, garment_type VARCHAR(50), manufacturing_process VARCHAR(50), co2_emission DECIMAL(10, 2)); | What is the average CO2 emission for each garment manufacturing process? | SELECT garment_type, AVG(co2_emission) FROM emissions GROUP BY garment_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id int, product_id int, vendor_id int, quantity int, sale_date date); CREATE TABLE vendors (vendor_id int, vendor_name varchar(255), country varchar(50)); INSERT INTO sales (sale_id, product_id, vendor_id, quantity, sale_date) VALUES (1, 1, 101, 10, '2022-01-01'); INSERT INTO vendors (vendor_id... | How many products were sold by each vendor in the United States? | SELECT vendor_id, SUM(quantity) AS total_sold FROM sales JOIN vendors ON sales.vendor_id = vendors.vendor_id WHERE country = 'United States' GROUP BY vendor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (employee_id INT, name TEXT, gender TEXT, job_title TEXT, mining_company_id INT); INSERT INTO employees (employee_id, name, gender, job_title, mining_company_id) VALUES (1, 'John Doe', 'Male', 'Miner', 1001), (2, 'Jane Doe', 'Female', 'Engineer', 1001), (3, 'Alice Smith', 'Female', 'Miner', 1002)... | How many employees of each gender work in the mining industry per country? | SELECT country, gender, COUNT(*) as employee_count FROM employees JOIN mining_companies ON employees.mining_company_id = mining_companies.mining_company_id GROUP BY country, gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE budget (budget_id INT, program_name VARCHAR(50), state VARCHAR(50), year INT, amount INT); INSERT INTO budget (budget_id, program_name, state, year, amount) VALUES (1, 'Accessible Transportation', 'New York', 2022, 50000), (2, 'Sign Language Interpretation', 'New York', 2022, 30000), (3, 'Adaptive Equipmen... | What is the total budget for disability support programs in 'New York' for 2022? | SELECT SUM(amount) FROM budget WHERE state = 'New York' AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists employment (id INT, industry VARCHAR, number_of_employees INT); INSERT INTO employment (id, industry, number_of_employees) VALUES (1, 'manufacturing', 5000), (2, 'technology', 8000), (3, 'healthcare', 7000), (4, 'retail', 6000), (5, 'education', 9000), (6, 'finance', 10000); | How many employees work in the 'finance' sector? | SELECT SUM(number_of_employees) FROM employment WHERE industry = 'finance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup (id INT, name TEXT, founder_identity TEXT, funding TEXT); INSERT INTO startup (id, name, founder_identity, funding) VALUES (1, 'TechCo', 'Black Female', 'Seed'), (2, 'InnovateIT', 'Black Male', 'Series A'), (3, 'GreenSolutions', 'White Male', 'Seed'), (4, 'DataDriven', 'Asian Female', 'Series B'), ... | Show the count of startups founded by individuals from historically underrepresented groups that have raised Series B or later funding. | SELECT COUNT(*) FROM startup WHERE founder_identity NOT LIKE 'White%' AND funding IN ('Series B', 'Series C', 'Series D', 'Series E'); | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings.certification (certification_level VARCHAR(255), building_count INT); INSERT INTO green_buildings.certification (certification_level, building_count) VALUES ('Gold', 200), ('Silver', 150), ('Bronze', 100), ('Platinum', 50); | How many green buildings are there in the 'green_buildings' schema, for each certification level? | SELECT certification_level, SUM(building_count) FROM green_buildings.certification GROUP BY certification_level; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment_stats (id INT, equipment_name VARCHAR(50), operating_hours INT, last_maintenance_date DATE); | What is the average operating hours for mining equipment in the 'equipment_stats' table that has more than 1000 operating hours? | SELECT AVG(operating_hours) FROM equipment_stats WHERE operating_hours > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_finance_policies_as (country VARCHAR(50), policy_year INT, policy_type VARCHAR(50)); INSERT INTO climate_finance_policies_as (country, policy_year, policy_type) VALUES ('China', 2012, 'Climate Finance'), ('India', 2015, 'Carbon Pricing'), ('Japan', 2018, 'Climate Finance'), ('Vietnam', 2011, 'Renew... | Determine the number of climate finance policies in Asia since 2010, and their distribution by policy type. | SELECT policy_type, COUNT(*) FROM climate_finance_policies_as WHERE policy_year >= 2010 GROUP BY policy_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE programs (program_id INT, program_name TEXT, date_added DATE, date_updated DATE); INSERT INTO programs VALUES (1, 'Financial Literacy 101', '2021-01-01', '2021-03-15'); INSERT INTO programs VALUES (2, 'Budgeting Basics', '2021-02-01', '2021-02-28'); INSERT INTO programs VALUES (3, 'Retirement Planning', '2... | How many financial wellbeing programs have been added or updated in the last month? | SELECT COUNT(*) FROM programs WHERE date_added >= DATEADD(month, -1, GETDATE()) OR date_updated >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE broadband_services (service_id INT, region VARCHAR(255), revenue DECIMAL(10,2)); INSERT INTO broadband_services (service_id, region, revenue) VALUES (1, 'North', 5000), (2, 'South', 7000); | What is the total revenue from broadband services for each region? | SELECT region, SUM(revenue) FROM broadband_services GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transactions (TransactionID int, DAppName varchar(50), Transactions int); INSERT INTO Transactions (TransactionID, DAppName, Transactions) VALUES (1, 'DApp1', 100), (2, 'DApp2', 200), (3, 'DApp3', 300); | List the decentralized applications that have the lowest and highest number of transactions, in ascending order. | SELECT DAppName, MIN(Transactions) as MinTransactions, MAX(Transactions) as MaxTransactions FROM Transactions GROUP BY DAppName ORDER BY MinTransactions, MaxTransactions; | gretelai_synthetic_text_to_sql |
CREATE TABLE MakeupPackaging (product_id INT, product_name VARCHAR(100), packaging_material VARCHAR(50), recyclable BOOLEAN, country VARCHAR(50)); INSERT INTO MakeupPackaging VALUES (501, 'Lipstick', 'Plastic', FALSE, 'Canada'), (502, 'Eyeshadow Palette', 'Cardboard', TRUE, 'Canada'), (503, 'Mascara', 'Glass', TRUE, 'U... | List all makeup products with recyclable packaging sold in Canada. | SELECT product_id, product_name FROM MakeupPackaging WHERE country = 'Canada' AND recyclable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, username TEXT, email TEXT, created_at DATETIME); CREATE TABLE posts (id INT, user_id INT, content TEXT, likes INT, shares INT, created_at DATETIME); INSERT INTO users (id, username, email, created_at) VALUES (1, 'jane123', '[jane@gmail.com](mailto:jane@gmail.com)', '2021-01-01 10:00:00'), (2... | Count the number of unique users from the "users" table who have posted content related to "plant-based diets" in the "social_media" schema. | SELECT COUNT(DISTINCT users.id) FROM users JOIN posts ON users.id = posts.user_id WHERE posts.content LIKE '%plant-based%' AND schema='social_media'; | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (content_id INTEGER, genre VARCHAR(100)); INSERT INTO genres (content_id, genre) VALUES (1, 'Action'), (1, 'Adventure'), (2, 'Drama'), (2, 'Comedy'), (3, 'Documentary'), (3, 'History'), (4, 'Sci-Fi'), (4, 'Fantasy'); | What is the distribution of media content genres? | SELECT genre, COUNT(*) FROM genres GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE Industrial (id INT, household_id INT, daily_consumption DECIMAL(5,2)); INSERT INTO Industrial (id, household_id, daily_consumption) VALUES (1, 201, 250.50), (2, 202, 300.20), (3, 203, 220.85), (4, 204, 180.33), (5, 205, 290.11), (6, 206, 195.44), (7, 207, 350.76), (8, 208, 270.99), (9, 209, 215.60), (10, 2... | What is the maximum daily water consumption for the top 10 water-consuming households in the 'Industrial' district? | SELECT MAX(daily_consumption) FROM (SELECT daily_consumption FROM Industrial WHERE district = 'Industrial' ORDER BY daily_consumption DESC LIMIT 10) AS top_10_households; | gretelai_synthetic_text_to_sql |
CREATE TABLE routes (route_id INT, name VARCHAR(255), type VARCHAR(255)); | Create a table named 'routes' with columns 'route_id', 'name', 'type' | CREATE TABLE routes (route_id INT, name VARCHAR(255), type VARCHAR(255)); | gretelai_synthetic_text_to_sql |
CREATE TABLE time_spent (visitor_id INT, city VARCHAR(10), time_minutes INT); INSERT INTO time_spent (visitor_id, city, time_minutes) VALUES (1, 'CityA', 60), (2, 'CityB', 90); | What was the total time spent by visitors from a specific city? | SELECT city, SUM(time_minutes) AS total_time_minutes FROM time_spent GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Assistive_Technology (Student_ID INT, Student_Name TEXT, Disability_Type TEXT, Assistive_Tech_Item TEXT); INSERT INTO Assistive_Technology (Student_ID, Student_Name, Disability_Type, Assistive_Tech_Item) VALUES (1, 'John Doe', 'Visual Impairment', 'Screen Reader'), (2, 'Jane Smith', 'Hearing Impairment', '... | What is the total number of assistive technology items provided to students with hearing impairments? | SELECT SUM(CASE WHEN Disability_Type = 'Hearing Impairment' THEN 1 ELSE 0 END) FROM Assistive_Technology WHERE Assistive_Tech_Item IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_engagement (id INT PRIMARY KEY, name TEXT, location TEXT, date DATE); | Update the name of the community engagement event in 'Russia' with id 3 | UPDATE community_engagement SET name = 'Maslenitsa' WHERE id = 3 AND location = 'Russia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shelters (shelter_id INT, shelter_name VARCHAR(255), location VARCHAR(255), sector VARCHAR(255)); INSERT INTO shelters (shelter_id, shelter_name, location, sector) VALUES (1, 'Shelter A', 'City A', 'Education'); | What is the number of shelters and their types for each sector in 'disaster_response' schema? | SELECT sector, COUNT(shelter_id) as total_shelters, sector as shelter_type FROM shelters GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability_programs (id INT, program_name VARCHAR(255), country VARCHAR(255), launch_date DATE); INSERT INTO financial_capability_programs (id, program_name, country, launch_date) VALUES (1, 'Financial Literacy 101', 'Nigeria', '2018-01-01'), (2, 'Money Management for Youth', 'South Africa', '201... | Determine the number of financial capability programs in Africa that were launched in the last 5 years. | SELECT COUNT(*) FROM financial_capability_programs WHERE country = 'Africa' AND launch_date >= DATEADD(year, -5, CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE container_ships (ship_id INT, ship_name VARCHAR(255), ship_builder VARCHAR(255), year INT, cargo_weight INT);INSERT INTO container_ships (ship_id, ship_name, ship_builder, year, cargo_weight) VALUES (1, 'Ever Given', 'Baosteel', 2010, 210000), (2, 'CMA CGM Marco Polo', 'Daewoo Shipbuilding & Marine Enginee... | What is the total cargo weight handled by container ships built before 2010, grouped by ship builder? | SELECT ship_builder, SUM(cargo_weight) FROM container_ships WHERE year < 2010 GROUP BY ship_builder; | gretelai_synthetic_text_to_sql |
CREATE TABLE property_prices (property_id INT, city VARCHAR(50), price INT); CREATE TABLE inclusive_housing (property_id INT, inclusive_scheme BOOLEAN); INSERT INTO property_prices (property_id, city, price) VALUES (1, 'Chicago', 600000), (2, 'Portland', 400000), (3, 'Chicago', 700000), (4, 'Seattle', 800000); INSERT I... | Calculate the total price of all properties in an inclusive housing scheme in Chicago. | SELECT SUM(price) FROM property_prices p JOIN inclusive_housing i ON p.property_id = i.property_id WHERE p.city = 'Chicago'; | gretelai_synthetic_text_to_sql |
CREATE TABLE property (id INT, size INT, state VARCHAR(20), co_owned BOOLEAN); | What is the total number of co-owned properties in the state of New York with an average size of over 1500 square feet? | SELECT COUNT(*) FROM property WHERE state = 'New York' AND co_owned = TRUE GROUP BY co_owned HAVING AVG(size) > 1500; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_strategies (strategy_id INT, strategy_name VARCHAR(50), client_id INT); INSERT INTO investment_strategies (strategy_id, strategy_name, client_id) VALUES (1, 'Equity', 1), (2, 'Fixed Income', 2), (3, 'Real Estate', 3), (4, 'Equity', 1), (5, 'Fixed Income', 2); | What is the total number of clients for each investment strategy? | SELECT strategy_name, COUNT(DISTINCT client_id) AS total_clients FROM investment_strategies GROUP BY strategy_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE DisasterPreparedness (id INT, city VARCHAR(255), preparedness_score INT); | What is the maximum preparedness score for each city? | SELECT city, MAX(preparedness_score) FROM DisasterPreparedness GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists ingredient (id INT PRIMARY KEY, name TEXT, natural BOOLEAN); INSERT INTO ingredient (id, name, natural) VALUES (2, 'Glycerin', true); CREATE TABLE if not exists product_ingredient (product_id INT, ingredient_id INT); INSERT INTO product_ingredient (product_id, ingredient_id) VALUES (2, 2); CR... | Which products contain a specific ingredient? | SELECT product.name FROM product JOIN product_ingredient ON product.id = product_ingredient.product_id JOIN ingredient ON product_ingredient.ingredient_id = ingredient.id WHERE ingredient.name = 'Glycerin'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_id INT, amount DECIMAL); INSERT INTO donations (id, donor_id, amount) VALUES (1, 1, 150.00), (2, 2, 75.00), (3, 1, 250.00), (4, 3, 120.00); CREATE TABLE donors (id INT, name TEXT, region TEXT); INSERT INTO donors (id, name, region) VALUES (1, 'Hanin', 'Middle East'), (2, 'Oliver', ... | What is the average donation amount by donors from the Middle East? | SELECT AVG(donations.amount) FROM donations INNER JOIN donors ON donations.donor_id = donors.id WHERE donors.region = 'Middle East'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer (id INT PRIMARY KEY, name VARCHAR(50), loyalty_score INT); INSERT INTO customer (id, name, loyalty_score) VALUES (1, 'Bob', 75), (2, 'Alice', 90); | Insert new record into 'customer' table for 'Cindy' with 'loyalty_score' of 85 | INSERT INTO customer (name, loyalty_score) VALUES ('Cindy', 85); | gretelai_synthetic_text_to_sql |
CREATE TABLE texas_schools (name TEXT, type TEXT); INSERT INTO texas_schools (name, type) VALUES ('Houston ISD', 'Public School'), ('University of Texas at Austin', 'University'); | What is the total number of public schools and universities in Texas? | SELECT COUNT(*) FROM (SELECT name FROM texas_schools WHERE type = 'Public School' UNION SELECT name FROM texas_schools WHERE type = 'University') AS schools; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_projects (id INT, project_name VARCHAR(50), location VARCHAR(50), budget INT); INSERT INTO ai_projects (id, project_name, location, budget) VALUES (1, 'AI for Agriculture', 'Kenya', 100000), (2, 'AI for Healthcare', 'Nigeria', 200000), (3, 'AI for Education', 'South Africa', 150000); | What is the average budget for AI projects in Africa? | SELECT AVG(budget) FROM ai_projects WHERE location = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE region_rainfall (region TEXT, date DATE, rainfall INTEGER); | What is the maximum rainfall recorded for each region in the past year? | SELECT region, MAX(rainfall) as max_rainfall FROM region_rainfall WHERE date >= DATEADD(year, -1, GETDATE()) GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE debris(debris_id INT, name VARCHAR(50), country VARCHAR(50), launch_date DATE, origin BOOLEAN); INSERT INTO debris VALUES (1, 'Debris1', 'USA', '2000-01-01', true); INSERT INTO debris VALUES (2, 'Debris2', 'USA', '2001-01-01', false); INSERT INTO debris VALUES (3, 'Debris3', 'China', '2002-01-01', true); | List of countries with the highest number of satellites and their respective debris count? | SELECT s.country, COUNT(s.satellite_id) as satellite_count, COUNT(d.debris_id) as debris_count FROM satellites s FULL OUTER JOIN debris d ON s.country = d.country GROUP BY s.country ORDER BY satellite_count DESC, debris_count DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE creative_ai_apps (id INT, app_name VARCHAR(255), submission_date DATE, location VARCHAR(255)); | Identify the number of creative AI applications submitted from Asia in the last year. | SELECT location, COUNT(*) FROM creative_ai_apps WHERE submission_date >= DATEADD(year, -1, GETDATE()) AND location = 'Asia' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_storage (id INT, name TEXT, capacity FLOAT, region TEXT); | Insert a new energy storage system with id 4, name 'GHI Battery', capacity 4000 and region 'East'. | INSERT INTO energy_storage (id, name, capacity, region) VALUES (4, 'GHI Battery', 4000, 'East'); | gretelai_synthetic_text_to_sql |
CREATE TABLE market_share (market_share_id INT, drug_name VARCHAR(255), year INT, market_share DECIMAL(10,2)); INSERT INTO market_share (market_share_id, drug_name, year, market_share) VALUES (1, 'DrugA', 2020, 0.35), (2, 'DrugB', 2020, 0.28), (3, 'DrugC', 2020, 0.30), (4, 'DrugA', 2020, 0.33), (5, 'DrugB', 2020, 0.31)... | What is the total market share for each drug, ranked by the highest market share first, for the year 2020? | SELECT drug_name, SUM(market_share) as total_market_share FROM market_share WHERE year = 2020 GROUP BY drug_name ORDER BY total_market_share DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_revenue (region VARCHAR(50), revenue FLOAT); | What is the total revenue by region for mobile and broadband? | SELECT region, SUM(revenue) FROM (SELECT * FROM mobile_revenue UNION ALL SELECT * FROM broadband_revenue) GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE ad_revenue (id INT, content_type VARCHAR(50), revenue DECIMAL(10,2), date DATE); | What is the average daily revenue generated by advertising on video content for the month of June 2022? | SELECT AVG(revenue) as avg_daily_revenue FROM ad_revenue WHERE content_type = 'Video' AND date >= '2022-06-01' AND date <= '2022-06-30' GROUP BY EXTRACT(DAY FROM date); | gretelai_synthetic_text_to_sql |
CREATE TABLE soil_nutrients (sensor_id TEXT, field_id TEXT, nitrogen FLOAT, phosphorus FLOAT, potassium FLOAT); INSERT INTO soil_nutrients (sensor_id, field_id, nitrogen, phosphorus, potassium) VALUES ('Sensor 401', 'Field 4', 50.2, 30.1, 60.5), ('Sensor 402', 'Field 4', 51.0, 31.0, 61.0); | Show soil nutrient levels in field 4 | SELECT nitrogen, phosphorus, potassium FROM soil_nutrients WHERE field_id = 'Field 4'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Country VARCHAR(50)); INSERT INTO Players (PlayerID, Age, Country) VALUES (1, 22, 'Brazil'), (2, 30, 'Canada'), (3, 25, 'China'), (4, 19, 'India'); CREATE TABLE GameLibrary (GameID INT, GameName VARCHAR(50), GameType VARCHAR(50), Category VARCHAR(50)); INSERT INTO GameLibrar... | What is the minimum age of players who play games in the 'Strategy' category? | SELECT MIN(Players.Age) FROM Players JOIN PlayerGameLibrary ON Players.PlayerID = PlayerGameLibrary.PlayerID JOIN GameLibrary ON PlayerGameLibrary.GameID = GameLibrary.GameID WHERE GameLibrary.Category = 'Strategy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_biomass (species TEXT, population REAL, biomass REAL); INSERT INTO fish_biomass (species, population, biomass) VALUES ('Cod', 10000, 200000), ('Herring', 20000, 300000); | What is the total biomass of fish in the Barents Sea? | SELECT SUM(biomass) FROM fish_biomass WHERE species IN ('Cod', 'Herring', 'Capelin'); | gretelai_synthetic_text_to_sql |
CREATE TABLE platforms (platform_id INT, region VARCHAR(50)); INSERT INTO platforms (platform_id, region) VALUES (1, 'Gulf of Mexico'), (2, 'North Sea'), (3, 'South China Sea'), (4, 'Gulf of Mexico'); | Find the number of platforms in each region | SELECT region, COUNT(platform_id) as num_platforms FROM platforms GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE JobApplicants (ApplicantID int, JobCategory varchar(50), JobLocation varchar(50), ApplicantType varchar(50)); INSERT INTO JobApplicants (ApplicantID, JobCategory, JobLocation, ApplicantType) VALUES (1, 'Software Engineer', 'California', 'Veteran'), (2, 'Project Manager', 'California', 'Non-Veteran'), (3, '... | What is the number of veteran job applicants and hires for each job category in the state of California? | SELECT JobCategory, COUNT(*) FILTER (WHERE ApplicantType = 'Veteran') as VeteranApplicants, COUNT(*) FILTER (WHERE ApplicantType = 'Non-Veteran') as NonVeteranApplicants, COUNT(*) as TotalApplicants FROM JobApplicants WHERE JobLocation = 'California' GROUP BY JobCategory; | gretelai_synthetic_text_to_sql |
CREATE TABLE clothing_brands (id INT PRIMARY KEY, brand VARCHAR(50), items_produced INT, recycled_materials_percentage FLOAT); INSERT INTO clothing_brands (id, brand, items_produced, recycled_materials_percentage) VALUES (1, 'Brand A', 100000, 50.00), (2, 'Brand B', 150000, 30.00), (3, 'Brand C', 80000, 70.00), (4, 'Br... | List the top 5 clothing brands by the quantity of items produced using recycled materials. | SELECT brand, items_produced FROM clothing_brands WHERE recycled_materials_percentage >= 50 ORDER BY items_produced DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (id INT, name VARCHAR, timestamp TIMESTAMP); INSERT INTO smart_contracts (id, name, timestamp) VALUES (1, 'SC1', '2022-01-01 10:00:00'), (2, 'SC2', '2022-01-02 11:00:00'), (3, 'SC3', '2022-01-03 12:00:00'), (4, 'SC4', '2022-01-04 13:00:00'); | Delete the smart contract record with the ID 3 and update the timestamp of the record with ID 4 to the current time. | DELETE FROM smart_contracts WHERE id = 3; UPDATE smart_contracts SET timestamp = CURRENT_TIMESTAMP WHERE id = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE farmers (id INT, name VARCHAR(50), country VARCHAR(50), experience INT); INSERT INTO farmers (id, name, country, experience) VALUES (1, 'John Doe', 'US', 10), (2, 'Jane Smith', 'US', 15), (3, 'Pierre Dupont', 'France', 5), (4, 'Ana Sousa', 'Portugal', 8), (5, 'Hiroshi Tanaka', 'Japan', 12); | What is the average experience of farmers per country? | SELECT country, AVG(experience) as avg_experience FROM farmers GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE flights (id INT, airline VARCHAR(255), safety_issue BOOLEAN); INSERT INTO flights (id, airline, safety_issue) VALUES (1, 'UniversalAirlines', true), (2, 'UniversalAirlines', false), (3, 'Intergalactic', true), (4, 'UniversalAirlines', false), (5, 'Intergalactic', false); | What is the percentage of flights operated by 'UniversalAirlines' that had safety issues? | SELECT 100.0 * COUNT(*) FILTER (WHERE safety_issue = true) / COUNT(*) as percentage FROM flights WHERE airline = 'UniversalAirlines'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name TEXT, location TEXT, gluten_free BOOLEAN); INSERT INTO restaurants (id, name, location, gluten_free) VALUES (1, 'Restaurant A', 'New York', true); INSERT INTO restaurants (id, name, location, gluten_free) VALUES (2, 'Restaurant B', 'California', false); INSERT INTO restaurants (id... | How many restaurants in New York offer gluten-free options on their menu? | SELECT COUNT(*) FROM restaurants WHERE location = 'New York' AND gluten_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE textile_workers (id INT, name VARCHAR(50), gender VARCHAR(10), salary FLOAT); INSERT INTO textile_workers (id, name, gender, salary) VALUES (1, 'John Doe', 'Male', 45000.0), (2, 'Jane Doe', 'Female', 42000.0); | What is the average salary of workers in the textile industry by gender? | SELECT gender, AVG(salary) FROM textile_workers GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vehicle_History (id INT, make VARCHAR(50), model VARCHAR(50), safety_rating FLOAT, manufacturing_country VARCHAR(50), year INT); INSERT INTO Vehicle_History (id, make, model, safety_rating, manufacturing_country, year) VALUES (1, 'Hyundai', 'Sonata', 5.1, 'South Korea', 2018); INSERT INTO Vehicle_History (... | What is the safety rating trend over time for vehicles manufactured in South Korea? | SELECT manufacturing_country, year, safety_rating FROM Vehicle_History WHERE manufacturing_country = 'South Korea' ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Students (Id INT, Name VARCHAR(100), DisabilityType VARCHAR(50)); CREATE TABLE Accommodations (Id INT, StudentId INT, AccommodationType VARCHAR(50), DateProvided DATETIME); INSERT INTO Students (Id, Name, DisabilityType) VALUES (1, 'John Doe', 'Visual Impairment'); INSERT INTO Accommodations (Id, StudentId... | How many students with visual impairments received accommodations in 2020? | SELECT COUNT(*) FROM Students JOIN Accommodations ON Students.Id = Accommodations.StudentId WHERE Students.DisabilityType = 'Visual Impairment' AND YEAR(Accommodations.DateProvided) = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE geostationary_satellites (id INT, name VARCHAR(50), type VARCHAR(50), altitude FLOAT); | What is the minimum and maximum altitude (in km) of all geostationary satellites? | SELECT MIN(altitude), MAX(altitude) FROM geostationary_satellites WHERE type = 'Geostationary'; | gretelai_synthetic_text_to_sql |
CREATE TABLE nail_polish_sales(product_id INT, sale_price FLOAT); INSERT INTO nail_polish_sales(product_id, sale_price) VALUES (1, 9.99); INSERT INTO nail_polish_sales(product_id, sale_price) VALUES (2, 10.99); CREATE TABLE product_info(product_id INT, is_vegan BOOLEAN); INSERT INTO product_info(product_id, is_vegan) V... | Update the price of all vegan nail polishes to $12.99 | UPDATE nail_polish_sales SET sale_price = 12.99 FROM nail_polish_sales INNER JOIN product_info ON nail_polish_sales.product_id = product_info.product_id INNER JOIN product_categories ON nail_polish_sales.product_id = product_categories.product_id WHERE product_info.is_vegan = TRUE AND product_categories.category_name =... | gretelai_synthetic_text_to_sql |
CREATE TABLE Game_Design (id INT PRIMARY KEY, game_id INT, genre VARCHAR(255), release_year INT, developer VARCHAR(255)); | Insert data into 'Game_Design' for game with ID 1001 | INSERT INTO Game_Design (id, game_id, genre, release_year, developer) VALUES (1, 1001, 'RPG', 2018, 'CompanyA'); | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (song_id INT, song VARCHAR(50), genre VARCHAR(10), duration FLOAT, country VARCHAR(50)); INSERT INTO songs VALUES (1, 'Despacito', 'Reggaeton', 320.5, 'Puerto Rico'), (2, 'Gasolina', 'Reggaeton', 285.6, 'Dominican Republic'), (3, 'Bailando', 'Reggaeton', 302.3, 'Cuba'); | Which countries have the highest and lowest average song duration in the 'Reggaeton' genre? | SELECT s.country, AVG(s.duration) as avg_duration FROM songs s WHERE s.genre = 'Reggaeton' GROUP BY s.country ORDER BY avg_duration DESC, s.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites(id INT, name VARCHAR(255), launch_date DATE, launch_site VARCHAR(255), country VARCHAR(255)); INSERT INTO satellites VALUES (1, 'Beidou-1A', '1990-10-31', 'Xichang', 'China'); INSERT INTO satellites VALUES (2, 'Beidou-1B', '1990-11-15', 'Xichang', 'China'); INSERT INTO satellites VALUES (3, 'Bei... | How many satellites have been launched by China by the end of 2025? | SELECT COUNT(*) FROM satellites WHERE country = 'China' AND launch_date <= '2025-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (patient_id INT, age INT, diagnosis VARCHAR(50), location VARCHAR(20)); INSERT INTO patient (patient_id, age, diagnosis, location) VALUES (1, 45, 'Heart Disease', 'Rural Florida'); INSERT INTO patient (patient_id, age, diagnosis, location) VALUES (2, 55, 'Heart Disease', 'Rural Florida'); INSERT IN... | What is the most common age range of patients diagnosed with heart disease in rural areas of Florida? | SELECT CASE WHEN age BETWEEN 20 AND 40 THEN '20-40' WHEN age BETWEEN 41 AND 60 THEN '41-60' WHEN age > 60 THEN '>60' END AS age_range, COUNT(*) FROM patient WHERE diagnosis = 'Heart Disease' AND location = 'Rural Florida' GROUP BY age_range; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospital_beds (id INT, hospital_name TEXT, location TEXT, total_beds INT, icu_beds INT, isolation_beds INT); INSERT INTO hospital_beds (id, hospital_name, location, total_beds, icu_beds, isolation_beds) VALUES (1, 'NY Presbyterian', 'NYC', 1000, 200, 150); INSERT INTO hospital_beds (id, hospital_name, loca... | What percentage of total hospital beds are ICU beds? | SELECT location, (SUM(icu_beds) * 100.0 / SUM(total_beds)) as icu_percentage FROM hospital_beds GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Faculty (FacultyID int, Name varchar(50), ResearchInterest varchar(50)); INSERT INTO Faculty (FacultyID, Name, ResearchInterest) VALUES (1, 'John Smith', 'Machine Learning'); INSERT INTO Faculty (FacultyID, Name, ResearchInterest) VALUES (2, 'Jane Doe', 'Data Science'); CREATE TABLE Grants (GrantID int, Fa... | What are the names and research interests of faculty members who have not received any grants? | SELECT Faculty.Name, Faculty.ResearchInterest FROM Faculty LEFT JOIN Grants ON Faculty.FacultyID = Grants.FacultyID WHERE Grants.FacultyID IS NULL; | 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.