context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE hotels (hotel_id INT, hotel_name TEXT, region TEXT); CREATE TABLE ai_solutions (solution_id INT, hotel_id INT, implemented_date DATE); INSERT INTO hotels (hotel_id, hotel_name, region) VALUES (1, 'Alpine Chalet', 'EMEA'), (2, 'Mediterranean Villa', 'EMEA'); INSERT INTO ai_solutions (solution_id, hotel_id, ... | What is the average number of AI-powered solutions implemented per hotel in the EMEA region? | SELECT AVG(ai_solutions_per_hotel) AS average_solutions FROM (SELECT h.hotel_id, COUNT(ai.solution_id) AS ai_solutions_per_hotel FROM hotels h INNER JOIN ai_solutions ai ON h.hotel_id = ai.hotel_id WHERE h.region = 'EMEA' GROUP BY h.hotel_id) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (id INT, name VARCHAR(50), data_usage DECIMAL(10,2), region VARCHAR(10)); INSERT INTO subscribers (id, name, data_usage, region) VALUES (1, 'John Doe', 30.5, 'west'), (2, 'Jane Smith', 45.3, 'west'), (3, 'Alice Johnson', 22.8, 'west'), (4, 'Bob Brown', 51.9, 'west'), (5, 'Charlie Green', 60.2, ... | Insert a new record for a customer with ID 6, name 'Diana White', data usage 35.0, and region 'east'. | INSERT INTO subscribers (id, name, data_usage, region) VALUES (6, 'Diana White', 35.0, 'east'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidity (id INT, location TEXT, pH FLOAT, year INT); INSERT INTO ocean_acidity (id, location, pH, year) VALUES (1, 'Pacific Ocean', 8.2, 2020), (2, 'Pacific Ocean', 8.1, 2019), (3, 'Pacific Ocean', 8.3, 2018); | What is the minimum ocean acidity level (pH value) recorded in the Pacific Ocean in 2020? | SELECT MIN(pH) FROM ocean_acidity WHERE location = 'Pacific Ocean' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE dives (dive_id INT, diver_name TEXT, depth FLOAT, temperature FLOAT, date DATE); | Delete the record with the minimum temperature from the 'dives' table. | DELETE FROM dives WHERE temperature = (SELECT MIN(temperature) FROM dives); | gretelai_synthetic_text_to_sql |
CREATE TABLE tech_donations (id INT PRIMARY KEY, organization VARCHAR(50), city VARCHAR(50), country VARCHAR(50), donation_date DATE, donation_value FLOAT); | Create a table named 'tech_donations' to store details about technology donations made by various organizations | CREATE TABLE tech_donations (id INT PRIMARY KEY, organization VARCHAR(50), city VARCHAR(50), country VARCHAR(50), donation_date DATE, donation_value FLOAT); | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_site (id INT, name VARCHAR(255), resource VARCHAR(255), amount INT); INSERT INTO mining_site (id, name, resource, amount) VALUES (1, 'Site A', 'Gold', 100), (2, 'Site B', 'Silver', 150), (3, 'Site A', 'Coal', 200), (4, 'Site C', 'Gold', 120), (5, 'Site C', 'Silver', 180), (6, 'Site D', 'Coal', NULL)... | Determine the mining sites with no resource extraction | SELECT ms.name FROM mining_site ms WHERE ms.amount IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (PolicyID INT, Gender VARCHAR(10), State VARCHAR(10)); INSERT INTO Policyholders VALUES (1, 'Female', 'California'); INSERT INTO Policyholders VALUES (2, 'Male', 'New York'); CREATE TABLE Policies (PolicyID INT, RenewalRate DECIMAL(3,2)); INSERT INTO Policies VALUES (1, 0.85); INSERT INTO Pol... | What is the policy renewal rate for female policyholders in California? | SELECT p.Gender, AVG(pr.RenewalRate) as RenewalRate FROM Policyholders p INNER JOIN Policies pr ON p.PolicyID = pr.PolicyID WHERE p.Gender = 'Female' AND p.State = 'California' GROUP BY p.Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE traditional_arts_centers (id INT, center_name VARCHAR(100), size INT, region VARCHAR(50)); INSERT INTO traditional_arts_centers (id, center_name, size, region) VALUES (1, 'Folk Arts Center', 2000, 'Northeast'), (2, 'Western Arts Center', 3000, 'Midwest'); | What is the average size of traditional arts centers by region? | SELECT region, AVG(size) as avg_size FROM traditional_arts_centers GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE BikeRacks (line VARCHAR(20), station VARCHAR(20), racks BOOLEAN); INSERT INTO BikeRacks (line, station, racks) VALUES ('Silver Line', 'South Station', true), ('Silver Line', 'World Trade Center', false); | Which stations on the Silver Line have bike racks? | SELECT station FROM BikeRacks WHERE line = 'Silver Line' AND racks = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE salesperson (id INT, name VARCHAR(50), region VARCHAR(50)); INSERT INTO salesperson (id, name, region) VALUES (1, 'John Doe', 'North'), (2, 'Jane Smith', 'South'); CREATE TABLE orders (id INT, salesperson_id INT, size INT); INSERT INTO orders (id, salesperson_id, size) VALUES (1, 1, 10), (2, 1, 15), (3, 2,... | What is the salesperson with the smallest average order size? | SELECT salesperson_id, MIN(AVG(size)) OVER (PARTITION BY salesperson_id) as min_avg_size FROM orders GROUP BY salesperson_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (id INT, gender VARCHAR, department VARCHAR, billing_amount DECIMAL); INSERT INTO attorneys (id, gender, department, billing_amount) VALUES (1, 'Female', 'Civil', 75000.00), (2, 'Male', 'Criminal', 100000.00), (3, 'Female', 'Family', 60000.00), (4, 'Male', 'Civil', 90000.00); | What is the minimum billing amount for cases handled by female attorneys? | SELECT MIN(billing_amount) FROM attorneys WHERE gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE salesperson_data (salesperson VARCHAR(20), product VARCHAR(20), sales_amount DECIMAL(10,2), quantity INT); INSERT INTO salesperson_data VALUES ('John', 'Laptop', 1200.00, 2), ('John', 'Phone', 500.00, 1), ('Jane', 'Phone', 300.00, 1), ('Jane', 'Tablet', 800.00, 2); | Compare the sales data for two different salespersons, showing the product, sales amount, and quantity sold. | SELECT salesperson, product, sales_amount, quantity FROM salesperson_data WHERE salesperson IN ('John', 'Jane') ORDER BY salesperson, sales_amount DESC; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists social_good; CREATE TABLE if not exists social_good.ethical_ai (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), open_source BOOLEAN); INSERT INTO social_good.ethical_ai (id, name, location, open_source) VALUES (1, 'AI for Social Good', 'USA', true), (2, 'Ethical AI Canada', 'Ca... | What is the total number of ethical AI initiatives in the US and Canada, and how many of them are open source? | SELECT SUM(open_source) as total_open_source, COUNT(*) as total_initiatives FROM social_good.ethical_ai WHERE location IN ('USA', 'Canada'); | gretelai_synthetic_text_to_sql |
CREATE TABLE SeaLevel(id INT, rise DECIMAL(5,2), date DATE); INSERT INTO SeaLevel(id, rise, date) VALUES (1, 0.3, '1990-01-01'), (2, 0.6, '2000-01-01'), (3, 1.0, '2010-01-01'), (4, 1.5, '2020-01-01'); | What is the average sea level rise in the Indian Ocean per decade since 1990? | SELECT AVG(rise) FROM (SELECT rise FROM SeaLevel WHERE YEAR(date) >= 1990 GROUP BY rise, YEAR(date)/10) AS Decades; | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (ProductID INT, ProductName TEXT, Price DECIMAL, EthicalSource BOOLEAN, TransparentProduction BOOLEAN, VendorID INT);CREATE TABLE Vendors (VendorID INT, VendorName TEXT, Country TEXT); INSERT INTO Products VALUES (1, 'Shirt', 20, true, true, 1), (2, 'Pants', 30, true, false, 1), (3, 'Shoes', 50, f... | Display the total revenue of products that are ethically sourced and have transparent production methods. | SELECT SUM(Price) FROM Products p WHERE p.EthicalSource = true AND p.TransparentProduction = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE appeals (id INT, appeal_date DATE, resolution_date DATE, appellate_court VARCHAR(50)); | What is the average time taken for appeals to be resolved for each appellate court? | SELECT appellate_court, AVG(DATEDIFF(day, appeal_date, resolution_date)) AS avg_time_taken FROM appeals GROUP BY appellate_court; | gretelai_synthetic_text_to_sql |
CREATE TABLE Claims (ClaimID INT, PolicyID INT, PolicyType VARCHAR(20), ClaimState VARCHAR(20)); INSERT INTO Claims (ClaimID, PolicyID, PolicyType, ClaimState) VALUES (1, 1, 'Auto', 'Texas'), (2, 2, 'Home', 'Texas'), (3, 3, 'Life', 'Texas'); | How many claims were filed per policy type in 'Texas'? | SELECT PolicyType, COUNT(*) as ClaimCount FROM Claims WHERE ClaimState = 'Texas' GROUP BY PolicyType; | gretelai_synthetic_text_to_sql |
CREATE TABLE air_quality_data (id INT, year INT, co2_level FLOAT); | What is the average CO2 level in the Arctic per year? | SELECT AVG(co2_level) FROM air_quality_data GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE progress (country TEXT, year INT, progress FLOAT); INSERT INTO progress (country, year, progress) VALUES ('India', 2017, 0.7); | Which countries have made the most progress in climate adaptation in the last 5 years? | SELECT country, MAX(progress) FROM progress WHERE year BETWEEN 2016 AND 2021 GROUP BY country ORDER BY progress DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE employees (id INT, name VARCHAR(50), department VARCHAR(50), salary DECIMAL(5,2)); INSERT INTO employees (id, name, department, salary) VALUES (1, 'Juan Garcia', 'Sales', 50000.00); | Update the salaries of all employees in the Sales department to be the average salary for the department plus 15%. | UPDATE employees SET salary = (SELECT AVG(salary) * 1.15 FROM employees e WHERE e.department = employees.department) WHERE department = 'Sales'; | gretelai_synthetic_text_to_sql |
CREATE TABLE loans (id INT, amount DECIMAL(10, 2), issuance_date DATE, borrower_type VARCHAR(20)); INSERT INTO loans (id, amount, issuance_date, borrower_type) VALUES (1, 5000, '2022-01-01', 'Microfinance Organization'); CREATE TABLE regions (id INT, name VARCHAR(20), description VARCHAR(50)); INSERT INTO regions (id, ... | What is the total amount of loans issued to microfinance organizations in Latin America? | SELECT SUM(loans.amount) FROM loans INNER JOIN regions ON loans.borrower_type = regions.name WHERE regions.name = 'Microfinance Organization'; | gretelai_synthetic_text_to_sql |
CREATE TABLE intelligence_agency (id INT, name VARCHAR(255), director VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO intelligence_agency (id, name, director, start_date, end_date) VALUES (1, 'CIA', 'John Doe', '2010-01-01', '2020-01-01'), (2, 'NSA', 'Jane Smith', '2015-01-01', '2021-01-01'), (3, 'FBI', 'Mik... | Who are the top five intelligence agency directors with the longest tenures, and what are their start and end dates? | SELECT director, start_date, end_date FROM intelligence_agency ORDER BY DATEDIFF(end_date, start_date) DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites_orbital (id INT, name VARCHAR(255), country VARCHAR(255), orbital_height FLOAT); | What is the average orbital height of satellites launched by Japan? | SELECT AVG(orbital_height) FROM satellites_orbital WHERE country = 'Japan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE retail_sector (year INT, incidents INT, insider BOOLEAN); INSERT INTO retail_sector (year, incidents, insider) VALUES (2022, 25, true), (2022, 35, false), (2021, 50, true), (2021, 40, false), (2020, 20, true); | What is the total number of security incidents caused by insiders in the retail sector in 2021 and 2022? | SELECT SUM(incidents) FROM retail_sector WHERE year IN (2021, 2022) AND insider = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (company VARCHAR(50), year INT, vulnerabilities INT); INSERT INTO vulnerabilities (company, year, vulnerabilities) VALUES ('Microsoft', 2019, 726), ('Microsoft', 2020, 869), ('Microsoft', 2021, 977), ('Google', 2019, 673), ('Google', 2020, 772), ('Google', 2021, 876); | What is the distribution of cybersecurity vulnerabilities reported by Microsoft and Google between 2019 and 2021? | SELECT company, year, vulnerabilities FROM vulnerabilities WHERE company IN ('Microsoft', 'Google') ORDER BY company, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE BinanceTransactions (id INT, txid VARCHAR(100), timestamp BIGINT); INSERT INTO BinanceTransactions (id, txid, timestamp) VALUES (1, '...', 1643324480), (2, '...', 1643410880); | What is the total number of transactions made on the Binance Smart Chain in the last month? | SELECT COUNT(*) FROM BinanceTransactions WHERE timestamp >= UNIX_TIMESTAMP(DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH)) * 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE State (state_id INT, state_name VARCHAR(50)); CREATE TABLE Building (building_id INT, building_name VARCHAR(50), building_type VARCHAR(50), state_id INT); | What is the total number of green buildings in each state? | SELECT State.state_name, COUNT(*) as num_buildings FROM State JOIN Building ON State.state_id = Building.state_id WHERE Building.building_type = 'green' GROUP BY State.state_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (factory_id INT, name TEXT, location TEXT, uses_renewable_energy BOOLEAN); INSERT INTO factories VALUES (1, 'Factory A', 'City A', true), (2, 'Factory B', 'City B', false), (3, 'Factory C', 'City C', true); | List the names and locations of factories that use renewable energy sources. | SELECT name, location FROM factories WHERE uses_renewable_energy = true; | 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', 'Midwest', 25000.00), (2, 'Jane Doe', 'Northeast', 22000.00), (3, 'Mike Johnson', 'Midwest', 18000.00), (4, 'Sara Jones', 'So... | What is the number of clients in the Midwest region with an account balance greater than $20,000? | SELECT COUNT(*) FROM clients WHERE region = 'Midwest' AND account_balance > 20000.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE mineral_extraction (mine_id INT, amount_extracted INT, operational_costs INT); INSERT INTO mineral_extraction (mine_id, amount_extracted, operational_costs) VALUES (7, 2000, 500000), (7, 2500, 625000), (8, 1500, 375000), (8, 1800, 450000); CREATE TABLE mines (mine_id INT, mine_name TEXT); INSERT INTO mines... | List the mineral extraction statistics for each mine, including the mine name, the total amount of minerals extracted, and the total operational costs. Calculate the revenue for each mine. | SELECT m.mine_name, AVG(me.amount_extracted) AS avg_amount_extracted, AVG(me.operational_costs) AS avg_operational_costs, AVG(me.amount_extracted - me.operational_costs) AS revenue FROM mineral_extraction me JOIN mines m ON me.mine_id = m.mine_id GROUP BY m.mine_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableCosts (state VARCHAR(20), project_type VARCHAR(20), cost FLOAT); INSERT INTO RenewableCosts (state, project_type, cost) VALUES ('California', 'Solar', 1000000.0); | What are the renewable energy project costs for the state of California? | SELECT cost FROM RenewableCosts WHERE state = 'California' AND project_type = 'Solar'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tournaments (id INT, name VARCHAR(50), prize_pool INT); CREATE TABLE tournament_participation (id INT, tournament_id INT, player_id INT); INSERT INTO tournaments VALUES (1, 'Tournament1', 70000); INSERT INTO tournaments VALUES (2, 'Tournament2', 30000); INSERT INTO tournament_participation VALUES (1, 1, 1)... | What is the total prize pool for tournaments in which a player with the name 'Chloe Lee' has participated? | SELECT SUM(tournaments.prize_pool) FROM tournaments INNER JOIN tournament_participation ON tournaments.id = tournament_participation.tournament_id INNER JOIN players ON tournament_participation.player_id = players.id WHERE players.name = 'Chloe Lee'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (id INT, plaintiff_gender VARCHAR(10), case_outcome VARCHAR(10)); INSERT INTO cases (id, plaintiff_gender, case_outcome) VALUES (1, 'female', 'won'); | What is the success rate of cases in which the plaintiff identifies as a woman? | SELECT 100.0 * AVG(CASE WHEN cases.plaintiff_gender = 'female' THEN (CASE WHEN cases.case_outcome = 'won' THEN 1 ELSE 0 END) ELSE 0 END) / COUNT(*) AS success_rate FROM cases; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, sector VARCHAR(20), ESG_score FLOAT); INSERT INTO companies (id, sector, ESG_score) VALUES (1, 'Technology', 75.0), (2, 'Finance', 60.0), (3, 'Healthcare', 80.0), (4, 'Technology', 85.0), (5, 'Finance', 82.0); | Identify the companies with the lowest ESG score in each sector. | SELECT sector, MIN(ESG_score) FROM companies GROUP BY sector; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Salary) VALUES (1, 'John', 'Doe', 'IT', 80000.00), (2, 'Jane', 'Doe', 'IT', 85000.00), (3, 'Mike', 'Johnson', 'IT', 9000... | What is the average salary of developers in the IT department, grouped by gender? | SELECT G.Gender, AVG(E.Salary) AS AvgSalary FROM Employees E INNER JOIN Genders G ON E.EmployeeID = G.EmployeeID WHERE E.Department = 'IT' AND E.Department IN (SELECT Department FROM Departments WHERE DepartmentHead = 'John Doe') GROUP BY G.Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_maintenance (vehicle_type VARCHAR(50), last_maintenance DATE); INSERT INTO vehicle_maintenance (vehicle_type, last_maintenance) VALUES ('Red Line', '2021-06-01'), ('Red Line', '2021-08-15'), ('Blue Line', '2021-07-20'); | List all vehicle maintenance records for the 'Red Line' subway fleet | SELECT * FROM vehicle_maintenance WHERE vehicle_type = 'Red Line'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_production (production_date DATE, production_volume INT, mining_method VARCHAR(255)); INSERT INTO mining_production (production_date, production_volume, mining_method) VALUES ('2021-08-01', 1000, 'Open Pit'), ('2021-07-01', 1200, 'Underground'), ('2020-08-01', 1500, 'Open Pit'), ('2020-07-01', 1800,... | What is the average production volume per mining method in the past 12 months? | SELECT mining_method, AVG(production_volume) as avg_production_volume FROM (SELECT mining_method, production_volume, production_date, ROW_NUMBER() OVER (PARTITION BY mining_method ORDER BY production_date DESC) as rn FROM mining_production WHERE production_date >= DATEADD(month, -12, CURRENT_DATE)) t WHERE rn = 1 GROUP... | gretelai_synthetic_text_to_sql |
CREATE TABLE ships (id INT, name TEXT, type TEXT, year_built INT, decommission_year INT); INSERT INTO ships (id, name, type, year_built, decommission_year) VALUES (1, 'Seabourn Pride', 'Passenger', 1988, 2011); | Delete all records from the ships table for ships that were decommissioned before 2010 | DELETE FROM ships WHERE decommission_year < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProjectTimeline (project_id INT, start_date DATE, end_date DATE); INSERT INTO ProjectTimeline (project_id, start_date, end_date) VALUES (1, '2016-01-01', '2017-12-31'); INSERT INTO ProjectTimeline (project_id, start_date, end_date) VALUES (2, '2019-01-01', '2020-12-31'); INSERT INTO InfrastructureProjects ... | Which projects were completed before 2018-01-01 and their respective total costs? | SELECT p.name, p.cost FROM InfrastructureProjects p JOIN ProjectTimeline t ON p.id = t.project_id WHERE t.end_date < '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE australia_energy_storage (technology VARCHAR(20), capacity INT); INSERT INTO australia_energy_storage (technology, capacity) VALUES ('Batteries', 2000), ('Pumped Hydro', 6000), ('Flywheels', 100); | Which energy storage technologies are used in Australia and their corresponding capacities? | SELECT technology, capacity FROM australia_energy_storage; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (ConcertID INT, Artist VARCHAR(50), City VARCHAR(50), Revenue DECIMAL(10,2)); INSERT INTO Concerts (ConcertID, Artist, City, Revenue) VALUES (1, 'Taylor Swift', 'Los Angeles', 500000.00), (2, 'BTS', 'New York', 750000.00), (3, 'Adele', 'London', 600000.00), (4, 'Taylor Swift', 'Paris', 400000.00); | Which artists have the highest concert revenue in each city? | SELECT City, Artist, MAX(Revenue) as MaxRevenue FROM Concerts GROUP BY City, Artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability (id INT, name VARCHAR(20), score INT); INSERT INTO financial_capability (id, name, score) VALUES (1, 'JohnDoe', 70), (2, 'JaneDoe', 85), (3, 'MikeSmith', 90); | Insert a new record into the 'financial_capability' table for 'FatimaKhan' with a score of 85. | INSERT INTO financial_capability (name, score) VALUES ('FatimaKhan', 85); | gretelai_synthetic_text_to_sql |
CREATE TABLE Products (productID INT, productName VARCHAR(50), ingredient VARCHAR(50)); INSERT INTO Products (productID, productName, ingredient) VALUES (1, 'Exfoliating Scrub', 'Microbeads'), (2, 'Face Wash', 'Salicylic Acid'), (3, 'Hand Cream', 'Shea Butter'); | Update the ingredient 'Microbeads' to 'Biodegradable Beads' in the Products table. | UPDATE Products SET ingredient = 'Biodegradable Beads' WHERE ingredient = 'Microbeads'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (subscriber_id INT, data_usage FLOAT, state VARCHAR(20), subscription_type VARCHAR(20)); INSERT INTO mobile_subscribers (subscriber_id, data_usage, state, subscription_type) VALUES (1, 3.5, 'Texas', 'prepaid'), (2, 4.2, 'Texas', 'prepaid'), (3, 3.8, 'California', 'postpaid'); | What is the minimum monthly data usage for prepaid mobile customers in the state of Texas? | SELECT MIN(data_usage) FROM mobile_subscribers WHERE state = 'Texas' AND subscription_type = 'prepaid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MarineLife (id INT, name VARCHAR(50), species VARCHAR(50), species_type VARCHAR(50), population INT); INSERT INTO MarineLife (id, name, species, species_type, population) VALUES (1, 'Sea Dragon', 'Squid', 'Cephalopod', 1500), (2, 'Blue Whale', 'Whale', 'Mammal', 2000), (3, 'Clownfish', 'Fish', 'Teleost', 5... | What is the total population of all marine species in the 'MarineLife' table, grouped by their species type? | SELECT species_type, SUM(population) FROM MarineLife GROUP BY species_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE professors (id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50), research_interest VARCHAR(50), publication_field VARCHAR(50)); INSERT INTO professors (id, name, gender, department, research_interest, publication_field) VALUES (1, 'Sophia Rodriguez', 'Female', 'Computer Science', 'Machine ... | Update the department of professors named 'Andrew Kim' to 'Mechanical Engineering'. | UPDATE professors SET department = 'Mechanical Engineering' WHERE name = 'Andrew Kim'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name VARCHAR(255), esg_score DECIMAL(3,2), sector VARCHAR(255)); | What is the number of companies in the 'Technology' sector with an ESG score above 80? | SELECT COUNT(*) FROM companies WHERE sector = 'Technology' AND esg_score > 80; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseSpending (Country VARCHAR(255), Spending FLOAT); INSERT INTO DefenseSpending (Country, Spending) VALUES ('United Kingdom', 59.2), ('Germany', 52.8), ('France', 50.1), ('Italy', 26.8); | What are the defense spending figures for European countries in 2021? | SELECT Spending FROM DefenseSpending WHERE Country IN ('United Kingdom', 'Germany', 'France', 'Italy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (article_id INT PRIMARY KEY, title TEXT, topic TEXT, author TEXT, publication_date DATE); | What is the distribution of articles by topic in the news_articles table? | SELECT topic, COUNT(*) FROM news_articles GROUP BY topic; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_satellites (id INT, satellite_name VARCHAR(50), type VARCHAR(50), country VARCHAR(50)); CREATE TABLE satellite_launches (id INT, satellite_id INT, launch_date DATE); INSERT INTO military_satellites (id, satellite_name, type, country) VALUES (1, 'Milstar-1', 'Communications', 'USA'), (2, 'GPS-IIR',... | Show details of military satellites and their launch dates | SELECT military_satellites.satellite_name, military_satellites.type, satellite_launches.launch_date FROM military_satellites INNER JOIN satellite_launches ON military_satellites.id = satellite_launches.satellite_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (id INT, name VARCHAR(50), category VARCHAR(50), certification VARCHAR(50), price DECIMAL(5,2)); INSERT INTO menu_items (id, name, category, certification, price) VALUES (101, 'Beef Shawarma', 'Middle Eastern', 'Halal', 7.99), (102, 'Chicken Tikka Masala', 'Indian', 'Halal', 10.99), (103, 'Veggi... | List all the menu items that have a 'Halal' certification | SELECT name FROM menu_items WHERE certification = 'Halal'; | gretelai_synthetic_text_to_sql |
CREATE TABLE trees (id INT PRIMARY KEY, species VARCHAR(255), diameter FLOAT); | Insert a new record in the trees table for a Sequoia tree with a diameter of 120 inches | INSERT INTO trees (species, diameter) VALUES ('Sequoia', 120); | gretelai_synthetic_text_to_sql |
CREATE TABLE airports (id INT, airport_name VARCHAR(255), location VARCHAR(255), runways INT); INSERT INTO airports (id, airport_name, location, runways) VALUES (1, 'Hartsfield-Jackson Atlanta International Airport', 'Southern United States', 5), (2, 'Dallas/Fort Worth International Airport', 'Southern United States', ... | Rank the airports in the Southern United States by the number of runways, and display the airport names and their corresponding runway counts. | SELECT airport_name, runways, RANK() OVER (ORDER BY runways DESC) AS runway_rank FROM airports WHERE location = 'Southern United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT PRIMARY KEY, restaurant_id INT, sale_date DATE, revenue DECIMAL(10,2)); | Calculate monthly revenue by restaurant | SELECT r.restaurant_id, r.restaurant_name, DATEADD(month, DATEDIFF(month, 0, s.sale_date), 0) as month, SUM(s.revenue) as monthly_revenue FROM sales s JOIN restaurants r ON s.restaurant_id = r.restaurant_id GROUP BY r.restaurant_id, r.restaurant_name, DATEADD(month, DATEDIFF(month, 0, s.sale_date), 0) ORDER BY r.restau... | gretelai_synthetic_text_to_sql |
CREATE TABLE CarbonOffsets (id INT, project_name VARCHAR(50), country VARCHAR(50), co2_reduction INT, year INT); INSERT INTO CarbonOffsets (id, project_name, country, co2_reduction, year) VALUES (3, 'Forest Regeneration', 'Italy', 4000, 2020); | How many carbon offset projects and green buildings are in Italy? | SELECT COUNT(c.id), COUNT(g.id) FROM CarbonOffsets c INNER JOIN GreenBuildings g ON c.country = g.country WHERE c.country = 'Italy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE highway_projects (project_id INT, project_name VARCHAR(100), state CHAR(2), start_date DATE, cost FLOAT); INSERT INTO highway_projects VALUES (1, 'I-5 Columbia River Bridge Replacement', 'OR', '2014-01-01', 1000000000), (2, 'SR 520 Bridge Replacement', 'WA', '2012-06-15', 1500000000), (3, 'I-90 Snoqualmie ... | What is the total cost of all highway projects in the Pacific Northwest that started before 2015? | SELECT SUM(cost) FROM highway_projects WHERE state IN ('OR', 'WA') AND start_date < '2015-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_data (id INT, country VARCHAR(50), destination VARCHAR(50), arrival_date DATE, age INT); INSERT INTO tourism_data (id, country, destination, arrival_date, age) VALUES (6, 'Mexico', 'Canada', '2022-08-15', 27), (7, 'Mexico', 'Canada', '2022-12-29', 32); | Update the age of tourists visiting Canada from Mexico in 2022. | UPDATE tourism_data SET age = 28 WHERE country = 'Mexico' AND destination = 'Canada' AND YEAR(arrival_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, content TEXT, likes INT, post_date DATE); CREATE TABLE users (id INT, country VARCHAR(50)); | What is the average number of likes on posts related to veganism for users in the United States, for the month of January 2022? | SELECT AVG(likes) as avg_likes FROM posts p JOIN users u ON p.user_id = u.id WHERE u.country = 'United States' AND post_date >= '2022-01-01' AND post_date <= '2022-01-31' AND content LIKE '%vegan%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE brute_force_attacks (ip VARCHAR(255), timestamp TIMESTAMP); CREATE TABLE attack_counts (ip VARCHAR(255), count INT); INSERT INTO brute_force_attacks (ip, timestamp) VALUES ('192.168.1.1', '2021-01-01 10:00:00'), ('192.168.1.2', '2021-01-01 11:00:00'); INSERT INTO attack_counts (ip, count) VALUES ('192.168.... | List all the unique IP addresses that have attempted a brute force attack on our systems, along with the total number of attempts made by each IP. | SELECT ip, COUNT(*) as total_attempts FROM brute_force_attacks INNER JOIN attack_counts ON brute_force_attacks.ip = attack_counts.ip GROUP BY ip; | gretelai_synthetic_text_to_sql |
CREATE TABLE building_permits (permit_id SERIAL PRIMARY KEY, issue_date DATE); INSERT INTO building_permits (issue_date) VALUES ('2022-01-01'), ('2022-01-10'), ('2022-02-01'); | Which building permits were issued in the last 30 days? | SELECT permit_id, issue_date FROM building_permits WHERE issue_date >= NOW() - INTERVAL '30 days'; | gretelai_synthetic_text_to_sql |
CREATE TABLE safe_ai_algorithms_av (id INT, algorithm VARCHAR(25), evaluation VARCHAR(25), score FLOAT); INSERT INTO safe_ai_algorithms_av (id, algorithm, evaluation, score) VALUES (1, 'AlgorithmJ', 'Robustness', 0.93), (2, 'AlgorithmK', 'Security', 0.96), (3, 'AlgorithmL', 'Reliability', 0.92), (4, 'AlgorithmM', 'Robu... | List the number of safe AI algorithms designed for autonomous vehicles grouped by their evaluation category. | SELECT evaluation, COUNT(*) as num_algorithms FROM safe_ai_algorithms_av WHERE evaluation IN ('Robustness', 'Security', 'Reliability') GROUP BY evaluation; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (team_id INT, team_name TEXT, city TEXT); CREATE TABLE games (game_id INT, team_id INT, home BOOLEAN); | What is the percentage of games played at home for each team? | SELECT t.team_name, (SUM(g.home) * 100.0 / COUNT(g.game_id)) as home_percentage FROM games g JOIN teams t ON g.team_id = t.team_id GROUP BY t.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE vendors (id INT, vendor_name VARCHAR(255), vendor_location VARCHAR(255)); INSERT INTO vendors (id, vendor_name, vendor_location) VALUES (1, 'General Dynamics', 'Florida'); INSERT INTO vendors (id, vendor_name, vendor_location) VALUES (2, 'Bell', 'Texas'); INSERT INTO vendors (id, vendor_name, vendor_locati... | Update the vendor address for 'General Dynamics' to 'Virginia' | UPDATE vendors SET vendor_location = 'Virginia' WHERE vendor_name = 'General Dynamics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Users (id INT, age INT, gender VARCHAR(10)); INSERT INTO Users (id, age, gender) VALUES (1, 27, 'Female'), (2, 31, 'Male'); CREATE TABLE Workouts (id INT, user_id INT, activity VARCHAR(20), duration INT, heart_rate INT); INSERT INTO Workouts (id, user_id, activity, duration, heart_rate) VALUES (1, 1, 'Yoga... | What is the average heart rate of users aged 25-30, during their yoga workouts? | SELECT AVG(heart_rate) FROM Users u JOIN Workouts w ON u.id = w.user_id WHERE u.age BETWEEN 25 AND 30 AND w.activity = 'Yoga'; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, hotel_id INT, num_views INT); INSERT INTO virtual_tours (tour_id, hotel_id, num_views) VALUES (1, 1, 200), (2, 2, 150); | How many reviews were there in each city in August 2021? | SELECT hi.city, COUNT(gr.review_date) AS reviews FROM hotel_reviews gr INNER JOIN hotel_info hi ON gr.hotel_id = hi.hotel_id WHERE gr.review_date BETWEEN '2021-08-01' AND '2021-08-31' GROUP BY hi.city; | gretelai_synthetic_text_to_sql |
CREATE TABLE representatives (id INT PRIMARY KEY, name VARCHAR(255), district INT, title VARCHAR(255)); INSERT INTO representatives (id, name, district, title) VALUES (1, 'John Doe', 1, 'Councilor'), (2, 'Jane Doe', 2, 'Councilor'), (3, 'Alex Doe', 3, 'Councilor'); | Delete the representative with id 3 | DELETE FROM representatives WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE decentralized_apps (app_name VARCHAR(255), developer VARCHAR(255)); INSERT INTO decentralized_apps (app_name, developer) VALUES ('StellarPort', 'Stellar Devs'); INSERT INTO decentralized_apps (app_name, developer) VALUES ('Smartlands', 'Stellar Devs'); | Which decentralized applications were developed by Stellar's development team? | SELECT app_name FROM decentralized_apps WHERE developer = 'Stellar Devs'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_objects (id INT, object_name TEXT, mass FLOAT); INSERT INTO space_objects (id, object_name, mass) VALUES (1, 'ISS', 419454.0); | What is the total mass of the International Space Station? | SELECT mass FROM space_objects WHERE object_name = 'ISS'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Collaborations (CollaborationId INT, Artist1 VARCHAR(255), Genre1 VARCHAR(255), Artist2 VARCHAR(255), Genre2 VARCHAR(255), CollaborationDate DATE); INSERT INTO Collaborations (CollaborationId, Artist1, Genre1, Artist2, Genre2, CollaborationDate) VALUES (1, 'Drake', 'Hip Hop', 'Ariana Grande', 'Pop', '2021-... | List all collaborations between artists of different genres in the last year. | SELECT Artist1, Genre1, Artist2, Genre2 FROM Collaborations WHERE CollaborationDate >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) AND Genre1 <> Genre2; | gretelai_synthetic_text_to_sql |
CREATE TABLE accidents (id INT, vessel_id INT, accident_type VARCHAR(50), date DATE); INSERT INTO accidents VALUES (1, 1, 'Collision', '2021-03-01'), (2, 1, 'Grounding', '2021-05-05'), (3, 2, 'Collision', '2021-02-20'); | List the number of unique accidents for each vessel in descending order. | SELECT vessel_id, COUNT(DISTINCT accident_type) AS unique_accidents FROM accidents GROUP BY vessel_id ORDER BY unique_accidents DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_id INT, event_name VARCHAR(255), attendees INT); INSERT INTO Events (event_id, event_name, attendees) VALUES (1, 'Music Festival', 800), (2, 'Art Exhibition', 500), (5, 'Theater Performance', 350); CREATE TABLE Attendee_Demographics (attendee_id INT, attendee_race VARCHAR(255), event_id INT);... | Which cultural programs had the most diverse attendance in H1 2022? | SELECT E.event_name, COUNT(DISTINCT AD.attendee_race) as num_races FROM Events E JOIN Attendee_Demographics AD ON E.event_id = AD.event_id JOIN Event_Dates ED ON E.event_id = ED.event_id WHERE YEAR(ED.event_date) = 2022 AND MONTH(ED.event_date) <= 6 GROUP BY E.event_name ORDER BY num_races DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE FairTradeProduction (id INT, factory_id INT, num_garments INT, production_date DATE); INSERT INTO FairTradeProduction (id, factory_id, num_garments, production_date) VALUES (1, 1, 100, '2021-01-01'), (2, 2, 200, '2021-02-01'), (3, 3, 50, '2021-01-15'), (4, 1, 150, '2021-03-01'); CREATE TABLE FairTradeFacto... | Which fair trade certified factories have produced the fewest garments in the last year? | SELECT f.factory_name, SUM(p.num_garments) FROM FairTradeProduction p JOIN FairTradeFactories f ON p.factory_id = f.id GROUP BY p.factory_id ORDER BY SUM(p.num_garments) ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists companies (company_id INT, sector VARCHAR(50), esg_score DECIMAL(3,2), quarter INT, year INT); INSERT INTO companies (company_id, sector, esg_score, quarter, year) VALUES (4, 'Agriculture', 7.6, 2, 2021), (5, 'Agriculture', 7.8, 2, 2021), (6, 'Agriculture', 8.1, 2, 2021); | What is the average ESG score for companies in the agriculture sector in Q2 2021? | SELECT AVG(esg_score) FROM companies WHERE sector = 'Agriculture' AND quarter = 2 AND year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE Game (id INT, name VARCHAR(255)); INSERT INTO Game (id, name) VALUES (1, 'Puzzle'); CREATE TABLE Player (id INT, country VARCHAR(255)); CREATE TABLE GamePlayer (PlayerId INT, GameId INT); INSERT INTO Player (id, country) VALUES (1, 'Nigeria'), (2, 'Egypt'), (3, 'USA'); INSERT INTO GamePlayer (PlayerId, Gam... | What is the total number of players who have played "Puzzle" games and are from "Africa"? | SELECT COUNT(DISTINCT PlayerId) FROM GamePlayer GP JOIN Player P ON GP.PlayerId = P.id WHERE GP.GameId = (SELECT G.id FROM Game G WHERE G.name = 'Puzzle') AND P.country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Autonomous_Vehicles (id INT, name TEXT, max_speed FLOAT); INSERT INTO Autonomous_Vehicles (id, name, max_speed) VALUES (1, 'AutoV', 120.5); INSERT INTO Autonomous_Vehicles (id, name, max_speed) VALUES (2, 'AutoW', 110.0); | What is the maximum speed of the autonomous vehicle 'AutoV'? | SELECT max_speed FROM Autonomous_Vehicles WHERE name = 'AutoV'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_revenue (date DATE, revenue FLOAT); INSERT INTO restaurant_revenue (date, revenue) VALUES ('2021-03-01', 5000), ('2021-03-02', 6000), ('2021-03-03', 7000); | What was the total revenue for March 2021? | SELECT SUM(revenue) FROM restaurant_revenue WHERE date BETWEEN '2021-03-01' AND '2021-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient_treatment (patient_id INT, treatment_name VARCHAR(50), treatment_center VARCHAR(50)); INSERT INTO patient_treatment (patient_id, treatment_name, treatment_center) VALUES (11, 'Dialectical Behavior Therapy', 'clinic_k'); | What is the count of patients who received 'Dialectical Behavior Therapy' in 'clinic_k'? | SELECT COUNT(*) FROM patient_treatment WHERE treatment_name = 'Dialectical Behavior Therapy' AND treatment_center = 'clinic_k'; | gretelai_synthetic_text_to_sql |
CREATE TABLE prison (id INT, name TEXT, security_level TEXT, age INT); INSERT INTO prison (id, name, security_level, age) VALUES (1, 'John Doe', 'low_security', 65); INSERT INTO prison (id, name, security_level, age) VALUES (2, 'Jane Smith', 'medium_security', 55); | What is the name and age of the oldest inmate in the prison table? | SELECT name, age FROM prison ORDER BY age DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE microfinance_program (client_id INT, program_name VARCHAR(30)); INSERT INTO microfinance_program (client_id, program_name) VALUES (101, 'Socially Responsible Microfinance'), (102, 'Conventional Microfinance'), (103, 'Socially Responsible Microfinance'); CREATE TABLE client_transactions (client_id INT, tran... | List all clients from the Socially Responsible Microfinance program and their transaction histories. | SELECT * FROM microfinance_program INNER JOIN client_transactions ON microfinance_program.client_id = client_transactions.client_id WHERE program_name = 'Socially Responsible Microfinance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Eco_Friendly_Hotels (hotel_id INT, hotel_name VARCHAR(50), city VARCHAR(50), country VARCHAR(50), sustainability_rating FLOAT); INSERT INTO Eco_Friendly_Hotels (hotel_id, hotel_name, city, country, sustainability_rating) VALUES (1, 'Eco Hotel Madrid', 'Madrid', 'Spain', 4.8), (2, 'Eco Hotel Barcelona', 'Ba... | What are the names of the top 2 cities with the most eco-friendly hotels in Spain? | SELECT city, hotel_name FROM Eco_Friendly_Hotels WHERE country = 'Spain' GROUP BY city ORDER BY AVG(sustainability_rating) DESC LIMIT 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (dish_id INT PRIMARY KEY, dish_name VARCHAR(255), cuisine_id INT, dietary_restrictions VARCHAR(255), FOREIGN KEY (cuisine_id) REFERENCES cuisine(cuisine_id)); | Determine the percentage of dishes in the 'Mexican' cuisine category that are vegetarian. | SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM dishes WHERE cuisine_id = (SELECT cuisine_id FROM cuisine WHERE cuisine_name = 'Mexican'))) FROM dishes WHERE cuisine_id = (SELECT cuisine_id FROM cuisine WHERE cuisine_name = 'Mexican') AND dietary_restrictions LIKE '%Vegetarian%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SalesData (Id INT, Make VARCHAR(50), Model VARCHAR(50), FuelType VARCHAR(50), UnitsSold INT, SalesYear INT); | What is the total number of electric and hybrid vehicles sold in Europe in the 'SalesData' database? | SELECT SUM(UnitsSold) FROM SalesData WHERE FuelType IN ('Electric', 'Hybrid') AND Country = 'Germany' OR Country = 'France' OR Country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (player_id INT, player_name TEXT, country TEXT); INSERT INTO players VALUES (1, 'John Doe', 'Brazil'), (2, 'Jane Smith', 'Argentina'), (3, 'Bob Johnson', 'Canada'); CREATE TABLE games (game_id INT, game_name TEXT, country TEXT); INSERT INTO games VALUES (1, 'Game 1', 'Brazil'), (2, 'Game 2', 'Colom... | What is the number of unique games played by players from South America? | SELECT COUNT(DISTINCT player_games.game_id) FROM player_games JOIN players ON player_games.player_id = players.player_id JOIN games ON player_games.game_id = games.game_id WHERE players.country IN ('Brazil', 'Argentina', 'Colombia'); | gretelai_synthetic_text_to_sql |
CREATE TABLE digital_assets (id INT, name TEXT, launch_date DATE, value REAL); INSERT INTO digital_assets (id, name, launch_date, value) VALUES (16, 'Asset9', '2020-03-15', 150); INSERT INTO digital_assets (id, name, launch_date, value) VALUES (17, 'Asset10', '2020-12-31', 75); | Which digital assets were launched in 2020 and have a value greater than 100? | SELECT * FROM digital_assets WHERE YEAR(launch_date) = 2020 AND value > 100; | gretelai_synthetic_text_to_sql |
CREATE TABLE treatments (id INT PRIMARY KEY, patient_id INT, condition TEXT, city TEXT); INSERT INTO treatments (id, patient_id, condition, city) VALUES (1, 1, 'Anxiety', 'Seattle'); INSERT INTO treatments (id, patient_id, condition, city) VALUES (2, 2, 'Depression', 'Seattle'); INSERT INTO treatments (id, patient_id, ... | What is the most common mental health condition treated in Seattle? | SELECT condition, COUNT(*) FROM treatments WHERE city = 'Seattle' GROUP BY condition ORDER BY COUNT(*) DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE art_pieces (id INT, style VARCHAR(20), year_sold INT, revenue DECIMAL(10,2)); CREATE VIEW impressionist_sales AS SELECT * FROM art_pieces WHERE style = 'Impressionist'; | What was the total revenue for all Impressionist art pieces sold in 2020? | SELECT SUM(revenue) FROM impressionist_sales WHERE year_sold = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE gymhotels (id INT, name VARCHAR(255), region VARCHAR(255), has_gym BOOLEAN); INSERT INTO gymhotels (id, name, region, has_gym) VALUES (1, 'Fitness Hotel', 'Europe', 1); INSERT INTO gymhotels (id, name, region, has_gym) VALUES (2, 'Relax Hotel', 'Europe', 0); | Determine the number of hotels that offer 'gym' facilities in the 'Europe' region. | SELECT COUNT(*) FROM gymhotels WHERE region = 'Europe' AND has_gym = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (station_id INTEGER, name TEXT, latitude REAL, longitude REAL); INSERT INTO stations (station_id, name, latitude, longitude) VALUES (1, 'Downtown', 40.7128, -74.0060); | List all unique station names from the stations table | SELECT DISTINCT name FROM stations; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Region VARCHAR(20), MembershipDate DATE); INSERT INTO Members (MemberID, Region, MembershipDate) VALUES (1, 'New York', '2021-01-01'); CREATE TABLE WearableTech (DeviceID INT, MemberID INT, UsageDate DATE); INSERT INTO WearableTech (DeviceID, MemberID, UsageDate) VALUES (10, 1, '2021... | What is the total revenue generated from members in the New York region who use the wearable technology devices in the past 6 months? | SELECT SUM(Transactions.Amount) FROM Members INNER JOIN WearableTech ON Members.MemberID = WearableTech.MemberID INNER JOIN Transactions ON Members.MemberID = Transactions.MemberID WHERE Members.Region = 'New York' AND Transactions.TransactionDate BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) AND CURRENT_DATE; | gretelai_synthetic_text_to_sql |
CREATE TABLE virtual_tours (tour_id INT, city TEXT); INSERT INTO virtual_tours (tour_id, city) VALUES (1, 'Tokyo'), (2, 'Tokyo'), (3, 'Osaka'); | What is the number of virtual tours in each city? | SELECT city, COUNT(*) FROM virtual_tours GROUP BY city; | gretelai_synthetic_text_to_sql |
CREATE TABLE Project_Timeline (Project_ID INT, Project_Name TEXT, Location TEXT, Timeline INT, Type TEXT); INSERT INTO Project_Timeline (Project_ID, Project_Name, Location, Timeline, Type) VALUES (1, 'Green House', 'California', 12, 'Residential'), (2, 'Eco Office', 'New York', 18, 'Commercial'), (3, 'Solar Farm', 'Tex... | What is the average project timeline for commercial projects in California? | SELECT AVG(Timeline) FROM Project_Timeline WHERE Location = 'California' AND Type = 'Commercial'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, name TEXT, organic BOOLEAN, price DECIMAL, quantity INT); | Show the total inventory value for all organic products in the inventory. | SELECT SUM(price * quantity) as total_inventory_value FROM products WHERE organic = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID int, DonorType varchar(50), DonationAmount decimal(10,2), DonationDate date); INSERT INTO Donations (DonationID, DonorType, DonationAmount, DonationDate) VALUES (1, 'Corporation', 2500, '2022-01-10'); INSERT INTO Donations (DonationID, DonorType, DonationAmount, DonationDate) VALUES (... | What is the average donation amount by corporations in Q1 2022? | SELECT AVG(DonationAmount) FROM Donations WHERE DonorType = 'Corporation' AND DonationDate BETWEEN '2022-01-01' AND '2022-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE PlayerUsage (PlayerID INT, Platform VARCHAR(50), UsageTime FLOAT, UsageDate DATE); INSERT INTO PlayerUsage (PlayerID, Platform, UsageTime, UsageDate) VALUES (1, 'PS5', 240, '2022-08-01'), (2, 'Xbox', 300, '2022-08-02'), (3, 'Nintendo Switch', 120, '2022-08-01'); | What is the average time spent on the platform per day for each player who has used the platform for more than 2 hours, sorted by the average time in descending order? | SELECT PlayerID, AVG(UsageTime) AS AvgTimePerDay, Platform FROM PlayerUsage WHERE UsageTime > 2*60 GROUP BY PlayerID, Platform ORDER BY AvgTimePerDay DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE cyber_strategy_updates (strategy_update_id INT PRIMARY KEY, strategy_name VARCHAR(255), update_date DATE); INSERT INTO cyber_strategy_updates (strategy_update_id, strategy_name, update_date) VALUES (1, 'Firewall Implementation', '2021-01-05'), (2, 'Intrusion Detection System', '2020-06-10'), (3, 'Penetrati... | What cybersecurity strategies were implemented before 2022 and have been updated since then? | SELECT s.strategy_name FROM cyber_strategies s INNER JOIN cyber_strategy_updates u ON s.strategy_name = u.strategy_name WHERE s.implementation_year < 2022 AND u.update_date >= '2022-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (transaction_id INT, customer_id INT, product_id INT, category_id INT, transaction_date DATE, amount DECIMAL(10,2), gender VARCHAR(10)); CREATE TABLE customers (customer_id INT, age INT, name VARCHAR(255)); | What is the average daily transaction count for the last month, split by customer gender and day of the week? | SELECT c.gender, DATE_FORMAT(t.transaction_date, '%W') as day_of_week, AVG(COUNT(t.transaction_id)) as avg_daily_transaction_count FROM customers c INNER JOIN transactions t ON c.customer_id = t.customer_id WHERE t.transaction_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY c.gender, day_of_week; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (ArtistID int, ArtistName varchar(50), Gender varchar(10), CountryID int); CREATE TABLE Art (ArtID int, ArtName varchar(50), ArtistID int, ArtType varchar(50), GalleryID int); CREATE TABLE Galleries (GalleryID int, GalleryName varchar(50), CountryID int); | Who are the top 5 female photographers with the most works in European galleries? | SELECT Artists.ArtistName, COUNT(Art.ArtID) as TotalWorks FROM Artists INNER JOIN Art ON Artists.ArtistID = Art.ArtistID INNER JOIN Galleries ON Art.GalleryID = Galleries.GalleryID WHERE Artists.Gender = 'female' AND Galleries.CountryID IN (SELECT CountryID FROM Countries WHERE Continent = 'Europe') AND Art.ArtType = '... | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_offset_initiatives (initiative_id INT, initiative_name VARCHAR(100), location VARCHAR(50), start_date DATE); INSERT INTO carbon_offset_initiatives (initiative_id, initiative_name, location, start_date) VALUES (1, 'Carbon Farm 2', 'East', '2017-05-01'); INSERT INTO carbon_offset_initiatives (initiati... | How many carbon offset initiatives were started in the 'East' region after 2018-01-01? | SELECT COUNT(*) FROM carbon_offset_initiatives WHERE location = 'East' AND start_date > '2018-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE InfectiousDiseases (DiseaseID INT, State VARCHAR(20), Year INT, Disease VARCHAR(50)); INSERT INTO InfectiousDiseases (DiseaseID, State, Year, Disease) VALUES (1, 'New York', 2019, 'COVID-19'); INSERT INTO InfectiousDiseases (DiseaseID, State, Year, Disease) VALUES (2, 'New York', 2018, 'Influenza'); | What is the total number of infectious diseases reported in New York in 2019? | SELECT COUNT(*) FROM InfectiousDiseases WHERE State = 'New York' AND Year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (species_name TEXT, ocean TEXT); INSERT INTO marine_species (species_name, ocean) VALUES ('Whale Shark', 'Indian Ocean'), ('Olive Ridley Turtle', 'Indian Ocean'), ('Indian Mackerel', 'Indian Ocean'); | What is the total number of marine species found in the Indian ocean? | SELECT COUNT(*) FROM marine_species WHERE ocean = 'Indian Ocean'; | 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.