context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE daily_revenue (date date, revenue int); INSERT INTO daily_revenue (date, revenue) VALUES ('2022-01-01', 10000), ('2022-01-02', 12000), ('2022-01-03', 11000);
What is the average revenue generated per day?
SELECT AVG(revenue) FROM daily_revenue;
gretelai_synthetic_text_to_sql
CREATE TABLE patents (id INT, inventor_id INT, patent_year INT, ai_related BOOLEAN);
Insert new records of AI-related patents filed in 2021.
INSERT INTO patents (id, inventor_id, patent_year, ai_related) SELECT p.next_id, i.id, 2021, true FROM (SELECT ROW_NUMBER() OVER (ORDER BY name) AS next_id, id FROM inventors i WHERE i.ai_contributions = true) p WHERE p.next_id <= 10;
gretelai_synthetic_text_to_sql
CREATE TABLE research_papers (paper_id INT, title VARCHAR(50), citations INT); INSERT INTO research_papers (paper_id, title, citations) VALUES (1, 'Autonomous Driving Algorithms', 120), (2, 'Deep Learning for Self-Driving Cars', 150), (3, 'LiDAR Sensor Technology in AVs', 85), (4, 'Neural Networks in AVs', 130), (5, 'C...
Show the top 2 most frequently cited research papers in the 'research_papers' table.
SELECT title, citations FROM (SELECT title, citations, RANK() OVER (ORDER BY citations DESC) rank FROM research_papers) sq WHERE rank <= 2;
gretelai_synthetic_text_to_sql
CREATE TABLE droughts (drought_id INT, location VARCHAR(255), start_date DATE, end_date DATE); INSERT INTO droughts (drought_id, location, start_date, end_date) VALUES (1, 'Australia', '2010-01-01', '2010-12-31'), (2, 'California', '2011-01-01', '2011-12-31'), (3, 'Texas', '2012-01-01', '2012-12-31'), (4, 'India', '201...
How many droughts have been reported in India in the last 5 years?
SELECT COUNT(*) FROM droughts WHERE location = 'India' AND start_date >= '2016-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE team_expenses (team_id INT, league VARCHAR(50), total_expenses DECIMAL(10,2));
What are the total expenses for each team in the NBA, considering the 'team_expenses' table?
SELECT b.team_name, SUM(e.total_expenses) AS total_expenses FROM sports_teams b INNER JOIN team_expenses e ON b.team_id = e.team_id WHERE b.league = 'NBA' GROUP BY b.team_name;
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', 'New York', 600, 'Modern', '2005-01-01');
Number of modern art exhibitions held in New York since 2000 with more than 500 visitors?
SELECT COUNT(*) FROM Exhibitions WHERE location = 'New York' AND art_period = 'Modern' AND visitors > 500 AND start_date >= '2000-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE urban_farms (id INT PRIMARY KEY, name VARCHAR(100), nitrogen FLOAT, potassium FLOAT, farm_id INT, FOREIGN KEY (farm_id) REFERENCES farmers(id)); INSERT INTO urban_farms (id, name, nitrogen, potassium, farm_id) VALUES (1, 'Brooklyn Grange', 0.35, 0.55, 1), (2, 'Eagle Street Rooftop Farm', 0.40, 0.60, 2), (3...
What is the average nitrogen level in soils of urban farms in New York?
SELECT AVG(u.nitrogen) FROM urban_farms u WHERE u.farm_id IN (SELECT f.id FROM farmers f WHERE f.location = 'New York');
gretelai_synthetic_text_to_sql
CREATE TABLE student_data (city VARCHAR(255), school_type VARCHAR(255), enrollment INT, ell_enrollment INT); INSERT INTO student_data (city, school_type, enrollment, ell_enrollment) VALUES ('New York City', 'Public', 1200000, 150000);
What is the percentage of students in 'New York City' public schools who are English language learners?
SELECT (ell_enrollment * 100.0 / enrollment) AS percentage FROM student_data WHERE city = 'New York City' AND school_type = 'Public';
gretelai_synthetic_text_to_sql
CREATE TABLE building_permits (permit_id INT, sector VARCHAR(50), year INT); INSERT INTO building_permits (permit_id, sector, year) VALUES (1, 'Industrial', 2018), (2, 'Residential', 2018), (3, 'Industrial', 2019), (4, 'Commercial', 2019), (5, 'Industrial', 2020);
List the number of building permits issued in the industrial sector each year.
SELECT year, COUNT(permit_id) FROM building_permits WHERE sector = 'Industrial' GROUP BY year;
gretelai_synthetic_text_to_sql
CREATE TABLE wave_heights (id INT, sea TEXT, max_wave_height FLOAT); INSERT INTO wave_heights (id, sea, max_wave_height) VALUES (1, 'North Sea', 30.0), (2, 'Southern Ocean', 15.0);
What is the maximum wave height recorded in the North Sea?
SELECT MAX(max_wave_height) FROM wave_heights WHERE sea = 'North Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE movies (id INT, title VARCHAR(255), release_year INT, production_budget INT, revenue INT); INSERT INTO movies (id, title, release_year, production_budget, revenue) VALUES (1, 'Avengers: Endgame', 2019, 356000000, 27978000000), (2, 'Captain Marvel', 2019, 153000000, 11285000000);
What's the total revenue of Marvel movies released in 2019?
SELECT SUM(revenue) FROM movies WHERE release_year = 2019 AND title IN ('Avengers: Endgame', 'Captain Marvel');
gretelai_synthetic_text_to_sql
CREATE TABLE microfinance_loans (bank VARCHAR(50), product VARCHAR(50), repayment_period INT); INSERT INTO microfinance_loans (bank, product, repayment_period) VALUES ('Grameen Bank', 'Microenterprise Loan', 12), ('Grameen Bank', 'Education Loan', 24), ('Grameen Bank', 'Housing Loan', 36);
List all microfinance loans provided by the Grameen Bank with their corresponding repayment periods.
SELECT bank, product, repayment_period FROM microfinance_loans WHERE bank = 'Grameen Bank';
gretelai_synthetic_text_to_sql
CREATE TABLE CarbonPricing ( SchemeID INT, Name VARCHAR(255), Country VARCHAR(255), StartDate DATE );
How many Carbon Pricing schemes are there in the EU?
SELECT COUNT(*) FROM CarbonPricing WHERE Country = 'European Union';
gretelai_synthetic_text_to_sql
CREATE TABLE solar_energy (project_id INT, project_name VARCHAR(255), region VARCHAR(255), completion_date DATE, installed_capacity FLOAT);
How many solar energy projects were completed in the Asia-Pacific region in the last 5 years, with a capacity greater than 10 MW?
SELECT COUNT(*) FROM solar_energy WHERE region = 'Asia-Pacific' AND completion_date >= DATE_SUB(CURRENT_DATE, INTERVAL 5 YEAR) AND installed_capacity > 10000000;
gretelai_synthetic_text_to_sql
CREATE TABLE FarmingSystems (FarmingSystemID INT, FarmingSystemName VARCHAR(50), AvgDO DECIMAL(4,2)); INSERT INTO FarmingSystems VALUES (1, 'Pond Systems', 6.5), (2, 'Cage Systems', 7.2), (3, 'Recirculating Systems', 8.1);
What is the average dissolved oxygen level in each farming system?
SELECT FarmingSystemName, AvgDO FROM FarmingSystems;
gretelai_synthetic_text_to_sql
CREATE TABLE soccer_teams (team_id INT, team_name VARCHAR(100), num_games INT);
What is the total number of games played by each team in the 'soccer_teams' table?
SELECT team_id, SUM(num_games) FROM soccer_teams GROUP BY team_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Attendance (AttendanceID INT, MemberID INT, ClassID INT); INSERT INTO Attendance (AttendanceID, MemberID, ClassID) VALUES (1, 1, 2), (2, 2, 2), (3, 3, 3); CREATE TABLE Members (MemberID INT, Name VARCHAR(20)); INSERT INTO Members (MemberID, Name) VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Carol');
Who has attended the most 'Pilates' classes?
SELECT Name, COUNT(*) FROM Attendance JOIN Members ON Attendance.MemberID = Members.MemberID JOIN Classes ON Attendance.ClassID = Classes.ClassID WHERE Classes.ClassType = 'Pilates' GROUP BY Name ORDER BY COUNT(*) DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE research_vessels (id INT, name TEXT, registry TEXT); INSERT INTO research_vessels (id, name, registry) VALUES (1, 'Oceanus', 'Mediterranean'), (2, 'Nautilus', 'Caribbean');
How many research vessels are registered in the Mediterranean Sea?
SELECT COUNT(*) FROM research_vessels WHERE registry = 'Mediterranean';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_finance_investments (id INT, country VARCHAR(50), investment FLOAT); INSERT INTO climate_finance_investments (id, country, investment) VALUES (1, 'Brazil', 12000000), (2, 'India', 15000000), (3, 'South Africa', 10000000);
What are the top three countries with the highest climate finance investments?
SELECT country, investment FROM climate_finance_investments ORDER BY investment DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE projects (name TEXT, budget FLOAT); INSERT INTO projects (name, budget) VALUES ('ProjectA', 4000000), ('ProjectB', 5000000), ('ProjectC', 6000000);
What is the average bioprocess engineering project budget?
SELECT AVG(budget) FROM projects;
gretelai_synthetic_text_to_sql
CREATE TABLE patients (id INT, name TEXT, age INT, treatment TEXT, state TEXT); INSERT INTO patients (id, name, age, treatment, state) VALUES (1, 'John Doe', 35, 'CBT', 'CA'), (2, 'Jane Smith', 40, 'DBT', 'NY');
List the names and treatments of patients from California.
SELECT name, treatment FROM patients WHERE state = 'CA';
gretelai_synthetic_text_to_sql
CREATE TABLE ai_safety_incidents (incident_id INT, incident_year INT, ai_application_area VARCHAR(50));
How many AI safety incidents were reported in the 'autonomous vehicles' application area in 2022?
SELECT COUNT(*) FROM ai_safety_incidents WHERE ai_application_area = 'autonomous vehicles' AND incident_year = 2022;
gretelai_synthetic_text_to_sql
CREATE TABLE GameSales (GameID INT, GameType VARCHAR(10), Sales INT); INSERT INTO GameSales (GameID, GameType, Sales) VALUES (1, 'RPG', 50000), (2, 'FPS', 70000), (3, 'RPG', 60000), (4, 'Simulation', 80000);
What are the top 3 game genres with the highest sales?
SELECT GameType, AVG(Sales) FROM GameSales GROUP BY GameType ORDER BY AVG(Sales) DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_protected_areas (id INT, name VARCHAR(50), size FLOAT, region VARCHAR(20)); INSERT INTO marine_protected_areas (id, name, size, region) VALUES (1, 'Sargasso Sea', 6000000, 'Atlantic'); INSERT INTO marine_protected_areas (id, name, size, region) VALUES (2, 'Bermuda Rise', 300000, 'Atlantic');
Show the total area of marine protected areas in the Atlantic region, excluding the Sargasso Sea.
SELECT SUM(size) FROM marine_protected_areas WHERE region = 'Atlantic' AND name != 'Sargasso Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE BudgetAllocations (Year INT, Service TEXT, Amount INT); INSERT INTO BudgetAllocations (Year, Service, Amount) VALUES (2019, 'EnvironmentalServices', 9000000), (2020, 'EnvironmentalServices', 8000000);
What was the total budget allocated to environmental services in 2019 and 2020, and which year had a lower allocation?
SELECT Year, SUM(Amount) FROM BudgetAllocations WHERE Service = 'EnvironmentalServices' GROUP BY Year HAVING Year IN (2019, 2020) ORDER BY SUM(Amount) LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE ArtWorks (ArtworkID int, Title varchar(100), YearCreated int);
How many artworks were created each year in the 19th century?
SELECT YearCreated, COUNT(ArtworkID) FROM ArtWorks
gretelai_synthetic_text_to_sql
CREATE TABLE rural_infrastructure_projects (id INT, project_name VARCHAR(255), location VARCHAR(255), sector VARCHAR(255), cost FLOAT); INSERT INTO rural_infrastructure_projects (id, project_name, location, sector, cost) VALUES (1, 'Water Supply System', 'Village A', 'Infrastructure', 50000.00), (2, 'Electricity Grid E...
What is the total cost of all rural infrastructure projects, ordered by the project cost in ascending order?
SELECT SUM(cost) as total_cost FROM rural_infrastructure_projects ORDER BY total_cost ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE audience_demographics (id INT PRIMARY KEY, age INT, country VARCHAR(255), gender VARCHAR(255));
Delete all records from the "audience_demographics" table where the "age" is less than 18
DELETE FROM audience_demographics WHERE age < 18;
gretelai_synthetic_text_to_sql
CREATE TABLE ocean_acidification (id INT, location TEXT, level FLOAT); INSERT INTO ocean_acidification (id, location, level) VALUES (1, 'Indian Ocean', 8.2), (2, 'Atlantic Ocean', 8.1), (3, 'Southern Ocean', 8.4);
What is the maximum level of ocean acidification in the Southern Ocean?
SELECT MAX(level) FROM ocean_acidification WHERE location = 'Southern Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE incident_reports (id INT PRIMARY KEY, incident_type VARCHAR(50), latitude DECIMAL(10, 8), longitude DECIMAL(11, 8), timestamp TIMESTAMP); CREATE TABLE vessels_extended (id INT PRIMARY KEY, vessel_name VARCHAR(50), previous_vessel_id INT, FOREIGN KEY (previous_vessel_id) REFERENCES vessels_extended(id));
Which vessels were involved in an accident in the South China Sea in 2018?
SELECT DISTINCT vessels_extended.vessel_name FROM incident_reports INNER JOIN vessels_extended ON vessels_extended.id = (incident_reports.id + 1 OR incident_reports.id - 1) WHERE incident_type = 'accident' AND latitude BETWEEN 1.5 AND 22.5 AND longitude BETWEEN 99.5 AND 122.5 AND YEAR(timestamp) = 2018;
gretelai_synthetic_text_to_sql
CREATE TABLE factories (factory_id INT, department VARCHAR(20));CREATE TABLE workers (worker_id INT, factory_id INT, salary DECIMAL(5,2), department VARCHAR(20)); INSERT INTO factories (factory_id, department) VALUES (1, 'textile'), (2, 'metal'), (3, 'electronics'); INSERT INTO workers (worker_id, factory_id, salary, d...
What is the minimum salary for workers in the 'textile' department at factory 1?
SELECT MIN(w.salary) FROM workers w JOIN factories f ON w.factory_id = f.factory_id WHERE f.department = 'textile' AND w.factory_id = 1;
gretelai_synthetic_text_to_sql
CREATE TABLE Games (GameID INT, GameGenre VARCHAR(10), Revenue INT); INSERT INTO Games (GameID, GameGenre, Revenue) VALUES (1, 'Action', 1000000), (2, 'RPG', 2000000), (3, 'Strategy', 1500000);
What is the total revenue for each game genre in the gaming industry?
SELECT GameGenre, SUM(Revenue) as TotalRevenue FROM Games GROUP BY GameGenre;
gretelai_synthetic_text_to_sql
CREATE TABLE safety_reports (report_id INT, state VARCHAR(2), incident_type VARCHAR(15)); INSERT INTO safety_reports (report_id, state, incident_type) VALUES (1, 'NY', 'Fall'), (2, 'CA', 'Electrocution'), (3, 'IL', 'Fall');
What is the most common type of workplace safety incident in each state?
SELECT state, MAX(incident_type) as most_common_incident FROM safety_reports GROUP BY state;
gretelai_synthetic_text_to_sql
CREATE TABLE Infrastructure (id INT, name VARCHAR(100), type VARCHAR(50), location VARCHAR(100), state VARCHAR(50)); INSERT INTO Infrastructure (id, name, type, location, state) VALUES (8, 'Port of Seattle', 'Seaport', 'Seattle', 'Washington');
List the names and locations of all seaports in Washington
SELECT name, location FROM Infrastructure WHERE type = 'Seaport' AND state = 'Washington';
gretelai_synthetic_text_to_sql
CREATE TABLE biosensor_technology_patents (patent_id INT, patent_name VARCHAR(255), patent_filing_date DATE);
Delete biosensor technology patents filed before 2015
DELETE FROM biosensor_technology_patents WHERE patent_filing_date < '2015-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE spacecraft(id INT, name VARCHAR(255), weight_kg FLOAT); INSERT INTO spacecraft(id, name, weight_kg) VALUES (1, 'Saturn V', 303540.0), (2, 'Space Shuttle', 110000.0);
What is the weight (in kg) of the heaviest spacecraft ever built?
SELECT MAX(weight_kg) FROM spacecraft;
gretelai_synthetic_text_to_sql
CREATE TABLE co2_emission (farm_id INT, year INT, co2_emission INT); INSERT INTO co2_emission VALUES (1, 2022, 100), (2, 2021, 120), (3, 2022, 150), (4, 2021, 180);
What is the total CO2 emission from all aquaculture farms in the year 2021?
SELECT SUM(co2_emission) FROM co2_emission WHERE year = 2021;
gretelai_synthetic_text_to_sql
CREATE SCHEMA Government;CREATE TABLE Government.Agency (name VARCHAR(255), budget INT);CREATE TABLE Government.Department (name VARCHAR(255), agency VARCHAR(255), employees INT, budget INT);
What is the minimum number of employees in each department in the 'Human Services' agency?
SELECT agency, MIN(employees) FROM Government.Department WHERE agency IN (SELECT name FROM Government.Agency WHERE budget > 5000000) GROUP BY agency;
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, name VARCHAR(50), country VARCHAR(50), start_date DATE, end_date DATE);
What is the average time it takes for agricultural innovation projects to be implemented, from start to finish, and how does it vary by country?
SELECT country, AVG(DATEDIFF(end_date, start_date)) as avg_duration FROM projects GROUP BY country;
gretelai_synthetic_text_to_sql
CREATE TABLE funding (id INT, company_id INT, amount DECIMAL(10, 2)); CREATE TABLE company (id INT, name VARCHAR(255), industry VARCHAR(255)); INSERT INTO company (id, name, industry) VALUES (1, 'Fintech Inc', 'finance'), (2, 'Startup Corp', 'tech'), (3, 'Green Inc', 'green'); INSERT INTO funding (id, company_id, amoun...
What is the industry with the highest total funding?
SELECT industry, SUM(amount) AS total_funding FROM funding INNER JOIN company ON funding.company_id = company.id GROUP BY industry ORDER BY total_funding DESC LIMIT 1;
gretelai_synthetic_text_to_sql
CREATE TABLE games (id INT, genre VARCHAR(255), daily_active_players INT);
What is the average number of daily active players for each game genre?
SELECT genre, AVG(daily_active_players) FROM games GROUP BY genre;
gretelai_synthetic_text_to_sql
CREATE TABLE Satellites (ID INT, Organization VARCHAR(50), Year INT, Number_Of_Satellites INT); INSERT INTO Satellites (ID, Organization, Year, Number_Of_Satellites) VALUES (1, 'NASA', 2018, 21), (2, 'SpaceX', 2018, 18), (3, 'ESA', 2019, 15), (4, 'NASA', 2020, 32), (5, 'SpaceX', 2020, 60);
How many satellites were deployed by each organization in 2020?
SELECT Organization, Number_Of_Satellites FROM Satellites WHERE Year = 2020 GROUP BY Organization;
gretelai_synthetic_text_to_sql
CREATE TABLE users (user_id INT, user_country VARCHAR(50), post_date DATE);
What is the average number of posts per day for users from the United States, for the month of January 2022?
SELECT AVG(post_count) FROM (SELECT user_country, COUNT(post_date) AS post_count FROM users WHERE user_country = 'United States' AND post_date BETWEEN '2022-01-01' AND '2022-01-31' GROUP BY user_country) AS subquery;
gretelai_synthetic_text_to_sql
CREATE TABLE news_pubs (pub_id INT, pub_name VARCHAR(50), city VARCHAR(50), avg_age FLOAT);
What is the average age of readers who prefer print news in 'news_pubs' table, grouped by their city?
SELECT city, AVG(avg_age) FROM news_pubs WHERE pub_name = 'Print News' GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE Sales (id INT, garmentID INT, quantity INT, saleDate DATE, isSustainable BOOLEAN); INSERT INTO Sales (id, garmentID, quantity, saleDate, isSustainable) VALUES (1, 301, 7, '2021-01-10', true), (2, 302, 4, '2021-02-15', false), (3, 303, 6, '2021-03-20', true), (4, 304, 5, '2021-04-12', true); CREATE TABLE Ga...
What is the total revenue generated from sustainable fashion sales in Africa?
SELECT SUM(quantity * price) FROM Sales INNER JOIN Garments ON Sales.garmentID = Garments.garmentID INNER JOIN Countries ON Garments.country = Countries.country WHERE isSustainable = true AND Countries.continent = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE properties (property_id INT, name VARCHAR(255), address VARCHAR(255), city VARCHAR(255), sold_date DATE, sustainable_urbanism_certified BOOLEAN); INSERT INTO properties (property_id, name, address, city, sold_date, sustainable_urbanism_certified) VALUES (1, 'The Green House', '123 Main St', 'Austin', '2021...
List the names and addresses of properties in the city of Austin that have been sold in the past year and have a sustainable urbanism certification.
SELECT name, address FROM properties WHERE city = 'Austin' AND sold_date >= DATEADD(year, -1, GETDATE()) AND sustainable_urbanism_certified = true;
gretelai_synthetic_text_to_sql
CREATE TABLE crime_rates (month VARCHAR(255), rate INT); INSERT INTO crime_rates (month, rate) VALUES ('Jan', 10), ('Feb', 12), ('Mar', 15), ('Apr', 18), ('May', 20), ('Jun', 22);
What is the trend of crime rate over the last 6 months?
SELECT month, rate, LAG(rate) OVER (ORDER BY month) AS previous_rate FROM crime_rates;
gretelai_synthetic_text_to_sql
CREATE TABLE PlayerVRData (PlayerID INT, VRGame VARCHAR(20), Playtime INT); INSERT INTO PlayerVRData (PlayerID, VRGame, Playtime) VALUES (1, 'VR', 50), (2, 'VR', 30), (3, 'Racing', 70);
What is the total number of players who have played VR games and have participated in esports events?
SELECT COUNT(DISTINCT PlayerID) FROM Players WHERE Game = 'VR' INTERSECT SELECT DISTINCT PlayerID FROM EsportsEvents;
gretelai_synthetic_text_to_sql
CREATE TABLE vessel_port_visits ( id INT, vessel_id INT, port_id INT, visit_date DATE ); INSERT INTO vessel_port_visits (id, vessel_id, port_id, visit_date) VALUES (3, 18, 51, '2022-03-07'); INSERT INTO vessel_port_visits (id, vessel_id, port_id, visit_date) VALUES (4, 19, 52, '2022-03-14');
How many times did each vessel visit ports in the Pacific Ocean in the last month?
SELECT vessel_id, COUNT(DISTINCT visit_date) as visits_to_pacific_ports FROM vessel_port_visits WHERE port_id BETWEEN 41 AND 90 AND visit_date BETWEEN '2022-02-01' AND '2022-03-01' GROUP BY vessel_id;
gretelai_synthetic_text_to_sql
CREATE TABLE MM_Trips (id INT, trip_type VARCHAR(20), city VARCHAR(50), trips INT, date DATE); INSERT INTO MM_Trips (id, trip_type, city, trips, date) VALUES (1, 'Bike-Transit', 'New York City', 15000, '2022-01-01'), (2, 'Bus-Subway', 'New York City', 22000, '2022-01-02'), (3, 'Car-Transit', 'New York City', 18000, '20...
How many multimodal trips were taken in New York City in the last month?
SELECT SUM(total_trips) as total_trips FROM MM_Trips WHERE city = 'New York City' AND date >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH);
gretelai_synthetic_text_to_sql
CREATE TABLE customers (id INT, name VARCHAR(100), assets_value FLOAT); INSERT INTO customers (id, name, assets_value) VALUES (1, 'Jane Smith', 600000.00);
Update the assets value of the customer 'Jane Smith' to $800,000.00.
UPDATE customers SET assets_value = 800000.00 WHERE name = 'Jane Smith';
gretelai_synthetic_text_to_sql
CREATE TABLE social_good_projects (project_id INT, region VARCHAR(20), focus VARCHAR(50)); INSERT INTO social_good_projects (project_id, region, focus) VALUES (1, 'Africa', 'accessibility'), (2, 'Africa', 'education'), (3, 'Europe', 'infrastructure'), (4, 'North America', 'policy');
What is the percentage of technology for social good projects in Africa that focus on accessibility?
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM social_good_projects WHERE region = 'Africa')) as percentage FROM social_good_projects WHERE region = 'Africa' AND focus = 'accessibility';
gretelai_synthetic_text_to_sql
CREATE TABLE satellite_deployments (country VARCHAR(255), launch_date DATE); INSERT INTO satellite_deployments (country, launch_date) VALUES ('USA', '2020-01-01'), ('China', '2019-06-15'), ('Russia', '2021-08-27'), ('India', '2018-03-04'), ('Japan', '2021-02-12');
Which are the top 3 countries with the most satellite deployments in the past 5 years?
SELECT country, COUNT(*) as count FROM satellite_deployments WHERE launch_date >= DATEADD(year, -5, CURRENT_DATE) GROUP BY country ORDER BY count DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE military_bases (base_name VARCHAR(255), country VARCHAR(255), personnel INT); INSERT INTO military_bases (base_name, country, personnel) VALUES ('Osan Air Base', 'South Korea', 1800), ('Yokota Air Base', 'Japan', 3000), ('Camp Humphreys', 'South Korea', 4000), ('Taegu Air Base', 'South Korea', 2500), ('Iwa...
What are the top three countries in Asia with the most military bases?
SELECT country, COUNT(*) as base_count FROM military_bases WHERE country IN ('South Korea', 'Japan', 'Okinawa') GROUP BY country ORDER BY base_count DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE safety_protocols (protocol_name TEXT, safety_measure_code TEXT); INSERT INTO safety_protocols (protocol_name, safety_measure_code) VALUES ('Fire Safety', 'FS01'), ('Chemical Handling', 'CH01'), ('Personal Protective Equipment', 'PPE01');
Display the safety protocol names and their corresponding safety measure codes, in alphabetical order based on safety protocol names from the safety_protocols table.
SELECT protocol_name, safety_measure_code FROM safety_protocols ORDER BY protocol_name ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE salaries (id INT, worker_id INT, department VARCHAR(50), salary DECIMAL(10,2)); INSERT INTO salaries (id, worker_id, department, salary) VALUES (1, 1, 'Research', 85000.00), (2, 2, 'Operations', 75000.00), (3, 3, 'Research', 88000.00);
What was the average salary of workers in the 'research' department compared to the 'operations' department?
SELECT department, AVG(salary) as avg_salary FROM salaries GROUP BY department;
gretelai_synthetic_text_to_sql
CREATE TABLE sales_data (id INT, sale_date DATE, make VARCHAR(50), model VARCHAR(50), vehicle_type VARCHAR(50), price FLOAT);
How many hybrid vehicles have been sold in each month of the year 2018 in the 'sales_data' table?
SELECT MONTH(sale_date), COUNT(*) FROM sales_data WHERE vehicle_type = 'Hybrid' AND YEAR(sale_date) = 2018 GROUP BY MONTH(sale_date);
gretelai_synthetic_text_to_sql
CREATE TABLE oceanography_data (id INT, location VARCHAR(50), depth INT, temperature FLOAT, salinity FLOAT); INSERT INTO oceanography_data (id, location, depth, temperature, salinity) VALUES (1, 'Indian Ocean', 5000, 29.5, 34.9); INSERT INTO oceanography_data (id, location, depth, temperature, salinity) VALUES (2, 'Sou...
What is the maximum temperature in the Indian Ocean?
SELECT MAX(temperature) FROM oceanography_data WHERE location = 'Indian Ocean';
gretelai_synthetic_text_to_sql
CREATE TABLE house_water_usage (house_id INT, city VARCHAR(255), usage_liters INT, year INT); INSERT INTO house_water_usage (house_id, city, usage_liters, year) VALUES (1, 'Austin', 12000, 2020), (2, 'Austin', 15000, 2020), (3, 'Austin', 11000, 2020);
What is the average amount of water consumption (in liters) per household in the city of Austin, Texas, for the year 2020?
SELECT AVG(usage_liters) FROM house_water_usage WHERE city = 'Austin' AND year = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE digital_assets (id INT, name TEXT, company TEXT, launch_date DATE); INSERT INTO digital_assets (id, name, company, launch_date) VALUES (1, 'Asset1', 'A', '2020-01-01'); INSERT INTO digital_assets (id, name, company, launch_date) VALUES (2, 'Asset2', 'A', '2021-05-15');
What is the total number of digital assets launched by company 'A'?
SELECT COUNT(*) FROM digital_assets WHERE company = 'A';
gretelai_synthetic_text_to_sql
CREATE TABLE wells (id INT, well_name VARCHAR(100), location VARCHAR(50), status VARCHAR(20)); INSERT INTO wells VALUES (1, 'Well A', 'North Sea', 'Producing'); INSERT INTO wells VALUES (2, 'Well B', 'Gulf of Mexico', 'Abandoned');
Find the total number of wells in the North Sea
SELECT COUNT(*) FROM wells WHERE location = 'North Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE bike_sharing_stations (station_id INT, station_name TEXT, city TEXT, country TEXT, latitude FLOAT, longitude FLOAT);
Update the bike sharing station with ID 601 to change its name
UPDATE bike_sharing_stations SET station_name = 'South Lake Union' WHERE station_id = 601;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (id INT PRIMARY KEY, name VARCHAR(255), conservation_status VARCHAR(255));
Delete marine species records with a conservation_status of 'extinct'.
DELETE FROM marine_species WHERE conservation_status = 'extinct';
gretelai_synthetic_text_to_sql
CREATE TABLE social_impact_funding (id INT, project_name VARCHAR(50), funding_date DATE, region VARCHAR(30), amount DECIMAL(10,2)); INSERT INTO social_impact_funding (id, project_name, funding_date, region, amount) VALUES (1, 'Education Initiative A', '2020-03-15', 'Asia', 25000.00), (2, 'Healthcare Program B', '2019-1...
What is the total amount of funding for social impact projects in Asia in the year 2020?
SELECT SUM(amount) FROM social_impact_funding WHERE funding_date >= '2020-01-01' AND funding_date < '2021-01-01' AND region = 'Asia';
gretelai_synthetic_text_to_sql
CREATE TABLE bridges (id INT, name TEXT, region TEXT, resilience_score FLOAT); INSERT INTO bridges (id, name, region, resilience_score) VALUES (1, 'Golden Gate Bridge', 'West Coast', 85.2), (2, 'Brooklyn Bridge', 'East Coast', 76.3), (3, 'Bay Bridge', 'West Coast', 78.1), (4, 'Chenab Bridge', 'South Asia', 89.6), (5, '...
Delete all records of bridges in the 'Africa' region.
DELETE FROM bridges WHERE region = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE agricultural_innovation_budget (id INT, project_id INT, budget DECIMAL(10,2)); INSERT INTO agricultural_innovation_budget (id, project_id, budget) VALUES (1, 1, 50000.00), (2, 2, 75000.00); CREATE TABLE rural_innovation (id INT, project_name VARCHAR(255), sector VARCHAR(255), location VARCHAR(255), start_d...
What is the minimum budget for agricultural innovation projects in 2020?
SELECT MIN(budget) FROM agricultural_innovation_budget JOIN rural_innovation ON agricultural_innovation_budget.project_id = rural_innovation.id WHERE YEAR(start_date) = 2020 AND YEAR(end_date) = 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE Mine (MineID int, MineName varchar(50), Location varchar(50)); CREATE TABLE Emission (EmissionID int, MineID int, EmissionType varchar(50), EmissionQuantity int); INSERT INTO Mine VALUES (1, 'ABC Mine', 'Colorado'), (2, 'DEF Mine', 'Wyoming'), (3, 'GHI Mine', 'West Virginia'); INSERT INTO Emission VALUES (...
What are the total greenhouse gas emissions for each mine, ranked from highest to lowest?
SELECT MineName, SUM(EmissionQuantity) as TotalEmissionQuantity FROM Emission INNER JOIN Mine ON Emission.MineID = Mine.MineID GROUP BY MineName ORDER BY TotalEmissionQuantity DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE brands (id INT PRIMARY KEY, name TEXT, country TEXT, sustainability_score INT);
Identify the top 5 countries with the highest number of ethical fashion brands.
SELECT country, COUNT(*) as brand_count FROM brands GROUP BY country ORDER BY brand_count DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE Ingredients (IngredientID INT, ProductID INT, IngredientName VARCHAR(50), CrueltyFree BOOLEAN, Category VARCHAR(50)); INSERT INTO Ingredients (IngredientID, ProductID, IngredientName, CrueltyFree, Category) VALUES (1, 1, 'Rose Oil', TRUE, 'Skincare'), (2, 1, 'Paraben', FALSE, 'Skincare'), (3, 2, 'Silicone'...
What is the total number of cruelty-free ingredients in products, grouped by their category?
SELECT Category, COUNT(*) FROM Ingredients WHERE CrueltyFree = TRUE GROUP BY Category;
gretelai_synthetic_text_to_sql
CREATE TABLE SpaceMissions (id INT, name VARCHAR(50), destination VARCHAR(50)); INSERT INTO SpaceMissions (id, name, destination) VALUES (1, 'Apollo 11', 'Moon');
What is the total number of manned space missions that have traveled to the Moon?
SELECT COUNT(*) FROM SpaceMissions WHERE destination = 'Moon' AND type = 'Manned';
gretelai_synthetic_text_to_sql
CREATE TABLE volunteer_hours (id INT, age_group VARCHAR(50), volunteer_date DATE, volunteer_hours FLOAT); INSERT INTO volunteer_hours (id, age_group, volunteer_date, volunteer_hours) VALUES (1, '18-24', '2023-03-20', 5.0), (2, '25-34', '2023-02-01', 8.0), (3, '35-44', '2023-01-15', 10.0), (4, '18-24', '2023-04-01', 15....
Calculate the average number of volunteer hours per week for each age group.
SELECT age_group, AVG(volunteer_hours / 7) FROM volunteer_hours GROUP BY age_group;
gretelai_synthetic_text_to_sql
CREATE TABLE customers (id INT, name VARCHAR(100), age INT, gender VARCHAR(10), city VARCHAR(50), state VARCHAR(50), account_balance DECIMAL(10,2), assets DECIMAL(10,2));
What is the total asset value for all customers in Canada?
SELECT SUM(assets) FROM customers WHERE state='Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE technology_for_social_good (id INT PRIMARY KEY, project_name VARCHAR(100), region VARCHAR(50), funding_amount INT, funding_status VARCHAR(20)); INSERT INTO technology_for_social_good (id, project_name, region, funding_amount, funding_status) VALUES (1, 'Clean Water AI', 'Europe', 60000, 'Pending'); INSERT ...
Update the "technology_for_social_good" table to set the "funding_status" to "Approved" for the records with "region" as "Europe" and "funding_amount" greater than 50000
UPDATE technology_for_social_good SET funding_status = 'Approved' WHERE region = 'Europe' AND funding_amount > 50000;
gretelai_synthetic_text_to_sql
CREATE TABLE students (id INT, district TEXT, mental_health_score INT); INSERT INTO students (id, district, mental_health_score) VALUES (1, 'Remote Learning', 80), (2, 'Remote Learning', 85), (3, 'Remote Learning', 90);
What is the minimum mental health score of students in the 'Remote Learning' district?
SELECT MIN(mental_health_score) FROM students WHERE district = 'Remote Learning';
gretelai_synthetic_text_to_sql
CREATE TABLE production_data (id INT, date DATE, coal_production INT, gold_production INT); INSERT INTO production_data (id, date, coal_production, gold_production) VALUES (1, '2022-01-01', 200, 10); INSERT INTO production_data (id, date, coal_production, gold_production) VALUES (2, '2022-01-02', 250, 15);
What is the minimum amount of gold extracted in a single day in the 'production_data' table?
SELECT MIN(gold_production) as min_gold_production FROM production_data;
gretelai_synthetic_text_to_sql
CREATE TABLE accommodations (id INT, country VARCHAR(50), accommodation_type VARCHAR(50), sustainability_score INT); INSERT INTO accommodations (id, country, accommodation_type, sustainability_score) VALUES (1, 'Australia', 'Hotel', 75); INSERT INTO accommodations (id, country, accommodation_type, sustainability_score)...
Calculate the average sustainability score for accommodations in Australia and New Zealand.
SELECT AVG(sustainability_score) FROM accommodations WHERE country IN ('Australia', 'New Zealand');
gretelai_synthetic_text_to_sql
CREATE TABLE olympic_countries (country_id INT, name VARCHAR(50)); CREATE TABLE olympic_medals (medal_id INT, country_id INT, medal VARCHAR(50)); INSERT INTO olympic_countries (country_id, name) VALUES (1, 'USA'), (2, 'Canada'), (3, 'Mexico'); INSERT INTO olympic_medals (medal_id, country_id, medal) VALUES (1, 1, 'Gold...
What is the total number of medals won by each country in the 'olympic_medals' table?
SELECT name AS country, SUM(CASE WHEN medal = 'Gold' THEN 1 ELSE 0 END) AS total_gold, SUM(CASE WHEN medal = 'Silver' THEN 1 ELSE 0 END) AS total_silver, SUM(CASE WHEN medal = 'Bronze' THEN 1 ELSE 0 END) AS total_bronze, SUM(CASE WHEN medal IN ('Gold', 'Silver', 'Bronze') THEN 1 ELSE 0 END) AS total_medals FROM olympic...
gretelai_synthetic_text_to_sql
CREATE TABLE clean_transport (vehicle_type TEXT, num_vehicles INTEGER); INSERT INTO clean_transport (vehicle_type, num_vehicles) VALUES ('Tesla Model 3', 1000), ('Nissan Leaf', 1500), ('Chevy Bolt', 500);
How many electric vehicles are in the 'clean_transport' table?
SELECT SUM(num_vehicles) FROM clean_transport;
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityDev (id INT, initiative VARCHAR(255), country VARCHAR(255), coordinator VARCHAR(255)); INSERT INTO CommunityDev (id, initiative, country, coordinator) VALUES (1, 'Youth Empowerment', 'Brazil', 'Maria Silva'), (2, 'Elderly Care', 'Brazil', 'Jose Pires');
List all community development initiatives in Brazil and their respective coordinators.
SELECT initiative, coordinator FROM CommunityDev WHERE country = 'Brazil';
gretelai_synthetic_text_to_sql
CREATE TABLE Pizzeria (Date DATE, Revenue INT); INSERT INTO Pizzeria (Date, Revenue) VALUES ('2022-01-01', 500), ('2022-01-02', 700), ('2022-01-03', 800), ('2022-01-04', 600);
What was the highest revenue generating day in 'Pizzeria Z'?
SELECT Date, MAX(Revenue) FROM Pizzeria WHERE Date BETWEEN '2022-01-01' AND '2022-01-04' GROUP BY Date;
gretelai_synthetic_text_to_sql
CREATE TABLE shipments (id INT, source_country VARCHAR(20), destination_city VARCHAR(20), shipment_date DATE); INSERT INTO shipments (id, source_country, destination_city, shipment_date) VALUES (1, 'South Africa', 'Cape Town', '2022-07-10'), (2, 'South Africa', 'Cape Town', '2022-07-15');
Find the total number of shipments made from South Africa to Cape Town in the past week.
SELECT COUNT(*) FROM shipments WHERE source_country = 'South Africa' AND destination_city = 'Cape Town' AND shipment_date >= DATE_SUB(CURRENT_DATE, INTERVAL 1 WEEK);
gretelai_synthetic_text_to_sql
CREATE TABLE energy_efficiency (city VARCHAR(255), co2_emissions INT);
What are the names of the top 5 cities with the highest CO2 emissions in the 'energy_efficiency' table?
SELECT city FROM energy_efficiency ORDER BY co2_emissions DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE multi_sport_athletes (athlete_id INT, name VARCHAR(50), sport VARCHAR(30));
List the names and sports of athletes in the 'multi_sport_athletes' table.
SELECT name, sport FROM multi_sport_athletes;
gretelai_synthetic_text_to_sql
CREATE TABLE creative_ai_apps (app_name VARCHAR(255), user_rating INT, year INT); INSERT INTO creative_ai_apps (app_name, user_rating, year) VALUES ('App1', 85, 2023), ('App2', 92, 2023), ('App3', 78, 2023), ('App4', 90, 2023), ('App5', 88, 2023), ('App6', 75, 2023);
Identify the top 2 creative AI applications with the highest user ratings in 2023
SELECT app_name, user_rating FROM (SELECT app_name, user_rating, ROW_NUMBER() OVER (ORDER BY user_rating DESC) as rank FROM creative_ai_apps WHERE year = 2023) tmp WHERE rank <= 2;
gretelai_synthetic_text_to_sql
CREATE TABLE ai_ethics (project TEXT, budget INTEGER); INSERT INTO ai_ethics (project, budget) VALUES ('AI Ethics Research Project A', 100000); INSERT INTO ai_ethics (project, budget) VALUES ('AI Ethics Research Project B', 120000);
What is the minimum budget for AI ethics research in the 'ai_ethics' table?
SELECT MIN(budget) FROM ai_ethics;
gretelai_synthetic_text_to_sql
CREATE TABLE textile_sustainability (source VARCHAR(50), rating FLOAT); INSERT INTO textile_sustainability (source, rating) VALUES ('Organic Cotton', 4.2), ('Recycled Polyester', 3.9), ('Hemp', 4.5);
What is the average rating of garments by textile source, ordered by rating?
SELECT source, AVG(rating) as avg_rating FROM textile_sustainability GROUP BY source ORDER BY avg_rating DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE company_location_sustainability (company_id INT, location TEXT, sustainability_score INT); INSERT INTO company_location_sustainability (company_id, location, sustainability_score) VALUES (1, 'Asia-Pacific', 85), (2, 'Europe', 92), (3, 'Asia-Pacific', 78), (4, 'Europe', 60), (5, 'Europe', 88), (6, 'Africa',...
What is the total sustainability score of companies located in Africa?
SELECT SUM(sustainability_score) FROM company_location_sustainability WHERE location = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE AirportsAustralia (AirportID INT, Name VARCHAR(255), Region VARCHAR(255), RunwayLength INT, AirportType VARCHAR(255), AircraftMovements INT); INSERT INTO AirportsAustralia VALUES (1, 'Airport A', 'New South Wales', 2000, 'International', 10000); INSERT INTO AirportsAustralia VALUES (2, 'Airport B', 'Queens...
Identify the number of airports, their respective runway lengths, and the total number of aircraft movements in each region of Australia, along with their airport types (e.g., international, domestic, or military).
SELECT Region, AirportType, COUNT(*) as AirportCount, SUM(RunwayLength) as TotalRunwayLength, SUM(AircraftMovements) as TotalAircraftMovements FROM AirportsAustralia GROUP BY Region, AirportType;
gretelai_synthetic_text_to_sql
CREATE TABLE sectors (sector_id INT, sector_name VARCHAR(20)); CREATE TABLE companies (company_id INT, company_name VARCHAR(30), sector_id INT, esg_rating FLOAT);
What's the average ESG rating for all companies in the 'technology' sector?
SELECT AVG(c.esg_rating) FROM companies c INNER JOIN sectors s ON c.sector_id = s.sector_id WHERE s.sector_name = 'technology';
gretelai_synthetic_text_to_sql
CREATE TABLE Donations (DonationID int, DonorID int, DonationDate date);
What is the number of donations made by first-time donors from the United Kingdom?
SELECT COUNT(*) FROM Donations D INNER JOIN (SELECT DISTINCT DonorID FROM Donations WHERE YEAR(DonationDate) = YEAR(CURRENT_DATE) - 1) FD ON D.DonorID = FD.DonorID WHERE Country = 'UK';
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (name VARCHAR(255), status VARCHAR(255), location VARCHAR(255)); INSERT INTO marine_species (name, status, location) VALUES ('Mediterranean Monk Seal', 'Endangered', 'Mediterranean Sea'), ('Bluefin Tuna', 'Endangered', 'Mediterranean Sea');
How many marine species are listed as endangered in the Mediterranean Sea?
SELECT COUNT(*) FROM marine_species WHERE status = 'Endangered' AND location = 'Mediterranean Sea';
gretelai_synthetic_text_to_sql
CREATE TABLE ProgramVolunteers (ProgramID INT, VolunteerCount INT); INSERT INTO ProgramVolunteers (ProgramID, VolunteerCount) VALUES (1, 5), (3, 0);
Which programs received donations in Q4 2021 but did not have any volunteers?
SELECT ProgramName FROM Programs LEFT JOIN ProgramVolunteers ON Programs.ProgramID = ProgramVolunteers.ProgramID WHERE DonationDate BETWEEN '2021-10-01' AND '2021-12-31' AND VolunteerCount = 0;
gretelai_synthetic_text_to_sql
CREATE TABLE DispensarySales (dispensary_id INT, strain VARCHAR(20), quantity INT); INSERT INTO DispensarySales (dispensary_id, strain, quantity) VALUES (1, 'Sour Diesel', 50), (1, 'Blue Dream', 75), (2, 'Green Crack', 60), (2, 'Jack Herer', 80); CREATE TABLE DCDispensaries (dispensary_id INT, location VARCHAR(20)); IN...
Find dispensaries in Washington D.C. that sell both indica and sativa strains.
SELECT ds.dispensary_id FROM DispensarySales ds JOIN DCDispensaries dcd ON ds.dispensary_id = dcd.dispensary_id WHERE strain LIKE '%Indica%' INTERSECT SELECT ds.dispensary_id FROM DispensarySales ds JOIN DCDispensaries dcd ON ds.dispensary_id = dcd.dispensary_id WHERE strain LIKE '%Sativa%';
gretelai_synthetic_text_to_sql
CREATE TABLE medical_facilities_nigeria (id INT, name TEXT, patients INT); INSERT INTO medical_facilities_nigeria (id, name, patients) VALUES (1, 'Facility X', 5000);
What is the maximum number of patients served per medical facility in Nigeria?
SELECT MAX(patients) FROM medical_facilities_nigeria;
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, engineer_id INT, department VARCHAR(20), cost DECIMAL(10,2)); INSERT INTO projects (id, engineer_id, department, cost) VALUES (1, 1001, 'civil', 5000), (2, 1002, 'civil', 6000), (3, 1003, 'structural', 4000), (4, 1001, 'civil', 7000), (5, 1002, 'civil', 3000), (6, 1003, 'structural', 6000...
Display the cost of the project with the ID 4 and the department of the project with the ID 5.
SELECT cost FROM projects WHERE id = 4; SELECT department FROM projects WHERE id = 5;
gretelai_synthetic_text_to_sql
CREATE TABLE ArtistConcerts (ArtistID INT, ConcertID INT, Revenue INT); INSERT INTO ArtistConcerts VALUES (1, 1, 10000); INSERT INTO ArtistConcerts VALUES (2, 2, 15000); INSERT INTO ArtistConcerts VALUES (3, 3, 12000); CREATE TABLE Artists (ArtistID INT, ArtistName VARCHAR(100), Age INT, Genre VARCHAR(50)); INSERT INTO...
Which artists have the highest and lowest average concert ticket revenue?
SELECT ArtistName, AVG(Revenue) FROM ArtistConcerts AC INNER JOIN Artists A ON AC.ArtistID = A.ArtistID GROUP BY ArtistID ORDER BY AVG(Revenue) DESC, ArtistName ASC;
gretelai_synthetic_text_to_sql
CREATE TABLE tickets_sold (ticket_id INT, game_type VARCHAR(50), division VARCHAR(50), tickets_sold INT); INSERT INTO tickets_sold (ticket_id, game_type, division, tickets_sold) VALUES (1, 'Basketball', 'Atlantic Division', 500), (2, 'Football', 'Atlantic Division', 700), (3, 'Basketball', 'Atlantic Division', 600), (4...
What is the minimum number of tickets sold for football games in the 'Northern Division'?
SELECT MIN(tickets_sold) FROM tickets_sold WHERE game_type = 'Football' AND division = 'Northern Division';
gretelai_synthetic_text_to_sql
CREATE TABLE consumers (consumer_id INT, consumer_name TEXT); CREATE TABLE purchases (purchase_id INT, consumer_id INT, supplier_id INT, product_id INT, quantity INT, price DECIMAL); CREATE TABLE suppliers (supplier_id INT, supplier_name TEXT, labor_practice TEXT);
Get the top 3 consumers with the highest total spending on ethical products?
SELECT consumers.consumer_name, SUM(quantity * price) AS total_spending FROM consumers JOIN purchases ON consumers.consumer_id = purchases.consumer_id JOIN suppliers ON purchases.supplier_id = suppliers.supplier_id WHERE suppliers.labor_practice = 'Ethical' GROUP BY consumers.consumer_id ORDER BY total_spending DESC LI...
gretelai_synthetic_text_to_sql
CREATE TABLE organizations (id INT, name TEXT, location TEXT, donations DECIMAL(10,2)); INSERT INTO organizations (id, name, location, donations) VALUES (1, 'Aid for Africa', 'Africa', 50000.00), (2, 'Hope for Asia', 'Asia', 75000.00), (3, 'Charity for Europe', 'Europe', 100000.00);
What is the maximum amount of donations received by an organization in Asia?
SELECT MAX(donations) FROM organizations WHERE location = 'Asia';
gretelai_synthetic_text_to_sql
CREATE TABLE IF NOT EXISTS carbon_offset_initiatives ( initiative_id INT, initiative_name VARCHAR(255), co2_offset FLOAT, country VARCHAR(255), PRIMARY KEY (initiative_id)); INSERT INTO carbon_offset_initiatives (initiative_id, initiative_name, co2_offset, country) VALUES (1, 'Tree Planting', 50, 'USA'), (2, '...
What is the total CO2 offset for each country in the carbon_offset_initiatives table?
SELECT country, SUM(co2_offset) FROM carbon_offset_initiatives GROUP BY country;
gretelai_synthetic_text_to_sql