context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE products (id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(5,2), cruelty_free BOOLEAN); INSERT INTO products (id, name, category, price, cruelty_free) VALUES (1, 'Lipstick', 'makeup', 12.99, true), (2, 'Mascara', 'makeup', 14.99, true), (3, 'Eyeshadow', 'makeup', 9.99, false); | What is the total revenue of all cruelty-free products in the 'makeup' category? | SELECT SUM(price) FROM products WHERE category = 'makeup' AND cruelty_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE DepartmentVulnerabilities (id INT, department VARCHAR(255), vulnerability_risk VARCHAR(255), vulnerability_date DATE); | How many high-risk vulnerabilities were found in the finance department in the last week? | SELECT COUNT(*) as high_risk_count FROM DepartmentVulnerabilities WHERE department = 'finance' AND vulnerability_risk = 'high' AND vulnerability_date >= DATEADD(week, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE ads (ad_id INT, user_id INT, country VARCHAR(50)); INSERT INTO ads (ad_id, user_id, country) VALUES (1, 101, 'USA'), (2, 102, 'Canada'), (3, 101, 'USA'), (4, 103, 'Canada'); | What is the total number of ads served to users in the United States and Canada, excluding duplicates? | SELECT COUNT(DISTINCT ad_id) FROM ads WHERE country IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_id INT, exhibition_name VARCHAR(50), start_date DATE, end_date DATE); | Insert a new record for an exhibition 'African Art' starting from 2024-01-01 until 2024-12-31. | INSERT INTO Exhibitions (exhibition_id, exhibition_name, start_date, end_date) VALUES (4, 'African Art', '2024-01-01', '2024-12-31'); | gretelai_synthetic_text_to_sql |
CREATE TABLE UnionActivities (id INT, union_member_id INT, activity_type VARCHAR, duration INT); CREATE TABLE UnionMembers (id INT, name VARCHAR, state VARCHAR, union_member BOOLEAN); | Which union activities in Washington have the highest average duration? | SELECT ua.activity_type, AVG(ua.duration) as avg_duration FROM UnionActivities ua JOIN UnionMembers um ON ua.union_member_id = um.id WHERE um.state = 'Washington' GROUP BY ua.activity_type ORDER BY avg_duration DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE public.fire_calls (id SERIAL PRIMARY KEY, city VARCHAR(255), response_time INTEGER); INSERT INTO public.fire_calls (city, response_time) VALUES ('New York', 120), ('New York', 150), ('New York', 90); | What is the average response time for fire calls in the city of New York? | SELECT AVG(response_time) FROM public.fire_calls WHERE city = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerGames (PlayerID INT, GameDate DATE, GamesPlayed INT); INSERT INTO PlayerGames (PlayerID, GameDate, GamesPlayed) VALUES (1, '2022-01-01', 3); INSERT INTO PlayerGames (PlayerID, GameDate, GamesPlayed) VALUES (1, '2022-01-02', 5); INSERT INTO PlayerGames (PlayerID, GameDate, GamesPlayed) VALUES (2, '202... | What is the maximum number of games played in a single day by any player in the database? | SELECT MAX(GamesPlayed) FROM PlayerGames; | gretelai_synthetic_text_to_sql |
CREATE TABLE CoOwnership (id INT, property_id INT, owner_name VARCHAR(50), ownership_percentage FLOAT, state VARCHAR(2)); | Summarize the number of co-ownership records for properties in California with more than one owner. | SELECT property_id, COUNT(DISTINCT owner_name) as num_owners FROM CoOwnership WHERE state = 'CA' GROUP BY property_id HAVING num_owners > 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO customers (customer_id, name, region) VALUES (1, 'Elias Abubakar', 'Africa'); INSERT INTO customers (customer_id, name, region) VALUES (2, 'Grace Mwangi', 'Europe'); CREATE TABLE transactions (transaction_id INT, customer_id INT... | List all transactions and customers from the 'Africa' region. | SELECT customers.name, transactions.transaction_id, transactions.transaction_value FROM customers JOIN transactions ON customers.customer_id = transactions.customer_id WHERE customers.region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS ai_feedback (algorithm_name TEXT, user_feedback TEXT, rating INTEGER); INSERT INTO ai_feedback (algorithm_name, user_feedback, rating) VALUES ('Algorithm T', 'Feedback 1', 4), ('Algorithm U', 'Feedback 2', 5), ('Algorithm V', 'Feedback 3', 5), ('Algorithm W', 'Feedback 4', 4); | What is the average rating of algorithms 'V' and 'W'? | SELECT AVG(rating) as avg_rating FROM ai_feedback WHERE algorithm_name IN ('Algorithm V', 'Algorithm W'); | gretelai_synthetic_text_to_sql |
contracts(contract_id, vendor_id, title, description, value, date_signed) | Delete all contracts from the 'contracts' table that have a value higher than $10000000 | DELETE FROM contracts WHERE value > 10000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE IntelligenceOperations(id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), location VARCHAR(50), year INT);INSERT INTO IntelligenceOperations(id, name, type, location, year) VALUES (1, 'Operation Red Sparrow', 'Cyber', 'Asia', 2013), (2, 'Operation Black Thunder', 'Military', 'Asia', 2012), (3, 'Operat... | What is the number of intelligence operations conducted in Africa between 2010 and 2015? | SELECT COUNT(*) FROM IntelligenceOperations WHERE location = 'Africa' AND year BETWEEN 2010 AND 2015; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessels (region TEXT, year INT, registered BOOLEAN); INSERT INTO vessels (region, year, registered) VALUES ('Indian Ocean', 2019, TRUE), ('Indian Ocean', 2020, TRUE); | How many vessels were registered in the Indian Ocean in the year 2020? | SELECT COUNT(*) FROM vessels WHERE region = 'Indian Ocean' AND year = 2020 AND registered = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, attorney TEXT, won BOOLEAN); INSERT INTO cases (id, attorney, won) VALUES (1, 'Davis', FALSE), (2, 'Davis', FALSE), (3, 'Davis', TRUE); INSERT INTO cases (id, attorney, won) VALUES (4, 'Evans', FALSE), (5, 'Evans', FALSE), (6, 'Evans', FALSE); | How many cases were lost by attorneys in the 'family' department? | SELECT COUNT(*) FROM cases WHERE attorney IN ('Davis', 'Evans') AND won = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE brand_skincare_sales (brand VARCHAR(20), revenue DECIMAL(10,2)); INSERT INTO brand_skincare_sales (brand, revenue) VALUES ('BrandD', 13000), ('BrandD', 14000), ('BrandE', 15000), ('BrandE', 16000), ('BrandF', 12000); | Show the total revenue for each brand that sells skincare products. | SELECT brand, SUM(revenue) FROM brand_skincare_sales GROUP BY brand; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT, username VARCHAR(50), last_login TIMESTAMP); CREATE TABLE games (id INT, title VARCHAR(50)); CREATE TABLE gaming.user_games (user_id INT, game_id INT, play_date TIMESTAMP); | Delete players who haven't played a game in the last 6 months in the 'gaming' schema. | DELETE FROM users WHERE id NOT IN (SELECT user_id FROM gaming.user_games JOIN users ON gaming.user_games.user_id = users.id WHERE gaming.user_games.play_date >= DATE_SUB(NOW(), INTERVAL 6 MONTH)); | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, curator VARCHAR(50), title VARCHAR(100), location VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO Exhibitions (id, curator, title, location, start_date, end_date) VALUES (1, 'Mavis B. Fillmore', 'Post-Impressionist Masters', 'Paris', '2022-02-15', '2022-05-31'); | Delete all exhibitions by 'Mavis B. Fillmore'. | DELETE FROM Exhibitions WHERE curator = 'Mavis B. Fillmore'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels (hotel_id INT, name TEXT, city TEXT, rating FLOAT); | Insert a new eco-friendly hotel in Rome with a rating of 4.7 | INSERT INTO eco_hotels (name, city, rating) VALUES ('New Eco Hotel Rome', 'Rome', 4.7); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(255), sector VARCHAR(255), ESG_score FLOAT); INSERT INTO companies (id, name, sector, ESG_score) VALUES (1, 'CareMed', 'Healthcare', 92.0); INSERT INTO companies (id, name, sector, ESG_score) VALUES (2, 'HealthTech', 'Healthcare', 89.5); INSERT INTO companies (id, name, sect... | List the top 5 most socially responsible companies based on ESG scores in the Healthcare sector. | SELECT * FROM (SELECT name, ESG_score, ROW_NUMBER() OVER (ORDER BY ESG_score DESC) as rn FROM companies WHERE sector = 'Healthcare') t WHERE rn <= 5; | gretelai_synthetic_text_to_sql |
CREATE VIEW Projects_Southeast AS SELECT project_id, project_name, project_type, location, start_date FROM Water_Infrastructure WHERE region = 'Southeast'; | List the names, types, and start dates of all projects in the Southeast region in the Projects_Southeast view | SELECT project_name, project_type, start_date FROM Projects_Southeast; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation (year INT, continent VARCHAR(50), initiative VARCHAR(50), amount FLOAT); INSERT INTO climate_mitigation (year, continent, initiative, amount) VALUES (2018, 'Europe', 'Mitigation Initiative 1', 300000); | What are the total funding amounts for climate mitigation initiatives in each continent in 2018? | SELECT continent, SUM(amount) FROM climate_mitigation WHERE year = 2018 AND initiative = 'climate mitigation' GROUP BY continent; | gretelai_synthetic_text_to_sql |
CREATE TABLE TreeHarvest (species_id INT, region_id INT, volume INT); INSERT INTO TreeHarvest (species_id, region_id, volume) VALUES (1, 1, 150), (2, 2, 200), (3, 3, 180), (1, 4, 220), (2, 1, 160), (3, 2, 210), (4, 3, 190), (1, 5, 250); | What is the total volume of timber harvested by each tree species in Brazil? | SELECT Th.species_id, SUM(Th.volume) as total_volume FROM TreeHarvest Th WHERE Th.region_id = 5 GROUP BY Th.species_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE workout_groups (id INT, user_id INT, group_label VARCHAR(10)); INSERT INTO workout_groups (id, user_id, group_label) VALUES (1, 21, 'Beginner'); INSERT INTO workout_groups (id, user_id, group_label) VALUES (2, 22, 'Intermediate'); INSERT INTO workout_groups (id, user_id, group_label) VALUES (3, 23, 'Elite'... | What is the total weight lifted by users in the 'Elite' workout group who lifted more than 150 pounds in a single session? | SELECT SUM(weight) FROM weights JOIN workout_groups ON weights.workout_group_id = workout_groups.id WHERE group_label = 'Elite' AND weight > 150; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (id INT, name VARCHAR(255), gender VARCHAR(10), department VARCHAR(255)); INSERT INTO students (id, name, gender, department) VALUES (1, 'Alice', 'Female', 'Physics'), (2, 'Bob', 'Male', 'Mathematics'), (3, 'Charlie', 'Male', 'Chemistry'), (4, 'Diana', 'Female', 'Biology'); CREATE TABLE department... | How many female graduate students are there in the 'students' and 'departments' tables, grouped by department? | SELECT d.name, COUNT(s.id) FROM students s JOIN departments d ON s.department = d.name WHERE s.gender = 'Female' AND d.type = 'Graduate' GROUP BY d.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE dams (id INT PRIMARY KEY, name VARCHAR(255), height INT, reservoir VARCHAR(255), built_year INT); INSERT INTO dams (id, name, height, reservoir, built_year) VALUES (1, 'DamP', 50, 'LakeA', 1940), (2, 'DamQ', 75, 'LakeB', 1975), (3, 'DamR', 60, 'LakeA', 2000); | Count of dams built after 1990? | SELECT COUNT(*) as dam_count FROM dams WHERE built_year > 1990; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability (id INT, loan_type VARCHAR(255), amount DECIMAL(10,2), country VARCHAR(255)); | What is the total amount of loans issued for financial capability programs in Germany? | SELECT SUM(amount) FROM financial_capability WHERE loan_type = 'financial capability' AND country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_calls (id INT, city VARCHAR(20), response_time INT); | What is the average response time for emergency calls in 'Mumbai'? | SELECT AVG(response_time) FROM emergency_calls WHERE city = 'Mumbai'; | gretelai_synthetic_text_to_sql |
CREATE TABLE deliveries (id INT, warehouse_state VARCHAR(20), pallets INT, delivery_date DATE); INSERT INTO deliveries (id, warehouse_state, pallets, delivery_date) VALUES (1, 'California', 25, '2022-01-16'), (2, 'California', 32, '2022-01-30'); | How many pallets were delivered to California warehouses between January 15 and January 31, 2022? | SELECT COUNT(pallets) FROM deliveries WHERE warehouse_state = 'California' AND delivery_date BETWEEN '2022-01-15' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Neighborhoods (NeighborhoodID INT, NeighborhoodName VARCHAR(255)); CREATE TABLE Properties (PropertyID INT, PropertyTax FLOAT, NeighborhoodID INT); INSERT INTO Neighborhoods VALUES (1, 'Central Park'); INSERT INTO Properties VALUES (1, 6000, 1); | What is the count of properties in each neighborhood with a property tax greater than $5000? | SELECT NeighborhoodName, COUNT(*) FROM Properties p JOIN Neighborhoods n ON p.NeighborhoodID = n.NeighborhoodID WHERE p.PropertyTax > 5000 GROUP BY NeighborhoodName; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policy (PolicyID INT, PolicyType VARCHAR(50)); INSERT INTO Policy VALUES (1, 'Auto'), (2, 'Home'), (3, 'Life'), (4, 'Travel'), (5, 'Renters'); CREATE TABLE Claims (ClaimID INT, PolicyID INT, ClaimDate DATE, ClaimAmount DECIMAL(10,2)); INSERT INTO Claims VALUES (1, 1, '2021-01-01', 500.00), (2, 1, '2021-02-... | What is the maximum claim amount for policy type 'Auto' in the past 12 months? | SELECT MAX(ClaimAmount) as MaxClaimAmount FROM Policy p INNER JOIN Claims c ON p.PolicyID = c.PolicyID WHERE p.PolicyType = 'Auto' AND c.ClaimDate > DATE_SUB(CURDATE(), INTERVAL 12 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE contract_usage (contract_address TEXT, gas_used INTEGER, timestamp TIMESTAMP); INSERT INTO contract_usage (contract_address, gas_used, timestamp) VALUES ('0x1234567890abcdef', 25000, '2022-01-01 12:34:56'); INSERT INTO contract_usage (contract_address, gas_used, timestamp) VALUES ('0x9876543210fedcba', 300... | Who are the top 3 smart contracts with the highest gas usage in the past month? | SELECT contract_address, SUM(gas_used) as total_gas_used FROM contract_usage WHERE timestamp >= (SELECT timestamp FROM contract_usage ORDER BY timestamp DESC LIMIT 1) - INTERVAL '1 month' GROUP BY contract_address ORDER BY total_gas_used DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE restorative_justice_outcomes (outcome_id INT, program_id INT, success BOOLEAN); INSERT INTO restorative_justice_outcomes (outcome_id, program_id, success) VALUES (1, 1001, TRUE), (2, 1002, FALSE); | What is the percentage of restorative justice programs in Texas that were successful? | SELECT 100.0 * SUM(success) / COUNT(*) FROM restorative_justice_outcomes WHERE state = 'TX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offsets (id INT, project_id INT, carbon_offsets_in_tonnes INT, year INT); CREATE TABLE renewable_projects (id INT, project_name TEXT, location TEXT); | What is the total carbon offset generated by renewable energy projects in India in 2020? | SELECT SUM(carbon_offsets.carbon_offsets_in_tonnes) FROM carbon_offsets JOIN renewable_projects ON carbon_offsets.project_id = renewable_projects.id WHERE renewable_projects.location = 'India' AND carbon_offsets.year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetics_preferences (id INT, consumer_id INT, product_id INT, preference_score INT, country VARCHAR(255)); INSERT INTO cosmetics_preferences (id, consumer_id, product_id, preference_score, country) VALUES (1, 1, 1, 5, 'USA'); CREATE TABLE products (id INT, name VARCHAR(255), is_cruelty_free BOOLEAN); INS... | Which cruelty-free certified products are most preferred by consumers in the USA? | SELECT p.name, cp.preference_score FROM cosmetics_preferences cp INNER JOIN products p ON cp.product_id = p.id WHERE cp.country = 'USA' AND p.is_cruelty_free = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE researchers (id INT, name VARCHAR(50), department VARCHAR(50), grant_amount DECIMAL(10,2)); INSERT INTO researchers (id, name, department, grant_amount) VALUES (1, 'Alice', 'Computer Science', 50000.00), (2, 'Bob', 'Computer Science', 75000.00); | What is the average grant amount awarded to female researchers in the Computer Science department? | SELECT AVG(grant_amount) FROM researchers WHERE department = 'Computer Science' AND gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Restaurants (RestaurantID int, Name varchar(50)); INSERT INTO Restaurants (RestaurantID, Name) VALUES (1, 'Asian Fusion'), (2, 'Bistro Bella Vita'), (3, 'Cocina del Sol'); CREATE TABLE MenuItems (MenuItemID int, RestaurantID int, Name varchar(50), SustainableSource bit); INSERT INTO MenuItems (MenuItemID, ... | Calculate the percentage of menu items that are sustainably sourced, for each restaurant. | SELECT R.Name, AVG(CAST(SustainableSource AS float)) * 100 AS PercentageSustainable FROM Restaurants R JOIN MenuItems MI ON R.RestaurantID = MI.RestaurantID GROUP BY R.Name; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellite_database (id INT, name VARCHAR(50), type VARCHAR(50), orbit_type VARCHAR(50), country VARCHAR(50), launch_date DATE); | Show the number of satellites in the satellite_database table, grouped by their orbit_type and order by the count in ascending order | SELECT orbit_type, COUNT(*) as satellite_count FROM satellite_database GROUP BY orbit_type ORDER BY satellite_count ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE supply_chain (id INT, vendor VARCHAR(255), risk_score INT); | Delete all records from the "supply_chain" table with a risk score above 7 | DELETE FROM supply_chain WHERE risk_score > 7; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists wind_turbines (turbine_id integer, turbine_name varchar(255), turbine_location varchar(255), commissioning_date date, energy_production_mwh integer); INSERT INTO wind_turbines (turbine_id, turbine_name, turbine_location, commissioning_date, energy_production_mwh) VALUES (1, 'Turbine A', 'Aust... | What is the average energy production (in MWh) for wind turbines in Australia that were commissioned in 2018? | SELECT turbine_location, AVG(energy_production_mwh) as avg_production FROM wind_turbines WHERE turbine_location LIKE 'Australia%' AND commissioning_date BETWEEN '2018-01-01' AND '2018-12-31' GROUP BY turbine_location; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, open_date DATE, close_date DATE); INSERT INTO cases (case_id, open_date, close_date) VALUES (1, '2020-01-01', '2020-03-15'), (2, '2020-02-10', '2020-06-20'), (3, '2020-04-01', '2020-08-30'), (4, '2020-06-15', '2020-10-25'); | How many cases were opened and closed in each month of 2020? | SELECT EXTRACT(MONTH FROM open_date) as month, COUNT(*) as cases_opened FROM cases WHERE open_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY month; SELECT EXTRACT(MONTH FROM close_date) as month, COUNT(*) as cases_closed FROM cases WHERE close_date BETWEEN '2020-01-01' AND '2020-12-31' GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, user_name VARCHAR(255)); INSERT INTO users (user_id, user_name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Carol'), (4, 'David'), (5, 'Eve'); CREATE TABLE user_transactions (transaction_id INT, user_id INT, tx_time TIMESTAMP); INSERT INTO user_transactions (transaction_id, user_id) VALUES (1... | Who are the top 5 users with the highest number of transactions on the Binance Smart Chain? | SELECT user_name, COUNT(*) AS transactions FROM user_transactions JOIN users ON user_transactions.user_id = users.user_id GROUP BY user_name ORDER BY transactions DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityB_Vehicles (vehicle_id INT, vehicle_type VARCHAR(20), is_electric BOOLEAN); INSERT INTO CityB_Vehicles (vehicle_id, vehicle_type, is_electric) VALUES (1, 'Car', true), (2, 'Bike', false), (3, 'Car', true), (4, 'Bus', false); | How many electric vehicles are there in CityB? | SELECT COUNT(*) FROM CityB_Vehicles WHERE is_electric = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE ResearchInstitutes (id INT, name VARCHAR(50), species VARCHAR(50), population INT); INSERT INTO ResearchInstitutes (id, name, species, population) VALUES (1, 'Ocean Research Center', 'Dolphin', 1300), (2, 'Marine Life Institute', 'Shark', 1100); CREATE TABLE MarineSpecies (id INT, name VARCHAR(50), species... | What are the names of all marine species with a population over 1200 in the 'ResearchInstitutes' and 'MarineSpecies' tables? | SELECT R.species FROM ResearchInstitutes R WHERE R.population > 1200 INTERSECT SELECT M.species FROM MarineSpecies M WHERE M.population > 1200; | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (asset_id INT, name VARCHAR(20), sector VARCHAR(20)); | Insert a new digital asset 'BitInvest' with sector 'Investment' | INSERT INTO digital_assets (name, sector) VALUES ('BitInvest', 'Investment'); | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, species VARCHAR(50), ocean VARCHAR(50), feeding_habits VARCHAR(50)); | Update the feeding habits of the 'Blue Whale' to 'Filter Feeder' in all oceans. | UPDATE marine_species SET feeding_habits = 'Filter Feeder' WHERE species = 'Blue Whale'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabric_suppliers(name VARCHAR(50), location VARCHAR(50), sustainability_rating INT); INSERT INTO fabric_suppliers (name, location, sustainability_rating) VALUES ('GreenTextiles', 'India', 95); INSERT INTO fabric_suppliers (name, location, sustainability_rating) VALUES ('EcoFabrics', 'China', 88); INSERT IN... | List the top 3 most sustainable fabric suppliers in 'Asia' based on the sustainability_rating? | SELECT name, sustainability_rating FROM fabric_suppliers WHERE location = 'Asia' ORDER BY sustainability_rating DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouses (id INT, name TEXT, capacity INT, country TEXT); INSERT INTO Warehouses (id, name, capacity, country) VALUES (1, 'Berlin Warehouse', 5000, 'Germany'); INSERT INTO Warehouses (id, name, capacity, country) VALUES (2, 'Munich Warehouse', 7000, 'Germany'); | What are the names and capacities of all warehouses located in Germany? | SELECT name, capacity FROM Warehouses WHERE country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE union_details(id INT, union_name VARCHAR(50), total_members INT, country VARCHAR(14));INSERT INTO union_details(id, union_name, total_members, country) VALUES (1, 'Union A', 5000, 'Canada'), (2, 'Union B', 3000, 'Canada'), (3, 'Union C', 8000, 'Australia'), (4, 'Union D', 6000, 'Australia'); | List the unions with the highest and lowest number of members in Canada and Australia. | SELECT union_name, country, total_members FROM (SELECT union_name, country, total_members, ROW_NUMBER() OVER (PARTITION BY country ORDER BY total_members DESC, union_name ASC) AS rank FROM union_details WHERE country IN ('Canada', 'Australia')) ranked_unions WHERE rank IN (1, 2); | gretelai_synthetic_text_to_sql |
CREATE TABLE Graduate_Students_2 (id INT, name VARCHAR(50), department VARCHAR(50)); INSERT INTO Graduate_Students_2 (id, name, department) VALUES (1, 'Dana', 'Physics'); CREATE TABLE Publications_2 (id INT, student_id INT, year INT, title VARCHAR(100)); INSERT INTO Publications_2 (id, student_id, year, title) VALUES (... | What is the average number of publications by graduate students each year, overall? | SELECT AVG(publications_per_year) FROM (SELECT COUNT(*) AS publications_per_year FROM Publications_2 JOIN Graduate_Students_2 ON Publications_2.student_id = Graduate_Students_2.id GROUP BY year) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA FoodService;CREATE TABLE Sustainability (sustainability_id INT, restaurant_id INT, category VARCHAR(50), score INT, sustainability_date DATE); INSERT INTO Sustainability (sustainability_id, restaurant_id, category, score, sustainability_date) VALUES (1, 1, 'dining', 85, '2021-06-01'), (2, 1, 'dining', 90,... | What is the sum of sustainable sourcing scores for each restaurant category in the last six months? | SELECT category, SUM(score) as total_score FROM Sustainability WHERE sustainability_date >= '2021-06-01' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, type TEXT, engagement FLOAT); CREATE TABLE hotels (hotel_id INT, name TEXT, city TEXT, rating FLOAT); CREATE TABLE boutique_hotels (hotel_id INT, name TEXT, city TEXT, rating FLOAT); | What is the virtual tour engagement for 'Boutique' hotels in 'Rio de Janeiro'? | SELECT AVG(virtual_tours.engagement) FROM virtual_tours INNER JOIN (SELECT hotel_id FROM boutique_hotels WHERE city = 'Rio de Janeiro') as subquery ON virtual_tours.hotel_id = subquery.hotel_id WHERE virtual_tours.type = 'Boutique'; | gretelai_synthetic_text_to_sql |
CREATE TABLE graduate_students (id INT, name VARCHAR(100), department VARCHAR(50), publications INT); INSERT INTO graduate_students (id, name, department, publications) VALUES (1, 'Dana', 'Physics', 7); | How many graduate students in the Physics department have published more than 5 papers? | SELECT COUNT(*) FROM graduate_students WHERE department = 'Physics' AND publications > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, age INT, donation FLOAT); INSERT INTO donors (id, name, age, donation) VALUES (1, 'John Doe', 35, 500.00); INSERT INTO donors (id, name, age, donation) VALUES (2, 'Jane Smith', 45, 750.00); INSERT INTO donors (id, name, age, donation) VALUES (3, 'Bob Johnson', 25, 600.00); | What is the minimum donation amount in the 'donors' table? | SELECT MIN(donation) FROM donors; | gretelai_synthetic_text_to_sql |
CREATE TABLE france_cities (name TEXT, population INTEGER); INSERT INTO france_cities (name, population) VALUES ('Paris', 2148000), ('Marseille', 855000); CREATE TABLE germany_cities (name TEXT, population INTEGER); INSERT INTO germany_cities (name, population) VALUES ('Berlin', 3671000), ('Hamburg', 1795000); | List the names of cities with a population over 1 million in France and Germany. | SELECT name FROM france_cities WHERE population > 1000000 INTERSECT SELECT name FROM germany_cities WHERE population > 1000000; | gretelai_synthetic_text_to_sql |
CREATE TABLE drugs(drug_name TEXT, approval_year INT, rd_expenditure FLOAT); INSERT INTO drugs(drug_name, approval_year, rd_expenditure) VALUES('DrugA', 2017, 5000000), ('DrugB', 2018, 7000000), ('DrugC', 2019, 8000000), ('DrugD', 2019, 6000000); | Find the average R&D expenditure for the drugs approved in 2019. | SELECT AVG(rd_expenditure) FROM drugs WHERE approval_year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_efforts (id INT, species_id INT, project_status VARCHAR(20)); | Update the conservation_efforts table to reflect a successful conservation project for species with id 3 and 7 | UPDATE conservation_efforts SET project_status = 'successful' WHERE species_id IN (3, 7); | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (id INT, name TEXT, location TEXT); INSERT INTO factories (id, name, location) VALUES (1, 'Factory A', 'California'), (2, 'Factory B', 'Texas'); CREATE TABLE chemical_produced (factory_id INT, chemical_name TEXT, quantity INT); INSERT INTO chemical_produced (factory_id, chemical_name, quantity) V... | What are the names and quantities of chemicals produced by factories located in California? | SELECT chemical_name, quantity FROM chemical_produced CP JOIN factories F ON CP.factory_id = F.id WHERE F.location = 'California'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_farming (farmer_id INT, name VARCHAR(30), region VARCHAR(20), revenue REAL); INSERT INTO sustainable_farming (farmer_id, name, region, revenue) VALUES (1, 'Farmer A', 'Asia-Pacific', 12000), (2, 'Farmer B', 'Asia-Pacific', 15000), (3, 'Farmer C', 'Europe', 9000), (4, 'Farmer D', 'Africa', 18000... | Find the total revenue generated by sustainable farming in the Asia-Pacific region. | SELECT SUM(revenue) FROM sustainable_farming WHERE region = 'Asia-Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE material_production (material_id INT, material_name VARCHAR(50), production_date DATE, production_cost DECIMAL(10,2)); INSERT INTO material_production (material_id, material_name, production_date, production_cost) VALUES (1, 'Organic Cotton', '2021-08-05', 500.00), (2, 'Recycled Polyester', '2021-07-10', 7... | What is the total production cost of sustainable materials in Africa in the last quarter? | SELECT SUM(production_cost) FROM material_production WHERE material_name IN ('Organic Cotton', 'Recycled Polyester', 'Hemp') AND production_date BETWEEN DATE_SUB(CURDATE(), INTERVAL 3 MONTH) AND CURDATE(); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, founding_year INT, industry TEXT, founder_region TEXT, funding FLOAT); | What is the trend in funding received by startups founded by people from a specific region in the e-commerce sector over time? | SELECT founding_year, AVG(funding) FROM companies WHERE industry = 'e-commerce' AND founder_region = 'region_name' GROUP BY founding_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE IF NOT EXISTS programs (id INT, name VARCHAR(255), type VARCHAR(255), year INT, funding DECIMAL(10,2)); INSERT INTO programs (id, name, type, year, funding) VALUES (1, 'ProgramA', 'Music', 2021, 10000), (2, 'ProgramB', 'Music', 2021, 20000), (3, 'ProgramC', 'Music', 2021, 30000); | What is the average funding for music programs in 2021? | SELECT AVG(funding) FROM programs WHERE type = 'Music' AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Location VARCHAR(50), HireDate DATE); | Insert a new employee with ID 3 into the Employees table, with the name 'Jim Smith', department 'IT', location 'Chicago', and hire date '2022-03-20' | INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Location, HireDate) VALUES (3, 'Jim', 'Smith', 'IT', 'Chicago', '2022-03-20'); | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, production_volume INT); INSERT INTO mines (id, name, location, production_volume) VALUES (1, 'Australian Uranium Mine 1', 'Australia', 500); INSERT INTO mines (id, name, location, production_volume) VALUES (2, 'Australian Uranium Mine 2', 'Australia', 600); | What is the minimum production volume for uranium mines in Australia? | SELECT MIN(production_volume) FROM mines WHERE location = 'Australia' AND mineral = 'uranium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE peacekeeping_operations (id INT PRIMARY KEY, country VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO peacekeeping_operations (id, country, start_date, end_date) VALUES (1, 'Bosnia and Herzegovina', '1995-12-14', '2007-12-21'); INSERT INTO peacekeeping_operations (id, country, start_date, end_dat... | Which countries does the 'peacekeeping_operations' table contain data for? | SELECT DISTINCT country FROM peacekeeping_operations; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (ProductID int, SupplierID int, IsEcoFriendly boolean); | Which suppliers provide the most eco-friendly products? | SELECT SupplierID, 100.0 * COUNT(*) / (SELECT COUNT(*) FROM Products WHERE IsEcoFriendly = true) AS PercentEcoFriendly FROM Products WHERE IsEcoFriendly = true GROUP BY SupplierID ORDER BY PercentEcoFriendly DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (id INT, policy_name VARCHAR(100), description TEXT, review_date DATE, review_rating INT); INSERT INTO policies (id, policy_name, description, review_date, review_rating) VALUES (1, 'Policy A', 'Policy A description', '2021-09-01', 4), (2, 'Policy B', 'Policy B description', '2021-08-15', 5); | Which cybersecurity policies in the 'policies' table have been reviewed in the last month, based on the 'review_date' column, and what is their average review rating? | SELECT policy_name, AVG(review_rating) as average_rating FROM policies WHERE review_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY policy_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditure (id INT, drug_name VARCHAR(255), region VARCHAR(255), expenditure DECIMAL(10,2), expenditure_year INT); INSERT INTO rd_expenditure (id, drug_name, region, expenditure, expenditure_year) VALUES (1, 'DrugD', 'Asia', 50000, 2019); INSERT INTO rd_expenditure (id, drug_name, region, expenditure, ... | How much was spent on R&D in Asia for a specific drug during a given year? | SELECT SUM(expenditure) FROM rd_expenditure WHERE drug_name = 'DrugD' AND region = 'Asia' AND expenditure_year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryBases (Country VARCHAR(50), NumberOfBases INT); INSERT INTO MilitaryBases (Country, NumberOfBases) VALUES ('Brazil', 100), ('Argentina', 75), ('Colombia', 50), ('Peru', 30), ('Venezuela', 40); CREATE TABLE MilitaryAircrafts (Country VARCHAR(50), NumberOfAircrafts INT); INSERT INTO MilitaryAircrafts... | What is the total number of military bases in South American nations with more than 200 aircrafts? | SELECT SUM(NumberOfBases) FROM MilitaryBases INNER JOIN MilitaryAircrafts ON MilitaryBases.Country = MilitaryAircrafts.Country WHERE NumberOfAircrafts > 200; | gretelai_synthetic_text_to_sql |
CREATE TABLE deliveries (id INT, shipment_id INT, delivered_at TIMESTAMP); INSERT INTO deliveries (id, shipment_id, delivered_at) VALUES (1, 1, '2021-03-01 12:30:00'), (2, 2, '2021-03-31 09:15:00'); CREATE TABLE shipments (id INT, origin VARCHAR(255), destination VARCHAR(255), shipped_at TIMESTAMP); INSERT INTO shipmen... | What was the average delivery time for shipments from South Korea to Canada in March 2021? | SELECT AVG(TIMESTAMPDIFF(MINUTE, shipped_at, delivered_at)) FROM deliveries D JOIN shipments S ON D.shipment_id = S.id WHERE S.origin = 'South Korea' AND S.destination = 'Canada' AND shipped_at >= '2021-03-01' AND shipped_at < '2021-04-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE oil_fields (field_name VARCHAR(50) PRIMARY KEY, field_type VARCHAR(20), discovery_year INT); | Insert a new record into the 'oil_fields' table with the following data: 'Alaska North Slope', 'onshore', 1968 | INSERT INTO oil_fields (field_name, field_type, discovery_year) VALUES ('Alaska North Slope', 'onshore', 1968); | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_adoption (region VARCHAR(20), quarter INT, adoption_rate DECIMAL(5,2)); INSERT INTO ai_adoption (region, quarter, adoption_rate) VALUES ('North America', 1, 62.30), ('North America', 1, 64.50); | What is the adoption rate of AI-powered chatbots in 'North America' for 'Q1 2021'? | SELECT AVG(adoption_rate) FROM ai_adoption WHERE region = 'North America' AND quarter = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE recycling_rates (id INT PRIMARY KEY, location VARCHAR(50), rate FLOAT); | Add a record to the recycling_rates table | INSERT INTO recycling_rates (id, location, rate) VALUES (1, 'Seattle', 63.1); | gretelai_synthetic_text_to_sql |
CREATE TABLE employment (employee_id INT, state VARCHAR(2), employment_date DATE, num_employees INT); INSERT INTO employment (employee_id, state, employment_date, num_employees) VALUES (1, 'CO', '2018-12-31', 10000), (2, 'CO', '2019-12-31', 12000), (3, 'TX', '2020-12-31', 16000); | How many construction workers were employed in Colorado in 2018 and 2019? | SELECT employment_date, SUM(num_employees) FROM employment WHERE state = 'CO' AND employment_date IN ('2018-12-31', '2019-12-31') GROUP BY employment_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE green_buildings (id INT, building_name VARCHAR(255), state VARCHAR(255)); CREATE TABLE carbon_offset_projects (id INT, project_name VARCHAR(255), state VARCHAR(255)); | What is the total number of green buildings and carbon offset projects in each state? | SELECT state, COUNT(gb.building_name) + COUNT(cop.project_name) FROM green_buildings gb RIGHT JOIN carbon_offset_projects cop ON gb.state = cop.state GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE co2_emissions (state VARCHAR(20), year INT, sector VARCHAR(20), co2_emissions FLOAT); | List the top 5 states with the highest CO2 emissions from transportation in 2019. | SELECT state, SUM(co2_emissions) as total_emissions FROM co2_emissions WHERE year = 2019 AND sector = 'Transportation' GROUP BY state ORDER BY total_emissions DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE collective_bargaining (id INT, industry VARCHAR(50), num_agreements INT); INSERT INTO collective_bargaining (id, industry, num_agreements) VALUES (1, 'construction', 15); INSERT INTO collective_bargaining (id, industry, num_agreements) VALUES (2, 'manufacturing', 10); INSERT INTO collective_bargaining (id,... | What is the total number of collective bargaining agreements signed in the 'construction' industry? | SELECT SUM(num_agreements) FROM collective_bargaining WHERE industry = 'construction'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WeatherData (site_id INT, year INT, avg_temp DECIMAL(5,2)); INSERT INTO WeatherData (site_id, year, avg_temp) VALUES (1, 2015, 15.6), (1, 2016, 15.8), (1, 2017, 15.3), (1, 2018, 15.9); | What was the average temperature in Rome during excavations between 2015 and 2018? | SELECT AVG(avg_temp) FROM WeatherData WHERE site_id = 1 AND year BETWEEN 2015 AND 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, HireDate DATE); INSERT INTO Employees (EmployeeID, HireDate) VALUES (1, '2021-04-20'), (2, '2021-03-15'), (3, '2021-01-08'), (4, '2021-04-01'), (5, '2020-12-28'), (6, '2021-05-12'), (7, '2021-07-01'); | How many employees were hired in Q2 of 2021? | SELECT COUNT(*) FROM Employees WHERE HireDate BETWEEN '2021-04-01' AND '2021-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE WasteGenerationAfrica (region VARCHAR(50), year INT, waste_quantity INT); INSERT INTO WasteGenerationAfrica (region, year, waste_quantity) VALUES ('Africa/North', 2019, 200000), ('Africa/West', 2019, 250000), ('Africa/Central', 2019, 300000), ('Africa/East', 2019, 220000), ('Africa/South', 2019, 270000); | What is the total waste generation in Africa for the year 2019, separated by region? | SELECT region, SUM(waste_quantity) FROM WasteGenerationAfrica WHERE year = 2019 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameLibrary (GameID INT, GameName VARCHAR(50), GameType VARCHAR(50), Category VARCHAR(50)); INSERT INTO GameLibrary (GameID, GameName, GameType, Category) VALUES (1, 'GameA', 'VR', 'Adventure'), (2, 'GameB', 'Non-VR', 'Strategy'), (3, 'GameC', 'VR', 'Action'), (4, 'GameD', 'VR', 'Adventure'); | How many VR games are available in the 'Adventure' category? | SELECT COUNT(GameID) FROM GameLibrary WHERE GameType = 'VR' AND Category = 'Adventure'; | gretelai_synthetic_text_to_sql |
CREATE TABLE project_timelines (project_name VARCHAR(255), state VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO project_timelines (project_name, state, start_date, end_date) VALUES ('Project A', 'California', '2018-01-01', '2019-12-31'), ('Project B', 'California', '2018-06-01', '2020-05-31'), ('Project C',... | Identify the top 3 construction projects by duration in California | SELECT project_name, DATEDIFF(end_date, start_date) as duration FROM project_timelines WHERE state = 'California' ORDER BY duration DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE music_festivals (festival_id INT, genre VARCHAR(255), ticket_price DECIMAL(5,2)); INSERT INTO music_festivals (festival_id, genre, ticket_price) VALUES (1, 'Rock', 200.00), (2, 'Pop', 250.00), (3, 'Jazz', 150.00); | What is the average ticket price for each music festival genre? | SELECT genre, AVG(ticket_price) FROM music_festivals GROUP BY genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name TEXT, country TEXT, num_of_ICU_beds INT); | What is the maximum number of ICU beds available in hospitals in Peru? | SELECT MAX(num_of_ICU_beds) FROM hospitals WHERE country = 'Peru'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftLaunches (id INT, name VARCHAR(50), company VARCHAR(50), launch_date DATE); | What is the average time between spacecraft launches for 'SpaceX'? | SELECT AVG(DATEDIFF(lead_launch_date, launch_date)) FROM (SELECT launch_date, LEAD(launch_date) OVER (PARTITION BY company ORDER BY launch_date) AS lead_launch_date FROM SpacecraftLaunches WHERE company = 'SpaceX') AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE billing (attorney_id INT, client_id INT, hours FLOAT, rate FLOAT); INSERT INTO billing (attorney_id, client_id, hours, rate) VALUES (1, 101, 10, 300), (2, 102, 8, 350), (3, 103, 12, 250); | What is the average billing rate for each attorney in the 'billing' table? | SELECT attorney_id, AVG(rate) FROM billing GROUP BY attorney_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donation_date DATE, state TEXT, amount DECIMAL(10,2)); INSERT INTO donations (id, donation_date, state, amount) VALUES (4, '2020-07-01', 'California', 100.00), (5, '2020-08-15', 'Texas', 250.50), (6, '2020-09-30', 'New York', 150.25); | What were the total donations in Q3 2020 by state? | SELECT state, SUM(amount) FROM donations WHERE donation_date BETWEEN '2020-07-01' AND '2020-09-30' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE Astronauts (AstronautID INT, Name VARCHAR(50), Spaceflights INT, Agency VARCHAR(50), PreviousSpaceflights INT); INSERT INTO Astronauts (AstronautID, Name, Spaceflights, Agency, PreviousSpaceflights) VALUES (1, 'Neil Armstrong', 2, 'NASA', NULL); INSERT INTO Astronauts (AstronautID, Name, Spaceflights, Agen... | Identify astronauts who have flown more missions than their preceding colleagues within the same space agency. | SELECT Name, Spaceflights, Agency, PreviousSpaceflights, Spaceflights - LAG(Spaceflights) OVER (PARTITION BY Agency ORDER BY Spaceflights) AS Spaceflight_Difference FROM Astronauts WHERE Spaceflights - LAG(Spaceflights) OVER (PARTITION BY Agency ORDER BY Spaceflights) > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_energy_production (id INT PRIMARY KEY, source VARCHAR(255), state VARCHAR(255), production_gwh FLOAT); | Insert new records into the 'renewable_energy_production' table for wind and solar production in 'Florida' and 'Georgia' | INSERT INTO renewable_energy_production (source, state, production_gwh) VALUES ('wind', 'Florida', 30), ('solar', 'Florida', 45), ('wind', 'Georgia', 40), ('solar', 'Georgia', 55); | gretelai_synthetic_text_to_sql |
CREATE TABLE social_media_app (app_id INT, user_id INT, country VARCHAR(50)); INSERT INTO social_media_app (app_id, user_id, country) VALUES (1, 12345, 'USA'), (2, 67890, 'Canada'), (3, 11121, 'Mexico'), (4, 22232, 'Brazil'), (5, 33343, 'Germany'); | What are the top 3 countries where our social media app is most popular, based on user count? | SELECT country, COUNT(user_id) AS user_count FROM social_media_app GROUP BY country ORDER BY user_count DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE platforms (id INT, platform TEXT); | Delete all records from the 'platforms' table | DELETE FROM platforms; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_performance (vessel_id INT, speed FLOAT, timestamp TIMESTAMP); | Find the average speed of all vessels in the 'vessel_performance' table | SELECT AVG(speed) FROM vessel_performance; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, species VARCHAR(50), population INT, endangered BOOLEAN); | What is the percentage of endangered animals in the animal_population table for each species? | SELECT species, (COUNT(*) FILTER (WHERE endangered = TRUE)) * 100.0 / COUNT(*) AS percentage FROM animal_population GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT, category VARCHAR(255), price DECIMAL(5,2)); INSERT INTO Events (event_id, category, price) VALUES (1, 'Concert', 50.99), (2, 'Sports', 30.50), (3, 'Theater', 75.00); CREATE TABLE Fans (fan_id INT, age INT, event_id INT); INSERT INTO Fans (fan_id, age, event_id) VALUES (1, 25, 1), (2, ... | What is the average age of fans who attend theater events? | SELECT AVG(age) FROM Fans WHERE event_id IN (SELECT event_id FROM Events WHERE category = 'Theater'); | gretelai_synthetic_text_to_sql |
CREATE TABLE australian_conservation_areas (id INT, name VARCHAR(255), area_size FLOAT); CREATE TABLE australian_animal_population (id INT, conservation_area_id INT, species VARCHAR(255), animal_count INT); | What is the total number of animals in the Australian wildlife conservation areas, broken down by animal species and conservation area? | SELECT aca.name, aap.species, SUM(aap.animal_count) as total_animals FROM australian_conservation_areas aca JOIN australian_animal_population aap ON aca.id = aap.conservation_area_id GROUP BY aca.name, aap.species; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites_launches (company VARCHAR(50), year INT, num_satellites INT); INSERT INTO satellites_launches (company, year, num_satellites) VALUES ('SpaceX', 2020, 242), ('OneWeb', 2019, 34), ('Blue Origin', 2021, 12); | What is the maximum number of satellites a private company has launched in a single year? | SELECT company, MAX(num_satellites) as max_satellites FROM satellites_launches GROUP BY company; | gretelai_synthetic_text_to_sql |
CREATE TABLE country (id INT, name VARCHAR(255)); INSERT INTO country (id, name) VALUES (1, 'United States'); INSERT INTO country (id, name) VALUES (2, 'Canada'); CREATE TABLE open_data (id INT, country_id INT, is_open INT, date DATE); INSERT INTO open_data (id, country_id, is_open, date) VALUES (1, 1, 1, '2021-12-31')... | What is the number of open data portals in each country as of January 1, 2022? | SELECT country.name, COUNT(open_data.id) as num_open_data_portals FROM country JOIN open_data ON country.id = open_data.country_id WHERE open_data.date = '2022-01-01' AND open_data.is_open = 1 GROUP BY country.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_initiatives (region VARCHAR(50), initiative_name VARCHAR(50), budget NUMERIC(10,2), start_date DATE); INSERT INTO circular_initiatives (region, initiative_name, budget, start_date) VALUES ('Africa', 'Green Cities', 500000, '2020-01-01'), ('Africa', 'Waste-to-Energy', 800000, '2019-01-01'); | Get the circular economy initiative name and start date with the highest budget for 'Africa'. | SELECT initiative_name, start_date FROM (SELECT initiative_name, start_date, ROW_NUMBER() OVER (PARTITION BY region ORDER BY budget DESC) AS rn FROM circular_initiatives WHERE region = 'Africa') x WHERE rn = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE database_access (access_id INT PRIMARY KEY, user_name VARCHAR(50), access_time TIMESTAMP, role VARCHAR(50)); | Which users have accessed the database in the last week, and what are their roles? | SELECT user_name, role FROM database_access WHERE access_time >= NOW() - INTERVAL 1 WEEK; | gretelai_synthetic_text_to_sql |
CREATE TABLE ambulances (ambulance_id INT, location VARCHAR(255)); INSERT INTO ambulances (ambulance_id, location) VALUES (110, 'rural Kenya'); CREATE TABLE paramedics (paramedic_id INT, location VARCHAR(255)); INSERT INTO paramedics (paramedic_id, location) VALUES (111, 'rural Kenya'); INSERT INTO paramedics (paramedi... | What is the total number of ambulances in rural Kenya, and how many paramedics are available per ambulance? | SELECT COUNT(ambulances.ambulance_id) AS ambulances_count, COUNT(paramedics.paramedic_id) / COUNT(ambulances.ambulance_id) AS paramedics_per_ambulance FROM ambulances INNER JOIN paramedics ON ambulances.location = paramedics.location WHERE ambulances.location LIKE 'rural% Kenya'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tennis_players (player_id INT, name VARCHAR(50), country VARCHAR(50), ranking INT, salary DECIMAL(10, 2)); INSERT INTO tennis_players (player_id, name, country, ranking, salary) VALUES (1, 'Novak Djokovic', 'Serbia', 1, 21000000.00); INSERT INTO tennis_players (player_id, name, country, ranking, salary) VA... | What is the minimum salary of athletes in the tennis_players table? | SELECT MIN(salary) FROM tennis_players; | 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.