context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE waste_type (waste_type_id INT, waste_type VARCHAR(50)); INSERT INTO waste_type (waste_type_id, waste_type) VALUES (1, 'Plastic'), (2, 'Paper'), (3, 'Glass'), (4, 'Metal'); CREATE TABLE recycling_rate (year INT, waste_type_id INT, recycling_rate FLOAT); INSERT INTO recycling_rate (year, waste_type_id, recyc... | What is the paper recycling rate in Germany for the years 2017 and 2018? | SELECT r.recycling_rate FROM recycling_rate r JOIN waste_type w ON r.waste_type_id = w.waste_type_id WHERE w.waste_type = 'Paper' AND r.year IN (2017, 2018); | gretelai_synthetic_text_to_sql |
CREATE TABLE conservation_initiatives (initiative_id INT, initiative_name VARCHAR(100), budget FLOAT); | Show the water conservation initiatives and their corresponding budgets from the 'conservation_initiatives' table | SELECT initiative_name, budget FROM conservation_initiatives; | gretelai_synthetic_text_to_sql |
CREATE TABLE Emissions (sector VARCHAR(255), emissions FLOAT); INSERT INTO Emissions VALUES ('Energy', 3000.0), ('Industry', 2500.0), ('Agriculture', 2000.0), ('Transportation', 1500.0); | What are the total emissions for each sector in descending order, excluding the "Transportation" sector? | SELECT sector, emissions FROM Emissions WHERE sector != 'Transportation' ORDER BY emissions DESC | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (id INT, name TEXT, location TEXT, Neodymium_production_2021 FLOAT); | What is the average monthly production of Neodymium in 2021 from the 'mines' table? | SELECT AVG(Neodymium_production_2021) FROM mines WHERE YEAR(month) = 2021 AND month BETWEEN '01-01' AND '12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE city_properties (city VARCHAR(50), property_id INT); | List the number of properties in each city in the database, ordered by the number of properties in descending order. | SELECT city, COUNT(*) AS count FROM city_properties GROUP BY city ORDER BY count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory (inventory_id INT PRIMARY KEY, menu_item VARCHAR(50), inventory_quantity INT, inventory_cost DECIMAL(5,2), inventory_date DATE); CREATE TABLE Menu (menu_item VARCHAR(50) PRIMARY KEY, menu_item_category VARCHAR(50)); | What is the total inventory cost for each menu item in the "appetizer" category? | SELECT m.menu_item, SUM(i.inventory_cost * i.inventory_quantity) FROM Inventory i JOIN Menu m ON i.menu_item = m.menu_item WHERE m.menu_item_category = 'appetizer' GROUP BY m.menu_item; | gretelai_synthetic_text_to_sql |
CREATE TABLE NationalSecurity (id INT, title VARCHAR(50), level VARCHAR(50), description TEXT, date DATE); INSERT INTO NationalSecurity (id, title, level, description, date) VALUES (1, 'National Cyber Strategy', 'Secret', 'Description...', '2018-09-20'); | What is the maximum length of cyber strategy descriptions? | SELECT MAX(LENGTH(description)) FROM NationalSecurity WHERE title LIKE '%Cyber%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_plans (plan_id INT, plan_name VARCHAR(50), data_limit INT, price DECIMAL(5,2), contract_length INT, created_at TIMESTAMP); | Delete a mobile plan from the mobile_plans table | DELETE FROM mobile_plans WHERE plan_id = 2001; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artworks (Artist VARCHAR(50), Artwork VARCHAR(50), Year INT); INSERT INTO Artworks | Update the year of an artwork by Frida Kahlo | UPDATE Artworks SET Year = 1941 WHERE Artist = 'Frida Kahlo' AND Artwork = 'Self-Portrait' | gretelai_synthetic_text_to_sql |
CREATE TABLE accident_records_new (id INT PRIMARY KEY, location VARCHAR(50), accident_date DATE); | List all the accidents that occurred in locations where safety inspections failed. | SELECT a.location, a.accident_date FROM accident_records_new a INNER JOIN safety_inspections_new s ON a.location = s.location WHERE s.passed = FALSE; | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_data (id INT, system_name VARCHAR(30), system_type VARCHAR(20), popularity INT); | What is the most popular type of transportation in 'transportation_data' table? | SELECT system_type, MAX(popularity) FROM transportation_data GROUP BY system_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE team_fan_data (id INT, team VARCHAR(50), fans INT); INSERT INTO team_fan_data (id, team, fans) VALUES (1, 'Yankees', 20000), (2, 'Mets', 18000); | What is the total number of fans for each team? | SELECT team, SUM(fans) as total_fans FROM team_fan_data GROUP BY team; | gretelai_synthetic_text_to_sql |
CREATE TABLE SpacecraftManufacturers (id INT, country VARCHAR(50), num_spacecraft INT); INSERT INTO SpacecraftManufacturers (id, country, num_spacecraft) VALUES (1, 'USA', 20), (2, 'Russia', 15), (3, 'China', 12), (4, 'India', 8), (5, 'Germany', 6); | What is the total number of spacecraft manufactured by each country? | SELECT country, SUM(num_spacecraft) FROM SpacecraftManufacturers GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE Workouts (WorkoutID INT, MemberID INT, WorkoutDate DATE, Duration INT); INSERT INTO Workouts (WorkoutID, MemberID, WorkoutDate, Duration) VALUES (1, 1, '2022-01-01', 60); INSERT INTO Workouts (WorkoutID, MemberID, WorkoutDate, Duration) VALUES (2, 1, '2022-01-03', 90); INSERT INTO Workouts (WorkoutID, Memb... | How many workouts were done by all members in January? | SELECT COUNT(*) FROM Workouts WHERE WorkoutDate BETWEEN '2022-01-01' AND '2022-01-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AAS_Articles(id INT, title VARCHAR(50), publication DATE, category VARCHAR(20)); | What is the number of articles published daily in 'Austin American-Statesman' for a month? | SELECT COUNT(*) FROM AAS_Articles WHERE publication BETWEEN '2022-06-01' AND '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Policies (PolicyID INT, PolicyType VARCHAR(20), IssueState VARCHAR(20), RiskScore DECIMAL(5,2)); INSERT INTO Policies (PolicyID, PolicyType, IssueState, RiskScore) VALUES (1, 'Auto', 'California', 0.25), (2, 'Home', 'California', 0.15), (3, 'Life', 'California', 0.35); | What is the policy type and corresponding risk score for each policy, ordered by risk score in ascending order, for policies issued in 'California'? | SELECT PolicyType, RiskScore FROM Policies WHERE IssueState = 'California' ORDER BY RiskScore ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(255), genre VARCHAR(255), age INT); INSERT INTO Artists (id, name, genre, age) VALUES (1, 'Artist1', 'R&B', 30); CREATE TABLE Festivals (id INT, artist VARCHAR(255), date DATE); INSERT INTO Festivals (id, artist) VALUES (1, 'Artist1'); | What is the minimum age of R&B artists who have performed at festivals? | SELECT MIN(age) FROM Artists WHERE name IN (SELECT artist FROM Festivals WHERE genre = 'R&B'); | gretelai_synthetic_text_to_sql |
CREATE TABLE corn_moisture (crop_type TEXT, measurement_date DATE, soil_moisture INT); INSERT INTO corn_moisture (crop_type, measurement_date, soil_moisture) VALUES ('Corn', '2022-06-01', 650), ('Corn', '2022-06-15', 630); CREATE TABLE soybeans_moisture (crop_type TEXT, measurement_date DATE, soil_moisture INT); INSERT... | Compare the soil moisture levels of Corn and Soybeans crops in the same month and year. | SELECT 'Corn' AS crop_type, AVG(soil_moisture) AS avg_moisture FROM corn_moisture WHERE measurement_date BETWEEN '2022-06-01' AND '2022-06-15' UNION SELECT 'Soybeans' AS crop_type, AVG(soil_moisture) FROM soybeans_moisture WHERE measurement_date BETWEEN '2022-06-01' AND '2022-06-15'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Projects (id INT, name VARCHAR(50), category VARCHAR(50), cost FLOAT, year_started INT, year_completed INT); INSERT INTO Projects (id, name, category, cost, year_started, year_completed) VALUES (1, 'Dam Reconstruction', 'Water Supply', 500000, 2018, 2020), (2, 'Wastewater Treatment', 'Waste Management', 60... | What was the total cost of projects that started in 2018 and were completed in 2020? | SELECT SUM(cost) FROM Projects WHERE year_started = 2018 AND year_completed = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_chatbots (region VARCHAR(20), interaction_date DATE, interactions INT); INSERT INTO ai_chatbots (region, interaction_date, interactions) VALUES ('Europe', '2022-06-10', 50), ('Americas', '2022-06-15', 100), ('Asia Pacific', '2022-06-20', 75); | What is the total number of AI-powered chatbot interactions in the 'Americas' region for the month of June 2022? | SELECT SUM(interactions) FROM ai_chatbots WHERE region = 'Americas' AND MONTH(interaction_date) = 6 AND YEAR(interaction_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE polkadot_validators (validator_id VARCHAR(50), staked_tokens DECIMAL(18,0)); | What is the total number of validators in the Polkadot network that have staked more than 1,000 DOT tokens? | SELECT COUNT(*) FROM polkadot_validators WHERE staked_tokens > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE ClimateMitigationProjects (project_id INT, project_name VARCHAR(50), country VARCHAR(50), year INT); INSERT INTO ClimateMitigationProjects (project_id, project_name, country, year) VALUES (1, 'Solar Power Installation', 'Fiji', 2020), (2, 'Wind Turbine Construction', 'Mauritius', 2021); CREATE TABLE Countr... | Find the number of climate mitigation projects in Small Island Developing States (SIDS) for each year. | SELECT sids, year, COUNT(*) as num_projects FROM ClimateMitigationProjects JOIN CountrySIDS ON ClimateMitigationProjects.country = CountrySIDS.country GROUP BY sids, year; | gretelai_synthetic_text_to_sql |
CREATE TABLE VeteranJobs (JobID INT, JobTitle VARCHAR(50), Quarter INT, Year INT, JobApplications INT); INSERT INTO VeteranJobs (JobID, JobTitle, Quarter, Year, JobApplications) VALUES (1, 'Software Engineer', 2, 2021, 25), (2, 'Mechanical Engineer', 2, 2021, 30), (3, 'Data Analyst', 2, 2021, 20), (4, 'Project Manager'... | List the number of veteran job applications received in Q3 2021? | SELECT SUM(JobApplications) FROM VeteranJobs WHERE Quarter = 3 AND Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name VARCHAR(100), department VARCHAR(100)); INSERT INTO faculty (id, name, department) VALUES (1, 'Faculty Name', 'English'); CREATE TABLE grants (id INT, title VARCHAR(100), pi_name VARCHAR(100), pi_department VARCHAR(100), start_date DATE, end_date DATE); INSERT INTO grants (id, title, ... | What is the average number of research grants received per faculty member in the College of Arts and Humanities in the past 3 years? | SELECT AVG(num_grants) as avg_grants FROM (SELECT pi_department, COUNT(*) as num_grants FROM grants WHERE pi_department = 'English' AND start_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) AND CURRENT_DATE GROUP BY pi_department) AS subquery WHERE pi_department = 'English'; | gretelai_synthetic_text_to_sql |
CREATE TABLE athlete_games (athlete_id INT, game_id INT); CREATE TABLE athletes (athlete_id INT PRIMARY KEY); | Delete athlete records who have not participated in any games in the 'athlete_games' table | DELETE FROM athletes WHERE athletes.athlete_id NOT IN (SELECT athlete_id FROM athlete_games); | gretelai_synthetic_text_to_sql |
CREATE TABLE vuln_assessments (id INT, severity VARCHAR(10), description TEXT); INSERT INTO vuln_assessments (id, severity, description) VALUES (1, 'high', 'SQL Injection'), (2, 'medium', 'Cross-Site Scripting'), (3, 'high', 'Privilege Escalation'); | What is the total number of high severity vulnerabilities in the 'vuln_assessments' table? | SELECT COUNT(*) FROM vuln_assessments WHERE severity = 'high'; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_contracts (contract_id INT, platform VARCHAR(50), language VARCHAR(50), complexity INT); INSERT INTO smart_contracts (contract_id, platform, language, complexity) VALUES (1, 'Ethereum', 'Solidity', 5), (2, 'Ethereum', 'Solidity', 7), (3, 'Ethereum', 'Vyper', 3), (4, 'EOS', 'C++', 8), (5, 'EOS', 'Pyth... | Identify the top 3 smart contract platforms by total number of deployed smart contracts. | SELECT platform, COUNT(*) as num_contracts FROM smart_contracts GROUP BY platform ORDER BY num_contracts DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales_data (drug_name TEXT, country TEXT, sales INTEGER); | What is the total sales of all drugs in 'Asia'? | SELECT SUM(sales) FROM sales_data WHERE country = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE VIEW research_grants AS SELECT g.id, g.grant_name, g.amount, g.start_date, g.end_date, m.species_name FROM grants g JOIN marine_species m ON g.species_id = m.id; | Select all marine species research grants from the 'research_grants' view | SELECT * FROM research_grants; | gretelai_synthetic_text_to_sql |
CREATE TABLE materials (id INT, name VARCHAR(255), type VARCHAR(255), PRIMARY KEY(id)); INSERT INTO materials (id, name, type) VALUES (12, 'Hemp', 'Fabric'); CREATE TABLE products (id INT, name VARCHAR(255), category VARCHAR(255), price DECIMAL(10, 2), material_id INT, PRIMARY KEY(id), FOREIGN KEY (material_id) REFEREN... | What is the total revenue of hemp clothing? | SELECT SUM(price) FROM products WHERE name IN ('Hemp T-Shirt', 'Hemp Pants') AND material_id = (SELECT id FROM materials WHERE name = 'Hemp'); | gretelai_synthetic_text_to_sql |
CREATE TABLE arctic_temperature (year INT, temperature FLOAT); INSERT INTO arctic_temperature (year, temperature) VALUES (2000, 1.2), (2001, 1.3), (2002, 1.5); | What is the average temperature increase in the Arctic region for each year since 2000, ordered by year? | SELECT AVG(temperature) as avg_temp, year FROM arctic_temperature WHERE year >= 2000 GROUP BY year ORDER BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(255), registered_date DATETIME); | Which users liked a post with hashtag #climatechange in the past month? | SELECT users.name FROM users JOIN posts ON users.id = posts.user_id WHERE posts.post_date >= DATEADD(month, -1, GETDATE()) AND hashtags.name = '#climatechange'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_bias_mitigation_algorithms (id INT, algorithm_name VARCHAR(30)); INSERT INTO ai_bias_mitigation_algorithms (id, algorithm_name) VALUES (1, 'FairAI 1.0'); INSERT INTO ai_bias_mitigation_algorithms (id, algorithm_name) VALUES (2, 'FairAI 2.0'); INSERT INTO ai_bias_mitigation_algorithms (id, algorithm_name... | What are the AI bias mitigation algorithms that are not used in any AI explainability transactions? | SELECT algorithm_name FROM ai_bias_mitigation_algorithms WHERE id NOT IN (SELECT algorithm_id FROM ai_explainability_transactions); | gretelai_synthetic_text_to_sql |
CREATE TABLE Sensor (sensor_id INT, location VARCHAR(20), last_seen DATE); | List all sensors and their last known location for the past month. | SELECT sensor_id, location, MAX(last_seen) FROM Sensor WHERE last_seen >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) GROUP BY sensor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_wellbeing_data (customer_id INT, score INT, country VARCHAR(50)); INSERT INTO financial_wellbeing_data (customer_id, score, country) VALUES (1, 70, 'USA'), (2, 80, 'Germany'), (3, 60, 'Japan'), (4, 90, 'Canada'), (5, 75, 'Australia'), (6, 65, 'USA'); CREATE VIEW financial_wellbeing_view AS SELECT... | What is the average financial wellbeing score for customers in each country? | SELECT country, avg_score FROM financial_wellbeing_view; | gretelai_synthetic_text_to_sql |
CREATE TABLE public_meetings (id INT, state VARCHAR, year INT, meetings INT); INSERT INTO public_meetings (id, state, year, meetings) VALUES (1, 'California', 2020, 12), (2, 'California', 2020, 15); | What is the maximum number of public meetings held by the government in the state of California in 2020? | SELECT MAX(meetings) FROM public_meetings WHERE state = 'California' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE animal_population (id INT, animal_name VARCHAR(50), population INT); INSERT INTO animal_population (id, animal_name, population) VALUES (1, 'Tiger', 2000), (2, 'Elephant', 5000), (3, 'Giraffe', 8000); | Find the average population of animals in the 'animal_population' table | SELECT AVG(population) FROM animal_population; | gretelai_synthetic_text_to_sql |
CREATE TABLE funds(id INT, disaster_name TEXT, country TEXT, amount FLOAT, year INT); INSERT INTO funds(id, disaster_name, country, amount, year) VALUES (1, 'Earthquake', 'Haiti', 500000.00, 2020), (2, 'Hurricane', 'Haiti', 750000.00, 2019), (3, 'Flood', 'Haiti', 600000.00, 2018); | What is the total amount of funds raised for disaster relief efforts in Haiti in the year 2020? | SELECT SUM(amount) FROM funds WHERE country = 'Haiti' AND year = 2020 AND disaster_name <> 'Earthquake'; | gretelai_synthetic_text_to_sql |
CREATE TABLE co_ownership_agreements (agreement_id INT, property_id INT, co_owner_id INT, co_ownership_percentage FLOAT); INSERT INTO co_ownership_agreements (agreement_id, property_id, co_owner_id, co_ownership_percentage) VALUES (1, 101, 1, 50.0), (2, 101, 2, 50.0), (3, 102, 1, 75.0), (4, 102, 2, 25.0); | What is the maximum co-ownership percentage in the co_ownership_agreements table? | SELECT MAX(co_ownership_percentage) FROM co_ownership_agreements; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, customer_name TEXT, country TEXT, revenue FLOAT); INSERT INTO customers (customer_id, customer_name, country, revenue) VALUES (1, 'John Doe', 'USA', 5000.00), (2, 'Jane Smith', 'Canada', 3000.00); | What is the total revenue generated from US-based customers in Q2 2021? | SELECT SUM(revenue) FROM customers WHERE country = 'USA' AND EXTRACT(MONTH FROM order_date) BETWEEN 4 AND 6; | gretelai_synthetic_text_to_sql |
CREATE TABLE Clients (ClientID INT, Name TEXT); INSERT INTO Clients VALUES (1, 'Jones'), (2, 'Brown'), (3, 'Davis'); CREATE TABLE NYCases (CaseID INT, ClientID INT, Outcome TEXT); INSERT INTO NYCases VALUES (1, 1, 'Won'), (2, 2, 'Lost'), (3, 3, 'Won'); CREATE TABLE TXCases (CaseID INT, ClientID INT, Outcome TEXT); INSE... | What are the names of clients who have had cases in both New York and Texas? | SELECT c.Name FROM Clients c INNER JOIN NYCases n ON c.ClientID = n.ClientID WHERE n.Outcome = 'Won' INTERSECT SELECT c.Name FROM Clients c INNER JOIN TXCases t ON c.ClientID = t.ClientID WHERE t.Outcome = 'Won'; | gretelai_synthetic_text_to_sql |
CREATE TABLE public.green_buildings (id SERIAL PRIMARY KEY, building_name VARCHAR(255), energy_efficiency_rating INTEGER); INSERT INTO public.green_buildings (building_name, energy_efficiency_rating) VALUES ('SolarTower', 98), ('WindScraper', 97), ('GeoDome', 96); | Add a new green building to the green_buildings table | INSERT INTO public.green_buildings (building_name, energy_efficiency_rating) VALUES ('EcoSphere', 99); | gretelai_synthetic_text_to_sql |
CREATE TABLE AI_ethics (id INT, initiative VARCHAR(255)); CREATE TABLE tech_for_good (id INT, initiative VARCHAR(255)); | What's the total number of ethical AI initiatives in the AI_ethics and tech_for_good tables? | SELECT COUNT(*) FROM AI_ethics UNION SELECT COUNT(*) FROM tech_for_good; | gretelai_synthetic_text_to_sql |
CREATE TABLE regions (region_id INT, region TEXT, country TEXT); CREATE TABLE virtual_tours (tour_id INT, title TEXT, region_id INT, rating FLOAT); INSERT INTO regions VALUES (1, 'London', 'United Kingdom'), (2, 'Edinburgh', 'United Kingdom'); INSERT INTO virtual_tours VALUES (1, 'London Virtual Tour', 1, 4.6), (2, 'Ed... | Calculate the average rating of virtual tours in the United Kingdom. | SELECT AVG(rating) FROM virtual_tours WHERE country = 'United Kingdom'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fairness_issues (issue_id INT, model_name TEXT, country TEXT, reported_date DATE); INSERT INTO fairness_issues (issue_id, model_name, country, reported_date) VALUES (1, 'ModelA', 'India', '2021-01-01'), (2, 'ModelB', 'Canada', '2021-02-01'), (3, 'ModelC', 'US', '2021-03-01'), (4, 'ModelD', 'India', '2021-0... | How many fairness issues have been reported in the US for ModelX? | SELECT COUNT(*) FROM fairness_issues WHERE model_name = 'ModelX' AND country = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer (customer_id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE debit_card (transaction_id INT, customer_id INT, value DECIMAL(10,2), timestamp TIMESTAMP); | What is the average transaction value for each customer in the "debit_card" table, grouped by their country? | SELECT c.country, AVG(dc.value) as avg_value FROM customer c JOIN debit_card dc ON c.customer_id = dc.customer_id GROUP BY c.country; | gretelai_synthetic_text_to_sql |
CREATE TABLE the_guardian (article_id INT, title VARCHAR(255), publish_date DATE, author VARCHAR(255), length INT, category VARCHAR(255)); INSERT INTO the_guardian (article_id, title, publish_date, author, length, category) VALUES (1, 'Article 9', '2022-01-09', 'Author 9', 1000, 'technology'); CREATE TABLE technology (... | What is the average length of articles published by 'The Guardian' in the 'technology' category? | SELECT AVG(length) FROM the_guardian WHERE category = 'technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, name TEXT, sector TEXT); INSERT INTO companies (id, name, sector) VALUES (1, 'SocialCo', 'social_impact'), (2, 'ImpactInc', 'social_impact'), (3, 'ChangeOrg', 'non-profit'), (4, 'GreenCorp', 'renewable_energy'); | How many companies are there in total? | SELECT COUNT(*) FROM companies; | gretelai_synthetic_text_to_sql |
CREATE TABLE initiatives (id INT, title TEXT, budget INT, category TEXT, submit_date DATE); | What is the total budget for initiatives that are related to "public_safety" and were submitted after 2019-01-01 in the "initiatives" table? | SELECT SUM(budget) FROM initiatives WHERE category = 'public_safety' AND submit_date > '2019-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_clinics (id INT, region VARCHAR(255), name VARCHAR(255), patient_volume INT); INSERT INTO rural_clinics (id, region, name, patient_volume) VALUES (1, 'Appalachian', 'Clinic A', 50), (2, 'Great Plains', 'Clinic B', 75), (3, 'Mississippi Delta', 'Clinic C', 100); | What is the average patient volume for rural clinics in the Great Plains region, ordered from highest to lowest? | SELECT AVG(patient_volume) as avg_volume FROM rural_clinics WHERE region = 'Great Plains' ORDER BY avg_volume DESC; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensor; CREATE TABLE if not exists biosensor.patents (id INT, name TEXT, country TEXT); INSERT INTO biosensor.patents (id, name, country) VALUES (1, 'PatentX', 'UK'); INSERT INTO biosensor.patents (id, name, country) VALUES (2, 'PatentY', 'USA'); INSERT INTO biosensor.patents (id, name, c... | How many biosensor technology patents were filed in the UK? | SELECT COUNT(*) FROM biosensor.patents WHERE country = 'UK'; | gretelai_synthetic_text_to_sql |
CREATE TABLE dishes (id INT, name VARCHAR(50), is_vegan BOOLEAN, price INT); INSERT INTO dishes (id, name, is_vegan, price) VALUES (1, 'Veggie Burger', TRUE, 7), (2, 'Steak', FALSE, 20), (3, 'Tofu Stir Fry', TRUE, 12); | Calculate the average price of vegan dishes | SELECT AVG(price) FROM dishes WHERE is_vegan = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE seagrass_meadows (id INT, country VARCHAR(50), name VARCHAR(50), type VARCHAR(50), biomass_tons FLOAT); INSERT INTO seagrass_meadows (id, country, name, type, biomass_tons) VALUES (1, 'Indonesia', 'Bali Seagrass Meadows', 'Turtle Grass', 50); INSERT INTO seagrass_meadows (id, country, name, type, biomass_t... | What is the total biomass of seagrass meadows in each country, categorized by type? | SELECT country, type, SUM(biomass_tons) FROM seagrass_meadows GROUP BY country, type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (exhibition_name TEXT, exhibition_duration INT); | What is the most common exhibition_duration for exhibitions? | SELECT exhibition_duration, COUNT(*) as duration_count FROM Exhibitions GROUP BY exhibition_duration ORDER BY duration_count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE economic_diversification (id INT, country VARCHAR(50), year INT, effort FLOAT); INSERT INTO economic_diversification (id, country, year, effort) VALUES (1, 'Indonesia', 2020, 0.9); | What is the maximum economic diversification effort in Indonesia in 2020? | SELECT MAX(effort) FROM economic_diversification WHERE country = 'Indonesia' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Ingredients (item VARCHAR(50), cost DECIMAL(10,2)); | What is the minimum cost of ingredients for any menu item? | SELECT MIN(cost) FROM Ingredients; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtWorkSales (artworkID INT, artistID INT, saleDate DATE, revenue DECIMAL(10,2)); CREATE TABLE Artists (artistID INT, artistName VARCHAR(50)); | Who are the top 5 artists with the highest total revenue in 2021? | SELECT a.artistName, SUM(aws.revenue) as total_revenue FROM ArtWorkSales aws JOIN Artists a ON aws.artistID = a.artistID WHERE YEAR(aws.saleDate) = 2021 GROUP BY a.artistName ORDER BY total_revenue DESC LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE temperature (year INT, avg_temp FLOAT, avg_ocean_temp FLOAT); | Display the change in ocean temperatures for each year compared to avg. | SELECT t1.year, t1.avg_temp - t2.avg_ocean_temp AS temp_change FROM temperature t1 INNER JOIN temperature t2 ON t1.year = t2.year WHERE t2.year = t1.year - 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Accommodation (AccommodationID INT, AccommodationType VARCHAR(50), Cost DECIMAL(10,2), AccommodationDate DATE); INSERT INTO Accommodation (AccommodationID, AccommodationType, Cost, AccommodationDate) VALUES (1, 'Sign Language Interpreter', 150.00, '2021-02-01'); INSERT INTO Accommodation (AccommodationID, ... | What is the total amount spent on disability accommodations, categorized by accommodation type, for the current fiscal year? | SELECT AccommodationType, SUM(Cost) AS TotalCost FROM Accommodation WHERE AccommodationDate >= DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE()), 0) AND AccommodationDate < DATEADD(YEAR, DATEDIFF(YEAR, 0, GETDATE()) + 1, 0) GROUP BY AccommodationType; | gretelai_synthetic_text_to_sql |
CREATE TABLE socially_responsible_bonds (id INT PRIMARY KEY, issuer_id INT, interest_rate DECIMAL(10,2), maturity DATE, is_green BOOLEAN); CREATE TABLE issuers (id INT PRIMARY KEY, name VARCHAR(255), industry VARCHAR(255), country VARCHAR(255)); | Who are the issuers and interest rates of all socially responsible bonds in the Netherlands that mature after December 31, 2026 and have an is_green value of true? | SELECT issuers.name, socially_responsible_bonds.interest_rate, socially_responsible_bonds.maturity FROM issuers JOIN socially_responsible_bonds ON issuers.id = socially_responsible_bonds.issuer_id WHERE issuers.country = 'Netherlands' AND socially_responsible_bonds.is_green = TRUE AND socially_responsible_bonds.maturit... | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (patient_id INT, age INT, gender TEXT, diagnosis TEXT, state TEXT, location TEXT); | What is the total number of patients diagnosed with cancer in rural areas of each state? | SELECT state, SUM(CASE WHEN diagnosis = 'Cancer' THEN 1 ELSE 0 END) FROM patient WHERE location LIKE '%rural%' GROUP BY state; | gretelai_synthetic_text_to_sql |
CREATE TABLE members (member_id INT, name VARCHAR(50), gender VARCHAR(10), dob DATE); INSERT INTO members (member_id, name, gender, dob) VALUES (1, 'John Doe', 'Male', '1990-01-01'); INSERT INTO members (member_id, name, gender, dob) VALUES (2, 'Jane Smith', 'Female', '1985-05-15'); CREATE TABLE workout_sessions (sessi... | How many workout sessions were there in total for each month in 2023? | SELECT MONTH(session_date) AS month, COUNT(*) AS total_sessions FROM workout_sessions WHERE YEAR(session_date) = 2023 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, name VARCHAR(255), manufacturer VARCHAR(255), launch_date DATE); INSERT INTO satellites (id, name, manufacturer, launch_date) VALUES (1, 'FalconSat', 'SpaceX', '2020-01-01'), (2, 'Cubesat', 'Blue Origin', '2019-01-01'), (3, 'Electron', 'Rocket Lab', '2021-01-01'), (4, 'Starlink 1', 'Spa... | What is the name and launch date of the first 5 satellites deployed by SpaceX? | SELECT name, launch_date FROM satellites WHERE manufacturer = 'SpaceX' LIMIT 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_clinic (id INT, name VARCHAR(50), gender VARCHAR(10), age INT); INSERT INTO rural_clinic (id, name, gender, age) VALUES (1, 'John Doe', 'Male', 45), (2, 'Jane Smith', 'Female', 34); | Find the number of male and female patients in the "rural_clinic" | SELECT gender, COUNT(*) FROM rural_clinic GROUP BY gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinicians (id INT PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(50), last_name VARCHAR(50)); INSERT INTO clinicians (first_name, last_name) VALUES ('John', 'Doe'), ('Jane', 'Smith'); | Add a new clinician 'Alex' with the last name 'Johnson' to the "clinicians" table | INSERT INTO clinicians (first_name, last_name) VALUES ('Alex', 'Johnson'); | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, ESG_rating FLOAT) | What is the ESG rating for the company with id 10? | SELECT ESG_rating FROM companies WHERE id = 10 | gretelai_synthetic_text_to_sql |
CREATE TABLE CircularEconomy (country VARCHAR(50), adoption_rate FLOAT); INSERT INTO CircularEconomy (country, adoption_rate) VALUES ('Brazil', 0.2), ('Argentina', 0.18), ('Colombia', 0.15); | What is the average circular economy initiative adoption rate in South America? | SELECT AVG(adoption_rate) FROM CircularEconomy WHERE country IN ('Brazil', 'Argentina', 'Colombia', 'Peru', 'Chile') AND country LIKE 'South%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE incident_types (id INT, timestamp TIMESTAMP, incident_type VARCHAR(255)); | What is the distribution of incident types, in the last week, pivoted by day? | SELECT DATE(timestamp) AS incident_day, incident_type, COUNT(*) as incident_count FROM incident_types WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 WEEK) GROUP BY incident_day, incident_type ORDER BY incident_day; | gretelai_synthetic_text_to_sql |
CREATE TABLE co_owned_properties (property_id INT, size FLOAT, city VARCHAR(20)); INSERT INTO co_owned_properties (property_id, size, city) VALUES (1, 1200.0, 'Oakland'), (2, 1500.0, 'San_Francisco'); | What is the average size of co-owned properties in the city of Oakland? | SELECT AVG(size) FROM co_owned_properties WHERE city = 'Oakland'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name VARCHAR(255), category VARCHAR(255), price DECIMAL(10,2), is_organic BOOLEAN); INSERT INTO products (product_id, product_name, category, price, is_organic) VALUES (1, 'Rose Hip Oil', 'Skincare', 25.99, true), (2, 'Vitamin C Serum', 'Skincare', 39.99, false); | What is the total revenue of organic skincare products sold in the US? | SELECT SUM(price) FROM products WHERE category = 'Skincare' AND is_organic = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_development (id INT, location VARCHAR(255), year INT, completed BOOLEAN); | What is the total number of community development projects completed in the last 3 years in Latin America? | SELECT SUM(completed) FROM community_development WHERE location LIKE '%Latin America%' AND completed = TRUE AND year > (SELECT MAX(year) FROM community_development WHERE location LIKE '%Latin America%' AND completed = TRUE AND year < (SELECT MAX(year) FROM community_development WHERE location LIKE '%Latin America%') - ... | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation (innovation_id INT, success_rate DECIMAL(5,2), implementation_date DATE); | Which agricultural innovation metrics in the 'rural_development' schema's 'agricultural_innovation' table have a success rate above 75% and were implemented in the last 3 years? | SELECT innovation_id, success_rate FROM agricultural_innovation WHERE implementation_date >= DATE_SUB(CURRENT_DATE, INTERVAL 3 YEAR) AND success_rate > 75; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (id INT, name VARCHAR(255), region VARCHAR(255)); INSERT INTO Companies (id, name, region) VALUES (1, 'CompanyA', 'North America'), (2, 'CompanyB', 'Europe'); | What is the total number of digital assets issued by companies based in North America? | SELECT COUNT(*) FROM Companies WHERE region = 'North America' JOIN DigitalAssets ON Companies.id = DigitalAssets.company_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE users (user_id INT, country VARCHAR(255));CREATE TABLE transactions (transaction_id INT, user_id INT, revenue DECIMAL(10,2), transaction_date DATE); INSERT INTO users (user_id, country) VALUES (1, 'United States'); INSERT INTO transactions (transaction_id, user_id, revenue, transaction_date) VALUES (1, 1, ... | What was the total revenue generated from users in the United States for the month of January 2022? | SELECT SUM(revenue) FROM transactions JOIN users ON transactions.user_id = users.user_id WHERE users.country = 'United States' AND transaction_date >= '2022-01-01' AND transaction_date < '2022-02-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donation (ID INT, Amount DECIMAL(10, 2), DonorID INT, ProgramID INT); INSERT INTO Donation (ID, Amount, DonorID, ProgramID) VALUES (1, 500.00, 1, 1), (2, 1000.00, 2, 1), (3, 250.00, 3, 1), (4, 750.00, 4, 2); CREATE TABLE Donor (ID INT, Name VARCHAR(255), Address VARCHAR(255)); INSERT INTO Donor (ID, Name, ... | List all donations made to the 'Education' program in the 'NonprofitDB' database, along with the donor's name and address. | SELECT d.Amount, d.DonorID, donor.Name, donor.Address FROM Donation d JOIN Donor donor ON d.DonorID = donor.ID WHERE d.ProgramID = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE trainings (training_id INT, factory_id INT, training_topic VARCHAR(50), attendees INT); INSERT INTO trainings (training_id, factory_id, training_topic, attendees) VALUES (1, 1, 'Safety Training', 25), (2, 1, 'Automation Training', 30), (3, 2, 'Quality Control Training', 15), (4, 2, 'Sustainability Training... | Calculate the total number of workforce development training sessions and total attendees for each factory location. | SELECT factory_id, COUNT(training_id) as total_trainings, SUM(attendees) as total_attendees FROM trainings GROUP BY factory_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_certifications (certification_id INT, certification_name VARCHAR(50), certification_date DATE, destination_id INT, PRIMARY KEY (certification_id), FOREIGN KEY (destination_id) REFERENCES destinations(destination_id));CREATE TABLE destinations (destination_id INT, destination_name VARCHAR(50), r... | What is the number of sustainable tourism certifications obtained by each destination in the last 5 years? | SELECT d.destination_name, COUNT(sc.certification_id) as total_certifications, YEAR(sc.certification_date) as certification_year FROM sustainable_certifications sc JOIN destinations d ON sc.destination_id = d.destination_id WHERE sc.certification_date >= DATE(CURRENT_DATE()) - INTERVAL 5 YEAR GROUP BY d.destination_nam... | gretelai_synthetic_text_to_sql |
CREATE TABLE sustainable_sourcing (supplier_name TEXT, supplier_country TEXT, sustainable_practices BOOLEAN); | Delete all records from the 'sustainable_sourcing' table where the 'supplier_name' is 'Eco Farms' | DELETE FROM sustainable_sourcing WHERE supplier_name = 'Eco Farms'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Inventory(item_id INT, item_name VARCHAR(50), is_sustainable BOOLEAN, price DECIMAL(5,2), quantity INT); INSERT INTO Inventory VALUES(1,'Apples',TRUE,0.99,100),(2,'Bananas',TRUE,1.49,200),(3,'Beef',FALSE,5.50,150); | Calculate the total cost of all sustainable items in the inventory. | SELECT SUM(price * quantity) FROM Inventory WHERE is_sustainable = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE IndigenousFoodSystem (id INT, location VARCHAR(50), certified_organic BOOLEAN); INSERT INTO IndigenousFoodSystem (id, location, certified_organic) VALUES (1, 'Brazil', false); INSERT INTO IndigenousFoodSystem (id, location, certified_organic) VALUES (2, 'Peru', true); | What is the total number of indigenous food systems in Central and South America, and how many of them are certified organic? | SELECT COUNT(*), SUM(certified_organic) FROM IndigenousFoodSystem WHERE location IN ('Central America', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Nat_Sec_Meetings (meeting_id INT, meeting_date DATE, meeting_location VARCHAR(50), meeting_agenda VARCHAR(100)); INSERT INTO Nat_Sec_Meetings (meeting_id, meeting_date, meeting_location, meeting_agenda) VALUES (1, '2022-01-01', 'White House', 'Cybersecurity Threats'); INSERT INTO Nat_Sec_Meetings (meeting_... | What is the total number of national security meetings in the 'Nat_Sec_Meetings' table? | SELECT COUNT(*) FROM Nat_Sec_Meetings; | gretelai_synthetic_text_to_sql |
CREATE TABLE cultural_heritage_sites (site_id INT, site_name TEXT, yearly_visitor_count INT); INSERT INTO cultural_heritage_sites (site_id, site_name, yearly_visitor_count) VALUES (1, 'Acropolis', 1000000), (2, 'Colosseum', 2000000), (3, 'Machu Picchu', 800000); | Which cultural heritage sites have seen a decrease in visitor count since last year? | SELECT a.site_name, a.yearly_visitor_count FROM cultural_heritage_sites a INNER JOIN (SELECT site_id, yearly_visitor_count FROM cultural_heritage_sites WHERE YEAR(curdate()) - YEAR(datetime(updated_at)) = 1) b ON a.site_id = b.site_id WHERE a.yearly_visitor_count < b.yearly_visitor_count; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_protected_areas (area_id INT, name VARCHAR(50), depth FLOAT, ocean VARCHAR(10)); INSERT INTO marine_protected_areas (area_id, name, depth, ocean) VALUES (3, 'Azores', 1000, 'Atlantic'); | Update the depth of the marine protected area with ID 3 to 500 | UPDATE marine_protected_areas SET depth = 500 WHERE area_id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE mines (state VARCHAR(20), num_mines INT); INSERT INTO mines (state, num_mines) VALUES ('QLD', 7), ('NSW', 6), ('WA', 5), ('SA', 4), ('TAS', 2); | Which states have more than 5 operational mines? | SELECT state FROM mines WHERE num_mines > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE soil_moisture (sample_date DATE, crop_type VARCHAR(20), moisture_level INT); INSERT INTO soil_moisture (sample_date, crop_type, moisture_level) VALUES ('2022-06-01', 'Corn', 70), ('2022-06-01', 'Soybeans', 65), ('2022-06-03', 'Corn', 75), ('2022-06-05', 'Soybeans', 60), ('2022-06-07', 'Corn', 80); | Identify the crop type with the highest average soil moisture level | SELECT crop_type, AVG(moisture_level) as avg_moisture FROM soil_moisture GROUP BY crop_type ORDER BY avg_moisture DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE EquipmentDeliveries (DeliveryID INT, Equipment VARCHAR(50), Quantity INT, DeliveryDate DATE); INSERT INTO EquipmentDeliveries (DeliveryID, Equipment, Quantity, DeliveryDate) VALUES (7, 'Tanks', 5, '2022-06-30'); INSERT INTO EquipmentDeliveries (DeliveryID, Equipment, Quantity, DeliveryDate) VALUES (8, 'Art... | What is the earliest delivery date for each type of military equipment? | SELECT Equipment, MIN(DeliveryDate) AS EarliestDeliveryDate FROM EquipmentDeliveries GROUP BY Equipment | gretelai_synthetic_text_to_sql |
CREATE TABLE Complaints(Year INT, Transport VARCHAR(20), Count INT); INSERT INTO Complaints VALUES(2021, 'Bus', 200), (2021, 'Train', 150), (2021, 'Tram', 50); | How many public transportation complaints were received in 2021 for each mode of transport? | SELECT Transport, Count FROM Complaints WHERE Year = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE sk_mx_parcels (id INT, weight FLOAT, shipped_date DATE); INSERT INTO sk_mx_parcels (id, weight, shipped_date) VALUES (1, 2.8, '2022-04-02'), (2, 3.5, '2022-04-15'); | What is the total weight of parcels shipped from South Korea to Mexico in April? | SELECT SUM(weight) FROM sk_mx_parcels WHERE MONTH(shipped_date) = 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE menu_items (menu_item_id INT, restaurant_id INT, revenue INT); INSERT INTO menu_items (menu_item_id, restaurant_id, revenue) VALUES (1, 1, 500), (2, 1, 300), (3, 1, 700), (4, 2, 600), (5, 2, 800), (6, 2, 900); | Find the top 3 menu items by revenue for a specific restaurant. | SELECT menu_item_id, restaurant_id, revenue FROM menu_items WHERE restaurant_id = 1 ORDER BY revenue DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cargo (id INT PRIMARY KEY, name VARCHAR(255), weight FLOAT, delivery_date DATE, source_port_id INT, destination_port_id INT); CREATE TABLE Ports (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255)); | What is the average cargo weight for deliveries to Mumbai? | SELECT AVG(Cargo.weight) FROM Cargo INNER JOIN Ports ON Cargo.destination_port_id = Ports.id WHERE Ports.location = 'Mumbai'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerability_assessments_v2 (id INT, name VARCHAR(255), last_assessment_date DATE, severity_score INT); INSERT INTO vulnerability_assessments_v2 (id, name, last_assessment_date, severity_score) VALUES (4, 'Vulnerability Assessment 4', '2022-01-01', 5), (5, 'Vulnerability Assessment 5', '2022-01-05', 3), (... | Update the severity score of the vulnerability assessment with ID 3 to 8. | UPDATE vulnerability_assessments_v2 SET severity_score = 8 WHERE id = 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE network_investments (city VARCHAR(50), financial_year INT, investment_amount FLOAT); INSERT INTO network_investments (city, financial_year, investment_amount) VALUES ('Delhi', 2021, 5000000), ('Delhi', 2022, 5500000), ('Mumbai', 2021, 6000000), ('Mumbai', 2022, 6500000), ('Bangalore', 2021, 7000000), ('Ban... | What is the difference in investment between consecutive financial years for each city, ordered by investment? | SELECT city, financial_year, investment_amount, LEAD(investment_amount) OVER (PARTITION BY city ORDER BY investment_amount) - investment_amount as investment_diff FROM network_investments; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aircraft_Flight_Hours (flight_id INT, aircraft_type VARCHAR(50), manufacturer VARCHAR(50), flight_hours INT, flight_date DATE); INSERT INTO Aircraft_Flight_Hours (flight_id, aircraft_type, manufacturer, flight_hours, flight_date) VALUES (1, 'A320', 'Airbus', 500, '2018-01-15'), (2, '787', 'Boeing', 750, '2... | What is the total number of flight hours for aircraft of each manufacturer in the last 5 years? | SELECT manufacturer, SUM(flight_hours) as total_flight_hours FROM Aircraft_Flight_Hours WHERE flight_date >= DATEADD(year, -5, GETDATE()) GROUP BY manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE movie_reviews (id INT, user_id INT, movie_id INT, rating INT); CREATE VIEW movie_summary AS SELECT m.id, m.title, m.genre, m.director_gender, AVG(mr.rating) as avg_rating FROM movies m JOIN movie_reviews mr ON m.id = mr.movie_id GROUP BY m.id; | What is the average user rating for films directed by women in the horror genre? | SELECT AVG(avg_rating) FROM movie_summary WHERE genre = 'horror' AND director_gender = 'female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE regenerative_farms (id INT, farm_name VARCHAR(50), farm_type VARCHAR(50), acreage FLOAT, state VARCHAR(50)); INSERT INTO regenerative_farms (id, farm_name, farm_type, acreage, state) VALUES (1, 'Green Earth Farm', 'Vegetable', 15.6, 'CA'), (2, 'Sunny Acres', 'Livestock', 20.8, 'CA'), (3, 'Cedar Ridge', 'Mi... | What is the total acreage of organic farms in the 'regenerative_farms' table, partitioned by the 'farm_type'? | SELECT farm_type, SUM(acreage) FROM regenerative_farms WHERE organic = 'true' GROUP BY farm_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE vehicle_population (country VARCHAR(30), year INT, electric_vehicles INT, total_vehicles INT); INSERT INTO vehicle_population VALUES ('Singapore', 2020, 150000, 500000); | What is the percentage of electric vehicles in Singapore as of 2020? | SELECT (electric_vehicles * 100.0 / total_vehicles) FROM vehicle_population WHERE country = 'Singapore' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE annual_chemicals (manufacturer_id INT, manufacturer_name VARCHAR(50), year INT, weight FLOAT); INSERT INTO annual_chemicals (manufacturer_id, manufacturer_name, year, weight) VALUES (1, 'AusChem', 2023, 800.5), (2, 'British Biotech', 2023, 900.3), (3, 'ChemCorp', 2023, 700.7), (4, 'Global Green Chemicals',... | Identify the top 3 manufacturers with the highest total weight of chemicals produced, for the year 2023 | SELECT manufacturer_id, manufacturer_name, SUM(weight) as total_weight FROM annual_chemicals WHERE year = 2023 GROUP BY manufacturer_id, manufacturer_name ORDER BY total_weight DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT PRIMARY KEY, name VARCHAR(50), age INT, country VARCHAR(50)); INSERT INTO players (id, name, age, country) VALUES (1, 'John Doe', 25, 'USA'); INSERT INTO players (id, name, age, country) VALUES (2, 'Jane Smith', 30, 'Canada'); INSERT INTO players (id, name, age, country) VALUES (3, 'Marcos ... | Show the average age of players from the USA and Canada | SELECT country, AVG(age) as avg_age FROM players WHERE country IN ('USA', 'Canada') GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE MissionHistory(mission VARCHAR(50), astronaut_id INT); CREATE TABLE Astronauts(astronaut_id INT, name VARCHAR(50), age INT); | List the space missions that had more than 5 astronauts participating. | SELECT MissionHistory.mission FROM MissionHistory INNER JOIN Astronauts ON MissionHistory.astronaut_id = Astronauts.astronaut_id GROUP BY MissionHistory.mission HAVING COUNT(*) > 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE TimberProduction (id INT, name VARCHAR(255), region VARCHAR(255), year INT, production FLOAT); INSERT INTO TimberProduction (id, name, region, year, production) VALUES (1, 'Tropical Forest', 'Indonesia', 2015, 50000); | What is the total timber production in tropical forests in Indonesia? | SELECT SUM(production) FROM TimberProduction WHERE name = 'Tropical Forest' AND region = 'Indonesia'; | 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.