context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE SpacecraftManufacturing (Manufacturer VARCHAR(255), Country VARCHAR(255), SpacecraftModel VARCHAR(255), SpacecraftMass INT); INSERT INTO SpacecraftManufacturing (Manufacturer, Country, SpacecraftModel, SpacecraftMass) VALUES ('National Aeronautics and Space Administration', 'USA', 'ApolloLunarModule', 1500... | Delete the spacecraft record with the SpacecraftModel 'ApolloLunarModule' from the SpacecraftManufacturing table. | DELETE FROM SpacecraftManufacturing WHERE SpacecraftModel = 'ApolloLunarModule'; | gretelai_synthetic_text_to_sql |
CREATE TABLE purchases (id INT, customer_id INT, garment_id INT, price DECIMAL(5,2), quantity INT, purchase_date DATE); CREATE TABLE customers (id INT, name VARCHAR(100), gender VARCHAR(10), age INT); | Who are the top 3 customers by total spent? | SELECT customers.name, SUM(purchases.price * purchases.quantity) AS total_spent FROM customers INNER JOIN purchases ON customers.id = purchases.customer_id GROUP BY customers.id ORDER BY total_spent DESC LIMIT 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (country TEXT, year INTEGER, trials INTEGER); INSERT INTO clinical_trials (country, year, trials) VALUES ('Japan', 2019, 500); INSERT INTO clinical_trials (country, year, trials) VALUES ('China', 2019, 800); | How many clinical trials were conducted in Asia in 2019? | SELECT SUM(trials) FROM clinical_trials WHERE country IN ('Japan', 'China') AND year = 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE Companies (CompanyID INT, CompanyName VARCHAR(50), Country VARCHAR(50)); INSERT INTO Companies (CompanyID, CompanyName, Country) VALUES (1, 'ABC Mining', 'Canada'), (2, 'XYZ Excavations', 'USA'), (3, 'MNO Drilling', 'Mexico'), (4, 'PQR Quarrying', 'Australia'), (5, 'RST Mining', 'Russia'); CREATE TABLE Env... | What are the mining companies operating in countries with the highest environmental impact? | SELECT CompanyName FROM Companies JOIN EnvironmentalImpact ON Companies.Country = EnvironmentalImpact.Country WHERE ImpactScore IN (SELECT MAX(ImpactScore) FROM EnvironmentalImpact); | gretelai_synthetic_text_to_sql |
CREATE TABLE CarbonOffsetProject (id INT, name VARCHAR(255), location VARCHAR(255), year INT, amount_offset INT); INSERT INTO CarbonOffsetProject (id, name, location, year, amount_offset) VALUES (1, 'Solar Farm', 'California', 2010, 5000); INSERT INTO CarbonOffsetProject (id, name, location, year, amount_offset) VALUES... | Which locations have the highest carbon offset in a given year? | SELECT location, MAX(amount_offset) FROM CarbonOffsetProject GROUP BY location HAVING MAX(amount_offset) > 6000; | gretelai_synthetic_text_to_sql |
CREATE TABLE educators(id INT, age INT, num_courses INT); INSERT INTO educators VALUES (1, 45, 2), (2, 30, 5), (3, 50, 3), (4, 40, 1); | What is the average age of educators who have completed more than 3 professional development courses? | SELECT AVG(age) FROM educators WHERE num_courses > 3; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_innovation (id INT, project VARCHAR, country VARCHAR, budget FLOAT, start_year INT, end_year INT, PRIMARY KEY (id)); INSERT INTO military_innovation (id, project, country, budget, start_year, end_year) VALUES (1, 'Arjun Mk-II', 'India', 1500000, 2000, 2020), (2, 'Light Combat Aircraft', 'India', 2... | Rank military innovation projects in India by project age (end_year - start_year), in descending order? | SELECT project, country, ROW_NUMBER() OVER (PARTITION BY country ORDER BY end_year - start_year DESC) as project_age_rank FROM military_innovation WHERE country = 'India'; | gretelai_synthetic_text_to_sql |
CREATE TABLE FluTracking (ID INT, Month DATE, Cases INT, Year INT); INSERT INTO FluTracking (ID, Month, Cases, Year) VALUES (1, '2021-01-01', 2500, 2021), (2, '2021-02-01', 3000, 2021), (3, '2021-03-01', 2000, 2021); | How many flu cases were reported per month in 2021? | SELECT EXTRACT(MONTH FROM Month) as Month, SUM(Cases) as TotalCases FROM FluTracking WHERE Year = 2021 GROUP BY Month ORDER BY Month; | gretelai_synthetic_text_to_sql |
CREATE TABLE restaurants (id INT, name TEXT, city TEXT, state TEXT, daily_revenue DECIMAL); INSERT INTO restaurants (id, name, city, state, daily_revenue) VALUES (1, 'Restaurant A', 'Miami', 'FL', 1500.00), (2, 'Restaurant B', 'Miami', 'FL', 1200.00), (3, 'Restaurant C', 'Orlando', 'FL', 1800.00); | What is the average revenue per day for restaurants in Miami? | SELECT AVG(daily_revenue) FROM restaurants WHERE city = 'Miami'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (order_id INT, order_date DATE, menu_id INT); INSERT INTO Orders (order_id, order_date, menu_id) VALUES (1, '2021-07-01', 1), (2, '2021-07-02', 2), (3, '2021-07-03', 1); | What is the total number of meals served in the month of July 2021? | SELECT COUNT(*) FROM Orders WHERE MONTH(order_date) = 7 AND YEAR(order_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE SustainableBuildingProjects (id INT, state VARCHAR(50), project_name VARCHAR(50), completed_date DATE, sustainability_rating INT); INSERT INTO SustainableBuildingProjects VALUES (1, 'Oregon', 'EcoTower', '2021-04-10', 85); INSERT INTO SustainableBuildingProjects VALUES (2, 'Oregon', 'GreenFarm', '2021-11-2... | List the sustainable building projects completed in Oregon in 2021 with their sustainability ratings. | SELECT project_name, sustainability_rating FROM SustainableBuildingProjects WHERE state = 'Oregon' AND YEAR(completed_date) = 2021; | gretelai_synthetic_text_to_sql |
CREATE TABLE landfill_capacity (location VARCHAR(50), capacity INT); | Delete records in landfill_capacity table where capacity is greater than 30000 tons | DELETE FROM landfill_capacity WHERE capacity > 30000; | gretelai_synthetic_text_to_sql |
CREATE TABLE rural_infrastructure (id INT, project TEXT, budget INT, year INT); INSERT INTO rural_infrastructure (id, project, budget, year) VALUES (1, 'Project C', 500000, 2022), (2, 'Project D', 700000, 2023); | What is the budget for rural infrastructure projects in 2022? | SELECT SUM(budget) FROM rural_infrastructure WHERE year = 2022; | gretelai_synthetic_text_to_sql |
CREATE TABLE sales (region VARCHAR(20), produce_type VARCHAR(20), revenue INT, organic BOOLEAN); INSERT INTO sales VALUES ('Africa', 'Corn', 7000, true), ('Africa', 'Soybeans', 8000, false), ('Africa', 'Cotton', 6000, true); | What is the total revenue from organic and conventional crop sales in Africa, and what is the percentage of revenue from organic crop sales? | SELECT SUM(s.revenue) as total_revenue, ROUND(SUM(CASE WHEN s.organic THEN s.revenue ELSE 0 END) / SUM(s.revenue) * 100, 2) as organic_percentage FROM sales s WHERE s.region = 'Africa'; | gretelai_synthetic_text_to_sql |
CREATE TABLE artworks (id INT, name TEXT); INSERT INTO artworks (id, name) VALUES (1, 'Mona Lisa'), (2, 'Starry Night'); CREATE TABLE views (id INT, visitor_id INT, artwork_id INT, country TEXT); INSERT INTO views (id, visitor_id, artwork_id, country) VALUES (1, 1, 1, 'USA'), (2, 2, 1, 'Canada'); | How many times has each artwork been viewed by visitors from different countries? | SELECT artwork_id, country, COUNT(DISTINCT visitor_id) FROM views GROUP BY artwork_id, country; | gretelai_synthetic_text_to_sql |
CREATE TABLE TestFlights (FlightID INT, TestDate DATE, StarshipName VARCHAR(50), Result VARCHAR(50), Purpose VARCHAR(50)); INSERT INTO TestFlights (FlightID, TestDate, StarshipName, Result, Purpose) VALUES (1, '2021-08-03', 'Starship SN15', 'Success', 'Test Flight'); INSERT INTO TestFlights (FlightID, TestDate, Starshi... | Delete all test flights of the SpaceX Starship | DELETE FROM TestFlights WHERE StarshipName = 'Starship SN15' AND Purpose = 'Test Flight'; | gretelai_synthetic_text_to_sql |
CREATE TABLE archaeologists (id INT, name VARCHAR(255)); CREATE TABLE archaeologists_excavations (archaeologist_id INT, excavation_site_id INT); | Which archaeologists led excavations with more than 50 artifacts? | SELECT archaeologists.name FROM archaeologists | gretelai_synthetic_text_to_sql |
CREATE TABLE genres (id INT, genre TEXT); | Update the genre of the genre with id 2 to 'New Genre' in the 'genres' table | UPDATE genres SET genre = 'New Genre' WHERE id = 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE autonomous_driving_research (test_id INT, vehicle_name VARCHAR(50), test_location VARCHAR(50), test_date DATE, weather_conditions VARCHAR(50)); | Insert a new record for an autonomous vehicle test in the autonomous_driving_research table. | INSERT INTO autonomous_driving_research (test_id, vehicle_name, test_location, test_date, weather_conditions) VALUES (123, 'Self-Driving Car X', 'San Francisco', '2023-03-22', 'Rainy'); | gretelai_synthetic_text_to_sql |
CREATE TABLE products (product_id INT, product_category VARCHAR(50), sustainability_rating FLOAT, country VARCHAR(50)); INSERT INTO products (product_id, product_category, sustainability_rating, country) VALUES (1, 'makeup', 4.0, 'Germany'), (2, 'skincare', 4.5, 'Germany'); | What is the average 'sustainability rating' for 'makeup' products in 'Germany'? | SELECT AVG(sustainability_rating) FROM products WHERE product_category = 'makeup' AND country = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE eco_hotels_canada (hotel_id INT, hotel_name TEXT, country TEXT, rating FLOAT); INSERT INTO eco_hotels_canada (hotel_id, hotel_name, country, rating) VALUES (1, 'Eco-Hotel Vancouver', 'Canada', 4.6), (2, 'Green Living Toronto', 'Canada', 4.7); | How many eco-friendly hotels are there in Canada with a rating above 4.5? | SELECT COUNT(*) FROM eco_hotels_canada WHERE country = 'Canada' AND rating > 4.5; | gretelai_synthetic_text_to_sql |
CREATE TABLE donors (donor_id INT, donor_name TEXT, donation_amount FLOAT, cause TEXT, donation_date DATE); | What is the minimum and maximum donation amount for 'Rosa Rodriguez'? | SELECT MIN(donation_amount), MAX(donation_amount) FROM donors WHERE donor_name = 'Rosa Rodriguez'; | gretelai_synthetic_text_to_sql |
CREATE TABLE weather_data (id INT PRIMARY KEY, location VARCHAR(255), temperature FLOAT, precipitation FLOAT, wind_speed FLOAT, date DATE); | Update the "temperature" values in the "weather_data" table where the "location" is 'Field 1' | UPDATE weather_data SET temperature = 15 WHERE location = 'Field 1'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Stadiums (StadiumID INT, Stadium VARCHAR(50), City VARCHAR(50)); CREATE TABLE TicketSales (TicketID INT, StadiumID INT, SaleDate DATE); INSERT INTO Stadiums (StadiumID, Stadium, City) VALUES (1, 'StadiumA', 'CityA'), (2, 'StadiumB', 'CityB'); INSERT INTO TicketSales (TicketID, StadiumID, SaleDate) VALUES (... | For each stadium, find the number of ticket sales in January and February of 2023, ranked from highest to lowest. | SELECT Stadium, COUNT(*) AS SaleCount FROM TicketSales JOIN Stadiums ON TicketSales.StadiumID = Stadiums.StadiumID WHERE SaleDate BETWEEN '2023-01-01' AND '2023-02-28' GROUP BY Stadium ORDER BY SaleCount DESC; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA if not exists genetic_research;CREATE TABLE if not exists genetic_research.projects (id INT, name VARCHAR(255), country VARCHAR(255), category VARCHAR(255));INSERT INTO genetic_research.projects (id, name, country, category) VALUES (1, 'ProjectA', 'US', 'Genomics'), (2, 'ProjectB', 'UK', 'Proteomics'), (3... | Show me the number of genetic research projects by country. | SELECT country, COUNT(*) as num_projects FROM genetic_research.projects GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE r_and_d_expenses (expense_id INT, drug_id INT, expense_date DATE, amount FLOAT); INSERT INTO r_and_d_expenses (expense_id, drug_id, expense_date, amount) VALUES (1, 1002, '2019-02-01', 52000.0), (2, 1002, '2019-05-01', 57000.0), (3, 1002, '2019-08-01', 62000.0), (4, 1002, '2019-11-01', 67000.0), (5, 1003, ... | What are the R&D expenses per month for a different drug? | SELECT drug_id, DATE_TRUNC('month', expense_date) as month, SUM(amount) as total_expenses FROM r_and_d_expenses WHERE drug_id = 1002 GROUP BY drug_id, month; | gretelai_synthetic_text_to_sql |
CREATE TABLE crime_statistics (crime_type VARCHAR(255), crime_count INT, date DATE); INSERT INTO crime_statistics (crime_type, crime_count, date) VALUES (NULL, NULL, NULL); | Insert new records into the crime_statistics table for the following crime types, counts, and dates: ('Theft', 25, '2022-06-01'), ('Vandalism', 15, '2022-06-02')? | INSERT INTO crime_statistics (crime_type, crime_count, date) VALUES ('Theft', 25, '2022-06-01'), ('Vandalism', 15, '2022-06-02'); | gretelai_synthetic_text_to_sql |
CREATE TABLE renewable_generation (country TEXT, solar INTEGER, wind INTEGER); INSERT INTO renewable_generation (country, solar, wind) VALUES ('Germany', 50000, 30000), ('France', 35000, 25000), ('Spain', 20000, 22000), ('Italy', 18000, 19000), ('United Kingdom', 15000, 17000); | What is the combined solar and wind power generation capacity in Germany and France? | (SELECT solar + wind FROM renewable_generation WHERE country = 'Germany') UNION (SELECT solar + wind FROM renewable_generation WHERE country = 'France') | gretelai_synthetic_text_to_sql |
CREATE TABLE Auto_Shows (id INT, show_name VARCHAR(255), show_year INT, location VARCHAR(255)); INSERT INTO Auto_Shows (id, show_name, show_year, location) VALUES (1, 'Frankfurt Motor Show', 2018, 'Germany'); INSERT INTO Auto_Shows (id, show_name, show_year, location) VALUES (2, 'Paris Motor Show', 2018, 'France'); INS... | How many auto shows were held in Germany in the year 2018? | SELECT COUNT(*) FROM Auto_Shows WHERE show_year = 2018 AND location = 'Germany'; | gretelai_synthetic_text_to_sql |
CREATE TABLE vessel_inspections (vessel_id INT, inspection_date DATE, inspection_type VARCHAR(255), inspection_results VARCHAR(255)); | Display vessels that had more than two inspections in 2021 and the count of inspections. | SELECT vessel_id, COUNT(*) FROM vessel_inspections WHERE YEAR(inspection_date) = 2021 GROUP BY vessel_id HAVING COUNT(*) > 2; | gretelai_synthetic_text_to_sql |
CREATE TABLE companies (id INT, sector TEXT, ESG_rating FLOAT); INSERT INTO companies (id, sector, ESG_rating) VALUES (1, 'technology', 78.2), (2, 'finance', 82.5), (3, 'technology', 84.6); | What's the maximum ESG rating for the 'technology' sector? | SELECT MAX(ESG_rating) FROM companies WHERE sector = 'technology'; | gretelai_synthetic_text_to_sql |
CREATE TABLE satellites (id INT, country VARCHAR(255), launch_date DATE); | What is the earliest launch date of a satellite by China? | SELECT MIN(launch_date) FROM satellites WHERE country = 'China'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ev_data (id INT PRIMARY KEY, model VARCHAR(100), manufacturer VARCHAR(100), year INT, total_sales INT); | Drop the EV table | DROP TABLE ev_data; | gretelai_synthetic_text_to_sql |
CREATE TABLE destination_marketing (id INT, destination VARCHAR(50), promoted_by VARCHAR(50), promotion_start_date DATE, promotion_end_date DATE); INSERT INTO destination_marketing (id, destination, promoted_by, promotion_start_date, promotion_end_date) VALUES (1, 'Bali', 'ABC Travel Agency', '2022-01-01', '2022-12-31'... | Which destinations were promoted the most by travel agencies in 2022? | SELECT destination, COUNT(*) as promotions_count FROM destination_marketing WHERE promotion_start_date >= '2022-01-01' AND promotion_end_date <= '2022-12-31' GROUP BY destination ORDER BY promotions_count DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE tourism_spending_oceania (id INT, country VARCHAR(50), year INT, international_visitors INT, total_expenditure FLOAT, sustainability_practice BOOLEAN, continent VARCHAR(10)); INSERT INTO tourism_spending_oceania (id, country, year, international_visitors, total_expenditure, sustainability_practice, contine... | Identify the top 3 countries with the highest increase in international visitor expenditure between 2017 and 2021 that have implemented sustainable tourism practices in Oceania. | SELECT t1.country, (t1.total_expenditure - t2.total_expenditure) as expenditure_increase FROM tourism_spending_oceania t1 JOIN tourism_spending_oceania t2 ON t1.country = t2.country AND t1.year = 2021 AND t2.year = 2017 WHERE t1.sustainability_practice = true AND t1.continent = 'Oceania' GROUP BY t1.country ORDER BY ex... | gretelai_synthetic_text_to_sql |
CREATE TABLE transportation_projects (id INT, project_type VARCHAR(255), construction_cost FLOAT); INSERT INTO transportation_projects (id, project_type, construction_cost) VALUES (1, 'Bridge', 5000000), (2, 'Road', 2000000), (3, 'Highway', 15000000); | What is the average construction cost per project type in the transportation domain? | SELECT project_type, AVG(construction_cost) FROM transportation_projects GROUP BY project_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE Transactions (id INT, customer_id INT, region VARCHAR(10), amount DECIMAL(10, 2)); INSERT INTO Transactions (id, customer_id, region, amount) VALUES (1, 10, 'Europe', 100), (2, 10, 'Asia', 200), (3, 11, 'Asia', 300), (4, 12, 'Europe', 400), (5, 10, 'Americas', 500); | What is the total transaction amount and count for each customer, excluding transactions made in the 'Asia' region? | SELECT customer_id, SUM(amount) as total_amount, COUNT(*) as transaction_count FROM Transactions WHERE region != 'Asia' GROUP BY customer_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE Startup (Startup_Name VARCHAR(50) PRIMARY KEY, Industry VARCHAR(50), Funding DECIMAL(10, 2)); INSERT INTO Startup (Startup_Name, Industry, Funding) VALUES ('GenTech', 'Genetic Research', 3000000.00); INSERT INTO Startup (Startup_Name, Industry, Funding) VALUES ('BioPro', 'BioProcess Engineering', 4000000.0... | Which biotech startups are associated with the genetic research department? | SELECT S.Startup_Name FROM Startup S WHERE S.Industry = 'Genetic Research'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CityEvents (City VARCHAR(20), EventName VARCHAR(30), Languages INT); INSERT INTO CityEvents VALUES ('Toronto', 'Aboriginal Day Live', 3), ('Montreal', 'Francofolies', 1); CREATE VIEW EventLanguages AS SELECT EventName, COUNT(*) AS Languages FROM CityEvents GROUP BY EventName; | List community engagement events and the number of languages spoken at each. | SELECT e.EventName, e.Languages FROM CityEvents c JOIN EventLanguages e ON c.EventName = e.EventName; | gretelai_synthetic_text_to_sql |
CREATE TABLE hotels(id INT, name TEXT, country TEXT, rating FLOAT, ai BOOLEAN); | What is the average rating of hotels in 'North America' that have adopted AI? | SELECT AVG(rating) FROM hotels WHERE country = 'North America' AND ai = TRUE; | gretelai_synthetic_text_to_sql |
CREATE TABLE endangered_species (id INT, animal_name VARCHAR(255), population INT); | How many animals are currently in the endangered_species table, and what is their total population? | SELECT COUNT(id), SUM(population) FROM endangered_species; | gretelai_synthetic_text_to_sql |
CREATE TABLE articles (article_id INT, title VARCHAR(100), category VARCHAR(50), publication_date DATE, views INT); INSERT INTO articles (article_id, title, category, publication_date, views) VALUES (1, 'News from the Capital', 'Politics', '2022-01-01', 1500), (2, 'Tech Innovations in 2022', 'Technology', '2022-01-02',... | What is the total number of articles in the "articles" table published in the first half of 2022? | SELECT COUNT(article_id) FROM articles WHERE publication_date BETWEEN '2022-01-01' AND '2022-06-30'; | gretelai_synthetic_text_to_sql |
CREATE TABLE habitats (id INT PRIMARY KEY, name VARCHAR(255), location VARCHAR(255), size FLOAT); | Insert a new record into the 'habitats' table | INSERT INTO habitats (id, name, location, size) VALUES (1, 'Tiger Habitat', 'India', 1000.0); | gretelai_synthetic_text_to_sql |
CREATE TABLE Company (id INT, name VARCHAR(20)); CREATE TABLE Project (id INT, company_id INT, sustainable VARCHAR(5)); CREATE VIEW Sustainable_Projects AS SELECT * FROM Project WHERE sustainable = 'yes'; | List all companies and the number of sustainable projects they have completed | SELECT Company.name, COUNT(Sustainable_Projects.id) AS sustainable_projects_completed FROM Company INNER JOIN Sustainable_Projects ON Company.id = Sustainable_Projects.company_id GROUP BY Company.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE students(id INT, course VARCHAR(255), gpa DECIMAL(3,2)); INSERT INTO students VALUES (1, 'open pedagogy', 3.8), (2, 'open pedagogy', 3.2), (3, 'traditional pedagogy', 3.9), (4, 'open pedagogy', 4.0); | What is the maximum GPA for students in the open pedagogy course? | SELECT MAX(gpa) FROM students WHERE course = 'open pedagogy'; | gretelai_synthetic_text_to_sql |
CREATE TABLE philadelphia_police_officers (id INT, officer_name VARCHAR(255), officer_type VARCHAR(255)); INSERT INTO philadelphia_police_officers (id, officer_name, officer_type) VALUES (1, 'Michael Lee', 'Sergeant'); CREATE TABLE philadelphia_firefighters (id INT, firefighter_name VARCHAR(255), firefighter_type VARCH... | What is the total number of police officers and firefighters in the city of Philadelphia? | SELECT COUNT(*) FROM philadelphia_police_officers UNION ALL SELECT COUNT(*) FROM philadelphia_firefighters; | gretelai_synthetic_text_to_sql |
CREATE TABLE smart_city_tech (tech_id INT, category VARCHAR(50), year INT, energy_consumption FLOAT); | What is the average energy consumption (in kWh) of smart city technology, grouped by technology category and year, where the average consumption is greater than 500 kWh? | SELECT category, year, AVG(energy_consumption) FROM smart_city_tech GROUP BY category, year HAVING AVG(energy_consumption) > 500; | gretelai_synthetic_text_to_sql |
CREATE TABLE ElectricVehicles (Id INT, Manufacturer VARCHAR(255), Model VARCHAR(255)); INSERT INTO ElectricVehicles (Id, Manufacturer, Model) VALUES (1, 'Tesla', 'Model S'), (2, 'Tesla', 'Model 3'), (3, 'BMW', 'i3'), (4, 'Audi', 'eTron'); | Count the number of electric vehicle models by manufacturer. | SELECT Manufacturer, COUNT(Model) FROM ElectricVehicles GROUP BY Manufacturer; | gretelai_synthetic_text_to_sql |
CREATE TABLE if not exists destinations (destination_id int, destination_name varchar(50), region_id int); INSERT INTO destinations (destination_id, destination_name, region_id) VALUES (1, 'Seoul', 3), (2, 'Tokyo', 3), (3, 'Paris', 2), (4, 'Rome', 2); CREATE TABLE if not exists visitor_stats (visitor_id int, destinatio... | Which destinations had more than 500 visitors in the last month? | SELECT d.destination_name FROM destinations d JOIN (SELECT destination_id, COUNT(*) as visit_count FROM visitor_stats WHERE visit_date BETWEEN DATEADD(month, -1, CURRENT_DATE) AND CURRENT_DATE GROUP BY destination_id HAVING COUNT(*) > 500) vs ON d.destination_id = vs.destination_id; | gretelai_synthetic_text_to_sql |
CREATE TABLE states (state_abbr CHAR(2), state_name VARCHAR(50)); INSERT INTO states (state_abbr, state_name) VALUES ('AK', 'Alaska'), ('AL', 'Alabama'), ('AR', 'Arkansas'); CREATE TABLE hospitals (hospital_id INT, hospital_name VARCHAR(100), rural BOOLEAN, num_beds INT); INSERT INTO hospitals (hospital_id, hospital_na... | What is the number of hospital beds in rural hospitals per state? | SELECT hl.state_abbr, h.hospital_name, h.num_beds FROM hospitals h JOIN hospital_location hl ON h.hospital_id = hl.hospital_id WHERE h.rural = true; | gretelai_synthetic_text_to_sql |
CREATE TABLE soccer_players (player_id INT, name VARCHAR(50), position VARCHAR(20), team VARCHAR(50), salary DECIMAL(10, 2)); INSERT INTO soccer_players (player_id, name, position, team, salary) VALUES (1, 'Lionel Messi', 'Forward', 'Paris Saint-Germain', 35000000.00); INSERT INTO soccer_players (player_id, name, posit... | List the top 5 highest-paid soccer players from the soccer_players table, along with their respective teams. | SELECT name, team, salary FROM (SELECT name, team, salary, ROW_NUMBER() OVER (ORDER BY salary DESC) as rn FROM soccer_players) t WHERE rn <= 5; | gretelai_synthetic_text_to_sql |
CREATE TABLE teams (id INT, name VARCHAR(255)); INSERT INTO teams (id, name) VALUES (1, 'TeamA'), (2, 'TeamB'), (3, 'TeamC'); CREATE TABLE games (id INT, home_team_id INT, away_team_id INT, home_team_score INT, away_team_score INT); CREATE VIEW home_team_scores AS SELECT id, home_team_id, home_team_score FROM games; | What was the average home team score for each team's games in the second half of 2021? | SELECT t.name, AVG(h.home_team_score) as avg_score FROM home_team_scores h JOIN teams t ON h.home_team_id = t.id WHERE h.id IN (SELECT id FROM games WHERE game_date BETWEEN '2021-07-01' AND '2021-12-31') GROUP BY t.name; | gretelai_synthetic_text_to_sql |
CREATE TABLE artists (id INT, name VARCHAR, genre VARCHAR, revenue FLOAT); CREATE TABLE sales (artist_id INT, year INT, month INT, revenue FLOAT); INSERT INTO artists VALUES (1, 'John Coltrane', 'Jazz', 1000000); INSERT INTO sales VALUES (1, 2020, 1, 50000); INSERT INTO sales VALUES (1, 2019, 12, 150000); | What is the average monthly revenue generated by Jazz artists in the last 12 months? | SELECT AVG(sales.revenue) FROM sales JOIN artists ON sales.artist_id = artists.id WHERE artists.genre = 'Jazz' AND sales.year = (YEAR(CURDATE()) - 1) AND sales.month BETWEEN (MONTH(CURDATE()) - 11) AND MONTH(CURDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE Programs (ProgramID INT, ProgramType TEXT, ProgramBudget DECIMAL(10,2), ProgramStartDate DATE, ProgramEndDate DATE); INSERT INTO Programs (ProgramID, ProgramType, ProgramBudget, ProgramStartDate, ProgramEndDate) VALUES (1, 'Education', 9000.00, '2022-07-01', '2022-09-30'); | What was the total amount donated to education programs in Q3 2022? | SELECT SUM(ProgramBudget) as TotalDonation FROM Programs WHERE ProgramType = 'Education' AND ProgramStartDate <= '2022-09-30' AND ProgramEndDate >= '2022-07-01'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CommunityPolicing (id INT, year INT, numOfficers INT); | Find the number of police officers hired per year, for the years 2015-2018, from the 'CommunityPolicing' table. | SELECT year, SUM(numOfficers) FROM CommunityPolicing WHERE year BETWEEN 2015 AND 2018 GROUP BY year; | gretelai_synthetic_text_to_sql |
CREATE TABLE monthly_sales (sale_month DATE, revenue DECIMAL(10, 2)); INSERT INTO monthly_sales (sale_month, revenue) VALUES ('2022-01-01', 2500.00), ('2022-02-01', 3000.00), ('2022-03-01', 2000.00), ('2022-04-01', 3500.00); | What are the total ticket sales for each month? | SELECT EXTRACT(MONTH FROM sale_month) AS month_num, SUM(revenue) FROM monthly_sales GROUP BY month_num; | gretelai_synthetic_text_to_sql |
CREATE TABLE ai_fairness (ai_category TEXT, fairness_metric TEXT, value FLOAT); | Count the number of algorithmic fairness entries for each AI category in the 'ai_fairness' table. | SELECT ai_category, COUNT(*) FROM ai_fairness GROUP BY ai_category; | gretelai_synthetic_text_to_sql |
CREATE TABLE Coaches (CoachID INT, Name VARCHAR(50), Sport VARCHAR(20), Age INT, Country VARCHAR(50)); INSERT INTO Coaches (CoachID, Name, Sport, Age, Country) VALUES (1, 'Jane Smith', 'Soccer', 45, 'England'), (2, 'Mateo Garcia', 'Basketball', 52, 'Argentina'), (3, 'Svetlana Petrova', 'Basketball', 48, 'Russia'), (4, ... | What is the average age of basketball coaches? | SELECT AVG(Age) FROM Coaches WHERE Sport = 'Basketball'; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (faculty_id INT, name VARCHAR(50), gender VARCHAR(10), department VARCHAR(50)); INSERT INTO faculty (faculty_id, name, gender, department) VALUES (1, 'Alice', 'Female', 'Computer Science'); CREATE TABLE grants (grant_id INT, faculty_id INT, amount FLOAT); INSERT INTO grants (grant_id, faculty_id, a... | What is the average grant amount awarded to female faculty members in the Computer Science department? | SELECT AVG(g.amount) FROM grants g INNER JOIN faculty f ON g.faculty_id = f.faculty_id WHERE f.department = 'Computer Science' AND f.gender = 'Female'; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name TEXT, industry TEXT, founder_veteran BOOLEAN, founding_date DATE);CREATE TABLE funding (id INT, company_id INT, amount INT); INSERT INTO company (id, name, industry, founder_veteran, founding_date) VALUES (1, 'SecureTech', 'Defense', true, '2018-02-22'); INSERT INTO funding (id, compa... | What is the maximum amount of funding received by a company founded by a veteran in the defense sector? | SELECT MAX(funding.amount) FROM funding INNER JOIN company ON funding.company_id = company.id WHERE company.founder_veteran = true AND company.industry = 'Defense'; | gretelai_synthetic_text_to_sql |
CREATE TABLE CybersecurityIncidents (region VARCHAR(255), year INT, incidents INT); INSERT INTO CybersecurityIncidents (region, year, incidents) VALUES ('North America', 2018, 2000), ('North America', 2019, 2500), ('North America', 2020, 3000), ('Europe', 2020, 1500), ('Europe', 2021, 1800); | How many cybersecurity incidents were reported in the North America region in 2020 and 2021? | SELECT SUM(incidents) FROM CybersecurityIncidents WHERE region = 'North America' AND (year = 2020 OR year = 2021); | gretelai_synthetic_text_to_sql |
CREATE TABLE news_articles (id INT, title VARCHAR(100), content TEXT, publication_date DATE, language VARCHAR(20)); INSERT INTO news_articles (id, title, content, publication_date, language) VALUES (1, 'Articulo de Noticias 1', 'Contenido del Articulo de Noticias 1', '2021-01-01', 'Spanish'); INSERT INTO news_articles ... | Which news articles were published in Spanish? | SELECT * FROM news_articles WHERE language = 'Spanish'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Contractors (Contractor_ID INT, Contractor_Name VARCHAR(100), License_Number INT, City VARCHAR(50), State CHAR(2), Zipcode INT); CREATE VIEW Building_Permits_With_Contractors AS SELECT bp.*, c.Contractor_Name FROM Building_Permits bp INNER JOIN Contractors c ON bp.Permit_ID = c.Contractor_ID; | What are the contractors with the most permits in New York? | SELECT bpwc.Contractor_Name, COUNT(*) as Total_Permits FROM Building_Permits_With_Contractors bpwc WHERE bpwc.City = 'New York' GROUP BY bpwc.Contractor_Name ORDER BY Total_Permits DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE DefenseDiplomacy (Id INT PRIMARY KEY, Event VARCHAR(100), Country VARCHAR(100), StartDate DATE, EndDate DATE); INSERT INTO DefenseDiplomacy (Id, Event, Country, StartDate, EndDate) VALUES (1, 'Military Exercise', 'Country B', '2019-01-01', '2019-01-10'); | What is the total number of military exercises with the United States? | SELECT COUNT(*) FROM DefenseDiplomacy WHERE Event = 'Military Exercise' AND Country = 'United States'; | gretelai_synthetic_text_to_sql |
CREATE TABLE advocacy_campaigns (campaign_id INT, group_id INT, campaign_type VARCHAR(20), funds_spent DECIMAL(10,2), campaign_date DATE); INSERT INTO advocacy_campaigns (campaign_id, group_id, campaign_type, funds_spent, campaign_date) VALUES (1201, 3001, 'Human Rights', 12000.00, '2021-07-21'), (1202, 3001, 'Climate ... | What was the total number of advocacy campaigns and the total funds spent by each advocacy group on campaigns in H2 2021, grouped by campaign type? | SELECT group_id, campaign_type, COUNT(*) as campaigns_count, SUM(funds_spent) as total_funds_spent FROM advocacy_campaigns WHERE EXTRACT(QUARTER FROM campaign_date) = 4 AND EXTRACT(YEAR FROM campaign_date) = 2021 GROUP BY group_id, campaign_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE faculty (id INT, name VARCHAR(50), title VARCHAR(20), department VARCHAR(50), gender VARCHAR(10)); CREATE TABLE publications (id INT, faculty_id INT, title VARCHAR(100), year INT); INSERT INTO faculty (id, name, title, department, gender) VALUES (1, 'Alice Johnson', 'Assistant Professor', 'Computer Science... | What are the publishing statistics for each faculty member in the Computer Science department? | SELECT faculty.name, department, COUNT(*) AS total_publications FROM faculty JOIN publications ON faculty.id = publications.faculty_id WHERE department = 'Computer Science' GROUP BY faculty.name, department; | gretelai_synthetic_text_to_sql |
CREATE TABLE daily_water_usage(country VARCHAR(50), year INT, day INT, volume FLOAT); INSERT INTO daily_water_usage(country, year, day, volume) VALUES ('Canada', 2018, 1, 3.2), ('Canada', 2018, 2, 3.3), ('Canada', 2018, 3, 3.1); | What is the average daily water usage in Canada in 2018? | SELECT AVG(volume) FROM daily_water_usage WHERE country = 'Canada' AND year = 2018; | gretelai_synthetic_text_to_sql |
CREATE TABLE mobile_subscribers (id INT, name VARCHAR(50), region VARCHAR(20)); INSERT INTO mobile_subscribers (id, name, region) VALUES (1, 'John Doe', 'rural'); | What is the total number of mobile subscribers in the 'rural' regions? | SELECT COUNT(*) FROM mobile_subscribers WHERE region = 'rural'; | gretelai_synthetic_text_to_sql |
CREATE TABLE warehouse_shipments (id INT, warehouse_location VARCHAR(20), num_shipments INT); CREATE TABLE shipment_deliveries (id INT, shipment_id INT, warehouse_location VARCHAR(20), delivery_time INT); INSERT INTO warehouse_shipments (id, warehouse_location, num_shipments) VALUES (1, 'Atlanta', 50), (2, 'Dallas', 75... | How many shipments were made from each warehouse location, and what is the average delivery time for each location? | SELECT warehouse_location, AVG(delivery_time), COUNT(*) FROM shipment_deliveries JOIN warehouse_shipments ON shipment_deliveries.warehouse_location = warehouse_shipments.warehouse_location GROUP BY warehouse_location; | gretelai_synthetic_text_to_sql |
CREATE TABLE Properties (PropertyID INT, CoOwnedBy VARCHAR(50), Neighborhood VARCHAR(20)); INSERT INTO Properties (PropertyID, CoOwnedBy, Neighborhood) VALUES (1, 'Female, Latinx', 'UrbanCore'), (2, 'Male, African American', 'UrbanCore'), (3, 'Female, Asian', 'Suburban'); | Calculate the number of properties co-owned by people from underrepresented communities in each neighborhood. | SELECT Neighborhood, COUNT(*) FROM Properties WHERE CoOwnedBy LIKE '%Female,%' OR CoOwnedBy LIKE '%Male, African American%' OR CoOwnedBy LIKE '%Male, Latinx%' GROUP BY Neighborhood; | gretelai_synthetic_text_to_sql |
CREATE TABLE student_preference (student_id INT, district_id INT, preference VARCHAR(10)); CREATE TABLE student_mental_health (student_id INT, mental_health_score INT, district_id INT); INSERT INTO student_preference (student_id, district_id, preference) VALUES (1, 101, 'open'), (2, 101, 'traditional'), (3, 102, 'open'... | What is the number of districts with an average mental health score above the overall average? | SELECT COUNT(DISTINCT district_id) FROM student_mental_health smh JOIN (SELECT AVG(mental_health_score) AS avg_mental_health_score FROM student_mental_health) sub ON smh.mental_health_score > sub.avg_mental_health_score; | gretelai_synthetic_text_to_sql |
CREATE TABLE Exhibitions (id INT, exhibition_name VARCHAR(50), location VARCHAR(30), visitors INT, art_period VARCHAR(20), start_date DATE); INSERT INTO Exhibitions (id, exhibition_name, location, visitors, art_period, start_date) VALUES (1, 'Exhibition1', 'Madrid', 1200, 'Surrealist', '2018-01-01'); | Maximum number of visitors for Surrealist exhibitions in Madrid? | SELECT MAX(visitors) FROM Exhibitions WHERE art_period = 'Surrealist' AND location = 'Madrid'; | gretelai_synthetic_text_to_sql |
CREATE TABLE ticket_prices (ticket_id INT, team_id INT, sport_id INT, avg_ticket_price DECIMAL(10,2), seat_type VARCHAR(10)); CREATE TABLE teams (team_id INT, team_name VARCHAR(255), sport_id INT); CREATE TABLE sports (sport_id INT, sport_name VARCHAR(255)); INSERT INTO ticket_prices VALUES (1, 101, 1, 75.00, 'VIP'), (... | What is the average ticket price per sport, split by seat type (VIP, regular, obstructed view)? | SELECT sp.sport_name, tp.seat_type, AVG(tp.avg_ticket_price) as avg_price FROM ticket_prices tp JOIN teams t ON tp.team_id = t.team_id JOIN sports sp ON t.sport_id = sp.sport_id GROUP BY sp.sport_name, tp.seat_type; | gretelai_synthetic_text_to_sql |
CREATE TABLE company (id INT, name VARCHAR(50), industry VARCHAR(50), location VARCHAR(50)); INSERT INTO company (id, name, industry, location) VALUES (1, 'GenTech', 'Genetic Research', 'San Francisco'); INSERT INTO company (id, name, industry, location) VALUES (2, 'BioEngineer', 'Bioprocess Engineering', 'Boston'); IN... | Which companies have funding amounts greater than $10 million? | SELECT c.name, f.amount FROM company c JOIN funding f ON c.id = f.company_id WHERE f.amount > 10000000 | gretelai_synthetic_text_to_sql |
CREATE TABLE region (region_id INT, name VARCHAR(255)); INSERT INTO region (region_id, name) VALUES (1, 'Middle East'); CREATE TABLE team (team_id INT, name VARCHAR(255), region_id INT, budget INT); INSERT INTO team (team_id, name, region_id, budget) VALUES (1, 'Team1', 1, 100000), (2, 'Team2', 1, 200000); | What is the average budget of disaster response teams in the Middle East region? | SELECT AVG(budget) FROM team WHERE region_id = (SELECT region_id FROM region WHERE name = 'Middle East'); | gretelai_synthetic_text_to_sql |
CREATE TABLE ems_responses (id INT, region VARCHAR(10), response_time INT); INSERT INTO ems_responses (id, region, response_time) VALUES (1, 'central', 10), (2, 'central', 12), (3, 'western', 15), (4, 'eastern', 8); | What is the minimum response time for emergency medical services in each region? | SELECT region, MIN(response_time) FROM ems_responses GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE fabrics (id INT, name VARCHAR(255), sustainability_rating FLOAT); INSERT INTO fabrics (id, name, sustainability_rating) VALUES (1, 'Organic Cotton', 4.2), (2, 'Recycled Polyester', 3.8), (3, 'Hemp', 4.5); | What is the average rating of sustainable fabrics? | SELECT AVG(sustainability_rating) FROM fabrics WHERE name IN ('Organic Cotton', 'Recycled Polyester', 'Hemp'); | gretelai_synthetic_text_to_sql |
CREATE TABLE Veteran_Employment (Veteran_ID INT, Employment_Status VARCHAR(50), Industry VARCHAR(50), Employment_Start_Date DATE, Company_Name VARCHAR(50)); CREATE VIEW Veterans_in_IT AS SELECT Veteran_ID, Company_Name FROM Veteran_Employment WHERE Industry = 'IT'; | Which companies have the most veterans employed in the IT industry? | SELECT Company_Name, COUNT(*) as Number_of_Veterans FROM Veterans_in_IT GROUP BY Company_Name ORDER BY Number_of_Veterans DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE CybersecurityVulnerabilities (VulnerabilityID INT, VulnerabilitySeverity VARCHAR(20), VulnerabilityDate DATE); INSERT INTO CybersecurityVulnerabilities (VulnerabilityID, VulnerabilitySeverity, VulnerabilityDate) VALUES (1, 'High', '2021-01-01'), (2, 'Medium', '2021-02-15'), (3, 'Low', '2021-03-28'), (4, 'H... | What is the total number of cybersecurity vulnerabilities by severity level for each year? | SELECT YEAR(VulnerabilityDate) as Year, VulnerabilitySeverity, COUNT(*) as Total FROM CybersecurityVulnerabilities GROUP BY YEAR(VulnerabilityDate), VulnerabilitySeverity; | gretelai_synthetic_text_to_sql |
CREATE TABLE Orders (OrderID INT, MenuItemID INT, OrderDate DATETIME); INSERT INTO Orders (OrderID, MenuItemID, OrderDate) VALUES (4, 5, '2022-01-04 16:00:00'); INSERT INTO Orders (OrderID, MenuItemID, OrderDate) VALUES (5, 6, '2022-01-05 18:00:00'); INSERT INTO Orders (OrderID, MenuItemID, OrderDate) VALUES (6, 5, '20... | What is the most frequently ordered vegetarian menu item? | SELECT MenuItems.MenuItemName, COUNT(*) as OrderCount FROM Orders JOIN MenuItems ON Orders.MenuItemID = MenuItems.MenuItemID WHERE MenuItems.Category = 'Vegetarian' GROUP BY MenuItems.MenuItemName ORDER BY OrderCount DESC LIMIT 1 | gretelai_synthetic_text_to_sql |
CREATE TABLE esg_investments (id INT, country VARCHAR(255), amount FLOAT); INSERT INTO esg_investments (id, country, amount) VALUES (1, 'USA', 5000000); | What's the total amount of ESG investments in the USA? | SELECT SUM(amount) FROM esg_investments WHERE country = 'USA'; | gretelai_synthetic_text_to_sql |
CREATE TABLE City (Id INT PRIMARY KEY, Name VARCHAR(50), Population INT, Country VARCHAR(50), State VARCHAR(50)); INSERT INTO City (Id, Name, Population, Country, State) VALUES (1, 'Mumbai', 20000000, 'India', 'Maharashtra'); INSERT INTO City (Id, Name, Population, Country, State) VALUES (2, 'Delhi', 18000000, 'India',... | What is the total population of cities in 'India' and 'Australia', grouped by state or province? | SELECT Country, State, SUM(Population) as TotalPopulation FROM City WHERE Country IN ('India', 'Australia') GROUP BY Country, State; | gretelai_synthetic_text_to_sql |
CREATE TABLE vulnerabilities (id INT, software_app VARCHAR(50), severity INT, patch_date DATE); | List all software applications with unpatched vulnerabilities | SELECT software_app FROM vulnerabilities WHERE patch_date IS NULL; | gretelai_synthetic_text_to_sql |
CREATE SCHEMA research;CREATE TABLE grants(faculty_name TEXT,department TEXT,amount INTEGER);INSERT INTO grants(faculty_name,department,amount)VALUES('Irene','Mathematics',150000),('Jack','Physics',0); | What are the names of all faculty members who have not received any research grants? | SELECT faculty_name FROM research.grants WHERE amount=0; | gretelai_synthetic_text_to_sql |
CREATE TABLE production_rates (id INT PRIMARY KEY, chemical_name VARCHAR(255), production_rate INT, date DATE); INSERT INTO production_rates (id, chemical_name, production_rate, date) VALUES (1, 'Acetic Acid', 500, '2022-05-01'); INSERT INTO production_rates (id, chemical_name, production_rate, date) VALUES (2, 'Nitric... | What is the production rate rank for each chemical in the past month? | SELECT chemical_name, production_rate, RANK() OVER(ORDER BY production_rate DESC) as production_rank FROM production_rates WHERE date >= DATEADD(month, -1, GETDATE()); | gretelai_synthetic_text_to_sql |
CREATE TABLE ae_guidelines(guideline_id INT, region VARCHAR(10)); INSERT INTO ae_guidelines VALUES (1, 'Europe'), (2, 'North America'); | What is the total number of AI ethics guidelines published in Europe and North America, excluding any duplicates? | SELECT region FROM ae_guidelines GROUP BY region; | gretelai_synthetic_text_to_sql |
CREATE TABLE HumanitarianAssistance (id INT, country VARCHAR(50), mission_count INT, year INT); INSERT INTO HumanitarianAssistance (id, country, mission_count, year) VALUES (1, 'Nigeria', 7, 2020), (2, 'South Africa', 8, 2020), (3, 'Egypt', 9, 2020); | What is the maximum number of humanitarian assistance missions conducted by countries in Africa in 2020? | SELECT MAX(mission_count) FROM HumanitarianAssistance WHERE country IN ('Nigeria', 'South Africa', 'Egypt') AND year = 2020; | gretelai_synthetic_text_to_sql |
CREATE TABLE military_sales (id INT, year INT, customer VARCHAR(20), equipment_type VARCHAR(20), value FLOAT); INSERT INTO military_sales (id, year, customer, equipment_type, value) VALUES (1, 2020, 'Canadian Government', 'Aircraft', 5000000); INSERT INTO military_sales (id, year, customer, equipment_type, value) VALUE... | What is the total value of military equipment sales to the Canadian government in 2020? | SELECT SUM(value) FROM military_sales WHERE year = 2020 AND customer = 'Canadian Government'; | gretelai_synthetic_text_to_sql |
CREATE TABLE players (id INT, name VARCHAR(50), country VARCHAR(50), level INT); | Update 'players' level to 15 where name is 'Maria' | UPDATE players SET level = 15 WHERE name = 'Maria'; | gretelai_synthetic_text_to_sql |
CREATE TABLE donations (id INT, donor_name VARCHAR(50), donation_amount DECIMAL(10,2), donation_date DATE); INSERT INTO donations (id, donor_name, donation_amount, donation_date) VALUES (1, 'John Doe', 50.00, '2021-01-05'), (2, 'Jane Smith', 100.00, '2021-03-15'), (3, 'Alice Johnson', 75.00, '2021-01-20'), (4, 'Bob Bro... | List the number of new donors per month in 2021 and the total donation amount for each month. | SELECT MONTH(donation_date) AS month, COUNT(DISTINCT donor_name) AS new_donors, SUM(donation_amount) AS total_donations FROM donations WHERE YEAR(donation_date) = 2021 GROUP BY month; | gretelai_synthetic_text_to_sql |
CREATE TABLE movies (id INT, title TEXT, release_year INT); | Update the title of the movie with id 1 to 'New Movie Title' in the 'movies' table | UPDATE movies SET title = 'New Movie Title' WHERE id = 1; | gretelai_synthetic_text_to_sql |
CREATE TABLE clinical_trials (country VARCHAR(20), year INT, approval_status VARCHAR(10)); INSERT INTO clinical_trials (country, year, approval_status) VALUES ('USA', 2021, 'Approved'), ('Canada', 2021, 'Approved'), ('Mexico', 2021, 'Approved'), ('USA', 2021, 'Approved'), ('Canada', 2021, 'Rejected'), ('Mexico', 2021, ... | How many clinical trials were approved for each country in 2021? | SELECT country, COUNT(*) AS total_approved_trials FROM clinical_trials WHERE year = 2021 AND approval_status = 'Approved' GROUP BY country; | gretelai_synthetic_text_to_sql |
CREATE TABLE defense_diplomacy (id INT PRIMARY KEY, partnership VARCHAR(50), year INT); | Insert a new record into the 'defense_diplomacy' table with the following values: (4, 'US-Japan', '2015') | INSERT INTO defense_diplomacy (id, partnership, year) VALUES (4, 'US-Japan', 2015); | gretelai_synthetic_text_to_sql |
CREATE TABLE civil_cases (case_id INT PRIMARY KEY AUTO_INCREMENT, client_id INT, case_type VARCHAR(50), total_cost DECIMAL(10,2)); | Calculate the average total cost for all cases in the 'civil_cases' table where the case type is 'personal injury'. | SELECT AVG(total_cost) FROM civil_cases WHERE case_type = 'personal injury'; | gretelai_synthetic_text_to_sql |
CREATE TABLE patents (patent_id INT, country VARCHAR(50), field VARCHAR(100)); INSERT INTO patents (patent_id, country, field) VALUES (1, 'USA', 'Blockchain'), (2, 'China', 'Blockchain'), (3, 'South Korea', 'Blockchain'); | Which countries have the most blockchain-related patents? | SELECT country, COUNT(*) FROM patents WHERE field = 'Blockchain' GROUP BY country ORDER BY COUNT(*) DESC; | gretelai_synthetic_text_to_sql |
CREATE TABLE agricultural_innovation_projects (id INT, community_name VARCHAR(100), country VARCHAR(50), project_name VARCHAR(100), start_date DATE, end_date DATE, success_status VARCHAR(50)); | How many agricultural innovation projects were successfully implemented in Indigenous communities in Canada between 2015 and 2019? | SELECT COUNT(*) FROM agricultural_innovation_projects WHERE country = 'Canada' AND community_name LIKE '%Indigenous%' AND success_status = 'Successfully Implemented' AND YEAR(start_date) BETWEEN 2015 AND 2019; | gretelai_synthetic_text_to_sql |
CREATE TABLE emissions (id INT, mine_type VARCHAR(50), country VARCHAR(50), year INT, co2_emission INT); | Insert a new record into the "emissions" table for a coal mine in "India" that emitted 1000 tons of CO2 in 2021 | INSERT INTO emissions (id, mine_type, country, year, co2_emission) VALUES (1, 'coal', 'India', 2021, 1000); | gretelai_synthetic_text_to_sql |
CREATE TABLE subscriber_activity (subscriber_id INT, last_data_usage_date DATE); INSERT INTO subscriber_activity (subscriber_id, last_data_usage_date) VALUES (1, '2022-01-01'), (2, '2022-03-15'), (3, NULL); | Delete subscribers who have not used any data in the last 6 months. | DELETE FROM subscribers WHERE subscriber_id NOT IN (SELECT subscriber_id FROM subscriber_activity WHERE last_data_usage_date IS NOT NULL); | gretelai_synthetic_text_to_sql |
CREATE TABLE circular_economy (id INT PRIMARY KEY, country VARCHAR(255), region VARCHAR(255), circular_economy_percentage INT); INSERT INTO circular_economy (id, country, region, circular_economy_percentage) VALUES (1, 'Japan', 'Asia', 60), (2, 'Germany', 'Europe', 55), (3, 'Brazil', 'South America', 45); | Delete all records from the circular_economy table where the region is 'Asia' | DELETE FROM circular_economy WHERE region = 'Asia'; | gretelai_synthetic_text_to_sql |
CREATE TABLE Warehouse (name varchar(20), pallets_handled int, handling_date date); INSERT INTO Warehouse (name, pallets_handled, handling_date) VALUES ('Warehouse F', 50, '2022-07-01'), ('Warehouse F', 60, '2022-07-02'); | What was the average number of pallets handled per day by 'Warehouse F' in 'Quarter 3' of '2022'? | SELECT AVG(pallets_handled / (EXTRACT(DAY FROM handling_date) - EXTRACT(DAY FROM LAG(handling_date) OVER (PARTITION BY name ORDER BY handling_date)))) FROM Warehouse WHERE name = 'Warehouse F' AND quarter = 3 AND year = 2022; | 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.