context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE Ratings (id INT, actor_id INT, movie_id INT, rating DECIMAL(3,2)); INSERT INTO Ratings (id, actor_id, movie_id, rating) VALUES (1, 1, 1, 8.5), (2, 2, 2, 7.8), (3, 3, 3, 9.0), (4, 1, 4, 8.8); CREATE TABLE Actors (id INT, name VARCHAR(255)); INSERT INTO Actors (id, name) VALUES (1, 'Actor1'), (2, 'Actor2'), ... | Who are the top 3 actors with the highest average rating? | SELECT a.name, AVG(r.rating) FROM Actors a JOIN Ratings r ON a.id = r.actor_id GROUP BY a.name ORDER BY AVG(r.rating) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_agency_missions (id INT, agency VARCHAR(50), name VARCHAR(50), cost INT); INSERT INTO space_agency_missions (id, agency, name, cost) VALUES (1, 'NASA', 'Mars Rover 2001', 2500000), (2, 'NASA', 'ISS', 150000000), (3, 'ESA', 'Hubble Space Telescope', 1000000000); | What is the total cost of space missions by agency? | SELECT agency, SUM(cost) FROM space_agency_missions GROUP BY agency; | gretelai_synthetic_text_to_sql |
CREATE TABLE model_performance (model_name TEXT, accuracy FLOAT); INSERT INTO model_performance (model_name, accuracy) VALUES ('modelA', 0.92), ('modelB', 0.88), ('modelC', 0.95); | Find the name and description of the model with the highest accuracy in the 'model_performance' table. | SELECT model_name, accuracy FROM model_performance ORDER BY accuracy DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE song_streams (song_id INT, artist_name VARCHAR(30), release_year INT, stream_count INT); INSERT INTO song_streams (song_id, artist_name, release_year, stream_count) VALUES (1, 'Taylor Swift', 2020, 100000), (2, 'BTS', 2020, 125000), (3, 'Kendrick Lamar', 2019, 75000), (4, 'Ariana Grande', 2020, 110000); | What is the average stream count for songs released in 2020? | SELECT release_year, AVG(stream_count) as avg_stream_count FROM song_streams WHERE release_year = 2020 GROUP BY release_year; | gretelai_synthetic_text_to_sql |
CREATE TABLE Farm ( FarmID INT, FarmName VARCHAR(255), WaterTemperature DECIMAL(5,2) ); INSERT INTO Farm (FarmID, FarmName, WaterTemperature) VALUES (1, 'Farm A', 28.5), (2, 'Farm B', 12.3), (3, 'Farm C', 30.0), (4, 'Farm D', 29.5), (5, 'Farm E', 24.2); | List the top 3 aquaculture farms with the highest water temperature? | SELECT FarmName, WaterTemperature, ROW_NUMBER() OVER (ORDER BY WaterTemperature DESC) as Rank FROM Farm WHERE Rank <= 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE Buses (route_id INT, region VARCHAR(20), fare DECIMAL(5,2)); INSERT INTO Buses (route_id, region, fare) VALUES (1, 'Westpoint', 1.50), (2, 'Westpoint', 2.50), (3, 'Westpoint', 3.00); | How many buses in the 'Westpoint' region have a fare greater than 2.00? | SELECT COUNT(*) FROM Buses WHERE region = 'Westpoint' AND fare > 2.00; | gretelai_synthetic_text_to_sql |
CREATE TABLE Coordinators (id INT, name VARCHAR(20), region VARCHAR(20)); INSERT INTO Coordinators (id, name, region) VALUES (1, 'John Doe', 'Africa'), (2, 'Jane Smith', 'Asia'), (3, 'Alice Johnson', 'Africa'); CREATE TABLE EducationPrograms (id INT, coordinator_id INT, name VARCHAR(20)); INSERT INTO EducationPrograms ... | List the names and education programs of all coordinators in the 'Africa' region. | SELECT c.name, e.name FROM Coordinators c INNER JOIN EducationPrograms e ON c.id = e.coordinator_id WHERE c.region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Platform VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Platform) VALUES (1, 25, 'PC'), (2, 30, 'Console'), (3, 20, 'Mobile'); CREATE TABLE EsportsEvents (EventID INT, PlayerID INT); INSERT INTO EsportsEvents (EventID, PlayerID) VALUES (1, 1), (2, 2), (3, 3); | What is the average age of players who have participated in esports events, categorized by the platform (PC, Console, Mobile)? | SELECT Platform, AVG(Age) as AvgAge FROM Players p JOIN EsportsEvents e ON p.PlayerID = e.PlayerID GROUP BY Platform; | gretelai_synthetic_text_to_sql |
CREATE TABLE ingredients (id INT, name VARCHAR(255), origin VARCHAR(255), quantity INT); INSERT INTO ingredients (id, name, origin, quantity) VALUES (1, 'Rice', 'Thailand', 1000), (2, 'Soy Sauce', 'China', 500); | What is the total quantity of locally sourced ingredients used in our Asian operations? | SELECT SUM(quantity) FROM ingredients WHERE origin LIKE 'Asia%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FitnessTests (TestID INT, PlayerID INT, TestDate DATE, TestScore INT); | Delete the 'FitnessTests' table and all its records. | DROP TABLE FitnessTests; | gretelai_synthetic_text_to_sql |
cars (id, make, model, year, fuel_type) | Insert new records for electric cars produced in 2022 in the cars table. | INSERT INTO cars (make, model, year, fuel_type) VALUES ('Tesla', 'Model S', 2022, 'electric'), ('Nissan', 'Leaf', 2022, 'electric'), ('Chevrolet', 'Bolt', 2022, 'electric'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Donations (id INT, user VARCHAR(255), amount DECIMAL(10, 2)); INSERT INTO Donations (id, user, amount) VALUES (1, 'John', 50.00), (2, 'Jane', 75.00); | Update the donation amount to $100 for the user 'Jane' in the Donations table. | UPDATE Donations SET amount = 100.00 WHERE user = 'Jane'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Organizations (OrgID INT, OrgName TEXT, TotalDonation DECIMAL); INSERT INTO Organizations (OrgID, OrgName, TotalDonation) VALUES (1, 'ABC Nonprofit', 10000.00), (2, 'XYZ Foundation', 15000.00); | Which organization received the most donations in Q3 2019? | SELECT OrgName, MAX(TotalDonation) as MaxDonation FROM Organizations WHERE QUARTER(DonationDate) = 3 AND YEAR(DonationDate) = 2019 GROUP BY OrgName; | gretelai_synthetic_text_to_sql |
CREATE TABLE social_tech (id INT, project VARCHAR(50), technology VARCHAR(50), description TEXT, impact FLOAT, organization VARCHAR(50)); INSERT INTO social_tech (id, project, technology, description, impact, organization) VALUES (2, 'ML for Climate Change', 'Machine Learning', 'A project using ML to predict climate ch... | What is the average impact of projects involving machine learning? | SELECT technology, AVG(impact) as avg_impact FROM social_tech WHERE description LIKE '%Machine Learning%' GROUP BY technology; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_customers (customer_id INT, name VARCHAR(50), data_usage FLOAT, state VARCHAR(20)); INSERT INTO mobile_customers (customer_id, name, data_usage, state) VALUES (1, 'John Doe', 3.5, 'New York'); | What are the top 3 states with the highest mobile data usage? | SELECT state, SUM(data_usage) as total_data_usage FROM mobile_customers GROUP BY state ORDER BY total_data_usage DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE product (id INT, name TEXT, brand TEXT, cruelty_free BOOLEAN); | Find the number of cruelty-free products for each brand | SELECT brand, COUNT(*) FROM product WHERE cruelty_free = TRUE GROUP BY brand; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibition (exhibition_id INT, exhibition_name VARCHAR(30), genre VARCHAR(20), duration INT); | What is the total duration of all exhibitions in the 'Minimalism' genre, in hours? | SELECT SUM(Exhibition.duration / 60) FROM Exhibition WHERE Exhibition.genre = 'Minimalism'; | gretelai_synthetic_text_to_sql |
CREATE TABLE producer_materials (id INT, producer VARCHAR(20), material VARCHAR(20), usage INT); INSERT INTO producer_materials (id, producer, material, usage) VALUES (1, 'EcoFabrics', 'cotton', 7000), (2, 'GreenYarn', 'wool', 4000), (3, 'EcoFabrics', 'polyester', 6000), (4, 'GreenYarn', 'cotton', 3000), (5, 'SustainaF... | Which sustainable materials are most commonly used by each producer in the 'producer_materials' table? | SELECT producer, material, SUM(usage) AS total_usage FROM producer_materials GROUP BY producer, material ORDER BY total_usage DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE Events (id INT, name VARCHAR(50), location VARCHAR(50), date DATE, attendance INT); INSERT INTO Events (id, name, location, date, attendance) VALUES (1, 'Art Show', 'New York', '2018-01-01', 100); | How many visitors attended events in New York between 2018 and 2019? | SELECT SUM(attendance) FROM Events WHERE location = 'New York' AND date BETWEEN '2018-01-01' AND '2019-12-31'; | gretelai_synthetic_text_to_sql |
CREATE TABLE startup_funding (id INT, startup_name VARCHAR(50), city VARCHAR(50), funding_year INT, amount FLOAT); INSERT INTO startup_funding (id, startup_name, city, funding_year, amount) VALUES (1, 'GreenGen', 'Seattle', 2021, 3000000), (2, 'BioSolutions', 'Austin', 2022, 4000000), (3, 'NeuroTech', 'Boston', 2022, 5... | What is the total funding amount received by biotech startups in 'Boston' from the 'startup_funding' database? | SELECT SUM(amount) FROM startup_funding WHERE city = 'Boston'; | gretelai_synthetic_text_to_sql |
CREATE TABLE AtlanticProjects (organization TEXT, project_name TEXT); INSERT INTO AtlanticProjects (organization, project_name) VALUES ('National Oceanic and Atmospheric Administration', 'Atlantic Currents'), ('UNESCO', 'Marine Life Protection'), ('Greenpeace', 'Atlantic Plastic Reduction'); CREATE TABLE Organizations ... | How many marine research projects were conducted in the Atlantic Ocean by each organization? | SELECT Organizations.organization, Organizations.research_count FROM Organizations INNER JOIN AtlanticProjects ON Organizations.organization = AtlanticProjects.organization WHERE AtlanticProjects.project_name LIKE '%Atlantic%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE DysprosiumProduction (country VARCHAR(20), year INT, price DECIMAL(5,2)); INSERT INTO DysprosiumProduction (country, year, price) VALUES ('CountryA', 2017, 110.00), ('CountryB', 2017, 120.00); | What is the maximum price of dysprosium produced in any country for the year 2017? | SELECT MAX(price) FROM DysprosiumProduction WHERE year = 2017; | gretelai_synthetic_text_to_sql |
CREATE TABLE Genre (id INT, genre VARCHAR(255)); CREATE TABLE Song (id INT, genre_id INT, title VARCHAR(255), playtime INT); CREATE TABLE Sales (id INT, genre_id INT, year INT, revenue INT); | Calculate the average playtime and total revenue for each genre of music | SELECT G.genre, AVG(S.playtime) as avg_playtime, SUM(S.revenue) as total_revenue FROM Genre G INNER JOIN Song S ON G.id = S.genre_id INNER JOIN Sales SL ON G.id = SL.genre_id GROUP BY G.genre; | gretelai_synthetic_text_to_sql |
CREATE TABLE financial_quarters (id INT, quarter INT, year INT); INSERT INTO financial_quarters (id, quarter, year) VALUES (1, 1, 2021), (2, 2, 2021), (3, 3, 2021), (4, 4, 2021); CREATE TABLE expenses (id INT, financial_quarter_id INT, amount DECIMAL(10, 2)); | Show the total expenses for the last financial quarter | SELECT SUM(e.amount) as total_expenses FROM expenses e JOIN financial_quarters fq ON e.financial_quarter_id = fq.id WHERE fq.quarter = (SELECT MAX(quarter) FROM financial_quarters WHERE year = (SELECT MAX(year) FROM financial_quarters)) GROUP BY fq.quarter; | gretelai_synthetic_text_to_sql |
CREATE TABLE MakeupProducts (productID INT, productName VARCHAR(50), category VARCHAR(50), country VARCHAR(50), harmfulIngredient BOOLEAN); INSERT INTO MakeupProducts (productID, productName, category, country, harmfulIngredient) VALUES (1, 'Liquid Lipstick', 'Makeup', 'Canada', TRUE); | List all the makeup products with potentially harmful ingredients sold in Canada. | SELECT * FROM MakeupProducts WHERE country = 'Canada' AND harmfulIngredient = TRUE; | 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_country' is 'USA' | DELETE FROM sustainable_sourcing WHERE supplier_country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fish_farms (id INT, name TEXT, region TEXT); INSERT INTO fish_farms (id, name, region) VALUES (1, 'Farm A', 'Indian Ocean'), (2, 'Farm B', 'Atlantic Ocean'); CREATE TABLE readings (id INT, farm_id INT, dissolved_oxygen FLOAT); INSERT INTO readings (id, farm_id, dissolved_oxygen) VALUES (1, 1, 6.1), (2, 1, ... | What is the minimum dissolved oxygen level for fish farms in the 'Indian Ocean' region? | SELECT MIN(readings.dissolved_oxygen) FROM readings INNER JOIN fish_farms ON readings.farm_id = fish_farms.id WHERE fish_farms.region = 'Indian Ocean'; | gretelai_synthetic_text_to_sql |
CREATE TABLE solar_plants (id INT, name VARCHAR(100), country VARCHAR(50), capacity_mw FLOAT); INSERT INTO solar_plants (id, name, country, capacity_mw) VALUES (1, 'Solar Plant 1', 'Spain', 30.0), (2, 'Solar Plant 2', 'Spain', 45.0); | List the Solar Power Plants in Spain with their installed capacity | SELECT name, capacity_mw FROM solar_plants WHERE country = 'Spain'; | gretelai_synthetic_text_to_sql |
CREATE TABLE accessible_technology_initiatives (id INT, initiative_name VARCHAR(50), region VARCHAR(50)); INSERT INTO accessible_technology_initiatives (id, initiative_name, region) VALUES (1, 'Accessible Software Distribution', 'Asia'), (2, 'Hardware Adaptation for Persons with Disabilities', 'Europe'), (3, 'Inclusive... | What is the maximum number of accessible technology initiatives in a region? | SELECT region, COUNT(*) as initiative_count FROM accessible_technology_initiatives GROUP BY region ORDER BY initiative_count DESC LIMIT 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE deep_sea_exploration (project_id INT, country VARCHAR(50), funding_amount FLOAT); INSERT INTO deep_sea_exploration (project_id, country, funding_amount) VALUES (1, 'Canada', 15000000.0), (2, 'Japan', 20000000.0), (3, 'USA', 30000000.0); | List all countries with deep-sea exploration projects and their respective funding amounts. | SELECT country, funding_amount FROM deep_sea_exploration; | gretelai_synthetic_text_to_sql |
CREATE TABLE suppliers (name TEXT, last_update DATE, component_type TEXT); INSERT INTO suppliers (name, last_update, component_type) VALUES ('Smith Components', '2021-01-01', 'Safety Equipment'), ('Jones Parts', '2022-03-15', 'Training Materials'); | Which suppliers have not been updated in the last 6 months and supply components for workforce development programs? | SELECT name FROM suppliers WHERE last_update < DATE('now', '-6 month') AND component_type = 'Workforce Development'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ea_research_australia(paper_id INT, country VARCHAR(10), publish_year INT); INSERT INTO ea_research_australia VALUES (1, 'Australia', 2021), (2, 'Australia', 2020); CREATE TABLE ea_research_india(paper_id INT, country VARCHAR(10), publish_year INT); INSERT INTO ea_research_india VALUES (1, 'India', 2021), ... | What is the total number of ethical AI research papers published in Australia, India, and Argentina, in the year 2021? | SELECT SUM(publish_year = 2021) FROM ea_research_australia WHERE country = 'Australia' UNION ALL SELECT SUM(publish_year = 2021) FROM ea_research_india WHERE country = 'India' UNION ALL SELECT SUM(publish_year = 2021) FROM ea_research_argentina WHERE country = 'Argentina'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investment_rounds (round_name VARCHAR(50), investment_year INT, investment_amount INT, investment_type VARCHAR(50)); | Insert a new record into the "investment_rounds" table with the following data: "Series A", 2021, 5000000, "Venture Capital" | INSERT INTO investment_rounds (round_name, investment_year, investment_amount, investment_type) VALUES ('Series A', 2021, 5000000, 'Venture Capital'); | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_aid (disaster_id INT, country_name VARCHAR(50), aid_amount INT, aid_date DATE); | Insert new records into the "humanitarian_aid" table for the following disaster_id, country_name, aid_amount, and aid_date values: (301, 'Bangladesh', 50000, '2021-12-25'), (302, 'Pakistan', 75000, '2021-12-27'), and (303, 'Nepal', 60000, '2021-12-30') | INSERT INTO humanitarian_aid (disaster_id, country_name, aid_amount, aid_date) VALUES (301, 'Bangladesh', 50000, '2021-12-25'), (302, 'Pakistan', 75000, '2021-12-27'), (303, 'Nepal', 60000, '2021-12-30'); | gretelai_synthetic_text_to_sql |
CREATE TABLE patents (id INT, company_name VARCHAR(30), patent_count INT, company_domain VARCHAR(20)); INSERT INTO patents (id, company_name, patent_count, company_domain) VALUES (1, 'CompanyE', 2, 'Healthcare'); INSERT INTO patents (id, company_name, patent_count, company_domain) VALUES (2, 'CompanyF', 0, 'Finance'); | Count the number of patents filed by companies in the 'Healthcare' domain | SELECT SUM(patent_count) FROM patents WHERE company_domain = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE field_1 (date DATE, temperature FLOAT); INSERT INTO field_1 (date, temperature) VALUES ('2022-01-01', 15.0), ('2022-01-02', 14.5); CREATE TABLE field_3 (date DATE, temperature FLOAT); INSERT INTO field_3 (date, temperature) VALUES ('2022-01-01', 14.0), ('2022-01-02', 13.5); | What is the difference in average temperature between field_1 and field_3? | SELECT AVG(field_1.temperature) - AVG(field_3.temperature) FROM field_1, field_3 WHERE field_1.date = field_3.date AND field_1.date IN ('2022-01-01', '2022-01-02'); | gretelai_synthetic_text_to_sql |
CREATE TABLE inspections (inspection_id INT, restaurant_id INT, violation_score INT, inspection_date DATE); INSERT INTO inspections (inspection_id, restaurant_id, violation_score, inspection_date) VALUES (1, 1, 85, '2022-01-01'), (2, 1, 90, '2022-02-01'), (3, 2, 70, '2022-01-01'), (4, 3, 80, '2022-02-01'); CREATE TABLE... | Show the number of food safety inspections for each restaurant in 'Eastside'? | SELECT r.name, COUNT(i.inspection_id) AS number_of_inspections FROM inspections i JOIN restaurants r ON i.restaurant_id = r.restaurant_id WHERE r.area = 'Eastside' GROUP BY r.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Suppliers (id INT PRIMARY KEY, supplier_name VARCHAR(255), country VARCHAR(100), sustainability_rating INT); INSERT INTO Suppliers (id, supplier_name, country, sustainability_rating) VALUES (1, 'Green Farms', 'Canada', 4), (2, 'Tropical Fruits', 'Brazil', 3), (3, 'Ocean Harvest', 'Norway', 5); | Which suppliers are located in Canada and have a sustainability rating of 4 or higher? | SELECT supplier_name FROM Suppliers WHERE country = 'Canada' AND sustainability_rating >= 4; | gretelai_synthetic_text_to_sql |
CREATE TABLE Donors (DonorID INT, DonorName TEXT, Country TEXT, Amount DECIMAL(10,2)); INSERT INTO Donors (DonorID, DonorName, Country, Amount) VALUES (1, 'DonorA', 'USA', 1500.00), (2, 'DonorB', 'Canada', 2000.00); | Delete the record of DonorB from the Donors table | DELETE FROM Donors WHERE DonorName = 'DonorB'; | gretelai_synthetic_text_to_sql |
CREATE TABLE students (student_id INT, first_name TEXT, last_name TEXT); INSERT INTO students (student_id, first_name, last_name) VALUES (10, 'John', 'Doe'), (20, 'Jane', 'Smith'), (30, 'Mary', 'Johnson'), (40, 'David', 'Williams'); CREATE TABLE faculty_advisors (advisor_id INT, faculty_name TEXT, student_id INT); INSE... | Who is the faculty advisor for the graduate student with student_id 20? | SELECT faculty_advisors.faculty_name FROM faculty_advisors WHERE faculty_advisors.student_id = 20; | gretelai_synthetic_text_to_sql |
CREATE TABLE training (worker_id INT, training_type VARCHAR(50), completion_percentage INT); INSERT INTO training (worker_id, training_type, completion_percentage) VALUES (1, 'Cultural Competency', 85), (2, 'Cultural Competency', 90), (3, 'Cultural Competency', 95); | What is the percentage of cultural competency training completed by community health workers? | SELECT worker_id, training_type, completion_percentage, completion_percentage * 100.0 / SUM(completion_percentage) OVER (PARTITION BY training_type) as percentage FROM training WHERE training_type = 'Cultural Competency'; | gretelai_synthetic_text_to_sql |
CREATE TABLE MilitaryPatents (Id INT, Country VARCHAR(50), Patent VARCHAR(50), Year INT); INSERT INTO MilitaryPatents (Id, Country, Patent, Year) VALUES (1, 'USA', 'Laser Communication', 2020); INSERT INTO MilitaryPatents (Id, Country, Patent, Year) VALUES (2, 'China', 'Drone Swarm', 2020); | How many military technology patents were filed in 2020 by country? | SELECT COUNT(*), Country FROM MilitaryPatents WHERE Year = 2020 GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE geological_survey (survey_id INT PRIMARY KEY, mine_name VARCHAR(20), mineral_type VARCHAR(20), survey_date DATE); INSERT INTO geological_survey (survey_id, mine_name, mineral_type, survey_date) VALUES (1, 'Sapphire Summit', 'Sapphire', '2022-03-15'), (2, 'Emerald Exploration', 'Emerald', '2022-03-20'), (3,... | Update the "geological_survey" table to set the "survey_date" to '2022-04-15' for all records where the "mine_name" is 'Sapphire Summit' | UPDATE geological_survey SET survey_date = '2022-04-15' WHERE mine_name = 'Sapphire Summit'; | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_name TEXT, brand_id INT, sustainable_product BOOLEAN); INSERT INTO products (product_id, product_name, brand_id, sustainable_product) VALUES (1, 'Organic Cotton Shirt', 1, TRUE), (2, 'Polyester Jacket', 1, FALSE), (3, 'Hemp T-Shirt', 2, TRUE), (4, 'Viscose Dress', 2, FALSE... | Which brands offer the most sustainable products? | SELECT brands.brand_name, COUNT(*) as sustainable_product_count FROM products JOIN brands ON products.brand_id = brands.brand_id WHERE products.sustainable_product = TRUE GROUP BY brands.brand_name ORDER BY sustainable_product_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE ArtWorks (ArtworkID int, Title varchar(100), Value int, Period varchar(100)); | List the artworks created in the Baroque period with a value greater than $100k. | SELECT Title, Value FROM ArtWorks | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (donor_id INT, organization_id INT, amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (donor_id, organization_id, amount, donation_date) VALUES (1, 101, 500.00, '2022-10-01'), (2, 102, 350.00, '2022-11-05'), (3, 101, 200.00, '2022-12-25'), (1, 103, 400.00, '2022-11-12'); | What is the total amount donated by each donor in H2 2022? | SELECT donor_id, SUM(amount) as total_donation FROM donations WHERE donation_date BETWEEN '2022-10-01' AND '2022-12-31' GROUP BY donor_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE labor_productivity_by_region (region VARCHAR(20), productivity FLOAT); INSERT INTO labor_productivity_by_region (region, productivity) VALUES ('West', 3.2), ('East', 3.5), ('North', 3.0), ('South', 3.6); | Provide the average labor productivity for mining operations in the Western region. | SELECT AVG(productivity) FROM labor_productivity_by_region WHERE region = 'West'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Menu (menu_name VARCHAR(20), item_name VARCHAR(30), price DECIMAL(5,2)); INSERT INTO Menu (menu_name, item_name, price) VALUES ('Vegan', 'Tofu Stir Fry', 15.50); | Update the price of the 'Tofu Stir Fry' on the 'Vegan' menu to 16.50 | UPDATE Menu SET price = 16.50 WHERE menu_name = 'Vegan' AND item_name = 'Tofu Stir Fry'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(20)); INSERT INTO players (id, name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie'); CREATE TABLE console_games (id INT, player_id INT, console VARCHAR(10), title VARCHAR(20)); INSERT INTO console_games (id, player_id, console, title) VALUES (1, 1, 'PlayStation', 'God of War'... | List of players who have played games on both PlayStation and Xbox platforms? | SELECT players.name FROM players INNER JOIN console_games AS ps_games ON players.id = ps_games.player_id INNER JOIN console_games AS xbox_games ON players.id = xbox_games.player_id WHERE ps_games.console = 'PlayStation' AND xbox_games.console = 'Xbox'; | gretelai_synthetic_text_to_sql |
CREATE TABLE health_equity_metrics (state VARCHAR(2), year INT, accessibility FLOAT, affordability FLOAT); | Delete health equity metrics for New Mexico in 2018 | DELETE FROM health_equity_metrics WHERE state = 'NM' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name TEXT, category TEXT); INSERT INTO restaurants (id, name, category) VALUES (1, 'Restaurant A', 'organic'), (2, 'Restaurant B', 'conventional'), (3, 'Restaurant C', 'organic'), (4, 'Restaurant D', 'conventional'), (5, 'Restaurant E', 'organic'); | How many restaurants are there in each category? | SELECT category, COUNT(category) FROM restaurants GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists biosensors;USE biosensors;CREATE TABLE if not exists patents(id INT, name VARCHAR(255), company VARCHAR(255), country VARCHAR(255));INSERT INTO patents(id, name, company, country) VALUES (1, 'PatentA', 'Company1', 'UK'), (2, 'PatentB', 'Company2', 'DE'), (3, 'PatentC', 'Company3', 'MX'); | List all biosensor technology patents that were filed by companies from the UK or Germany. | SELECT * FROM biosensors.patents WHERE country IN ('UK', 'DE'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ReverseLogistics (id INT, customer VARCHAR(255), delivery_time FLOAT, country VARCHAR(255), quarter INT, year INT); | What is the average delivery time for reverse logistics shipments from the United Kingdom in Q4 2022? | SELECT AVG(delivery_time) FROM ReverseLogistics WHERE country = 'United Kingdom' AND quarter = 4 AND year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE HIV (Country TEXT, Cases INT); INSERT INTO HIV (Country, Cases) VALUES ('South Africa', 10000), ('South Africa', 12000); | What is the number of HIV cases in South Africa? | SELECT SUM(Cases) FROM HIV WHERE Country = 'South Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contractors (Id INT, Name VARCHAR(50), LicenseNumber VARCHAR(50), City VARCHAR(50), State VARCHAR(2), Specialty VARCHAR(50)); CREATE TABLE ContractorProjects (ContractorId INT, ProjectId INT, ContractStartDate DATE, ContractEndDate DATE, ContractAmount DECIMAL(10,2)); CREATE TABLE Projects (Id INT, Name VA... | What is the average contract amount for plumbing projects managed by contractors from California? | SELECT AVG(cp.ContractAmount) FROM ContractorProjects cp JOIN Contractors c ON cp.ContractorId = c.Id JOIN Projects p ON cp.ProjectId = p.Id WHERE c.State = 'CA' AND c.LicenseNumber IS NOT NULL AND p.Specialty = 'Plumbing'; | gretelai_synthetic_text_to_sql |
CREATE TABLE complaints_details (complaint_id INTEGER, product_name TEXT, complaint_type TEXT, launch_year INTEGER); INSERT INTO complaints_details (complaint_id, product_name, complaint_type, launch_year) VALUES (1, 'ProductA', 'Allergy', 2021), (2, 'ProductB', 'Packaging', 2020), (3, 'ProductC', 'Allergy', 2019); | Number of complaints related to allergies for cosmetic products launched since 2020? | SELECT COUNT(*) FROM complaints_details WHERE complaint_type = 'Allergy' AND launch_year >= 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE Meals (MealID INT, MealName VARCHAR(50), Country VARCHAR(50), Calories INT); INSERT INTO Meals (MealID, MealName, Country, Calories) VALUES (1, 'Spaghetti Bolognese', 'Italy', 650), (2, 'Chicken Tikka Masala', 'UK', 850); | What are the average calorie counts for meals served in each country? | SELECT Country, AVG(Calories) as AvgCalories FROM Meals GROUP BY Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE VesselCargo (CargoID INT, VesselID INT, CargoWeight INT, LastHandled DATE, Region VARCHAR(50)); INSERT INTO VesselCargo (CargoID, VesselID, CargoWeight, LastHandled, Region) VALUES (1, 1, 50000, '2022-03-15', 'Oceania'), (2, 2, 70000, '2022-02-20', 'Oceania'), (3, 3, 60000, '2022-01-05', 'Oceania'); | Sum the total cargo weight handled by all vessels in Oceania over the past 3 months | SELECT SUM(CargoWeight) FROM VesselCargo WHERE Region = 'Oceania' AND LastHandled >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH); | gretelai_synthetic_text_to_sql |
CREATE TABLE Neodymium_Production (id INT, year INT, country VARCHAR(255), quantity FLOAT, market_price FLOAT); | What is the average market price of Neodymium produced in the US in 2020? | SELECT AVG(market_price) FROM Neodymium_Production WHERE year = 2020 AND country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CarbonPrices (id INT, state VARCHAR(50), year INT, price FLOAT); INSERT INTO CarbonPrices (id, state, year, price) VALUES (1, 'California', 2020, 17.45), (2, 'California', 2019, 15.63), (3, 'NewYork', 2020, 12.27); | What is the maximum carbon price (in USD/tonne) in California in 2020? | SELECT MAX(price) FROM CarbonPrices WHERE state = 'California' AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE biosensor_projects (id INT, project_name VARCHAR(50), completion_year INT, region VARCHAR(50)); INSERT INTO biosensor_projects (id, project_name, completion_year, region) VALUES (1, 'Glucose Monitor', 2018, 'Europe'); INSERT INTO biosensor_projects (id, project_name, completion_year, region) VALUES (2, 'He... | How many biosensor technology development projects were completed in Asia in 2020? | SELECT COUNT(*) FROM biosensor_projects WHERE completion_year = 2020 AND region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Attorneys (AttorneyID INT, Name VARCHAR(50), Wins INT, Losses INT); INSERT INTO Attorneys (AttorneyID, Name, Wins, Losses) VALUES (1, 'John Doe', 10, 0), (2, 'Jane Smith', 15, 5); CREATE TABLE Cases (CaseID INT, AttorneyID INT, Category VARCHAR(50), Won INT); INSERT INTO Cases (CaseID, AttorneyID, Category... | Who are the attorneys who have never lost a case in the 'Civil' category? | SELECT Name FROM Attorneys WHERE AttorneyID NOT IN (SELECT AttorneyID FROM Cases WHERE Category = 'Civil' AND Won = 0); | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_contracts (id INT, contractor TEXT, award_date DATE, contract_value INT); INSERT INTO defense_contracts (id, contractor, award_date, contract_value) VALUES (1, 'Global Defence Inc.', '2020-01-01', 1000000), (2, 'Global Defence Inc.', '2019-12-01', 800000); | Obtain the total defense contracts awarded to 'Global Defence Inc.' in 2020. | SELECT SUM(contract_value) FROM defense_contracts WHERE contractor = 'Global Defence Inc.' AND award_date >= '2020-01-01' AND award_date < '2021-01-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE community_health_workers (id INT, name TEXT, last_update DATE); INSERT INTO community_health_workers (id, name, last_update) VALUES (1, 'Sophia Lee', '2019-01-01'), (2, 'Daniel Park', '2020-01-01'); | Delete community health worker records that have not been updated in the last 2 years. | DELETE FROM community_health_workers WHERE last_update < DATE_SUB(CURDATE(), INTERVAL 2 YEAR); | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (sale_id INT, menu_item VARCHAR(255), revenue INT); INSERT INTO sales (sale_id, menu_item, revenue) VALUES (1, 'Impossible Burger', 500), (2, 'Beyond Sausage', 700), (3, 'Local Greens Salad', 600), (4, 'Tofu Stir Fry', 800), (5, 'Chicken Caesar Salad', 900); CREATE TABLE menu (menu_item VARCHAR(255),... | Show the top 3 sustainable menu items by sales? | SELECT m.menu_item, SUM(s.revenue) AS total_sales FROM sales s JOIN menu m ON s.menu_item = m.menu_item WHERE m.sourcing = 'Sustainable' GROUP BY s.menu_item ORDER BY total_sales DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE EquipmentSales (SaleID INT, Contractor VARCHAR(255), EquipmentType VARCHAR(255), Quantity INT, SalePrice DECIMAL(5, 2)); INSERT INTO EquipmentSales (SaleID, Contractor, EquipmentType, Quantity, SalePrice) VALUES (1, 'Contractor X', 'Tank', 7, 8000000); | What was the total value of military equipment sales by Contractor X in Q3 of 2021? | SELECT Contractor, SUM(Quantity * SalePrice) FROM EquipmentSales WHERE Contractor = 'Contractor X' AND Quarter = 'Q3' AND Year = 2021 GROUP BY Contractor; | gretelai_synthetic_text_to_sql |
CREATE TABLE ContractNegotiations (contract_id INT, country VARCHAR(255), negotiation_start_date DATE, negotiation_end_date DATE); INSERT INTO ContractNegotiations (contract_id, country, negotiation_start_date, negotiation_end_date) VALUES (1, 'USA', '2018-04-01', '2018-06-15'), (2, 'Canada', '2019-02-10', '2019-05-20'... | List the countries with the highest contract negotiation duration, limited to the top 3? | SELECT country, TIMESTAMPDIFF(DAY, negotiation_start_date, negotiation_end_date) AS NegotiationDuration FROM ContractNegotiations ORDER BY NegotiationDuration DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE humanitarian_assistance (country VARCHAR(50), amount NUMERIC(10,2)); INSERT INTO humanitarian_assistance (country, amount) VALUES ('EU', 80000000), ('USA', 50000000), ('Germany', 15000000), ('UK', 20000000), ('France', 22000000); | What is the minimum humanitarian assistance provided by the European Union? | SELECT MIN(amount) FROM humanitarian_assistance WHERE country = 'EU'; | gretelai_synthetic_text_to_sql |
CREATE TABLE fans (fan_id INT, team_id INT, age INT); INSERT INTO fans (fan_id, team_id, age) VALUES (1, 1, 35), (2, 1, 45), (3, 2, 25), (4, 2, 30); | What is the average age and ticket revenue for fans of each team? | SELECT t.team_name, AVG(f.age) as avg_age, SUM(ts.revenue) as avg_revenue FROM teams t JOIN fans f ON t.team_id = f.team_id JOIN ticket_sales ts ON t.team_id = ts.team_id GROUP BY t.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE customers (customer_id INT, name TEXT, country TEXT, transaction_amount DECIMAL); INSERT INTO customers (customer_id, name, country, transaction_amount) VALUES (1, 'John Doe', 'USA', 150.00), (2, 'Jane Smith', 'Canada', 200.00); | What is the average transaction amount for customers from the United States? | SELECT AVG(transaction_amount) FROM customers WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE avs (id INT, model VARCHAR(50), avg_speed_city FLOAT, avg_speed_highway FLOAT); INSERT INTO avs (id, model, avg_speed_city, avg_speed_highway) VALUES (1, 'Wayve', 32.5, 55.0), (2, 'NVIDIA Drive', 35.0, 58.0), (3, 'Baidu Apollo', 30.0, 52.0); | Which autonomous vehicle has the highest average speed in city driving? | SELECT model, MAX(avg_speed_city) FROM avs; | gretelai_synthetic_text_to_sql |
CREATE TABLE exam_results (student_id INT, subject VARCHAR(10), passed BOOLEAN); INSERT INTO exam_results (student_id, subject, passed) VALUES (1, 'Math', TRUE), (1, 'English', FALSE), (2, 'Math', TRUE), (2, 'English', TRUE), (3, 'Math', FALSE), (3, 'English', TRUE); | What is the percentage of students passing the exam in each subject? | SELECT subject, COUNT(*) * 100.0 / (SELECT COUNT(*) FROM exam_results) as pass_percentage FROM exam_results WHERE passed = TRUE GROUP BY subject; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinic_CA (patient_id INT, name VARCHAR(50), primary_diagnosis VARCHAR(50)); INSERT INTO clinic_CA (patient_id, name, primary_diagnosis) VALUES (1, 'John Doe', 'Depression'), (2, 'Jane Smith', 'Anxiety'), (3, 'Alice Johnson', 'Bipolar Disorder'); | How many patients in 'clinic_CA' have a primary diagnosis of 'Depression' or 'Anxiety'? | SELECT COUNT(*) FROM clinic_CA WHERE primary_diagnosis IN ('Depression', 'Anxiety'); | gretelai_synthetic_text_to_sql |
CREATE TABLE transactions (platform VARCHAR(255), tx_value DECIMAL(10,2), tx_date DATE); INSERT INTO transactions (platform, tx_value, tx_date) VALUES ('Binance', 50.00, '2021-12-01'), ('Binance', 75.00, '2021-12-02'), ('Ethereum', 100.00, '2021-12-01'), ('Solana', 20.00, '2021-12-03'), ('Binance', 80.00, '2021-12-04')... | What is the average transaction value (in USD) for the 'Binance' platform, and what is the standard deviation? | SELECT AVG(tx_value), STDDEV(tx_value) FROM transactions WHERE platform = 'Binance'; | gretelai_synthetic_text_to_sql |
CREATE TABLE climate_zone_1 (crop_name TEXT, yield INTEGER); INSERT INTO climate_zone_1 (crop_name, yield) VALUES ('corn', 120), ('soybean', 50), ('wheat', 80); | What is the average yield of crops grown in 'climate_zone_1'? | SELECT AVG(yield) FROM climate_zone_1; | gretelai_synthetic_text_to_sql |
CREATE TABLE Hip_Hop_Songs (title TEXT, year INTEGER, rating FLOAT); INSERT INTO Hip_Hop_Songs (title, year, rating) VALUES ('Song1', 2013, 7.5), ('Song2', 2014, 8.0), ('Song3', 2015, 8.5), ('Song4', 2016, 9.0), ('Song5', 2017, 9.2), ('Song6', 2018, 9.5); | What is the average rating of hip-hop songs released in 2015? | SELECT AVG(rating) FROM Hip_Hop_Songs WHERE year = 2015; | gretelai_synthetic_text_to_sql |
VESSEL(vessel_id, safety_record_id, last_inspection_date); SAFETY_INCIDENT(safety_record_id, incident_date) | Show the number of safety incidents for each vessel in the last 6 months | SELECT v.vessel_id, COUNT(si.safety_record_id) AS num_of_incidents FROM VESSEL v JOIN SAFETY_INCIDENT si ON v.safety_record_id = si.safety_record_id WHERE si.incident_date BETWEEN DATEADD(month, -6, v.last_inspection_date) AND v.last_inspection_date GROUP BY v.vessel_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE AircraftManufacturers (Company VARCHAR(50), Model VARCHAR(50), Year INT); INSERT INTO AircraftManufacturers (Company, Model, Year) VALUES ('Boeing', '747', 1969), ('Boeing', '787 Dreamliner', 2004), ('Airbus', 'A320', 1988), ('Airbus', 'A380', 2005); | What is the total number of aircraft manufactured by each company, and the most recent year of manufacturing? | SELECT Company, COUNT(*) as Total, MAX(Year) as LatestYear FROM AircraftManufacturers GROUP BY Company; | gretelai_synthetic_text_to_sql |
CREATE TABLE policies (policy_id INT, category VARCHAR(10)); INSERT INTO policies (policy_id, category) VALUES (1, 'auto'), (2, 'home'), (3, 'auto'); CREATE TABLE claims (claim_id INT, policy_id INT, amount DECIMAL(10, 2)); INSERT INTO claims (claim_id, policy_id, amount) VALUES (1, 1, 500), (2, 1, 700), (3, 2, 300), (... | Find the average claim amount for policies in the 'auto' category | SELECT AVG(claims.amount) FROM claims INNER JOIN policies ON claims.policy_id = policies.policy_id WHERE policies.category = 'auto'; | gretelai_synthetic_text_to_sql |
CREATE TABLE menus (menu_id INT, menu_name VARCHAR(50), category VARCHAR(50), price DECIMAL(5,2), is_sustainable BOOLEAN); INSERT INTO menus (menu_id, menu_name, category, price, is_sustainable) VALUES (1, 'Quinoa Salad', 'Vegetarian', 9.99, true), (2, 'Margherita Pizza', 'Non-Vegetarian', 12.99, false), (3, 'Chickpea ... | What is the total revenue from sustainable menu items last month? | SELECT SUM(price) FROM menus JOIN orders ON menus.menu_id = orders.menu_id WHERE is_sustainable = true AND orders.order_date BETWEEN '2022-04-01' AND '2022-04-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE GameDesignData (GameID INT, SinglePlayer BOOLEAN, Revenue DECIMAL(10,2)); INSERT INTO GameDesignData (GameID, SinglePlayer, Revenue) VALUES (1, TRUE, 1000000), (2, FALSE, 2000000), (3, TRUE, 500000); | What is the total revenue of games with a single-player mode? | SELECT SUM(Revenue) FROM GameDesignData WHERE SinglePlayer = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE chemicals (id INT, name VARCHAR(255), category VARCHAR(255), production_time FLOAT, region VARCHAR(255)); | What is the average production time for each chemical category, for chemical manufacturing in the Africa region? | SELECT category, AVG(production_time) as avg_time FROM chemicals WHERE region = 'Africa' GROUP BY category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Vendors (VendorID INT, VendorName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Vendors (VendorID, VendorName, Country) VALUES (1, 'GreenVacations', 'Nepal'), (2, 'EcoTours', 'India'), (3, 'SustainableJourneys', 'Bhutan'), (4, 'BluePlanetTours', 'USA'); CREATE TABLE Packages (PackageID INT, VendorID INT, ... | What is the average CO2 emission per sustainable tour package offered by vendors from Asia? | SELECT V.Country, AVG(P.CO2Emission) as AvgCO2Emission FROM Vendors V INNER JOIN Packages P ON V.VendorID = P.VendorID WHERE V.Country LIKE 'Asia%' AND P.PackageType = 'Sustainable' GROUP BY V.Country; | gretelai_synthetic_text_to_sql |
CREATE TABLE tv_shows (id INT, title VARCHAR(255), release_year INT, country VARCHAR(100), viewership INT); | What's the viewership trend for TV shows in Australia over the last 3 years? | SELECT release_year, AVG(viewership) as avg_viewership FROM tv_shows WHERE country = 'Australia' GROUP BY release_year ORDER BY release_year DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE cities (id INT, name VARCHAR(30)); CREATE TABLE properties (id INT, city VARCHAR(20), price INT, sustainable_urbanism BOOLEAN); INSERT INTO cities (id, name) VALUES (1, 'Vancouver'), (2, 'Seattle'), (3, 'Portland'); INSERT INTO properties (id, city, price, sustainable_urbanism) VALUES (101, 'Vancouver', 60... | What is the maximum property price for buildings in each city with a sustainable urbanism certification? | SELECT cities.name, MAX(properties.price) FROM cities INNER JOIN properties ON cities.name = properties.city WHERE properties.sustainable_urbanism = true GROUP BY cities.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (id INT, name TEXT, country TEXT, donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donors (id, name, country, donation_amount, donation_date) VALUES (1, 'John Doe', 'USA', 500.00, '2022-04-01'), (2, 'Jane Smith', 'Canada', 300.00, '2022-04-15'); | What was the total amount donated by individual donors from the United States in Q2 2022? | SELECT SUM(donation_amount) FROM donors WHERE country = 'USA' AND donation_date >= '2022-04-01' AND donation_date <= '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE schools (id INT PRIMARY KEY, name VARCHAR(255)); CREATE TABLE students (id INT PRIMARY KEY, school_id INT, mental_health_score INT); | What is the maximum number of mental health scores recorded for students in each school? | SELECT s.name, MAX(COUNT(st.mental_health_score)) FROM students st JOIN schools s ON st.school_id = s.id GROUP BY s.id; | gretelai_synthetic_text_to_sql |
CREATE TABLE departments (id INT, name TEXT); CREATE TABLE faculty (id INT, name TEXT, gender TEXT, department_id INT); INSERT INTO departments (id, name) VALUES (1, 'Mathematics'), (2, 'Computer Science'); INSERT INTO faculty (id, name, gender, department_id) VALUES (1, 'Jane', 'Female', 1), (2, 'John', 'Male', 2), (... | Which departments have the highest percentage of female faculty members? | SELECT d.name, 100.0 * COUNT(f.id) / ( SELECT COUNT(*) FROM faculty f WHERE f.department_id = d.id ) as percentage FROM departments d JOIN faculty f ON d.id = f.department_id WHERE f.gender = 'Female' GROUP BY d.name ORDER BY percentage DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales(sale_id INT, brand VARCHAR(255), revenue DECIMAL(5,2));INSERT INTO sales (sale_id, brand, revenue) VALUES (1, 'Brand A', 5000), (2, 'Brand B', 7500), (3, 'Brand A', 6000), (4, 'Brand C', 4000), (5, 'Brand B', 8000); | Find the top 3 brands with the highest sales revenue and their total sales revenue? | SELECT brand, SUM(revenue) FROM sales GROUP BY brand ORDER BY SUM(revenue) DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE game_ticket_sales (id INT, game_id INT, team VARCHAR(50), revenue INT); INSERT INTO game_ticket_sales (id, game_id, team, revenue) VALUES (1, 1, 'TeamA', 5000), (2, 1, 'TeamA', 5000), (3, 2, 'TeamB', 6000), (4, 2, 'TeamB', 6000); | What is the average number of tickets sold for each game? | SELECT game_id, AVG(revenue/50) as avg_tickets_sold FROM game_ticket_sales GROUP BY game_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE healthcare_centers (id INT, name TEXT, country TEXT, created_at TIMESTAMP); | Update the country of healthcare center with id 2 to 'Canada'. | UPDATE healthcare_centers SET country = 'Canada' WHERE id = 2; | gretelai_synthetic_text_to_sql |
vessel_fuel_consumption(consumption_id, voyage_id, fuel_type, fuel_consumption) | Delete all records from the vessel_fuel_consumption table where the fuel_type is 'diesel' | DELETE FROM vessel_fuel_consumption WHERE fuel_type = 'diesel'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Concerts (concert_id INT, concert_name VARCHAR(255), location VARCHAR(255), year INT, revenue INT); INSERT INTO Concerts (concert_id, concert_name, location, year, revenue) VALUES (1, 'Concert A', 'Tokyo', 2022, 1000000), (2, 'Concert B', 'Seoul', 2022, 1200000), (3, 'Concert C', 'Sydney', 2021, 800000); | Find the total revenue for concerts in the APAC region in 2022. | SELECT SUM(revenue) FROM Concerts WHERE year = 2022 AND location LIKE 'APAC%'; | gretelai_synthetic_text_to_sql |
CREATE TABLE investments (investment_id INT, investor_id INT, org_id INT, investment_amount INT); INSERT INTO investments (investment_id, investor_id, org_id, investment_amount) VALUES (1, 1, 10, 30000), (2, 2, 11, 40000), (3, 1, 12, 50000), (4, 3, 11, 45000), (5, 2, 12, 60000); CREATE TABLE investors (investor_id INT,... | Delete all records in the healthcare sector from the database. | DELETE FROM investments WHERE investments.org_id IN (SELECT organizations.org_id FROM organizations WHERE organizations.focus_topic = 'Healthcare'); DELETE FROM organizations WHERE organizations.focus_topic = 'Healthcare'; | gretelai_synthetic_text_to_sql |
CREATE TABLE expenses (expense_id INT, expense_amount DECIMAL, expense_date DATE); CREATE TABLE income (income_id INT, income_amount DECIMAL, income_date DATE); | Calculate the average monthly expenses and income for the past year from 'expenses' and 'income' tables | SELECT DATE_FORMAT(expenses.expense_date, '%Y-%m') as month, AVG(expenses.expense_amount) as avg_monthly_expenses, AVG(income.income_amount) as avg_monthly_income FROM expenses INNER JOIN income ON DATE_FORMAT(expenses.expense_date, '%Y-%m') = DATE_FORMAT(income.income_date, '%Y-%m') WHERE expenses.expense_date >= DATE... | gretelai_synthetic_text_to_sql |
CREATE TABLE sea_surface_temperature (id INT, ocean VARCHAR(255), avg_temperature FLOAT); INSERT INTO sea_surface_temperature (id, ocean, avg_temperature) VALUES (1, 'Pacific', 28); | Which ocean has the highest average sea surface temperature? | SELECT ocean, MAX(avg_temperature) FROM sea_surface_temperature GROUP BY ocean ORDER BY MAX(avg_temperature) DESC LIMIT 1 | gretelai_synthetic_text_to_sql |
CREATE TABLE plants (plant VARCHAR(20), chemical VARCHAR(20), score INT); INSERT INTO plants (plant, chemical, score) VALUES ('Frankfurt', 'Ethanol', 80), ('Frankfurt', 'Propanol', 75), ('Munich', 'Methanol', 70), ('Munich', 'Butanol', 78); | Find the average environmental impact score for each chemical produced at the Frankfurt and Munich plants. | SELECT chemical, AVG(score) FROM plants WHERE plant IN ('Frankfurt', 'Munich') GROUP BY chemical; | gretelai_synthetic_text_to_sql |
CREATE TABLE space_objects (name TEXT, orbital_velocity_km_s INTEGER); INSERT INTO space_objects (name, orbital_velocity_km_s) VALUES ('ISS', 27600), ('Hubble Space Telescope', 28600), ('Moon', 1680); | What is the average orbital velocity of the International Space Station? | SELECT AVG(orbital_velocity_km_s) FROM space_objects WHERE name = 'ISS'; | gretelai_synthetic_text_to_sql |
CREATE TABLE games (game_id INT, team_id INT, won BOOLEAN); INSERT INTO games VALUES (1, 1, true), (2, 1, true), (3, 2, false), (4, 2, false), (5, 3, true); | How many games were won by each team in the eastern conference? | SELECT te.team_name, SUM(g.won::INT) as num_wins FROM games g JOIN teams te ON g.team_id = te.team_id WHERE te.conference = 'Eastern' GROUP BY te.team_name; | gretelai_synthetic_text_to_sql |
CREATE TABLE Players (PlayerID INT, Age INT, Gender VARCHAR(10), Country VARCHAR(20), TotalHoursPlayed INT, FavoriteGame VARCHAR(10)); INSERT INTO Players (PlayerID, Age, Gender, Country, TotalHoursPlayed, FavoriteGame) VALUES (1, 22, 'Female', 'India', 10, 'Action'); INSERT INTO Players (PlayerID, Age, Gender, Country... | List the number of players who prefer Action games from each country. | SELECT Country, COUNT(PlayerID) as NumberOfPlayers FROM Players WHERE FavoriteGame = 'Action' GROUP BY Country; | 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.