context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE brands (brand_id INT PRIMARY KEY, brand_name VARCHAR(255), brand_country VARCHAR(100), brand_status VARCHAR(20)); | Update 'brand_status' to 'Inactive' for 'brand_name' 'Nature's Beauty' in the 'brands' table | UPDATE brands SET brand_status = 'Inactive' WHERE brand_name = 'Nature''s Beauty'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name VARCHAR(255)); INSERT INTO donors (id, name) VALUES (1, 'Effective Altruism Funds'); CREATE TABLE donations (id INT, donor_id INT, organization_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, donor_id, organization_id, amount, donation_date) VALUES (1, 1, ... | List the names of all donors who have not donated in the past year. | SELECT name FROM donors WHERE id NOT IN (SELECT donor_id FROM donations WHERE donation_date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR) AND CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE international_bridges (id INT, name VARCHAR(50), country VARCHAR(50), length FLOAT); INSERT INTO international_bridges VALUES (1, 'Akashi Kaikyō', 'Japan', 3911), (2, 'Great Belt', 'Denmark', 6790), (3, 'Changhua-Kaohsiung', 'Taiwan', 1573); | What is the maximum length of a bridge in each country? | SELECT country, MAX(length) FROM international_bridges GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE cases (case_id INT, case_type VARCHAR(10), created_at TIMESTAMP); INSERT INTO cases (case_id, case_type, created_at) VALUES (1, 'civil', '2020-01-01 10:00:00'), (2, 'criminal', '2021-02-15 14:30:00'), (3, 'traffic', '2021-12-31 23:59:59'); | Delete records from the 'cases' table where the case_type is 'traffic' and created_at is in 2021 | DELETE FROM cases WHERE case_type = 'traffic' AND created_at >= '2021-01-01 00:00:00' AND created_at <= '2021-12-31 23:59:59'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerability_timeline(id INT, severity VARCHAR(50), vulnerability_date DATE, vulnerabilities INT); | What is the maximum number of simultaneous high severity vulnerabilities that have been discovered in the past month? | SELECT severity, MAX(vulnerabilities) as max_simultaneous_vulnerabilities FROM vulnerability_timeline WHERE severity = 'high' AND vulnerability_date > DATE(NOW()) - INTERVAL 30 DAY; | gretelai_synthetic_text_to_sql |
CREATE TABLE bridges (id INT, name TEXT, region TEXT, resilience_score FLOAT, year_built INT); INSERT INTO bridges (id, name, region, resilience_score, year_built) VALUES (1, 'Golden Gate Bridge', 'West Coast', 85.2, 1937), (2, 'Brooklyn Bridge', 'East Coast', 76.3, 1883), (3, 'Bay Bridge', 'West Coast', 90.1, 1936), (... | What is the minimum 'resilience_score' of bridges in the 'Midwest' region that were built before 2010? | SELECT MIN(resilience_score) FROM bridges WHERE region = 'Midwest' AND year_built < 2010; | gretelai_synthetic_text_to_sql |
CREATE TABLE funding (id INT, company_id INT, amount DECIMAL(10, 2), funding_year INT); CREATE TABLE company (id INT, name VARCHAR(255), founding_year INT); INSERT INTO company (id, name, founding_year) VALUES (1, 'Fintech Inc', 2018), (2, 'Startup Corp', 2019), (3, 'Green Inc', 2020); INSERT INTO funding (id, company_... | What is the total funding amount for companies founded in the year 2020? | SELECT SUM(amount) FROM funding INNER JOIN company ON funding.company_id = company.id WHERE funding.funding_year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE AISafetyIncidents (incident_id INTEGER, incident_date DATE, region TEXT); CREATE TABLE AIModels (model_id INTEGER, model_name TEXT); INSERT INTO AISafetyIncidents (incident_id, incident_date, region) VALUES (1, '2022-01-01', 'North America'), (2, '2022-04-01', 'North America'); INSERT INTO AIModels (model_... | List AI safety incidents in North America, cross-joined with AI model details. | SELECT AISafetyIncidents.incident_date, AIModels.model_name FROM AISafetyIncidents CROSS JOIN AIModels WHERE AISafetyIncidents.region = 'North America'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Aid_Donors (id INT, name TEXT, type TEXT); INSERT INTO Aid_Donors (id, name, type) VALUES (1, 'USA', 'Government'), (2, 'Germany', 'Government'), (3, 'Saudi Arabia', 'Government'), (4, 'UK', 'Government'); CREATE TABLE Aid_Contributions (id INT, donor_id INT, crisis TEXT, amount INT, contribution_date DATE... | What is the total amount of aid contributed by each government to the Rohingya refugee crisis, and the percentage of the total contribution made by each government? | SELECT A.name as donor_name, SUM(AC.amount) as total_contribution, (SUM(AC.amount) / (SELECT SUM(amount) FROM Aid_Contributions WHERE crisis = 'Rohingya Refugee Crisis')) * 100 as contribution_percentage FROM Aid_Contributions AC INNER JOIN Aid_Donors A ON AC.donor_id = A.id WHERE AC.crisis = 'Rohingya Refugee Crisis' ... | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels_types (hotel_id INT, type TEXT); CREATE TABLE bookings (booking_id INT, hotel_id INT, revenue FLOAT); | What is the average revenue per booking for 'Luxury' hotels in 'New York'? | SELECT AVG(subquery.revenue) FROM (SELECT hotel_id, AVG(revenue) as revenue FROM bookings WHERE hotel_id IN (SELECT hotel_id FROM hotels_types WHERE type = 'Luxury') GROUP BY hotel_id) as subquery WHERE subquery.hotel_id IN (SELECT hotel_id FROM hotels WHERE city = 'New York'); | gretelai_synthetic_text_to_sql |
CREATE TABLE movie_ratings (user_id INT, movie_id INT, rating FLOAT); | Insert records into the 'movie_ratings' table | INSERT INTO movie_ratings (user_id, movie_id, rating) VALUES (1, 123, 4.5); | gretelai_synthetic_text_to_sql |
CREATE TABLE Geopolitical_Risk_Assessments (assessment_id INT, assessment_date DATE, country VARCHAR(50)); INSERT INTO Geopolitical_Risk_Assessments (assessment_id, assessment_date, country) VALUES (1, '2018-05-12', 'Egypt'), (2, '2019-07-03', 'Egypt'), (3, '2020-11-28', 'Egypt'); | How many geopolitical risk assessments have been conducted for Egypt since 2018? | SELECT COUNT(assessment_id) FROM Geopolitical_Risk_Assessments WHERE assessment_date >= '2018-01-01' AND country = 'Egypt'; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (innovation_id SERIAL PRIMARY KEY, innovation_name VARCHAR(255), innovation_type VARCHAR(255), classification VARCHAR(255)); | Update the table 'military_innovation' and set the 'classification' to 'public' for all records where the 'innovation_type' is 'cybersecurity' | WITH cte_cybersecurity AS (UPDATE military_innovation SET classification = 'public' WHERE innovation_type = 'cybersecurity' RETURNING innovation_id, innovation_name, innovation_type, classification) SELECT * FROM cte_cybersecurity; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR(255), year_of_birth INT); CREATE TABLE artworks (id INT, artist_id INT, category VARCHAR(255), year_of_creation INT); | What is the average age of artists who have created artworks in the abstract category? | SELECT AVG(YEAR(CURRENT_DATE) - year_of_birth) FROM artists a JOIN artworks aw ON a.id = aw.artist_id WHERE category = 'Abstract'; | gretelai_synthetic_text_to_sql |
CREATE TABLE shariah_compliant_loans (loan_id INT, customer_id INT, amount DECIMAL(10, 2), issue_date DATE); INSERT INTO shariah_compliant_loans (loan_id, customer_id, amount, issue_date) VALUES (1, 101, 5000.00, '2021-01-01'), (2, 102, 7000.00, '2021-02-01'); | What is the total amount of Shariah-compliant loans issued to customers in January 2021? | SELECT SUM(amount) FROM shariah_compliant_loans WHERE MONTH(issue_date) = 1 AND YEAR(issue_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE unions (id INT, name VARCHAR(255), country VARCHAR(255));INSERT INTO unions (id, name, country) VALUES (1, 'UNI', 'Europe'), (2, 'CGT', 'France'), (3, 'UGT', 'Spain');CREATE TABLE members (id INT, union_id INT, joined DATE);INSERT INTO members (id, union_id, joined) VALUES (1, 1, '2018-01-01'), (2, 1, '202... | How many new union members joined from historically underrepresented communities in Europe in the last 5 years, and which unions were they? | SELECT unions.name, COUNT(members.id) as new_members FROM unions JOIN members ON unions.id = members.union_id WHERE unions.country = 'Europe' AND members.joined BETWEEN DATE_SUB(NOW(), INTERVAL 5 YEAR) AND NOW() AND unions.name IN ('UNI', 'CGT', 'UGT') GROUP BY unions.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Visitors (id INT, race VARCHAR(20), city VARCHAR(20), num_visitors INT); INSERT INTO Visitors (id, race, city, num_visitors) VALUES (1, 'Black', 'Chicago', 200), (2, 'Indigenous', 'Detroit', 150), (3, 'Latinx', 'St. Louis', 250); | What is the total number of visitors who identified as BIPOC and attended exhibitions in the Midwest? | SELECT SUM(num_visitors) FROM Visitors WHERE race IN ('Black', 'Indigenous', 'Latinx') AND city IN ('Chicago', 'Detroit', 'St. Louis'); | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_exploration (vessel TEXT, year INT); | Insert a new record for a deep-sea exploration conducted by the Alvin in the year 2022 | INSERT INTO deep_sea_exploration (vessel, year) VALUES ('Alvin', 2022); | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (event_name TEXT, city TEXT, type TEXT); INSERT INTO Events (event_name, city, type) VALUES ('Art Exhibition', 'Los Angeles', 'Art'), ('Art Exhibition', 'San Francisco', 'Art'); | How many art exhibitions were held in Los Angeles and San Francisco combined? | SELECT COUNT(*) FROM Events WHERE city IN ('Los Angeles', 'San Francisco') AND type = 'Art Exhibition'; | gretelai_synthetic_text_to_sql |
CREATE TABLE china_india_tourism (region TEXT, revenue FLOAT); INSERT INTO china_india_tourism (region, revenue) VALUES ('India', 3000000), ('China', 1500000); | What is the average revenue of sustainable tourism in India and China? | SELECT AVG(revenue) FROM china_india_tourism WHERE region IN ('India', 'China'); | gretelai_synthetic_text_to_sql |
CREATE TABLE rd_expenditure (id INT PRIMARY KEY, drug_id INT, year INT, amount DECIMAL(10,2)); CREATE TABLE drugs (id INT PRIMARY KEY, name VARCHAR(255), manufacturer VARCHAR(255), approval_date DATE); | What is the maximum R&D expenditure per year for drugs that were approved after 2017? | SELECT MAX(amount) as max_annual_rd_expenditure FROM rd_expenditure JOIN drugs ON rd_expenditure.drug_id = drugs.id WHERE approval_date > '2017-01-01' GROUP BY rd_expenditure.year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (Id INT, Name VARCHAR(50), Age INT, Nationality VARCHAR(50)); INSERT INTO Members (Id, Name, Age, Nationality) VALUES (8, 'Emma Wilson', 27, 'Australia'), (9, 'Liam Thompson', 38, 'New Zealand'); CREATE TABLE Workouts (Id INT, MemberId INT, WorkoutType VARCHAR(50), Duration INT, Date DATE); INSERT ... | What is the number of distinct workout types done by each member, excluding members who have only done 'Walking'? | SELECT w.MemberId, COUNT(DISTINCT w.WorkoutType) as DistinctWorkoutTypes FROM Workouts w WHERE w.MemberId IN (SELECT m.Id FROM Members m EXCEPT (SELECT m.Id FROM Members m JOIN Workouts w ON m.Id = w.MemberId WHERE w.WorkoutType = 'Walking')) GROUP BY w.MemberId; | gretelai_synthetic_text_to_sql |
CREATE TABLE RenewableEnergyProjects (id INT, name TEXT, location TEXT, category TEXT); INSERT INTO RenewableEnergyProjects (id, name, location, category) VALUES (1, 'SolarFarm1', 'Texas', 'Solar'), (2, 'WindFarm1', 'Oklahoma', 'Wind'), (3, 'SolarFarm2', 'Nevada', 'Solar'); | Identify the number of renewable energy projects in 'Solar' and 'Wind' categories. | SELECT COUNT(*), category FROM RenewableEnergyProjects WHERE category IN ('Solar', 'Wind') GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (id INT, name VARCHAR(255), type VARCHAR(255), price DECIMAL(5,2)); INSERT INTO menus (id, name, type, price) VALUES (1, 'Veggie Burger', 'Vegan', 9.99); INSERT INTO menus (id, name, type, price) VALUES (2, 'Tofu Stir Fry', 'Vegan', 12.49); | Find the average price of vegan menu items | SELECT type, AVG(price) FROM menus WHERE type = 'Vegan'; | gretelai_synthetic_text_to_sql |
CREATE TABLE mining_sites (id INT, site_name TEXT); CREATE TABLE environmental_impact_scores (site_id INT, score FLOAT); INSERT INTO mining_sites (id, site_name) VALUES (1, 'siteA'), (2, 'siteB'), (3, 'siteC'); INSERT INTO environmental_impact_scores (site_id, score) VALUES (1, 85.0), (2, 78.0), (3, 92.0); | Which mining sites have no recorded environmental impact scores? | SELECT mining_sites.site_name FROM mining_sites LEFT JOIN environmental_impact_scores ON mining_sites.id = environmental_impact_scores.site_id WHERE environmental_impact_scores.score IS NULL; | gretelai_synthetic_text_to_sql |
CREATE TABLE claims (id INT, underwriter_id INT, processed_date DATE); INSERT INTO claims (id, underwriter_id, processed_date) VALUES (1, 1, '2021-01-01'), (2, 2, '2021-02-01'), (3, 1, '2021-03-01'); | What is the total number of claims processed for each underwriter? | SELECT underwriter_id, COUNT(*) FROM claims GROUP BY underwriter_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE startups(id INT, name TEXT, founder_lgbtqia INT, industry TEXT, funding FLOAT); INSERT INTO startups VALUES (1, 'StartupG', 1, 'Biotech', 7000000); | What is the average funding amount for startups founded by individuals who identify as LGBTQIA+ in the Biotech sector? | SELECT AVG(funding) FROM startups WHERE industry = 'Biotech' AND founder_lgbtqia = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE athletes (athlete_id INT, name VARCHAR(50), age INT, sport VARCHAR(20)); | Show the number of athletes in each age group (0-20, 21-30, 31-40, 41-50, 51+) from the 'athletes' table. | SELECT CASE WHEN age BETWEEN 0 AND 20 THEN '0-20' WHEN age BETWEEN 21 AND 30 THEN '21-30' WHEN age BETWEEN 31 AND 40 THEN '31-40' WHEN age BETWEEN 41 AND 50 THEN '41-50' ELSE '51+' END AS age_group, COUNT(*) FROM athletes GROUP BY age_group; | gretelai_synthetic_text_to_sql |
CREATE TABLE customer_size_diversity (id INT PRIMARY KEY, customer_id INT, size VARCHAR(10), height INT, weight INT); | Display all customers with size 'L' from 'customer_size_diversity' table | SELECT * FROM customer_size_diversity WHERE size = 'L'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityVisitors (id INT, city VARCHAR(50), year INT, num_visitors INT); | Which cities had more than 100,000 visitors in 2021? | SELECT city, SUM(num_visitors) FROM CityVisitors WHERE year = 2021 GROUP BY city HAVING SUM(num_visitors) > 100000; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA community_development; Use community_development; CREATE TABLE comm_dev_initiatives (initiative_code VARCHAR(20), start_date DATE); INSERT INTO comm_dev_initiatives (initiative_code, start_date) VALUES ('CD1', '2022-01-01'), ('CD2', '2021-05-15'), ('CD3', '2022-07-20'); | List all unique community development initiative codes and their corresponding start dates in the 'community_development' schema, sorted by start date in ascending order. | SELECT DISTINCT initiative_code, start_date FROM community_development.comm_dev_initiatives ORDER BY start_date ASC; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (id INT, name VARCHAR(50), location VARCHAR(20)); INSERT INTO hospitals (id, name, location) VALUES (1, 'Hospital A', 'rural Alabama'); | How many hospitals are there in rural Alabama? | SELECT COUNT(*) FROM hospitals WHERE location = 'rural Alabama'; | gretelai_synthetic_text_to_sql |
CREATE TABLE buildings (id INT, name TEXT, city TEXT, state TEXT, is_green_certified BOOLEAN); | How many green-certified buildings are in Seattle? | SELECT COUNT(*) FROM buildings WHERE city = 'Seattle' AND is_green_certified = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_adaptation_projects ( id INT, name VARCHAR(255), location VARCHAR(255), strategy VARCHAR(255) ); INSERT INTO climate_adaptation_projects (id, name, location, strategy) VALUES (1, 'Project B', 'Pacific Islands', 'Educational outreach'); INSERT INTO climate_adaptation_projects (id, name, location, st... | List all unique communication strategies used in climate adaptation projects in the Pacific region, not including those in small island states. | SELECT DISTINCT strategy FROM climate_adaptation_projects WHERE location NOT IN ('Pacific Islands', 'Small Island States'); | gretelai_synthetic_text_to_sql |
CREATE TABLE investments(id INT, region VARCHAR(10), investment_date DATE, amount INT); | What is the average investment in network infrastructure for the current quarter in each region? | SELECT investments.region, AVG(investments.amount) FROM investments WHERE QUARTER(investments.investment_date) = QUARTER(CURRENT_DATE) GROUP BY investments.region; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_research_funding (id INT PRIMARY KEY, project_name VARCHAR(50), location VARCHAR(50), amount DECIMAL(10,2), start_date DATE, end_date DATE); | How much research funding is allocated for projects in the Pacific region? | SELECT SUM(amount) as total_funding FROM marine_research_funding WHERE location = 'Pacific'; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, title VARCHAR(100), release_year INT, runtime INT, genre VARCHAR(20)); INSERT INTO tv_shows (id, title, release_year, runtime, genre) VALUES (1, 'TVShow1', 2018, 600, 'Drama'); INSERT INTO tv_shows (id, title, release_year, runtime, genre) VALUES (2, 'TVShow2', 2019, 720, 'Drama'); INSERT... | What's the total runtime for Korean dramas released in 2019? | SELECT SUM(runtime) FROM tv_shows WHERE release_year = 2019 AND genre = 'Korean Drama'; | gretelai_synthetic_text_to_sql |
CREATE TABLE forest_timber (id INT, region VARCHAR(20), year INT, volume FLOAT); | Find the percentage of total timber volume that comes from boreal forests in the last 3 years. | SELECT region, (SUM(volume) / (SELECT SUM(volume) FROM forest_timber WHERE year BETWEEN 2019 AND 2021) * 100) as pct_volume FROM forest_timber WHERE region = 'Boreal' AND year BETWEEN 2019 AND 2021 GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (id INT, state VARCHAR(2), zip INT); INSERT INTO Members (id, state, zip) VALUES (1, 'CA', 90001), (2, 'CA', 90002); CREATE TABLE Workouts (member_id INT, duration INT, calories INT, workout_date DATE); INSERT INTO Workouts (member_id, duration, calories, workout_date) VALUES (1, 60, 250, '2022-01-... | List the total workout time and calories burned for members in California, per ZIP code. | SELECT m.zip, SUM(w.duration) as total_time, SUM(w.calories) as total_calories FROM Members m JOIN Workouts w ON m.id = w.member_id WHERE m.state = 'CA' GROUP BY m.zip; | gretelai_synthetic_text_to_sql |
CREATE TABLE drought_impact(region VARCHAR(50), year INT, score INT); INSERT INTO drought_impact(region, year, score) VALUES ('Texas', 2019, 80), ('Texas', 2020, 85), ('Texas', 2021, 90); | What is the average drought impact score for Texas in the last 3 years? | SELECT AVG(score) FROM drought_impact WHERE region = 'Texas' AND year BETWEEN (YEAR(CURRENT_DATE)-3) AND YEAR(CURRENT_DATE); | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriber_data (subscriber_id INT, plan_type VARCHAR(20), data_usage FLOAT); INSERT INTO subscriber_data VALUES (1, 'Basic', 2.5), (2, 'Premium', 4.7), (3, 'Basic', 3.2); | What is the average data usage for each mobile plan in the 'subscriber_data' table, grouped by plan type? | SELECT plan_type, AVG(data_usage) FROM subscriber_data GROUP BY plan_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE ocean_floor_mapping(id INT, region VARCHAR(20), depth FLOAT); INSERT INTO ocean_floor_mapping(id, region, depth) VALUES (1, 'Pacific', 5000.5), (2, 'Atlantic', 4500.3), (3, 'Pacific', 6200.7), (4, 'Indian', 4200.0); | What is the minimum depth of ocean floor mapping projects in the Atlantic region? | SELECT MIN(depth) FROM ocean_floor_mapping WHERE region = 'Atlantic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellite_deployments (id INT, satellite_id INT, country VARCHAR(255), altitude INT); INSERT INTO satellite_deployments (id, satellite_id, country, altitude) VALUES (1, 1, 'China', 50000000); | What is the maximum altitude reached by any satellite deployed by China? | SELECT MAX(altitude) FROM satellite_deployments WHERE country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE songs (song_id INT, genre VARCHAR(20), release_year INT, streams INT); INSERT INTO songs (song_id, genre, release_year, streams) VALUES (1, 'rock', 2022, 4000); INSERT INTO songs (song_id, genre, release_year, streams) VALUES (2, 'rock', 2022, 5000); INSERT INTO songs (song_id, genre, release_year, streams... | What is the minimum number of streams for rock songs released in 2022? | SELECT MIN(streams) FROM songs WHERE genre = 'rock' AND release_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (title VARCHAR(255), author VARCHAR(255), date DATE, topic VARCHAR(255)); | Update the articles table to set the topic to 'disinformation' for articles published by 'Dan' with the date 2022-03-14. | UPDATE articles SET topic = 'disinformation' WHERE author = 'Dan' AND date = '2022-03-14'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Gender) VALUES (1, 25, 'Male'); INSERT INTO Players (PlayerID, Age, Gender) VALUES (2, 30, 'Female'); | Show players' gender distribution in the 'Players' table. | SELECT Gender, COUNT(*) as Count FROM Players GROUP BY Gender; | gretelai_synthetic_text_to_sql |
CREATE TABLE hospitals (city VARCHAR(50), year INT, count INT); | How many hospitals are there in Tokyo, Japan as of 2020? | SELECT count FROM hospitals WHERE city = 'Tokyo' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE posts (id INT, user_id INT, brand_mentioned VARCHAR(255), likes INT, shares INT, post_time DATETIME); | What is the total number of likes and shares on posts mentioning the brand "Google" in the technology industry, in India, in the past month? | SELECT SUM(likes + shares) FROM posts WHERE brand_mentioned = 'Google' AND industry = 'technology' AND country = 'India' AND post_time > DATE_SUB(NOW(), INTERVAL 1 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE space_missions (mission_id INT, mission_name VARCHAR(50), launch_date DATE, return_date DATE, mission_company VARCHAR(50)); | What is the earliest launch date for a space mission for SpaceX? | SELECT MIN(launch_date) AS earliest_launch_date FROM space_missions WHERE mission_company = 'SpaceX'; | gretelai_synthetic_text_to_sql |
CREATE TABLE transport (id INT, method VARCHAR(50), frequency INT); INSERT INTO transport (id, method, frequency) VALUES (1, 'Bicycle', 1500), (2, 'Private Car', 8000), (3, 'Public Bus', 4000), (4, 'Subway', 3500), (5, 'Motorcycle', 600), (6, 'Tram', 2000); | Show the transportation methods in the 'city_transport' database that have a frequency higher than 'Bus' and 'Subway'. | SELECT method FROM transport WHERE frequency > (SELECT frequency FROM transport WHERE method = 'Bus') AND frequency > (SELECT frequency FROM transport WHERE method = 'Subway'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Vessels (VesselID INT, VesselName VARCHAR(100), VesselType VARCHAR(100), PortID INT); INSERT INTO Vessels (VesselID, VesselName, VesselType, PortID) VALUES (1, 'Kota Pertama', 'Container Ship', 1); CREATE TABLE Cargo (CargoID INT, CargoName VARCHAR(100), Quantity INT, VesselID INT); INSERT INTO Cargo (Ca... | What is the total quantity of textiles transported by container ships? | SELECT SUM(Cargo.Quantity) FROM Cargo INNER JOIN Vessels ON Cargo.VesselID = Vessels.VesselID INNER JOIN VesselTypes ON Vessels.VesselType = VesselTypes.VesselType WHERE VesselTypes.VesselType = 'Container Ship' AND Cargo.CargoName = 'Textiles'; | gretelai_synthetic_text_to_sql |
CREATE TABLE conferences (id INT, country VARCHAR(50), conference_year INT, conference_type VARCHAR(50)); INSERT INTO conferences (id, country, conference_year, conference_type) VALUES (1, 'Japan', 2022, 'Sustainable Tourism'), (2, 'Japan', 2021, 'Sustainable Tourism'), (3, 'Japan', 2020, 'Sustainable Tourism'), (4, 'J... | How many sustainable tourism conferences were held in Japan in 2022? | SELECT COUNT(*) FROM conferences WHERE country = 'Japan' AND conference_year = 2022 AND conference_type = 'Sustainable Tourism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE cosmetics.eyeshadow_data (eyeshadow_id INT, finish VARCHAR(20), country VARCHAR(50)); INSERT INTO cosmetics.eyeshadow_data (eyeshadow_id, finish, country) VALUES (1, 'Matte', 'Germany'), (2, 'Shimmer', 'Germany'), (3, 'Glitter', 'Germany'), (4, 'Matte', 'Spain'), (5, 'Shimmer', 'France'); | What is the most popular eyeshadow finish among consumers in Germany? | SELECT finish, COUNT(*) as countOfFinish FROM cosmetics.eyeshadow_data WHERE country = 'Germany' GROUP BY finish ORDER BY countOfFinish DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE marine_species (id INT, name TEXT, region TEXT); CREATE TABLE conservation_status (id INT, species_id INT, status TEXT); INSERT INTO marine_species (id, name, region) VALUES (1, 'Beluga Whale', 'Arctic'); INSERT INTO conservation_status (id, species_id, status) VALUES (1, 1, 'Vulnerable'); | List all marine species and their conservation status in the Arctic region. | SELECT marine_species.name, conservation_status.status FROM marine_species INNER JOIN conservation_status ON marine_species.id = conservation_status.species_id WHERE marine_species.region = 'Arctic'; | gretelai_synthetic_text_to_sql |
CREATE TABLE spacecrafts (manufacturer VARCHAR(255), mass FLOAT, manufacture_date DATE); INSERT INTO spacecrafts (manufacturer, mass, manufacture_date) VALUES ('SpaceCorp', 10000, '2010-01-01'); INSERT INTO spacecrafts (manufacturer, mass, manufacture_date) VALUES ('SpaceCorp', 12000, '2012-03-14'); INSERT INTO spacecr... | Find the average mass of spacecrafts manufactured by SpaceCorp between 2010 and 2015 | SELECT AVG(mass) FROM spacecrafts WHERE manufacturer = 'SpaceCorp' AND manufacture_date BETWEEN '2010-01-01' AND '2015-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE collective_bargaining (bargaining_id INT, union_name VARCHAR(50), company_name VARCHAR(50), contract_start_date DATE, contract_end_date DATE);CREATE VIEW union_region AS SELECT union_name, 'Southeast' as region FROM collective_bargaining GROUP BY union_name; | What is the average contract length for unions in the Southeast region? | SELECT AVG(DATEDIFF(contract_end_date, contract_start_date)) as avg_contract_length FROM collective_bargaining cb JOIN union_region ur ON cb.union_name = ur.union_name WHERE ur.region = 'Southeast'; | gretelai_synthetic_text_to_sql |
CREATE TABLE meals (user_id INT, meal_date DATE, calories INT); INSERT INTO meals (user_id, meal_date, calories) VALUES (1, '2022-01-01', 1200), (1, '2022-01-02', 800), (2, '2022-01-01', 600); CREATE TABLE users (user_id INT, country VARCHAR(255)); INSERT INTO users (user_id, country) VALUES (1, 'Brazil'), (2, 'USA'), ... | Show the percentage of meals in Brazil with more than 1000 calories. | SELECT 100.0 * COUNT(*) / (SELECT COUNT(*) FROM meals JOIN users ON meals.user_id = users.user_id WHERE users.country = 'Brazil') as pct_meals FROM meals JOIN users ON meals.user_id = users.user_id WHERE users.country = 'Brazil' AND calories > 1000; | gretelai_synthetic_text_to_sql |
CREATE TABLE Crop (id INT, farm_id INT, crop_type VARCHAR(255), location VARCHAR(255)); INSERT INTO Crop (id, farm_id, crop_type, location) VALUES (1, 1001, 'Wheat', 'AU-WA'); | List all the unique crop types grown in "AU-WA" and "ZA-WC". | SELECT DISTINCT crop_type FROM Crop WHERE location IN ('AU-WA', 'ZA-WC'); | gretelai_synthetic_text_to_sql |
CREATE TABLE staff_details (id INT, name VARCHAR(50), department VARCHAR(50), salary FLOAT); INSERT INTO staff_details (id, name, department, salary) VALUES (1, 'Alex Jones', 'human_resources', 65000.00), (2, 'Jessica Lee', 'human_resources', 70000.00), (3, 'Taylor Garcia', 'environmental_compliance', 68000.00); | What is the average salary for employees in the 'human_resources' and 'environmental_compliance' departments? | SELECT department, AVG(salary) as avg_salary FROM (SELECT department, salary FROM staff_details WHERE department = 'human_resources' UNION SELECT department, salary FROM staff_details WHERE department = 'environmental_compliance') AS combined_departments GROUP BY department; | gretelai_synthetic_text_to_sql |
CREATE TABLE species_density (id INT, species VARCHAR(255), density FLOAT); | List the names and average stocking density of fish species with density > 25 | SELECT species, AVG(density) FROM species_density WHERE density > 25 GROUP BY species; | gretelai_synthetic_text_to_sql |
CREATE TABLE media_content (content_id INT, country VARCHAR(50), genre VARCHAR(50), coverage INT); INSERT INTO media_content (content_id, country, genre, coverage) VALUES (1, 'USA', 'News', 500), (2, 'Canada', 'Entertainment', 300), (3, 'Mexico', 'Sports', 400); | What is the minimum coverage of news media in the media_content table? | SELECT MIN(coverage) as min_coverage FROM media_content WHERE genre = 'News'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MonitoringStation (ID INT, Name VARCHAR(100), Location VARCHAR(100), Elevation FLOAT, AnnualTemp FLOAT); INSERT INTO MonitoringStation (ID, Name, Location, Elevation, AnnualTemp) VALUES (1, 'Station X', 'Svalbard', 150, 2.5); INSERT INTO MonitoringStation (ID, Name, Location, Elevation, AnnualTemp) VALUES ... | What is the average temperature change in the past 3 years for each monitoring station? | SELECT Name, AVG(AnnualTemp) OVER (PARTITION BY Name ORDER BY Name ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS AvgAnnualTemp FROM MonitoringStation WHERE YEAR(CurrentDate) - YEAR(DateInstalled) BETWEEN 1 AND 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Museums (Name VARCHAR(50), Attendance INT, Year INT); | Add a new museum with attendance of 8000 in 2021 | INSERT INTO Museums (Name, Attendance, Year) VALUES ('New Museum', 8000, 2021) | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure_Projects (Project_ID INT, Project_Name VARCHAR(50), Project_Type VARCHAR(50), Completion_Date DATE); INSERT INTO Infrastructure_Projects (Project_ID, Project_Name, Project_Type, Completion_Date) VALUES (1, 'Seawall', 'Resilience', '2021-02-28'), (2, 'Floodgate', 'Resilience', '2020-12-31'), ... | What are the names and completion dates of all resilience projects in the infrastructure database? | SELECT Project_Name, Completion_Date FROM Infrastructure_Projects WHERE Project_Type = 'Resilience'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Producers (ProducerID INT PRIMARY KEY, Name TEXT, ProductionYear INT, RareEarth TEXT, Quantity INT, Location TEXT); | Display the names of companies that reduced their Europium production quantity between 2019 and 2020 by more than 20%. | SELECT DISTINCT p1.Name FROM Producers p1, Producers p2 WHERE p1.ProductionYear = 2020 AND p2.ProductionYear = 2019 AND p1.RareEarth = 'Europium' AND p2.RareEarth = 'Europium' AND p1.Name = p2.Name AND p1.Quantity < p2.Quantity * 0.8; | gretelai_synthetic_text_to_sql |
CREATE TABLE Employees (EmployeeID INT, FirstName VARCHAR(50), LastName VARCHAR(50), Department VARCHAR(50), Salary DECIMAL(10,2)); INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, Salary) VALUES (1, 'John', 'Doe', 'Engineering', 75000.00), (2, 'Jane', 'Doe', 'Engineering', 80000.00), (3, 'Mike', 'Sm... | Who are the employees with the lowest salary in each department? | SELECT EmployeeID, FirstName, LastName, Department, Salary, RANK() OVER (PARTITION BY Department ORDER BY Salary) AS Rank FROM Employees; | gretelai_synthetic_text_to_sql |
CREATE TABLE whale_sightings (id INT PRIMARY KEY, species VARCHAR(255), location VARCHAR(255), sighting_date DATE); INSERT INTO whale_sightings (id, species, location, sighting_date) VALUES (1, 'Beluga Whale', 'Arctic Ocean', '2023-03-10'); | Delete all records of whale sightings in the Arctic Ocean | DELETE FROM whale_sightings WHERE location = 'Arctic Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ProductionMaterials (id INT, name TEXT, co2_emissions INT, quantity INT); INSERT INTO ProductionMaterials (id, name, co2_emissions, quantity) VALUES (1, 'Organic Cotton', 4, 1000), (2, 'Recycled Polyester', 7, 2000), (3, 'Hemp', 2, 1500), (4, 'Tencel', 3, 2500); | Which materials are used the most in production, and what are their CO2 emissions? | SELECT name, SUM(quantity) AS total_quantity, AVG(co2_emissions) AS avg_co2_emissions FROM ProductionMaterials GROUP BY name ORDER BY total_quantity DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE factories (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), capacity INT); INSERT INTO factories (id, name, location, capacity) VALUES (1, 'Ethical Fabrications', 'Bangladesh', 500), (2, 'Fair Factories', 'Cambodia', 300); CREATE TABLE labor_practices (id INT PRIMARY KEY, factory_id INT, worke... | Find the factories with the lowest and highest worker counts and their corresponding wage levels. | SELECT f.name, lp.wage_level, MIN(lp.worker_count) AS min_workers, MAX(lp.worker_count) AS max_workers FROM factories f INNER JOIN labor_practices lp ON f.id = lp.factory_id GROUP BY f.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE attorneys (attorney_id INT, name TEXT); CREATE TABLE cases (case_id INT, attorney_id INT); | What is the number of cases handled by each attorney, grouped by attorney name? | SELECT a.name, COUNT(c.attorney_id) AS case_count FROM attorneys a JOIN cases c ON a.attorney_id = c.attorney_id GROUP BY a.name | gretelai_synthetic_text_to_sql |
CREATE TABLE Infrastructure_Projects (Project_ID INT, Project_Name VARCHAR(255), Project_Type VARCHAR(255), Resilience_Score FLOAT, Year INT, State VARCHAR(255)); | What is the maximum resilience score for each type of infrastructure project in California for the year 2020? | SELECT Project_Type, MAX(Resilience_Score) FROM Infrastructure_Projects WHERE Year = 2020 AND State = 'California' GROUP BY Project_Type; | gretelai_synthetic_text_to_sql |
CREATE TABLE support_programs (id INT, program_name VARCHAR(50), budget INT); INSERT INTO support_programs (id, program_name, budget) VALUES (1, 'Mentorship Program', 10000), (2, 'Tutoring Program', 15000), (3, 'Accessibility Improvements', 20000); | Update the budget for the 'Accessibility Improvements' program to 25000. | UPDATE support_programs SET budget = 25000 WHERE program_name = 'Accessibility Improvements'; | gretelai_synthetic_text_to_sql |
CREATE TABLE SubwayFares (id INT, city VARCHAR(255), fare DECIMAL(10, 2), accessibility VARCHAR(255), fare_date DATE); | What is the total fare collected for accessible subway rides in Tokyo in 2022? | SELECT SUM(fare) FROM SubwayFares WHERE city = 'Tokyo' AND accessibility = 'Accessible' AND YEAR(fare_date) = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Artists (id INT, name VARCHAR(100), country VARCHAR(50)); INSERT INTO Artists (id, name, country) VALUES (1, 'Artist 1', 'Nigeria'), (2, 'Artist 2', 'France'), (3, 'Artist 3', 'Egypt'); CREATE TABLE Paintings (id INT, name VARCHAR(100), artist_id INT, price DECIMAL(10,2)); INSERT INTO Paintings (id, name, ... | Find the highest price of a painting from an African artist. | SELECT MAX(price) FROM Paintings JOIN Artists ON Paintings.artist_id = Artists.id WHERE Artists.country = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE emergency_incidents (id INT, city VARCHAR(20), month INT, year INT, incidents INT); INSERT INTO emergency_incidents (id, city, month, year, incidents) VALUES (1, 'Phoenix', 5, 2022, 100); INSERT INTO emergency_incidents (id, city, month, year, incidents) VALUES (2, 'Phoenix', 5, 2022, 110); | What is the total number of emergency incidents in the city of Phoenix in the month of May 2022? | SELECT SUM(incidents) FROM emergency_incidents WHERE city = 'Phoenix' AND month = 5 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE Volunteers (VolunteerID int, VolunteerName varchar(50), VolunteerDOB date, VolunteerSignUpDate date); INSERT INTO Volunteers (VolunteerID, VolunteerName, VolunteerDOB, VolunteerSignUpDate) VALUES (1, 'James Brown', '1990-01-01', '2020-02-01'), (2, 'Emma White', '1985-06-15', '2020-04-20'), (3, 'Robert Gree... | How many volunteers signed up in each month of 2020? | SELECT DATEPART(mm, VolunteerSignUpDate) as Month, COUNT(*) as VolunteersSignedUp FROM Volunteers WHERE VolunteerSignUpDate >= '2020-01-01' AND VolunteerSignUpDate < '2021-01-01' GROUP BY DATEPART(mm, VolunteerSignUpDate); | gretelai_synthetic_text_to_sql |
CREATE TABLE Contracts (contract_id INT, region VARCHAR(50), original_timeline DATE, revised_timeline DATE); INSERT INTO Contracts (contract_id, region, original_timeline, revised_timeline) VALUES (1, 'Asia-Pacific', '2017-01-01', '2017-06-30'); | List all contracts that had delays in the Asia-Pacific region and their revised timelines. | SELECT contract_id, region, revised_timeline FROM Contracts WHERE region = 'Asia-Pacific' AND original_timeline < revised_timeline | gretelai_synthetic_text_to_sql |
CREATE TABLE Members (MemberID INT, Age INT, FavoriteExercise VARCHAR(20)); INSERT INTO Members (MemberID, Age, FavoriteExercise) VALUES (1, 35, 'Cycling'); INSERT INTO Members (MemberID, Age, FavoriteExercise) VALUES (2, 28, 'Running'); INSERT INTO Members (MemberID, Age, FavoriteExercise) VALUES (3, 45, 'Strength Tra... | What is the maximum age of members who do strength training workouts? | SELECT MAX(Age) FROM Members WHERE FavoriteExercise = 'Strength Training'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (ConcertID INT, ConcertName VARCHAR(100), Genre VARCHAR(50), Year INT, Revenue INT); INSERT INTO Concerts VALUES (1, 'Concert1', 'Pop', 2020, 10000); INSERT INTO Concerts VALUES (2, 'Concert2', 'Rock', 2021, 15000); INSERT INTO Concerts VALUES (3, 'Concert3', 'Jazz', 2019, 12000); | What is the total revenue from each genre of concert ticket sales? | SELECT Genre, SUM(Revenue) FROM Concerts GROUP BY Genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE energy_emissions (country VARCHAR(50), year INT, co2_emissions FLOAT); INSERT INTO energy_emissions (country, year, co2_emissions) VALUES ('USA', 2020, 5135.2), ('China', 2020, 10031.2), ('Germany', 2020, 712.4); | Find the total CO2 emissions for each country in 2020 from the energy sector | SELECT country, SUM(co2_emissions) as total_emissions FROM energy_emissions WHERE year = 2020 GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (city VARCHAR(20), year INT, landfill_capacity FLOAT, waste_generated FLOAT);INSERT INTO landfill_capacity (city, year, landfill_capacity, waste_generated) VALUES ('Jakarta', 2019, 6000000, 3500000), ('Jakarta', 2020, 6000000, 3700000), ('Jakarta', 2021, 6000000, 3900000), ('Bangkok', 201... | Calculate the landfill capacity utilization for the city of Jakarta in 2020 | SELECT (waste_generated / landfill_capacity) * 100 FROM landfill_capacity WHERE city = 'Jakarta' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityIncidents (community VARCHAR(255), incident_year INT, incident_type VARCHAR(255)); INSERT INTO CommunityIncidents (community, incident_year, incident_type) VALUES ('Indigenous', 2022, 'Algorithmic bias'), ('LGBTQ+', 2021, 'Data privacy'), ('Women in Tech', 2022, 'Model explainability'); | Which AI safety incidents were reported by the Indigenous community in 2022? | SELECT community, incident_type FROM CommunityIncidents WHERE community = 'Indigenous' AND incident_year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE countries (country_id INT, country_name VARCHAR(100));CREATE TABLE satellites (satellite_id INT, country_id INT, launch_date DATE); | List all countries with at least one satellite launched by 2022? | SELECT countries.country_name FROM countries INNER JOIN satellites ON countries.country_id = satellites.country_id WHERE satellites.launch_date <= '2022-01-01' GROUP BY countries.country_name HAVING COUNT(satellites.satellite_id) >= 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE AIModels (id INT, model_name VARCHAR(50), organization VARCHAR(50), application_type VARCHAR(50), safety_rating INT); INSERT INTO AIModels (id, model_name, organization, application_type, safety_rating) VALUES (1, 'AI4Welfare', 'Microsoft', 'Social Welfare', 85), (2, 'AI4Empowerment', 'Google', 'Social Wel... | Who is the TOP 1 organization with the highest number of AI models developed for social welfare applications, and what is the median safety rating of their models? | SELECT organization, COUNT(model_name) as model_count FROM AIModels WHERE application_type = 'Social Welfare' GROUP BY organization ORDER BY model_count DESC LIMIT 1; SELECT AVG(safety_rating) as median_safety_rating FROM (SELECT safety_rating FROM AIModels WHERE organization = (SELECT organization FROM AIModels WHERE ... | gretelai_synthetic_text_to_sql |
CREATE TABLE soldiers_personal_data (soldier_id INT, name VARCHAR(50), rank VARCHAR(50), departure_date DATE); | Update the rank of soldier with ID 3001 to Captain in the soldiers_personal_data table | UPDATE soldiers_personal_data SET rank = 'Captain' WHERE soldier_id = 3001; | gretelai_synthetic_text_to_sql |
CREATE TABLE niger_delta_operators (operator_id INT, operator_name VARCHAR(50), location VARCHAR(50), operational_status VARCHAR(15)); INSERT INTO niger_delta_operators VALUES (1, 'Shell', 'Niger Delta', 'Active'); INSERT INTO niger_delta_operators VALUES (2, 'Chevron', 'Niger Delta', 'Active'); CREATE TABLE oil_produc... | What is the total oil production for each operator in the Niger Delta for the year 2019? | SELECT operator_name, SUM(production) FROM oil_production JOIN niger_delta_operators ON oil_production.operator_id = niger_delta_operators.operator_id WHERE year = 2019 AND location = 'Niger Delta' GROUP BY operator_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE patient (patient_id INT, name VARCHAR(50), age INT, gender VARCHAR(10), condition VARCHAR(50)); INSERT INTO patient (patient_id, name, age, gender, condition) VALUES (1, 'John Doe', 45, 'Male', 'Anxiety'), (2, 'Jane Smith', 35, 'Female', 'Depression'); CREATE TABLE treatment (treatment_id INT, patient_id I... | How many patients have completed the Dialectical Behavior Therapy program? | SELECT COUNT(patient_id) FROM treatment WHERE treatment_name = 'Dialectical Behavior Therapy' AND completed = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE videos (id INT, title VARCHAR(100), topic VARCHAR(50), views INT, platform VARCHAR(50)); INSERT INTO videos (id, title, topic, views, platform) VALUES (1, 'Video1', 'technology', 5000, 'ABC News'), (2, 'Video2', 'politics', 7000, 'ABC News'), (3, 'Video3', 'technology', 6000, 'ABC News'); | What is the average number of views for videos on the topic "technology" on the media platform "ABC News"? | SELECT AVG(views) FROM videos WHERE topic = 'technology' AND platform = 'ABC News'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Disinformation (ID INT, Topic TEXT, Date DATE); INSERT INTO Disinformation (ID, Topic, Date) VALUES (1, 'Politics', '2022-01-01'), (2, 'Health', '2022-01-05'), (3, 'Politics', '2022-01-07'); | Identify the most common disinformation topics in the past month. | SELECT Topic, COUNT(*) as Count FROM Disinformation WHERE Date >= DATEADD(month, -1, CURRENT_DATE) GROUP BY Topic ORDER BY Count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Voyage (id INT, vessel VARCHAR(255), time_in_port INT, country VARCHAR(255), time DATETIME); INSERT INTO Voyage (id, vessel, time_in_port, country, time) VALUES (1, 'African Explorer', 12, 'South Africa', '2021-01-01 10:00:00'), (2, 'Sea Titan', 10, 'Morocco', '2021-02-15 15:30:00'); | What is the average time spent in port by vessels that have transported containers to Africa in the year 2021? | SELECT AVG(time_in_port) FROM Voyage V WHERE country = 'South Africa' OR country = 'Morocco'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Cases (CaseID int, ClientID int, Category varchar(50)); INSERT INTO Cases (CaseID, ClientID, Category) VALUES (401, 4, 'Divorce'); CREATE TABLE Billing (CaseID int, AttorneyID int, HoursFraction decimal(3,2), HourlyRate decimal(5,2)); INSERT INTO Billing (CaseID, AttorneyID, HoursFraction, HourlyRate) VALU... | What is the total billing amount for 'divorce' cases? | SELECT SUM(B.HoursFraction * B.HourlyRate) as TotalBillingAmount FROM Cases CA INNER JOIN Billing B ON CA.CaseID = B.CaseID WHERE CA.Category = 'Divorce'; | gretelai_synthetic_text_to_sql |
CREATE TABLE accessible_tech_2 (product_id INT, product_release_year INT, company_region VARCHAR(20));INSERT INTO accessible_tech_2 (product_id, product_release_year, company_region) VALUES (1, 2023, 'Latin America'), (2, 2022, 'Asia'), (3, 2021, 'Pacific Islands'); | Find the number of accessible technology products released in 2023 that were developed by companies based in Latin America or the Pacific Islands. | SELECT COUNT(*) FROM accessible_tech_2 WHERE product_release_year = 2023 AND company_region IN ('Latin America', 'Pacific Islands'); | gretelai_synthetic_text_to_sql |
CREATE TABLE clients (id INT, name TEXT, assets FLOAT); CREATE TABLE investments (id INT, client_id INT, product_code TEXT); INSERT INTO clients (id, name, assets) VALUES (1, 'John Doe', 50000.00), (2, 'Jane Smith', 75000.00), (3, 'Alice Johnson', 100000.00), (4, 'Bob Brown', 120000.00); INSERT INTO investments (id, cl... | What is the total assets value for clients who own investment product 'MSFT'? | SELECT SUM(c.assets) FROM clients c JOIN investments i ON c.id = i.client_id WHERE i.product_code = 'MSFT'; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurant_info (restaurant_id INT, name VARCHAR(50), address VARCHAR(100), city VARCHAR(50), state VARCHAR(2), has_vegan_options BOOLEAN); | Update the restaurant_info table to set the has_vegan_options field to true for restaurant ID 34 | UPDATE restaurant_info SET has_vegan_options = true WHERE restaurant_id = 34; | gretelai_synthetic_text_to_sql |
CREATE TABLE explainability_scores (model_id INT, model_type VARCHAR(20), score INT); INSERT INTO explainability_scores (model_id, model_type, score) VALUES (1, 'Generative', 7), (2, 'Transformer', 8), (3, 'Reinforcement', 9), (4, 'Generative2', 6), (5, 'Transformer2', 10), (6, 'Reinforcement2', 7), (7, 'Generative3', ... | What is the explainability score distribution for each AI model type, ordered by average explainability score in descending order? | SELECT model_type, AVG(score) as avg_explainability_score, STDDEV(score) as stddev_explainability_score FROM explainability_scores GROUP BY model_type ORDER BY avg_explainability_score DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE policyholders (id INT, age INT, state VARCHAR(2), policy_type VARCHAR(10)); INSERT INTO policyholders (id, age, state, policy_type) VALUES (1, 35, 'NY', 'car'), (2, 45, 'CA', 'home'), (3, 28, 'NY', 'car'); | What is the average age of policyholders who live in 'NY' and have a car insurance policy? | SELECT AVG(age) FROM policyholders WHERE state = 'NY' AND policy_type = 'car'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_mitigation(project_name TEXT, country TEXT, num_trees INTEGER); INSERT INTO climate_mitigation(project_name, country, num_trees) VALUES ('Project A', 'Kenya', 1000), ('Project B', 'Brazil', 1500); | What is the total number of trees planted for climate mitigation projects in Africa and South America? | SELECT SUM(num_trees) FROM climate_mitigation WHERE country IN ('Africa', 'South America'); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (drug_name TEXT, year INT, region TEXT, revenue FLOAT); INSERT INTO sales (drug_name, year, region, revenue) VALUES ('DrugA', 2020, 'US', 5000000); | What was the total sales revenue for 'DrugA' in the year 2020 in the US market? | SELECT revenue FROM sales WHERE drug_name = 'DrugA' AND year = 2020 AND region = 'US'; | gretelai_synthetic_text_to_sql |
CREATE TABLE brands (id INT, brand VARCHAR(255)); INSERT INTO brands (id, brand) VALUES (1, 'Lush'), (2, 'Burt’s Bees'), (3, 'Maybelline'), (4, 'Estée Lauder'), (5, 'MAC'); CREATE TABLE brand_products (id INT, brand VARCHAR(255), product VARCHAR(255), has_natural_ingredients BOOLEAN); INSERT INTO brand_products (id, br... | List brands that have no products with natural ingredients. | SELECT brand FROM brands WHERE id NOT IN (SELECT brand FROM brand_products WHERE has_natural_ingredients = true); | gretelai_synthetic_text_to_sql |
CREATE TABLE diversity_training (id INT, mine_id INT, training_type VARCHAR(50), PRIMARY KEY(id), FOREIGN KEY (mine_id) REFERENCES mine_operations(id)); INSERT INTO diversity_training (id, mine_id, training_type) VALUES (1, 1, 'Diversity Training'); CREATE TABLE workforce_demographics (id INT, mine_id INT, gender VARCH... | Which mines have a diversity training program and have a workforce that is at least 30% female? | SELECT m.mine_name FROM mine_operations m JOIN diversity_training dt ON m.id = dt.mine_id JOIN workforce_demographics wd ON m.id = wd.mine_id WHERE dt.training_type = 'Diversity Training' AND wd.gender = 'Female' AND wd.percentage >= 30 GROUP BY m.mine_name; | 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.