context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE players (id INT, platform VARCHAR(20), region VARCHAR(20), total_hours_played INT);CREATE TABLE game_sessions (id INT, player_id INT, session_duration INT, game_type VARCHAR(10)); | What is the total number of hours spent playing VR games by players, grouped by their preferred gaming platform and region? | SELECT p.platform, p.region, SUM(gs.session_duration) AS total_hours_played FROM players p INNER JOIN game_sessions gs ON p.id = gs.player_id WHERE gs.game_type = 'VR' GROUP BY p.platform, p.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE critical_habitats (id INT, habitat_id INT, reason VARCHAR(50)); INSERT INTO critical_habitats (id, habitat_id, reason) VALUES (1, 1, 'Endangered Species'), (2, 3, 'Biodiversity Hotspot'), (3, 4, 'Climate Change Impact'); CREATE TABLE habitats (id INT, type VARCHAR(50)); INSERT INTO habitats (id, type) VALU... | Identify habitats that require preservation efforts | SELECT h.type FROM habitats h INNER JOIN critical_habitats ch ON h.id = ch.habitat_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE organization (org_id INT, org_name TEXT); INSERT INTO organization (org_id, org_name) VALUES (1, 'Volunteers Inc'); INSERT INTO organization (org_id, org_name) VALUES (2, 'Helping Hands'); | Update the name of an existing organization | UPDATE organization SET org_name = 'Compassionate Communities' WHERE org_id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE gas_production (well_id INT, year INT, oil_production INT, gas_production INT); INSERT INTO gas_production (well_id, year, oil_production, gas_production) VALUES (1, 2018, 120000, 50000); INSERT INTO gas_production (well_id, year, oil_production, gas_production) VALUES (2, 2017, 130000, 60000); INSERT INTO... | What is the average gas production in Canada in 2018? | SELECT AVG(gas_production) FROM gas_production WHERE year = 2018 AND state = 'Canada'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT, company VARCHAR(255), price DECIMAL(5,2), name VARCHAR(255)); INSERT INTO products (id, company, price, name) VALUES (1, 'ABC', 50.99, 'Cleanser'), (2, 'DEF', 35.49, 'Toner'), (3, 'GHI', 65.99, 'Moisturizer'), (4, 'JKL', 25.99, 'Serum'); | What is the name of the most expensive product? | SELECT name FROM products WHERE price = (SELECT MAX(price) FROM products); | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (id INT, title VARCHAR(255), language VARCHAR(50), publication_date DATE); INSERT INTO articles (id, title, language, publication_date) VALUES (1, 'ArticleE', 'Spanish', '2021-01-01'), (2, 'ArticleF', 'English', '2022-12-31'), (3, 'ArticleG', 'French', '2022-01-01'), (4, 'ArticleH', 'Spanish', '20... | What is the total number of articles published in the Spanish language in 2021? | SELECT COUNT(*) FROM articles WHERE language = 'Spanish' AND YEAR(publication_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE mental_health_parity (id INT, worker_id INT, incident_date DATE, violation_count INT); INSERT INTO mental_health_parity (id, worker_id, incident_date, violation_count) VALUES (1, 123, '2021-01-01', 5), (2, 123, '2021-01-15', 3); CREATE TABLE community_health_workers (id INT, name VARCHAR(50), region VARCHA... | What is the number of mental health parity violation incidents reported by community health workers in New York? | SELECT SUM(violation_count) FROM mental_health_parity INNER JOIN community_health_workers ON mental_health_parity.worker_id = community_health_workers.id WHERE community_health_workers.region = 'New York'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_skincare_sales (customer_id INT, product_id INT, sale_price DECIMAL(5,2)); | What is the number of unique customers who have purchased skincare products in the 'customer_skincare_sales' table? | SELECT COUNT(DISTINCT customer_id) FROM customer_skincare_sales; | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_impact (region_id INT, drought_status VARCHAR(50), water_usage FLOAT); | List the regions and their water usage in cubic meters from the 'drought_impact' and 'water_usage' tables | SELECT drought_impact.region_id, drought_impact.drought_status, water_usage FROM drought_impact INNER JOIN water_usage ON drought_impact.region_id = water_usage.region_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE exoplanets (id INT, exoplanet_name VARCHAR(50), constellation VARCHAR(30), discovery_year INT); | How many exoplanets have been discovered in the constellation Cygnus? | SELECT COUNT(*) FROM exoplanets WHERE constellation = 'Cygnus'; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_objects_leo (id INT, name VARCHAR(255), mass FLOAT); INSERT INTO space_objects_leo (id, name, mass) VALUES (1, 'Space Object 1', 1000.0), (2, 'Space Object 2', 1500.0), (3, 'Space Object 3', 500.0); | What is the average mass of space objects in low Earth orbit? | SELECT AVG(mass) FROM space_objects_leo; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (id INT PRIMARY KEY, name VARCHAR(100), manufacturing_country VARCHAR(50)); INSERT INTO products (id, name, manufacturing_country) VALUES (1, 'productA', 'China'), (2, 'productB', 'Mexico'); | Delete all records from the "products" table where the "manufacturing_country" is "China" | DELETE FROM products WHERE manufacturing_country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE well_drilling (year INT, region VARCHAR(255), country VARCHAR(255), num_wells INT); INSERT INTO well_drilling (year, region, country, num_wells) VALUES (2017, 'North Sea', 'Norway', 25), (2017, 'North Sea', 'UK', 30), (2017, 'North Sea', 'Denmark', 12), (2018, 'North Sea', 'Norway', 28), (2018, 'North Sea'... | List the number of wells drilled in the North Sea by each country in 2019 | SELECT country, SUM(num_wells) FROM well_drilling WHERE year = 2019 AND region = 'North Sea' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Name VARCHAR(100), Age INT, FavoriteGenre VARCHAR(50), VRPossible BOOLEAN); INSERT INTO Players (PlayerID, Name, Age, FavoriteGenre, VRPossible) VALUES (1, 'John Doe', 25, 'Action', true), (2, 'Jane Smith', 28, 'Adventure', true), (3, 'James Johnson', 30, 'Simulation', true), (4, 'Em... | What's the total number of players who play action games on VR platforms? | SELECT COUNT(*) FROM Players WHERE FavoriteGenre = 'Action' AND VRPossible = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE YttriumProduction (Company VARCHAR(50), Year INT, Production FLOAT); INSERT INTO YttriumProduction(Company, Year, Production) VALUES ('CompanyA', 2018, 115.6), ('CompanyA', 2019, 134.8), ('CompanyA', 2020, 146.2), ('CompanyB', 2018, 98.1), ('CompanyB', 2019, 109.5), ('CompanyB', 2020, 120.9); | Find the yttrium production difference between 2018 and 2019 for each company. | SELECT Company, Production - LEAD(Production) OVER (PARTITION BY Company ORDER BY Year) as Difference FROM YttriumProduction WHERE Company IN ('CompanyA', 'CompanyB'); | gretelai_synthetic_text_to_sql |
CREATE TABLE stations (line_name VARCHAR(50), station_name VARCHAR(50), bikes_available INT); INSERT INTO stations (line_name, station_name, bikes_available) VALUES ('Green Line', 'Station A', 10), ('Green Line', 'Station B', 8), ('Green Line', 'Station C', 12); | How many bikes are available at each station on the Green Line? | SELECT station_name, bikes_available FROM stations WHERE line_name = 'Green Line'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product (product_id VARCHAR(10), name VARCHAR(50), price DECIMAL(5,2), supplier_id VARCHAR(10), origin VARCHAR(50), primary key (product_id)); | Delete all products that have 'Made in China' in 'origin' column | DELETE FROM product WHERE origin LIKE '%Made in China%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE market_trends (id INT, element VARCHAR(10), price DECIMAL(5,2), date DATE); INSERT INTO market_trends (id, element, price, date) VALUES (1, 'samarium', 28.25, '2022-01-01'), (2, 'samarium', 29.00, '2022-02-01'), (3, 'samarium', 30.00, '2022-03-01'); | Update the price of samarium oxide to $30.50 in the table 'market_trends' | UPDATE market_trends SET price = 30.50 WHERE element = 'samarium'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Research_Station (station_name VARCHAR(50), latitude NUMERIC(8,2), longitude NUMERIC(8,2), ocean_name VARCHAR(50)); INSERT INTO Research_Station (station_name, latitude, longitude, ocean_name) VALUES ('Station A', 40.7128, -74.0060, 'Pacific'), ('Station B', 34.0522, -118.2437, 'Indian'); CREATE TABLE Univ... | Which universities have marine research stations in the Pacific Ocean? | SELECT University.university_name FROM University INNER JOIN Research_Station ON University.station_name = Research_Station.station_name WHERE Research_Station.ocean_name = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ExcavationSites (SiteID INT PRIMARY KEY, Name VARCHAR(255), Country VARCHAR(255), StartDate DATE, EndDate DATE); INSERT INTO ExcavationSites (SiteID, Name, Country, StartDate, EndDate) VALUES (4, 'Rosetta Stone', 'Egypt', '1799-07-15', '1799-07-19'); CREATE TABLE Artifacts (ArtifactID INT PRIMARY KEY, Na... | Delete all records from 'Rosetta Stone' excavation. | DELETE FROM Artifacts WHERE SiteID = 4; DELETE FROM ExcavationSites WHERE SiteID = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (id INT, name VARCHAR(100), region VARCHAR(50), assets_value FLOAT); INSERT INTO customers (id, name, region, assets_value) VALUES (1, 'Oluwatobi Adebayo', 'Africa', 300000.00); | Delete all records of customers from 'Africa' region. | DELETE FROM customers WHERE region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (location VARCHAR(255), date DATE, temperature FLOAT); INSERT INTO weather_data (location, date, temperature) VALUES ('France', '2017-01-01', 4.2), ('France', '2017-01-02', 4.5), ('France', '2018-01-01', 3.9), ('France', '2018-01-02', 4.1), ('France', '2019-01-01', 3.7), ('France', '2019-01-02... | What is the average temperature trend in France over the past 5 years, based on historical IoT sensor data? | SELECT AVG(temperature) FROM (SELECT temperature FROM weather_data WHERE location = 'France' AND date BETWEEN '2017-01-01' AND '2021-12-31' GROUP BY YEAR(date)) AS subquery; | gretelai_synthetic_text_to_sql |
CREATE TABLE EventAttendance (event_id INT, region VARCHAR(50), attendees INT, event_date DATE); INSERT INTO EventAttendance (event_id, region, attendees, event_date) VALUES (200, 'Midwest', 500, '2021-01-01'), (201, 'Midwest', 600, '2021-02-01'), (202, 'West', 400, '2021-01-01'); | What was the maximum number of attendees at events in the Midwest region in 2021? | SELECT MAX(attendees) FROM EventAttendance WHERE region = 'Midwest' AND YEAR(event_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecraft_missions (id INT PRIMARY KEY, spacecraft_name VARCHAR(50), mission_name VARCHAR(50)); | Which spacecraft have been used in the most space missions? | SELECT spacecraft_name, COUNT(*) as num_missions FROM spacecraft_missions GROUP BY spacecraft_name ORDER BY num_missions DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE founders (founder_id INT, company_id INT, gender VARCHAR(10)); CREATE TABLE companies (company_id INT, industry VARCHAR(255)); INSERT INTO founders (founder_id, company_id, gender) VALUES (1, 1, 'Female'), (2, 2, 'Male'), (3, 3, 'Female'), (4, 4, 'Female'); INSERT INTO companies (company_id, industry) VALU... | What is the number of female founders in each industry? | SELECT industry, COUNT(f.founder_id) as num_female_founders FROM founders f JOIN companies c ON f.company_id = c.company_id WHERE f.gender = 'Female' GROUP BY industry; | gretelai_synthetic_text_to_sql |
CREATE TABLE bioprocess(id INT, investment VARCHAR(50), date DATE, amount DECIMAL(10,2)); INSERT INTO bioprocess VALUES (1, 'InvestmentA', '2021-04-15', 2000000.00), (2, 'InvestmentB', '2021-06-30', 1500000.00), (3, 'InvestmentC', '2021-02-28', 2500000.00); | What is the total investment in bioprocess engineering by month in 2021? | SELECT EXTRACT(MONTH FROM date), SUM(amount) FROM bioprocess GROUP BY EXTRACT(MONTH FROM date); | gretelai_synthetic_text_to_sql |
CREATE TABLE civil (case_id INT, client_name VARCHAR(50), case_type VARCHAR(20), case_outcome VARCHAR(20), case_date DATE); INSERT INTO civil (case_id, client_name, case_type, case_outcome, case_date) VALUES (7, 'Alice Davis', 'traffic', 'settled', '2021-02-22'); | Show the client_name and case_outcome for all cases in the 'civil' table | SELECT client_name, case_outcome FROM civil; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessel (vessel_id INT, name VARCHAR(255), type VARCHAR(255), max_speed DECIMAL(5,2)); CREATE TABLE Inspection (inspection_id INT, vessel_id INT, inspection_time TIMESTAMP); INSERT INTO Vessel (vessel_id, name, type, max_speed) VALUES (1, 'Test Vessel 1', 'Cargo', 20.5), (2, 'Test Vessel 2', 'Tanker', 15.2)... | Which vessels have been inspected in the last month? | SELECT v.vessel_id, v.name FROM Vessel v INNER JOIN Inspection i ON v.vessel_id = i.vessel_id WHERE i.inspection_time >= NOW() - INTERVAL '1 month'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_pledges (id INT, country VARCHAR(255), status VARCHAR(255)); | Update the 'climate_pledges' table by setting 'status' to 'active' for all records where 'country' is 'India' | UPDATE climate_pledges SET status = 'active' WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patients (id INT, name TEXT, state TEXT);CREATE TABLE treatments (id INT, patient_id INT, therapy TEXT); | Add a new record for a patient from Texas who received group therapy. | INSERT INTO patients (id, name, state) VALUES (1, 'Maria Rodriguez', 'Texas');INSERT INTO treatments (id, patient_id, therapy) VALUES (1, 1, 'Group Therapy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE community_support (donation_id INT, community VARCHAR(50), amount DECIMAL(10,2), donation_date DATE); INSERT INTO community_support (donation_id, community, amount, donation_date) VALUES (1, 'Hopeful Hearts Local Community', 150.00, '2021-01-01'), (2, 'United Neighbors (humanitarian aid)', 200.00, '2021-02... | How many total donations were made by 'local_communities' in the 'community_support' table? | SELECT SUM(amount) FROM community_support WHERE community LIKE '%local community%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergyFactories (id INT, num_employees INT); | What is the total number of employees in factories that use renewable energy? | select sum(num_employees) from RenewableEnergyFactories; | gretelai_synthetic_text_to_sql |
CREATE TABLE field6 (date DATE, temperature FLOAT); INSERT INTO field6 (date, temperature) VALUES ('2021-10-20', 15.2), ('2021-10-21', 16.1), ('2021-10-22', 17.3); | Calculate the average temperature for the last 7 days for 'field6'. | SELECT AVG(temperature) FROM field6 WHERE date >= (CURRENT_DATE - INTERVAL '7 days'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Music_Videos (artist VARCHAR(255), viewership INT); INSERT INTO Music_Videos (artist, viewership) VALUES ('Artist1', 10000000), ('Artist2', 15000000), ('Artist3', 20000000), ('Artist4', 12000000), ('Artist5', 18000000); | What is the average viewership for each artist's music videos? | SELECT artist, AVG(viewership) FROM Music_Videos GROUP BY artist; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, app_type VARCHAR(10), severity VARCHAR(10), timestamp TIMESTAMP); | Compare the number of high and medium severity vulnerabilities found in the last quarter for web and desktop applications. | SELECT app_type, severity, COUNT(*) as total FROM vulnerabilities WHERE severity IN ('high', 'medium') AND timestamp >= NOW() - INTERVAL 3 MONTH GROUP BY app_type, severity; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (contract_id INT, contract_date DATE, contract_value DECIMAL(10,2), contractor TEXT, industry TEXT); | What is the total value of defense contracts awarded to companies in the aerospace industry in the last fiscal year? | SELECT SUM(contract_value) FROM defense_contracts WHERE industry = 'aerospace' AND contract_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND contract_date < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR - INTERVAL 1 DAY); | gretelai_synthetic_text_to_sql |
CREATE TABLE provider (provider_id INT, name VARCHAR(50), location VARCHAR(20), patients_served INT); INSERT INTO provider (provider_id, name, location, patients_served) VALUES (1, 'Rural Provider A', 'Alaska', 700); INSERT INTO provider (provider_id, name, location, patients_served) VALUES (2, 'Rural Provider B', 'Ala... | What is the total number of healthcare providers in rural areas of Alaska, serving more than 500 patients? | SELECT location, COUNT(*) FROM provider WHERE patients_served > 500 AND location = 'Alaska' GROUP BY location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Providers (ID INT, Name TEXT, Specialty TEXT); INSERT INTO Providers (ID, Name, Specialty) VALUES (1, 'Dr. A', 'Primary Care'); INSERT INTO Providers (ID, Name, Specialty) VALUES (2, 'Dr. B', 'Pediatrics'); | What is the total number of primary care physicians and pediatricians in the database? | SELECT COUNT(*) FROM Providers WHERE Specialty = 'Primary Care' UNION SELECT COUNT(*) FROM Providers WHERE Specialty = 'Pediatrics'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (code INT, name VARCHAR(50), type VARCHAR(50), manufacturer VARCHAR(50), last_updated TIMESTAMP); | What is the name of the manufacturer for the latest unmanned aerial vehicle (UAV) in the 'military_tech' table? | SELECT manufacturer FROM military_tech WHERE type = 'UAV' AND last_updated = (SELECT MAX(last_updated) FROM military_tech WHERE type = 'UAV'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_hotels (id INT, name TEXT, country TEXT, reviews INT); INSERT INTO sustainable_hotels (id, name, country, reviews) VALUES (1, 'Eco-Hotel', 'Germany', 180), (2, 'Green-Lodge', 'Germany', 120), (3, 'Nature-Resort', 'Italy', 200); | List the number of sustainable hotels in each country that have more than 150 reviews. | SELECT country, COUNT(*) as hotel_count FROM sustainable_hotels WHERE reviews > 150 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE subscribers (id INT, service VARCHAR(10), region VARCHAR(20)); INSERT INTO subscribers (id, service, region) VALUES (1, 'mobile', 'Southeast Asia'), (2, 'broadband', 'Southeast Asia'); CREATE TABLE usage (subscriber_id INT, data_usage FLOAT, year INT); INSERT INTO usage (subscriber_id, data_usage, year) VA... | What is the average mobile data usage in GB per customer in the Southeast Asia region for the past year? | SELECT AVG(usage.data_usage/1024/1024/1024) FROM usage JOIN subscribers ON usage.subscriber_id = subscribers.id WHERE subscribers.service = 'mobile' AND subscribers.region = 'Southeast Asia' AND usage.year BETWEEN 2021 AND 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE caribou_data (id INT, community VARCHAR(255), population INT); INSERT INTO caribou_data (id, community, population) VALUES (1, 'Gwich’in', 1000), (2, 'Inuit', 800); CREATE TABLE community_data (id INT, community VARCHAR(255), population INT); INSERT INTO community_data (id, community, population) VALUES (1... | Which indigenous communities are affected by the decline in caribou populations? | SELECT a.community FROM caribou_data a JOIN community_data b ON a.community = b.community WHERE a.population < b.population; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT, animal_type VARCHAR(50), size_km FLOAT); INSERT INTO habitats (id, animal_type, size_km) VALUES (1, 'Mammal', 45.1), (2, 'Reptile', 25.1); | What is the minimum size (in square kilometers) of a habitat for animals in the 'habitats' table that are not mammals? | SELECT MIN(size_km) FROM habitats WHERE animal_type != 'Mammal'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, donor_name VARCHAR(50), donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donors (id, donor_name, donation_amount, donation_date) VALUES (4, 'Jamie Smith', 120.00, '2022-01-05'), (5, 'Ali Hassan', 180.00, '2022-02-20'), (6, 'Park Soo-jin', 220.00, '2022-03-12'); | What was the average donation amount per donor for donations made in 2022? | SELECT AVG(donation_amount) as average_donation_amount FROM donors WHERE donation_date BETWEEN '2022-01-01' AND '2022-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE bridge_construction (id INT, project_name TEXT, location TEXT, cost INT, completion_date DATE); INSERT INTO bridge_construction (id, project_name, location, cost, completion_date) VALUES (1, 'Houston Tunnel', 'Texas', 12000000, '2018-08-25'); INSERT INTO bridge_construction (id, project_name, location, cos... | What was the total cost of bridge construction projects in 'Texas' in 2018? | SELECT SUM(cost) FROM bridge_construction WHERE location = 'Texas' AND YEAR(completion_date) = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (id INT, name TEXT, age INT); CREATE TABLE Donations (id INT, volunteer_id INT, amount FLOAT); INSERT INTO Volunteers (id, name, age) VALUES (1, 'Fatima', 35), (2, 'Jakub', 40); INSERT INTO Donations (id, volunteer_id, amount) VALUES (1, 1, 300.0), (2, 2, 150.0); | What are the names and ages of volunteers who made donations greater than $200? | SELECT Volunteers.name, Volunteers.age FROM Volunteers INNER JOIN Donations ON Volunteers.id = Donations.volunteer_id WHERE Donations.amount > 200.0; | gretelai_synthetic_text_to_sql |
CREATE TABLE species (id INT, name VARCHAR(50), habitat_type VARCHAR(50), habitat_depth FLOAT); | Calculate the total habitat depth for all marine species. | SELECT SUM(habitat_depth) FROM species; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, category VARCHAR(20), quantity INT); INSERT INTO products (product_id, category, quantity) VALUES (1, 'apparel', 50), (2, 'accessories', 70), (3, 'home_decor', 40), (4, 'electronics', 600), (5, 'grocery', 60), (6, 'toys', 30), (7, 'furniture', 150); | Calculate the total quantity of products in all categories | SELECT SUM(quantity) FROM products; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_strategies (strategy_id INT, ESG_score FLOAT, risk_level INT); INSERT INTO investment_strategies (strategy_id, ESG_score, risk_level) VALUES (101, 86.2, 3), (102, 78.9, 5), (103, 88.7, 2), (104, 65.1, 1); | Count the number of investment strategies for each risk level. | SELECT risk_level, COUNT(*) FROM investment_strategies GROUP BY risk_level; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name TEXT, gender TEXT, birth_date DATE); INSERT INTO Artists VALUES (1, 'Leonardo da Vinci', 'Male', '1452-04-15'); INSERT INTO Artists VALUES (2, 'Michelangelo', 'Male', '1475-03-06'); INSERT INTO Artists VALUES (3, 'Artemisia Gentileschi', 'Female', '1593-07-08'); | Who is the oldest artist in the database? | SELECT name, MAX(birth_date) as birth_date FROM Artists; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_acidification_impact (species_id INTEGER, species_name VARCHAR(255), impact VARCHAR(50)); | How many marine species are impacted by ocean acidification? | SELECT COUNT(species_id) FROM ocean_acidification_impact WHERE impact IS NOT NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability (id INT, age_group VARCHAR(50), score FLOAT); INSERT INTO financial_capability (id, age_group, score) VALUES (1, '18-24', 6.5), (2, '25-34', 7.2), (3, '35-44', 8.0), (4, '45-54', 8.5), (5, '55-64', 7.8), (6, '65+', 7.0); | What is the financial capability score distribution across different age groups? | SELECT age_group, AVG(score) as avg_score, STDDEV(score) as std_dev FROM financial_capability GROUP BY age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE community(id INT, name VARCHAR(255), population INT, language VARCHAR(255)); | Insert new records into the community table | INSERT INTO community (id, name, population, language) VALUES (1, 'Inuit', 80000, 'Inuktitut'); INSERT INTO community (id, name, population, language) VALUES (2, 'Sami', 80000, 'Northern Sami'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Sales (SaleID int, Genre varchar(50), SalesDate date, Revenue decimal(10,2)); INSERT INTO Sales VALUES (1, 'Latin Pop', '2021-01-01', 5000); INSERT INTO Sales VALUES (2, 'Reggaeton', '2021-02-01', 7000); INSERT INTO Sales VALUES (3, 'Salsa', '2021-03-01', 6000); | What is the total revenue generated by Latin music genres in 2021? | SELECT SUM(Revenue) as TotalRevenue FROM Sales WHERE Genre like 'Latin%' AND YEAR(SalesDate) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_statistics (id INT PRIMARY KEY, project_id INT, workers_count INT, FOREIGN KEY (project_id) REFERENCES project(id)); INSERT INTO labor_statistics (id, project_id, workers_count) VALUES (1, 1, 50); | Identify the number of workers per sustainable material used in projects | SELECT sm.material_name, AVG(l.workers_count) AS avg_workers_count FROM labor_statistics l INNER JOIN project p ON l.project_id = p.id INNER JOIN building_permit bp ON p.id = bp.project_id INNER JOIN sustainable_material sm ON bp.id = sm.permit_id WHERE sm.material_name IN ('Recycled Steel', 'Bamboo Flooring') GROUP BY... | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (state VARCHAR(2), capacity INT); INSERT INTO landfill_capacity (state, capacity) VALUES ('CA', 1500000), ('NY', 1200000), ('NJ', 1000000); | What is the maximum landfill capacity in the state of California? | SELECT MAX(capacity) FROM landfill_capacity WHERE state = 'CA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE contracts (id INT PRIMARY KEY, project_id INT, contract_start_date DATE, contract_end_date DATE); INSERT INTO contracts (id, project_id, contract_start_date, contract_end_date) VALUES (1, 1, '2024-01-01', '2026-12-31'); | Which projects have contracts starting in the first quarter of 2024? | SELECT project_id FROM contracts WHERE contract_start_date BETWEEN '2024-01-01' AND '2024-03-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE state_health_equity (state VARCHAR(2), num_community_health_workers INT); INSERT INTO state_health_equity (state, num_community_health_workers) VALUES ('NY', 10), ('CA', 5), ('TX', 0); CREATE VIEW community_health_workers_by_state AS SELECT state, COUNT(*) FROM community_health_workers GROUP BY state; | List all states that do not have any community health workers. | SELECT state FROM state_health_equity WHERE num_community_health_workers = 0 INTERSECT SELECT state FROM community_health_workers_by_state; | gretelai_synthetic_text_to_sql |
CREATE TABLE equipment_inventory (id INT, type VARCHAR(50), quantity INT); INSERT INTO equipment_inventory (id, type, quantity) VALUES (1, 'Drilling Machine', 15); INSERT INTO equipment_inventory (id, type, quantity) VALUES (2, 'Excavator', 8); INSERT INTO equipment_inventory (id, type, quantity) VALUES (3, 'Bulldozer'... | Delete all records from the 'equipment_inventory' table where the quantity is 0. | DELETE FROM equipment_inventory WHERE quantity = 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_cities (city_name TEXT, energy_consumption FLOAT); INSERT INTO smart_cities VALUES ('CityA', 500.0), ('CityB', 700.0), ('CityC', 300.0); | What is the average energy consumption per smart city? | SELECT AVG(energy_consumption) FROM smart_cities; | gretelai_synthetic_text_to_sql |
CREATE TABLE greenhouses (id INT, name VARCHAR(255), location VARCHAR(255), min_temp DECIMAL(4,2), max_temp DECIMAL(4,2)); INSERT INTO greenhouses (id, name, location, min_temp, max_temp) VALUES (1, 'Greenhouse A', 'Spain', 20.1, 25.6); INSERT INTO greenhouses (id, name, location, min_temp, max_temp) VALUES (2, 'Greenh... | What is the minimum and maximum temperature range (in Celsius) for greenhouses in Spain? | SELECT location, MIN(min_temp) as min_temp, MAX(max_temp) as max_temp FROM greenhouses WHERE location = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE campaigns (id INT, name VARCHAR(255), country VARCHAR(255), start_date DATE); INSERT INTO campaigns (id, name, country, start_date) VALUES (1, 'Mindful Asia', 'China', '2016-01-01'); INSERT INTO campaigns (id, name, country, start_date) VALUES (2, 'Asian Hope', 'Japan', '2018-05-01'); INSERT INTO campaigns... | List the mental health campaigns in Asia that started after 2015. | SELECT name FROM campaigns WHERE country = 'Asia' AND start_date > '2015-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (id INT, program_name VARCHAR(50), budget INT, department VARCHAR(50)); INSERT INTO support_programs (id, program_name, budget, department) VALUES (1, 'Mentorship Program', 10000, 'Education'), (2, 'Tutoring Program', 15000, 'Education'), (3, 'Accessibility Improvements', 25000, 'IT'); | What is the total budget for support programs in the 'IT' department? | SELECT SUM(support_programs.budget) AS total_budget FROM support_programs WHERE support_programs.department = 'IT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Manufacturers (manufacturer_id INT, manufacturer_name VARCHAR(50), region VARCHAR(50), renewable_energy_source VARCHAR(50)); INSERT INTO Manufacturers (manufacturer_id, manufacturer_name, region, renewable_energy_source) VALUES (1, 'ManufacturerA', 'North America', 'Solar'), (2, 'ManufacturerB', 'Europe', ... | List all the renewable energy sources used by manufacturers in the North America region | SELECT manufacturer_name, renewable_energy_source FROM Manufacturers WHERE region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (DonationID INT, DonorID INT, Amount DECIMAL, DonationDate DATE); INSERT INTO Donations (DonationID, DonorID, Amount, DonationDate) VALUES (1, 1, 50.00, '2021-01-01'); INSERT INTO Donations (DonationID, DonorID, Amount, DonationDate) VALUES (2, 1, 75.00, '2021-03-15'); INSERT INTO Donations (Dona... | Delete the donation with ID 2. | DELETE FROM Donations WHERE DonationID = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE cargo_tracking (cargo_id INT, cargo_type VARCHAR(50), weight FLOAT); INSERT INTO cargo_tracking (cargo_id, cargo_type, weight) VALUES (1, 'CargoType1', 5000), (2, 'CargoType2', 7000), (3, 'CargoType3', 6000); | What is the total weight of each cargo type in the 'cargo_tracking' table? | SELECT cargo_type, SUM(weight) as total_weight FROM cargo_tracking GROUP BY cargo_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_categories (category_id INT, category_name VARCHAR(50)); CREATE TABLE product_sales (product_id INT, category_id INT, sales_amount DECIMAL(5,2)); INSERT INTO product_categories (category_id, category_name) VALUES (1, 'Clothing'), (2, 'Footwear'); INSERT INTO product_sales (product_id, category_id, ... | What is the total revenue for each product category in the product_category_sales table? | SELECT pc.category_name, SUM(ps.sales_amount) FROM product_categories pc INNER JOIN product_sales ps ON pc.category_id = ps.category_id GROUP BY pc.category_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE garment_production (production_id INT, country VARCHAR(50), garment_type VARCHAR(50), production_date DATE, quantity INT); | How many garments were produced per country in 2021? | SELECT country, SUM(quantity) FROM garment_production WHERE production_date BETWEEN '2021-01-01' AND '2021-12-31' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE water_quality (region VARCHAR(255), year INT, contaminant_level INT); INSERT INTO water_quality (region, year, contaminant_level) VALUES ('North', 2018, 10), ('North', 2019, 12), ('North', 2020, 15), ('South', 2018, 15), ('South', 2019, 18), ('South', 2020, 20); CREATE TABLE conservation_initiatives (regio... | Which conservation initiatives were implemented in regions with increasing contaminant levels in 2019? | SELECT c.initiative FROM conservation_initiatives c JOIN water_quality w ON c.region = w.region WHERE c.year = w.year AND w.contaminant_level > (SELECT contaminant_level FROM water_quality WHERE region = w.region AND year = w.year - 1); | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_competency_trainings (training_id INT, location VARCHAR(50), date DATE); INSERT INTO cultural_competency_trainings (training_id, location, date) VALUES (1, 'Los Angeles, CA', '2022-01-01'), (2, 'San Diego, CA', '2022-02-01'), (3, 'San Francisco, CA', '2022-03-01'); | How many cultural competency trainings were conducted in California? | SELECT COUNT(*) FROM cultural_competency_trainings WHERE location LIKE '%CA%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shrimp_farms (id INT, name TEXT, country TEXT, salinity FLOAT); INSERT INTO shrimp_farms (id, name, country, salinity) VALUES (1, 'Farm M', 'Thailand', 30.5); INSERT INTO shrimp_farms (id, name, country, salinity) VALUES (2, 'Farm N', 'Thailand', 32.1); INSERT INTO shrimp_farms (id, name, country, salinity... | What is the minimum water salinity level for all shrimp farms in Thailand? | SELECT MIN(salinity) FROM shrimp_farms WHERE country = 'Thailand'; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_date DATE, supplier VARCHAR(255), product VARCHAR(255), quantity INT); | How many units of each product were sold in the last month, by supplier? | SELECT supplier, product, SUM(quantity) AS qty_sold, DATE_TRUNC('month', sale_date) AS sale_month FROM sales WHERE sale_date >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') GROUP BY supplier, product, sale_month; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_charging_stations (id INT, station_type VARCHAR(50), installation_cost FLOAT, country VARCHAR(50)); INSERT INTO ev_charging_stations (id, station_type, installation_cost, country) VALUES (1, 'Level 1', 1200, 'USA'), (2, 'Level 2', 2500, 'UK'), (3, 'DC Fast Charger', 40000, 'Japan'), (4, 'Tesla Superchar... | What is the average installation cost of electric vehicle charging stations in the UK? | SELECT AVG(installation_cost) FROM ev_charging_stations WHERE country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, price DECIMAL(5,2), country TEXT); INSERT INTO products (product_id, product_name, price, country) VALUES (1, 'T-Shirt', 20.99, 'Italy'); INSERT INTO products (product_id, product_name, price, country) VALUES (2, 'Jeans', 50.49, 'France'); INSERT INTO products (... | How many products are made in each country? | SELECT country, COUNT(*) FROM products GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE farming_equipment_vendors (id INT, vendor VARCHAR(255), region VARCHAR(255), product_count INT); INSERT INTO farming_equipment_vendors (id, vendor, region, product_count) VALUES (6, 'EU GreenTech', 'Europe', 16), (7, 'AgriEase', 'North America', 10), (8, 'PrecisionPlus', 'Europe', 22), (9, 'FarmMate', 'Asi... | List the names of the precision farming equipment vendors that have more than 15 products in the European market. | SELECT vendor FROM farming_equipment_vendors WHERE region = 'Europe' AND product_count > 15; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (project_id INT, start_date DATE, end_date DATE, material_cost FLOAT); INSERT INTO Projects (project_id, start_date, end_date, material_cost) VALUES (1, '2021-01-01', '2021-03-31', 7000), (2, '2021-01-01', '2021-04-15', 9000), (3, '2022-01-01', '2022-03-31', 8000); | What is the total cost of sustainable building materials for projects that started in 2021 and lasted more than 3 months? | SELECT SUM(material_cost) FROM Projects WHERE start_date < end_date AND start_date >= '2021-01-01' AND end_date < '2022-01-01' AND material_cost > 0; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityEngagement (id INT, country VARCHAR(50), year INT, num_visitors INT); | What is the total number of visitors from African countries who engaged with | SELECT SUM(num_visitors) FROM CommunityEngagement WHERE country IN (SELECT name FROM Countries WHERE continent = 'Africa') AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Sites (SiteID int, SiteName varchar(50)); INSERT INTO Sites VALUES (1, 'Site A'), (2, 'Site B'); CREATE TABLE Artifacts (ArtifactID int, SiteID int, ArtifactType varchar(50), Quantity int); INSERT INTO Artifacts VALUES (1, 1, 'Lithic', 120), (2, 1, 'Ceramic', 30), (3, 2, 'Lithic', 150), (4, 2, 'Ceramic', 5... | What is the historical context of excavation sites with the highest number of lithic artifacts? | SELECT Sites.SiteName, HistoricalContext.HistoricalPeriod FROM (SELECT Sites.SiteName, SUM(Artifacts.Quantity) as TotalLithics FROM Artifacts INNER JOIN Sites ON Artifacts.SiteID = Sites.SiteID WHERE ArtifactType = 'Lithic' GROUP BY Sites.SiteName ORDER BY TotalLithics DESC LIMIT 1) as Subquery INNER JOIN Sites ON Subq... | gretelai_synthetic_text_to_sql |
CREATE TABLE therapists (id INT PRIMARY KEY, age INT, gender TEXT, specialty TEXT); INSERT INTO therapists (id, age, gender, specialty) VALUES (1, 45, 'Female', 'CBT'); INSERT INTO therapists (id, age, gender, specialty) VALUES (2, 50, 'Male', 'DBT'); | What is the average age of therapists specializing in CBT? | SELECT AVG(age) FROM therapists WHERE specialty = 'CBT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE reporters (id INT, gender VARCHAR(255), salary DECIMAL(10,2)); INSERT INTO reporters (id, gender, salary) VALUES (1, 'Male', 90000.00), (2, 'Female', 80000.00), (3, 'Male', 85000.00) | What is the maximum salary for male reporters in the 'reporters' table? | SELECT MAX(salary) FROM reporters WHERE gender = 'Male'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policyholders (PolicyID INT, Name VARCHAR(50), CoverageLimit DECIMAL(10,2)); INSERT INTO Policyholders (PolicyID, Name, CoverageLimit) VALUES (1, 'John Doe', 750000.00), (2, 'Jane Smith', 400000.00); | Which policyholders have a coverage limit over $500,000? Update their records with a new category 'High Limit'. | WITH UpdatedLimits AS (UPDATE Policyholders SET Category = 'High Limit' WHERE CoverageLimit > 500000 RETURNING *) SELECT * FROM UpdatedLimits; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (id INT PRIMARY KEY, name TEXT, gender TEXT, sustainable_practices BOOLEAN); CREATE TABLE products (id INT PRIMARY KEY, name TEXT, supplier_id INT, FOREIGN KEY (supplier_id) REFERENCES suppliers(id)); | What are the products made by women-owned suppliers? | SELECT products.name, suppliers.name AS supplier_name FROM products INNER JOIN suppliers ON products.supplier_id = suppliers.id WHERE suppliers.gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergencies (eid INT, call_time TIME, response_time INT); | What is the average response time for emergency calls on weekends? | SELECT AVG(response_time) FROM emergencies WHERE DAYOFWEEK(call_time) IN (1, 7); | gretelai_synthetic_text_to_sql |
CREATE TABLE TeacherProfessionalDevelopment (TeacherID INT, DevelopmentType VARCHAR(50), StartDate DATE, EndDate DATE); INSERT INTO TeacherProfessionalDevelopment (TeacherID, DevelopmentType, StartDate, EndDate) VALUES (1, 'Workshop', '2022-03-01', '2022-03-03'), (2, 'Conference', '2022-04-01', '2022-04-05'), (3, 'Onli... | Create a view for teacher professional development types | CREATE VIEW DevelopmentTypes AS SELECT DISTINCT DevelopmentType FROM TeacherProfessionalDevelopment; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityC_VehicleMovement (vehicle_id INT, vehicle_type VARCHAR(20), is_autonomous BOOLEAN, distance FLOAT); INSERT INTO CityC_VehicleMovement (vehicle_id, vehicle_type, is_autonomous, distance) VALUES (1, 'Car', true, 56.2), (2, 'Bike', false, 12.4), (3, 'Car', false, 34.6), (4, 'Bus', true, 78.9); | What is the total distance traveled by autonomous vehicles in CityC? | SELECT SUM(distance) FROM CityC_VehicleMovement WHERE is_autonomous = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE carbon_sequestration (id INT, country VARCHAR(255), year INT, sequestration FLOAT, hectares FLOAT); INSERT INTO carbon_sequestration (id, country, year, sequestration, hectares) VALUES (1, 'Canada', 2018, 1000.2, 12000000.5), (2, 'Australia', 2019, 1100.1, 15000000.3), (3, 'Brazil', 2018, 1300.0, 20000000.... | What is the average carbon sequestration per hectare for each country in 2020? | SELECT country, AVG(sequestration/hectares) as avg_sequestration FROM carbon_sequestration WHERE year = 2020 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE drug_sales_category(drug_category VARCHAR(255), sale_date DATE, amount DECIMAL(10,2)); INSERT INTO drug_sales_category(drug_category, sale_date, amount) VALUES ('Analgesics', '2021-04-01', 1000), ('Analgesics', '2021-04-15', 1500), ('Antidepressants', '2021-04-01', 2000), ('Antidepressants', '2021-04-15', ... | What are the sales figures for a specific drug category in Q2 2021? | SELECT drug_category, SUM(amount) as total_sales FROM drug_sales_category WHERE sale_date BETWEEN '2021-04-01' AND '2021-06-30' GROUP BY drug_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE ftm_transactions (transaction_id INT, to_address VARCHAR(42), gas_limit INT, timestamp BIGINT); | What is the maximum gas limit set for transactions involving the smart contract with the address '0x8901234567890123456789012345678901234567' on the Fantom Opera network? | SELECT MAX(gas_limit) FROM ftm_transactions WHERE to_address = '0x8901234567890123456789012345678901234567'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (donation_id INT, donation_amount FLOAT, donation_date DATE); INSERT INTO Donations (donation_id, donation_amount, donation_date) VALUES (1, 500.00, '2021-01-01'), (2, 300.00, '2021-01-15'), (3, 400.00, '2021-02-20'), (4, 250.00, '2021-03-10'), (5, 600.00, '2021-03-15'), (6, 100.00, '2021-07-04')... | How many donations were made in the first half of 2021? | SELECT COUNT(*) FROM Donations WHERE YEAR(donation_date) = 2021 AND MONTH(donation_date) <= 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryCollaborations (ID INT, CollaborationName TEXT, CollaborationDate DATE, Country1 TEXT, Country2 TEXT); INSERT INTO MilitaryCollaborations VALUES (1, 'Collaboration 1', '2003-01-01', 'USA', 'UK'); CREATE VIEW FrequentCollaborators AS SELECT Country1 as Country FROM MilitaryCollaborations UNION SELEC... | Which countries have participated in the most military innovation collaborations in the last 2 decades, along with the number of collaborations? | SELECT fc.Country, COUNT(*) as CollaborationCount FROM FrequentCollaborators fc JOIN MilitaryCollaborations mc ON fc.Country = mc.Country1 OR fc.Country = mc.Country2 WHERE mc.CollaborationDate BETWEEN DATEADD(year, -20, GETDATE()) AND GETDATE() GROUP BY fc.Country ORDER BY CollaborationCount DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE SafetyRecords (id INT, vessel_id INT, safety_score DECIMAL(3,2), year INT); | Identify the number of vessels in the Mediterranean Sea with safety records exceeding 95% in the last 5 years. | SELECT COUNT(DISTINCT V.id) FROM Vessels V JOIN SafetyRecords SR ON V.id = SR.vessel_id WHERE SR.safety_score > 0.95 AND SR.year BETWEEN (YEAR(NOW()) - 5) AND YEAR(NOW()) AND V.latitude BETWEEN 30 AND 45 AND V.longitude BETWEEN -20 AND 45; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stores (StoreID INT, StoreName VARCHAR(50)); INSERT INTO Stores (StoreID, StoreName) VALUES (1, 'Store A'), (2, 'Store B'); CREATE TABLE Menu (MenuID INT, MenuItem VARCHAR(50), Type VARCHAR(20), StoreID INT); INSERT INTO Menu (MenuID, MenuItem, Type, StoreID) VALUES (1, 'Falafel', 'Vegetarian', 1), (2, 'Ch... | What is the total quantity of vegan items sold per store? | SELECT StoreID, SUM(Quantity) as TotalQuantity FROM Sales s JOIN Menu m ON s.MenuID = m.MenuID WHERE Type = 'Vegan' GROUP BY StoreID; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_capability_programs (program_id INT, country VARCHAR, start_date DATE); INSERT INTO financial_capability_programs (program_id, country, start_date) VALUES (1, 'Indonesia', '2021-05-01'); INSERT INTO financial_capability_programs (program_id, country, start_date) VALUES (2, 'Indonesia', '2022-02-1... | List financial capability programs in Indonesia, ordered by start date. | SELECT * FROM financial_capability_programs WHERE country = 'Indonesia' ORDER BY start_date; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_tech (id INT, tech VARCHAR(50), country VARCHAR(50), year INT, spending INT); INSERT INTO military_tech (id, tech, country, year, spending) VALUES (1, 'Drones', 'USA', 2019, 5000000), (2, 'Cybersecurity', 'USA', 2019, 7000000), (3, 'Artificial Intelligence', 'USA', 2019, 8000000), (4, 'Drones', 'C... | What are the top 3 military technologies by spending in the last 3 years, and which countries have invested the most in them? | SELECT tech, country, SUM(spending) as total_spending FROM military_tech WHERE year BETWEEN 2019 AND 2021 GROUP BY tech, country HAVING COUNT(*) >= 3 ORDER BY total_spending DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE news_reporters (id INT, name VARCHAR(50), gender VARCHAR(10), age INT, department VARCHAR(30)); CREATE TABLE news_stories (id INT, title VARCHAR(100), content TEXT, reporter_id INT, department VARCHAR(30)); | How many news stories have been published in each department in the "news_reporters" table? | SELECT news_reporters.department, COUNT(news_stories.id) FROM news_reporters INNER JOIN news_stories ON news_reporters.department = news_stories.department GROUP BY news_reporters.department; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255), industry VARCHAR(255), founding_date DATE); | Update the industry for "SmartEco" to "Green Technology" | UPDATE company SET industry = 'Green Technology' WHERE name = 'SmartEco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE product_categories (id INT, product_id INT, category VARCHAR(255)); INSERT INTO product_categories (id, product_id, category) VALUES (1, 1, 'Electronics'), (2, 2, 'Clothing'), (3, 3, 'Home Appliances'); CREATE TABLE sales (id INT, product_id INT, sale_date DATE, quantity_sold INT); INSERT INTO sales (id, p... | List the products that have the highest sales quantity in each category. | SELECT p.name, p.category, MAX(s.quantity_sold) as max_quantity_sold FROM products p JOIN product_categories pc ON p.id = pc.product_id JOIN sales s ON pc.product_id = s.product_id GROUP BY p.name, p.category; | gretelai_synthetic_text_to_sql |
CREATE TABLE incidents (id INT, region TEXT, incident_date DATE); INSERT INTO incidents (id, region, incident_date) VALUES (1, 'North America', '2021-08-15'); INSERT INTO incidents (id, region, incident_date) VALUES (2, 'Europe', '2021-09-20'); INSERT INTO incidents (id, region, incident_date) VALUES (3, 'North America... | List all security incidents in the North America region from the last quarter. | SELECT * FROM incidents WHERE region = 'North America' AND incident_date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Europium_Price (year INT, price FLOAT); INSERT INTO Europium_Price (year, price) VALUES (2015, 300), (2016, 320), (2017, 340), (2018, 360), (2019, 380), (2020, 400); | What is the trend of Europium price from 2016 to 2020? | SELECT year, price FROM Europium_Price WHERE year BETWEEN 2016 AND 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_projects (project_id INT, city VARCHAR(50), annual_budget FLOAT); INSERT INTO smart_city_projects (project_id, city, annual_budget) VALUES (1, 'Tokyo', 15000000), (2, 'Seoul', 18000000), (3, 'Hong Kong', 12000000), (4, 'Shanghai', 16000000); | What is the average smart city technology adoption budget per city in Asia? | SELECT AVG(annual_budget) FROM (SELECT DISTINCT annual_budget FROM smart_city_projects WHERE city IN ('Tokyo', 'Seoul', 'Hong Kong', 'Shanghai') ORDER BY annual_budget) | 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.