context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE movies (id INT, title TEXT, genre TEXT); INSERT INTO movies (id, title, genre) VALUES (1, 'Funny MovieA', 'Action'); INSERT INTO movies (id, title, genre) VALUES (2, 'Drama MovieB', 'Drama'); INSERT INTO movies (id, title, genre) VALUES (3, 'Comedy MovieC', 'Comedy');
Update the genre of a movie to 'Comedy' if its title contains 'Funny'.
UPDATE movies SET genre = 'Comedy' WHERE title LIKE '%Funny%';
gretelai_synthetic_text_to_sql
CREATE TABLE ai_adoption (hotel_id INT, city TEXT, adoption_rate INT); INSERT INTO ai_adoption (hotel_id, city, adoption_rate) VALUES (3, 'Tokyo', 80), (4, 'Tokyo', 90), (5, 'Seoul', 70);
What is the adoption rate of AI in 'Tokyo' hotels?
SELECT AVG(adoption_rate) FROM ai_adoption WHERE city = 'Tokyo';
gretelai_synthetic_text_to_sql
CREATE TABLE climate_mitigation (id INT, project VARCHAR(255), location VARCHAR(255), budget FLOAT); INSERT INTO climate_mitigation (id, project, location, budget) VALUES (1, 'Wind Energy Expansion', 'Africa', 9000000);
Update the name of the project 'Wind Energy Expansion' to 'Wind Power Expansion' in Africa.
UPDATE climate_mitigation SET project = 'Wind Power Expansion' WHERE project = 'Wind Energy Expansion' AND location = 'Africa';
gretelai_synthetic_text_to_sql
CREATE TABLE biotech_startups (id INT, name VARCHAR(50), budget DECIMAL(10,2), region VARCHAR(50)); INSERT INTO biotech_startups (id, name, budget, region) VALUES (1, 'BioGenBrazil', 3000000.00, 'Brazil'); INSERT INTO biotech_startups (id, name, budget, region) VALUES (2, 'InnoLife', 4000000.00, 'USA'); INSERT INTO biotech_startups (id, name, budget, region) VALUES (3, 'BioTechNova', 6000000.00, 'Canada');
What is the average budget of biotech startups in Canada?
SELECT AVG(budget) FROM biotech_startups WHERE region = 'Canada';
gretelai_synthetic_text_to_sql
CREATE TABLE Episodes (id INT, title VARCHAR(100), season INT, rating FLOAT, show_id INT);
Which TV show episodes have the highest rating in each season?
SELECT title, season, MAX(rating) FROM Episodes GROUP BY season;
gretelai_synthetic_text_to_sql
CREATE TABLE artworks(artwork_id INT, title VARCHAR(50), is_checked_out INT); INSERT INTO artworks (artwork_id, title, is_checked_out) VALUES (1, 'Mona Lisa', 1), (2, 'Starry Night', 0), (3, 'The Persistence of Memory', 0); CREATE TABLE visitors(visitor_id INT, name VARCHAR(50), member_id INT, is_checked_out INT); INSERT INTO visitors (visitor_id, name, member_id, is_checked_out) VALUES (1, 'John Doe', NULL, 1), (2, 'Jane Smith', NULL, 2), (3, 'Alice Johnson', NULL, 0);
What is the maximum number of artworks checked out by a single visitor?
SELECT MAX(is_checked_out) FROM artworks a JOIN visitors v ON a.visitor_id = v.visitor_id;
gretelai_synthetic_text_to_sql
CREATE TABLE Railways (id INT, name TEXT, country TEXT, length FLOAT); INSERT INTO Railways (id, name, country, length) VALUES (1, 'RailwayA', 'CountryX', 650.00), (2, 'RailwayB', 'CountryY', 420.50), (3, 'RailwayC', 'CountryZ', 800.25), (4, 'RailwayD', 'CountryA', 350.00), (5, 'RailwayE', 'CountryB', 550.50); CREATE TABLE Countries (id INT, name TEXT, continent TEXT); INSERT INTO Countries (id, name, continent) VALUES (1, 'CountryX', 'Asia'), (2, 'CountryY', 'Europe'), (3, 'CountryZ', 'Asia'), (4, 'CountryA', 'North America'), (5, 'CountryB', 'Africa');
How many railways are there in 'Asia' that have a length greater than 500?
SELECT COUNT(*) FROM Railways INNER JOIN Countries ON Railways.country = Countries.name WHERE Countries.continent = 'Asia' AND length > 500;
gretelai_synthetic_text_to_sql
CREATE SCHEMA gradschool;CREATE TABLE faculty(name TEXT,department TEXT,gender TEXT);INSERT INTO faculty(name,department,gender)VALUES('Alice','Computer Science','Female'),('Bob','Physics','Male');
What are the names of all female faculty members in the Computer Science department?
SELECT name FROM gradschool.faculty WHERE department='Computer Science' AND gender='Female';
gretelai_synthetic_text_to_sql
CREATE TABLE vessels (vessel_id INT, vessel_name VARCHAR(50), type VARCHAR(50)); CREATE TABLE cargo (cargo_id INT, vessel_id INT, port_id INT, weight FLOAT, handling_date DATE); CREATE TABLE ports (port_id INT, port_name VARCHAR(50), city VARCHAR(50), country VARCHAR(50));
Identify vessels that have visited the port of 'Chennai', India at least once, partitioned by year and month.
SELECT DISTINCT v.vessel_name, YEAR(c.handling_date) AS handling_year, MONTH(c.handling_date) AS handling_month FROM cargo c JOIN vessels v ON c.vessel_id = v.vessel_id JOIN ports p ON c.port_id = p.port_id WHERE p.port_name = 'Chennai' AND p.country = 'India' GROUP BY v.vessel_name, YEAR(c.handling_date), MONTH(c.handling_date);
gretelai_synthetic_text_to_sql
CREATE TABLE Suppliers (id INT, name TEXT, country TEXT); INSERT INTO Suppliers VALUES (1, 'Supplier1', 'China'), (2, 'Supplier2', 'India'), (3, 'Supplier3', 'Japan'), (4, 'Supplier4', 'South Korea'), (5, 'Supplier5', 'Vietnam'); CREATE TABLE SustainableMaterials (id INT, supplier_id INT, material TEXT); INSERT INTO SustainableMaterials VALUES (1, 1, 'OrganicCotton'), (2, 3, 'Tencel'), (3, 2, 'Hemp'), (4, 5, 'Bamboo');
List all suppliers located in Asia that provide sustainable materials.
SELECT s.name FROM Suppliers s INNER JOIN SustainableMaterials sm ON s.id = sm.supplier_id WHERE s.country LIKE 'Asia%';
gretelai_synthetic_text_to_sql
CREATE TABLE Veteran_Employment (ID INT, State VARCHAR(50), Year INT, Applications INT); INSERT INTO Veteran_Employment (ID, State, Year, Applications) VALUES (1, 'California', 2016, 200), (2, 'California', 2018, 300), (3, 'New_York', 2017, 250), (4, 'New_York', 2019, 320);
How many veteran employment applications were submitted in New York in 2019?
SELECT State, Year, SUM(Applications) FROM Veteran_Employment WHERE State = 'New_York' AND Year = 2019 GROUP BY State, Year;
gretelai_synthetic_text_to_sql
CREATE TABLE company_impact (id INT, name VARCHAR(255), sector VARCHAR(255), impact_measurement_score FLOAT); INSERT INTO company_impact (id, name, sector, impact_measurement_score) VALUES (1, 'Google', 'Technology', 85.0), (2, 'Apple', 'Technology', 87.5), (3, 'Microsoft', 'Technology', 90.0);
What is the maximum impact measurement score for companies in the technology sector?
SELECT MAX(impact_measurement_score) FROM company_impact WHERE sector = 'Technology';
gretelai_synthetic_text_to_sql
CREATE TABLE rural_infrastructure (year INT, category VARCHAR(255), spending FLOAT); INSERT INTO rural_infrastructure (year, category, spending) VALUES (2018, 'Roads', 1200000), (2018, 'Bridges', 800000), (2019, 'Roads', 1500000), (2019, 'Bridges', 900000), (2020, 'Roads', 1800000), (2020, 'Bridges', 1000000);
What was the total spending on rural infrastructure projects in 2020, grouped by project category?
SELECT category, SUM(spending) as total_spending FROM rural_infrastructure WHERE year = 2020 GROUP BY category;
gretelai_synthetic_text_to_sql
CREATE TABLE mining_sites (id INT, name VARCHAR(50)); CREATE TABLE employees (site_id INT, gender VARCHAR(10), role VARCHAR(10)); INSERT INTO mining_sites (id, name) VALUES (1, 'Site A'), (2, 'Site B'), (3, 'Site C'); INSERT INTO employees (site_id, gender, role) VALUES (1, 'Female', 'Engineer'), (1, 'Male', 'Manager'), (2, 'Female', 'Operator'), (2, 'Male', 'Supervisor'), (3, 'Male', 'Engineer'), (3, 'Female', 'Manager');
Which mining sites have a higher percentage of female employees compared to male employees?
SELECT ms.name, COUNT(e.gender) as total, (COUNT(CASE WHEN e.gender = 'Female' THEN 1 END) * 100.0 / COUNT(e.gender)) as female_percentage, (COUNT(CASE WHEN e.gender = 'Male' THEN 1 END) * 100.0 / COUNT(e.gender)) as male_percentage FROM mining_sites ms INNER JOIN employees e ON ms.id = e.site_id GROUP BY ms.name HAVING female_percentage > male_percentage;
gretelai_synthetic_text_to_sql
CREATE TABLE AircraftMaintenance (id INT, branch VARCHAR(255), quarter INT, requests INT); INSERT INTO AircraftMaintenance (id, branch, quarter, requests) VALUES (1, 'Air Force', 1, 50), (2, 'Navy', 2, 70), (3, 'Army', 1, 60), (4, 'Air Force', 2, 80), (5, 'Navy', 1, 40), (6, 'Army', 2, 65);
How many aircraft maintenance requests were filed in Q2 2021 by military branch?
SELECT branch, SUM(requests) FROM AircraftMaintenance WHERE quarter = 2 GROUP BY branch;
gretelai_synthetic_text_to_sql
CREATE TABLE Projects (project_id INT, city VARCHAR(255), cost FLOAT); INSERT INTO Projects (project_id, city, cost) VALUES (1, 'Austin', 500000), (2, 'Houston', 700000);
What were the total construction costs for each project in the city of Austin in Q1 2022?
SELECT city, SUM(cost) FROM Projects WHERE city = 'Austin' AND QUARTER(start_date) = 1 AND YEAR(start_date) = 2022 GROUP BY city;
gretelai_synthetic_text_to_sql
CREATE TABLE Equipment (EquipmentID INT, EquipmentName VARCHAR(50), PurchaseDate DATE, PurchaseLocation VARCHAR(50));
Insert new equipment data for a rowing machine purchased in Japan on March 15, 2022.
INSERT INTO Equipment (EquipmentID, EquipmentName, PurchaseDate, PurchaseLocation) VALUES (4, 'Rowing Machine', '2022-03-15', 'Japan');
gretelai_synthetic_text_to_sql
CREATE TABLE media_ethics (publisher TEXT, ethics_code TEXT);
Update the media ethics records for 'The Washington Post' to include a new ethics code.
UPDATE media_ethics SET ethics_code = 'New Ethics Code' WHERE publisher = 'The Washington Post';
gretelai_synthetic_text_to_sql
CREATE SCHEMA ethical_fashion; CREATE TABLE factories (factory_id INT, material VARCHAR(255), water_consumption FLOAT, year INT); INSERT INTO factories VALUES (1,'cotton',1200,2020),(2,'cotton',1250,2019),(3,'polyester',1400,2020),(4,'polyester',1350,2019),(5,'wool',1100,2020),(6,'wool',1050,2019);
What is the average water consumption of the factories, partitioned by material type for the last 2 years?
SELECT material, AVG(water_consumption) OVER (PARTITION BY material) FROM ethical_fashion.factories WHERE year BETWEEN 2019 AND 2020 ORDER BY material;
gretelai_synthetic_text_to_sql
CREATE TABLE workers (id INT, name VARCHAR(255), industry VARCHAR(255), salary DECIMAL(10,2)); CREATE TABLE unions (id INT, worker_id INT, union VARCHAR(255)); INSERT INTO workers (id, name, industry, salary) VALUES (1, 'Alice Johnson', 'healthcare', 60000.00);
What is the minimum salary of workers in the 'healthcare' industry who are part of a union?
SELECT MIN(workers.salary) FROM workers INNER JOIN unions ON workers.id = unions.worker_id WHERE workers.industry = 'healthcare' AND unions.union = 'yes';
gretelai_synthetic_text_to_sql
CREATE TABLE projects (id INT, name VARCHAR(50), country VARCHAR(50), techniques VARCHAR(50)); INSERT INTO projects (id, name, country, techniques) VALUES (1, 'ProjectX', 'UK', 'DNA sequencing, PCR'); INSERT INTO projects (id, name, country, techniques) VALUES (2, 'ProjectY', 'UK', 'PCR, bioinformatics');
Which genetic research projects in the UK involve DNA sequencing?
SELECT name FROM projects WHERE country = 'UK' AND techniques LIKE '%DNA sequencing%';
gretelai_synthetic_text_to_sql
CREATE TABLE sustainable_housing_subdivisions (id INT, property_price FLOAT); INSERT INTO sustainable_housing_subdivisions (id, property_price) VALUES (1, 500000), (2, 600000), (3, 700000);
What is the total property price for properties in the sustainable_housing_subdivisions table?
SELECT SUM(property_price) FROM sustainable_housing_subdivisions;
gretelai_synthetic_text_to_sql
CREATE TABLE habitats (id INT PRIMARY KEY, habitat_type VARCHAR(50)); INSERT INTO habitats (id, habitat_type) VALUES (1, 'Forest'); INSERT INTO habitats (id, habitat_type) VALUES (2, 'Grassland'); INSERT INTO habitats (id, habitat_type) VALUES (3, 'Wetland');
Add a new habitat 'Desert' to the database
INSERT INTO habitats (id, habitat_type) VALUES ((SELECT COALESCE(MAX(id), 0) + 1 FROM habitats), 'Desert');
gretelai_synthetic_text_to_sql
CREATE TABLE renewable_energy_projects (id INT, state VARCHAR(20), completion_year INT); INSERT INTO renewable_energy_projects (id, state, completion_year) VALUES (1, 'California', 2014), (2, 'California', 2016);
Identify the number of renewable energy projects in the state of California that were completed after 2015.
SELECT COUNT(*) FROM renewable_energy_projects WHERE state = 'California' AND completion_year > 2015;
gretelai_synthetic_text_to_sql
CREATE TABLE police_officers (id INT, name VARCHAR(255), diversity_training_completion DATE, state VARCHAR(255)); INSERT INTO police_officers (id, name, diversity_training_completion, state) VALUES (1, 'Jane Smith', '2021-03-05', 'Texas');
What is the percentage of police officers in Texas who completed diversity training in 2021?
SELECT (COUNT(*) * 100.0 / (SELECT COUNT(*) FROM police_officers WHERE state = 'Texas')) as percentage FROM police_officers WHERE state = 'Texas' AND diversity_training_completion IS NOT NULL AND diversity_training_completion >= '2021-01-01' AND diversity_training_completion < '2022-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE vessels (id INT PRIMARY KEY, name VARCHAR(50), type VARCHAR(50), length FLOAT, year_built INT);
Show me the vessels with the most recent year_built
SELECT name, year_built FROM vessels WHERE year_built = (SELECT MAX(year_built) FROM vessels);
gretelai_synthetic_text_to_sql
CREATE TABLE developers (developer_id INT, name VARCHAR(50), country VARCHAR(50)); CREATE TABLE digital_assets (asset_id INT, name VARCHAR(50), developer_id INT, value DECIMAL(10,2)); INSERT INTO digital_assets (asset_id, name, developer_id, value) VALUES (1, 'Asset1', 1, 5000), (2, 'Asset2', 2, 7000); INSERT INTO developers (developer_id, name, country) VALUES (1, 'Alice', 'USA'), (2, 'Bob', 'Canada');
What is the total value of digital assets owned by developers in the United States?
SELECT SUM(digital_assets.value) FROM digital_assets INNER JOIN developers ON digital_assets.developer_id = developers.developer_id WHERE developers.country = 'USA';
gretelai_synthetic_text_to_sql
CREATE TABLE agroecology_projects (id INT, name VARCHAR(255), biodiversity_score INT);
Which agroecology projects have the highest biodiversity scores?
SELECT name, biodiversity_score FROM agroecology_projects ORDER BY biodiversity_score DESC LIMIT 10;
gretelai_synthetic_text_to_sql
CREATE TABLE electric_vehicles (country VARCHAR(20), number INT); INSERT INTO electric_vehicles (country, number) VALUES ('Norway', 100000), ('Norway', 150000), ('Netherlands', 200000), ('Netherlands', 250000);
What is the total number of electric vehicles in Norway and the Netherlands?
SELECT SUM(number) FROM electric_vehicles WHERE country IN ('Norway', 'Netherlands');
gretelai_synthetic_text_to_sql
CREATE TABLE Product_Inventory (id INT, inventory_date DATETIME, inventory_country VARCHAR(50), product_category VARCHAR(50), pallets INT, weight DECIMAL(10, 2)); INSERT INTO Product_Inventory (id, inventory_date, inventory_country, product_category, pallets, weight) VALUES (1, '2022-01-01', 'China', 'Electronics', 10, 20.00), (2, '2022-01-02', 'Japan', 'Appliances', 20, 40.00), (3, '2022-01-03', 'South Korea', 'Furniture', 30, 60.00);
Calculate the total number of pallets and weight for each product category in Asia.
SELECT product_category, SUM(pallets) AS total_pallets, SUM(weight) AS total_weight FROM Product_Inventory WHERE inventory_country IN ('China', 'Japan', 'South Korea') GROUP BY product_category;
gretelai_synthetic_text_to_sql
CREATE TABLE tree_height (id INT, species VARCHAR(255), height INT); INSERT INTO tree_height (id, species, height) VALUES (1, 'Oak', 80), (2, 'Maple', 70), (3, 'Pine', 60);
What is the maximum and minimum height for trees in the 'tree_height' table?
SELECT species, MAX(height) FROM tree_height;
gretelai_synthetic_text_to_sql
CREATE TABLE market_access(product varchar(20), region varchar(20), strategy varchar(50)); INSERT INTO market_access VALUES ('ProductL', 'RegionP', 'Direct-to-consumer');
What is the market access strategy for 'ProductL' in 'RegionP'?
SELECT strategy FROM market_access WHERE product = 'ProductL' AND region = 'RegionP';
gretelai_synthetic_text_to_sql
CREATE TABLE product_recalls (recall_id INT, product_id INT, recall_date DATE); INSERT INTO product_recalls (recall_id, product_id, recall_date) VALUES (1, 1, '2022-01-01'), (2, 3, '2021-12-31'), (3, 2, '2021-06-01');
How many products have had a recall in the past 6 months?
SELECT COUNT(*) FROM product_recalls WHERE recall_date >= DATEADD(month, -6, GETDATE());
gretelai_synthetic_text_to_sql
CREATE TABLE Exploration (Location VARCHAR(30), Year INT, GasPresence BOOLEAN);
List all unique geographical locations from the 'Exploration' table
SELECT DISTINCT Location FROM Exploration;
gretelai_synthetic_text_to_sql
CREATE TABLE startup (id INT, name TEXT, industry TEXT, founder_identity TEXT); INSERT INTO startup (id, name, industry, founder_identity) VALUES (1, 'TechPride', 'Technology', 'LGBTQ+');
How many startups in the technology sector have a founder who identifies as LGBTQ+ and have received Series A funding or higher?
SELECT COUNT(*) FROM startup INNER JOIN investment_rounds ON startup.id = investment_rounds.startup_id WHERE startup.industry = 'Technology' AND startup.founder_identity = 'LGBTQ+' AND funding_round IN ('Series A', 'Series B', 'Series C', 'Series D', 'Series E', 'Series F', 'IPO');
gretelai_synthetic_text_to_sql
CREATE TABLE Dispensaries (id INT, name VARCHAR(255), city VARCHAR(255), state VARCHAR(255));INSERT INTO Dispensaries (id, name, city, state) VALUES (1, 'Green Haven', 'Seattle', 'WA');CREATE TABLE Sales (id INT, dispensary_id INT, revenue DECIMAL(10, 2), quarter INT, year INT);INSERT INTO Sales (id, dispensary_id, revenue, quarter, year) VALUES (1, 1, 5000, 1, 2021);
What was the total revenue for each dispensary in the city of Seattle in the first quarter of 2021?
SELECT d.name, SUM(s.revenue) as total_revenue FROM Dispensaries d JOIN Sales s ON d.id = s.dispensary_id WHERE d.city = 'Seattle' AND s.quarter = 1 AND s.year = 2021 GROUP BY d.name;
gretelai_synthetic_text_to_sql
CREATE TABLE BudgetAllocations (Year INT, Service VARCHAR(255), Region VARCHAR(255), Allocation FLOAT); INSERT INTO BudgetAllocations (Year, Service, Region, Allocation) VALUES (2020, 'Education', 'North', 5000000), (2020, 'Health', 'North', 7000000), (2020, 'Education', 'South', 6000000), (2020, 'Health', 'South', 8000000);
What is the average budget allocation for education and health services in the year 2020, per region?
SELECT AVG(Allocation) AS AvgAllocation, Region FROM BudgetAllocations WHERE Year = 2020 AND (Service = 'Education' OR Service = 'Health') GROUP BY Region;
gretelai_synthetic_text_to_sql
CREATE TABLE companies (id INT, name TEXT, industry TEXT, founders_underrepresented_communities BOOLEAN, founding_date DATE);
How many companies were founded by people from underrepresented communities in the tech sector in 2021?
SELECT COUNT(*) FROM companies WHERE founders_underrepresented_communities = true AND industry = 'tech' AND YEAR(founding_date) = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE posts(region VARCHAR(20), post_date DATE, posts INT); INSERT INTO posts(region, post_date, posts) VALUES('EMEA', '2021-02-01', 500), ('EMEA', '2021-02-02', 550), ('EMEA', '2021-02-03', 600), ('EMEA', '2021-02-04', 575), ('EMEA', '2021-02-05', 625), ('EMEA', '2021-02-06', 700), ('EMEA', '2021-02-07', 750);
What was the daily average number of posts in the EMEA region in the last week?
SELECT AVG(posts) FROM posts WHERE region = 'EMEA' AND post_date >= DATEADD(day, -7, CURRENT_DATE)
gretelai_synthetic_text_to_sql
CREATE TABLE SportsCar (Id INT, Name VARCHAR(255), Year INT, Horsepower INT); INSERT INTO SportsCar (Id, Name, Year, Horsepower) VALUES (1, 'Ferrari 488', 2015, 661), (2, 'Porsche 911', 2016, 443), (3, 'Lamborghini Huracan', 2017, 602), (4, 'McLaren 720S', 2018, 710), (5, 'Audi R8', 2019, 612), (6, 'Chevrolet Corvette', 2020, 495);
What is the average horsepower of sports cars produced between 2015 and 2020?
SELECT AVG(Horsepower) FROM SportsCar WHERE Year BETWEEN 2015 AND 2020 AND Name LIKE 'Sports Car'
gretelai_synthetic_text_to_sql
CREATE TABLE cosmetics_sales (id INT, product VARCHAR(255), quantity INT, revenue FLOAT, sale_date DATE); INSERT INTO cosmetics_sales (id, product, quantity, revenue, sale_date) VALUES (1, 'Organic Facial Cleanser', 25, 125.00, '2021-04-01');
What is the total revenue for organic skincare products in the second quarter of 2021?
SELECT SUM(revenue) FROM cosmetics_sales WHERE product LIKE '%Organic%' AND sale_date BETWEEN '2021-04-01' AND '2021-06-30';
gretelai_synthetic_text_to_sql
CREATE TABLE Defense_Diplomacy_Events (Event_ID INT PRIMARY KEY, Country VARCHAR(100), Date DATE);
List defense diplomacy events with their respective countries and dates in 2021.
SELECT * FROM Defense_Diplomacy_Events WHERE Year(Date) = 2021;
gretelai_synthetic_text_to_sql
CREATE TABLE Students (StudentId INT, Name VARCHAR(50), Age INT); INSERT INTO Students (StudentId, Name, Age) VALUES (1001, 'John Doe', 16); CREATE VIEW StudentNames AS SELECT * FROM Students; CREATE TABLE Courses (CourseId INT, CourseName VARCHAR(50), Instructor VARCHAR(50));
Insert data into 'Courses' table with values '1001', 'Introduction to Programming', 'Mr. Smith'
INSERT INTO Courses (CourseId, CourseName, Instructor) VALUES (1001, 'Introduction to Programming', 'Mr. Smith');
gretelai_synthetic_text_to_sql
CREATE TABLE mining_operations (id INT, country VARCHAR(20), operation_name VARCHAR(30), year INT, coal INT, copper INT, gold INT); INSERT INTO mining_operations (id, country, operation_name, year, coal, copper, gold) VALUES (1, 'Colombia', 'Operation M', 2021, 1000, 500, 200); INSERT INTO mining_operations (id, country, operation_name, year, coal, copper, gold) VALUES (2, 'Colombia', 'Operation N', 2021, 1200, 600, 250); INSERT INTO mining_operations (id, country, operation_name, year, coal, copper, gold) VALUES (3, 'Brazil', 'Operation O', 2021, 800, 400, 180);
What is the total quantity of coal, copper, and gold mined in mining operations in Colombia and Brazil, grouped by operation name and year?
SELECT operation_name, year, SUM(coal) AS total_coal, SUM(copper) AS total_copper, SUM(gold) AS total_gold FROM mining_operations WHERE country IN ('Colombia', 'Brazil') GROUP BY operation_name, year;
gretelai_synthetic_text_to_sql
CREATE TABLE unions (id INT, type TEXT); INSERT INTO unions (id, type) VALUES (1, 'Manufacturing'), (2, 'Service'), (3, 'Construction'); CREATE TABLE violations (id INT, union_id INT, date DATE, violation_count INT); INSERT INTO violations (id, union_id, date, violation_count) VALUES (1, 1, '2021-02-15', 3), (2, 2, '2021-03-01', 5), (3, 3, '2021-01-01', 7);
How many labor rights violations were reported for each type of union in the last year?
SELECT u.type, COUNT(v.violation_count) FROM unions u JOIN violations v ON u.id = v.union_id WHERE v.date >= DATEADD(year, -1, CURRENT_DATE) GROUP BY u.type;
gretelai_synthetic_text_to_sql
CREATE TABLE carbon_offset_programs (program_id INT, program_name TEXT, location TEXT, carbon_offset_tonnes INT); INSERT INTO carbon_offset_programs (program_id, program_name, location, carbon_offset_tonnes) VALUES (1, 'Solar Farm A', 'Rural Region Y', 1500), (2, 'Wind Farm B', 'Rural Region X', 2000), (3, 'Green Roofing', 'Urban Area X', 1000), (4, 'Green Roofing', 'Urban Area X', 1200);
What is the carbon offset for 'Green Roofing' programs in 'Urban Area X'?
SELECT program_name, SUM(carbon_offset_tonnes) as total_offset FROM carbon_offset_programs WHERE program_name = 'Green Roofing' AND location = 'Urban Area X' GROUP BY program_name;
gretelai_synthetic_text_to_sql
CREATE TABLE usage (subscriber_id INT, service VARCHAR(10), last_usage DATE); INSERT INTO usage (subscriber_id, service, last_usage) VALUES (1, 'mobile', '2022-01-15'), (2, 'mobile', '2022-05-01');
Which mobile subscribers have not used their services in the last 6 months?
SELECT subscriber_id, service FROM usage WHERE service = 'mobile' AND last_usage < NOW() - INTERVAL 6 MONTH;
gretelai_synthetic_text_to_sql
CREATE TABLE astronauts (astronaut_id INT, name VARCHAR(100), age INT, craft VARCHAR(50)); INSERT INTO astronauts (astronaut_id, name, age, craft) VALUES (1, 'John', 45, 'Dragon'), (2, 'Sarah', 36, 'Starship'), (3, 'Mike', 50, 'Falcon'); CREATE TABLE spacex_crafts (craft VARCHAR(50), manufacturer VARCHAR(50)); INSERT INTO spacex_crafts (craft, manufacturer) VALUES ('Dragon', 'SpaceX'), ('Starship', 'SpaceX'), ('Falcon', 'SpaceX');
What is the average age of astronauts who have flown on SpaceX crafts?
SELECT AVG(age) FROM astronauts a INNER JOIN spacex_crafts c ON a.craft = c.craft;
gretelai_synthetic_text_to_sql
CREATE TABLE sea_surface_temperature (year INTEGER, region TEXT, temperature REAL); INSERT INTO sea_surface_temperature (year, region, temperature) VALUES (2012, 'Arctic Ocean', 2.0), (2013, 'Arctic Ocean', 1.5), (2014, 'Arctic Ocean', 2.5); INSERT INTO sea_surface_temperature (year, region, temperature) VALUES (2015, 'Arctic Ocean', 3.0), (2016, 'Arctic Ocean', 1.0), (2017, 'Arctic Ocean', 2.0); INSERT INTO sea_surface_temperature (year, region, temperature) VALUES (2018, 'Arctic Ocean', 1.5), (2019, 'Arctic Ocean', 3.5), (2020, 'Arctic Ocean', 2.5);
Find the average sea surface temperature of the Arctic Ocean over the last 10 years.
SELECT AVG(temperature) FROM sea_surface_temperature WHERE region = 'Arctic Ocean' AND year BETWEEN 2011 AND 2020;
gretelai_synthetic_text_to_sql
CREATE TABLE defense_contractors (contractor_id INT, contractor_name VARCHAR(255), contract_value FLOAT); INSERT INTO defense_contractors (contractor_id, contractor_name, contract_value) VALUES (1, 'Lockheed Martin', 52000000000), (2, 'Boeing', 41000000000), (3, 'Raytheon Technologies', 28000000000), (4, 'Northrop Grumman', 27000000000), (5, 'General Dynamics', 25000000000);
What are the top 5 defense contractors by awarded contract value?
SELECT contractor_name, contract_value FROM defense_contractors ORDER BY contract_value DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE RuralInfrastructure (id INT, region VARCHAR(20), cost FLOAT, year INT); INSERT INTO RuralInfrastructure (id, region, cost, year) VALUES (1, 'Southeast Asia', 150000, 2019), (2, 'East Asia', 120000, 2018), (3, 'South Asia', 180000, 2020);
Which rural infrastructure projects in Southeast Asia had the highest cost in 2019?
SELECT region, MAX(cost) FROM RuralInfrastructure WHERE year = 2019 GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE network_devices (id INT, ip VARCHAR(20), vulnerability VARCHAR(50)); INSERT INTO network_devices (id, ip, vulnerability) VALUES (1, '10.0.0.1', 'CVE-2021-1234'), (2, '10.0.0.2', 'CVE-2022-5678'), (3, '10.0.0.3', 'CVE-2021-1234'), (4, '10.0.0.4', 'CVE-2023-9012'), (5, '10.0.0.5', 'CVE-2022-5678');
What are the top 5 most common vulnerabilities in the 'network_devices' table?
SELECT vulnerability, COUNT(*) FROM network_devices GROUP BY vulnerability ORDER BY COUNT(*) DESC LIMIT 5;
gretelai_synthetic_text_to_sql
CREATE TABLE ClinicalTech_DrugSales(company VARCHAR(20), year INT, revenue DECIMAL(10,2));INSERT INTO ClinicalTech_DrugSales VALUES('ClinicalTech', 2019, 12000000.00);
What was the total revenue for 'ClinicalTech' from drug sales in 2019?
SELECT SUM(revenue) FROM ClinicalTech_DrugSales WHERE company = 'ClinicalTech' AND year = 2019;
gretelai_synthetic_text_to_sql
CREATE TABLE players (player_id INT, name VARCHAR(50), position VARCHAR(50), team VARCHAR(50), age INT); INSERT INTO players (player_id, name, position, team, age) VALUES (1, 'John Doe', 'Goalkeeper', 'Arsenal', 32), (2, 'Jane Smith', 'Defender', 'Manchester United', 28);
What is the average age of football players in the 'players' table?
SELECT AVG(age) FROM players WHERE position = 'Goalkeeper' OR position = 'Defender';
gretelai_synthetic_text_to_sql
CREATE TABLE CommunityInitiatives (id INT PRIMARY KEY, name VARCHAR(50), location VARCHAR(50), type VARCHAR(20), start_date DATE, end_date DATE); INSERT INTO CommunityInitiatives (id, name, location, type, start_date, end_date) VALUES (1, 'Local Health Clinic', 'Rural Vietnam', 'Healthcare', '2020-02-01', '2021-12-31'), (2, 'Nutrition Education', 'Rural Guatemala', 'Health Education', '2021-03-01', '2022-12-31'), (3, 'Mobile Library', 'Rural South Africa', 'Education', '2021-01-01', '2022-12-31');
What community initiatives related to education were active in 2021?
SELECT name, location, type FROM CommunityInitiatives WHERE start_date <= '2021-12-31' AND end_date >= '2021-01-01' AND type = 'Education';
gretelai_synthetic_text_to_sql
CREATE TABLE waste_stream (year INT, material VARCHAR(50), recycling_rate DECIMAL(5,2));
What are the recycling rates for each material in 'waste_stream' table by year?
SELECT year, material, AVG(recycling_rate) as avg_recycling_rate FROM waste_stream GROUP BY year, material;
gretelai_synthetic_text_to_sql
CREATE TABLE Country_Arts (id INT, country TEXT, art_name TEXT); INSERT INTO Country_Arts (id, country, art_name) VALUES (1, 'Nigeria', 'Uli'); INSERT INTO Country_Arts (id, country, art_name) VALUES (2, 'India', 'Madhubani');
Create a table for traditional art forms by country.
CREATE TABLE Country_Arts (id INT, country TEXT, art_name TEXT);
gretelai_synthetic_text_to_sql
CREATE TABLE bus_routes (route_id INT, city VARCHAR(50), fare DECIMAL(5,2)); INSERT INTO bus_routes (route_id, city, fare) VALUES (1, 'Sydney', 4.50), (2, 'Sydney', 3.20); CREATE TABLE train_lines (line_id INT, city VARCHAR(50), fare DECIMAL(5,2)); INSERT INTO train_lines (line_id, city, fare) VALUES (1, 'Sydney', 6.00), (2, 'Sydney', 5.00);
What is the maximum fare for any public transportation in Sydney?
SELECT MAX(greatest(bus_routes.fare, train_lines.fare)) FROM bus_routes, train_lines WHERE bus_routes.city = 'Sydney' AND train_lines.city = 'Sydney';
gretelai_synthetic_text_to_sql
CREATE TABLE police_stations (station_id INT, station_name VARCHAR(50), district_id INT); INSERT INTO police_stations (station_id, station_name, district_id) VALUES (1, 'Central', 1), (2, 'East', 2), (3, 'West', 3), (4, 'North', 1), (5, 'South', 2); CREATE TABLE citizen_feedbacks (feedback_id INT, station_id INT, feedback_date DATE); INSERT INTO citizen_feedbacks (feedback_id, station_id, feedback_date) VALUES (1, 1, '2021-06-01'), (2, 1, '2021-07-01'), (3, 2, '2021-05-01'), (4, 3, '2021-06-15'), (5, 4, '2021-07-05'), (6, 5, '2021-04-10');
Find the top 3 police stations with the highest number of citizen feedbacks in the last 6 months.
SELECT station_name, COUNT(*) as feedback_count FROM citizen_feedbacks JOIN police_stations ON citizen_feedbacks.station_id = police_stations.station_id WHERE feedback_date >= DATEADD(month, -6, GETDATE()) GROUP BY station_name ORDER BY feedback_count DESC LIMIT 3;
gretelai_synthetic_text_to_sql
CREATE TABLE marine_species (id INT PRIMARY KEY, name VARCHAR(255), conservation_status VARCHAR(255), habitat VARCHAR(255));
Update the conservation status of the species with ID 2 in the marine_species table
WITH updated_species AS (UPDATE marine_species SET conservation_status = 'Endangered' WHERE id = 2 RETURNING *) SELECT * FROM updated_species;
gretelai_synthetic_text_to_sql
CREATE TABLE diversity_metrics (id INT, metric TEXT); INSERT INTO diversity_metrics (id, metric) VALUES (1, 'Gender'); INSERT INTO diversity_metrics (id, metric) VALUES (2, 'Race');
How many diversity metrics exist in the database?
SELECT COUNT(*) FROM diversity_metrics;
gretelai_synthetic_text_to_sql
CREATE TABLE Claims (PolicyID int, ClaimAmount int, SaleState varchar(20)); INSERT INTO Claims (PolicyID, ClaimAmount, SaleState) VALUES (1, 500, 'California'), (2, 2000, 'New York'), (3, 800, 'California');
What is the maximum claim amount for policies sold in California?
SELECT MAX(ClaimAmount) OVER (PARTITION BY SaleState) as MaxClaimAmount FROM Claims WHERE SaleState = 'California';
gretelai_synthetic_text_to_sql
CREATE TABLE justice_schemas.restorative_programs (id INT PRIMARY KEY, name TEXT, is_active BOOLEAN);
What is the total number of restorative justice programs in the justice_schemas.restorative_programs table, excluding those marked as inactive?
SELECT COUNT(*) FROM justice_schemas.restorative_programs WHERE is_active = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE healthcare_unions.workers (id INT, name TEXT, union_member BOOLEAN);
How many workers are there in 'healthcare_unions'?
SELECT COUNT(*) FROM healthcare_unions.workers WHERE union_member = TRUE;
gretelai_synthetic_text_to_sql
CREATE TABLE warehouse_inventory (item_id INT, item_name VARCHAR(50), quantity INT, warehouse_location VARCHAR(50));
Find the total quantity of items in the 'warehouse_inventory' table
SELECT SUM(quantity) FROM warehouse_inventory;
gretelai_synthetic_text_to_sql
CREATE TABLE graduate_students (id INT, student_name VARCHAR(255), department VARCHAR(255)); CREATE TABLE published_papers (id INT, paper_title VARCHAR(255), student_id INT, PRIMARY KEY (id), FOREIGN KEY (student_id) REFERENCES graduate_students(id)); INSERT INTO graduate_students (id, student_name, department) VALUES (1, 'Student1', 'Physics'), (2, 'Student2', 'Physics'), (3, 'Student3', 'Physics'), (4, 'Student4', 'Mathematics'), (5, 'Student5', 'Mathematics'); INSERT INTO published_papers (id, paper_title, student_id) VALUES (1, 'Paper1', 1), (2, 'Paper2', 2), (3, 'Paper3', 3), (4, 'Paper4', 1), (5, 'Paper5', 4);
What is the total number of published papers by graduate students in the Physics department?
SELECT COUNT(pp.id) as paper_count FROM published_papers pp JOIN graduate_students gs ON pp.student_id = gs.id WHERE gs.department = 'Physics';
gretelai_synthetic_text_to_sql
CREATE TABLE acquisition (id INT, company_id INT, acquisition_date DATE); INSERT INTO acquisition (id, company_id, acquisition_date) VALUES (1, 1, '2018-01-01');
List the number of acquisitions for female-founded startups in the transportation sector since 2016.
SELECT COUNT(*) FROM acquisition INNER JOIN company ON acquisition.company_id = company.id WHERE company.industry = 'Transportation' AND company.founder_gender = 'Female' AND acquisition_date >= '2016-01-01';
gretelai_synthetic_text_to_sql
CREATE TABLE Hotels (hotel_id INT, hotel_name TEXT, country TEXT, eco_friendly BOOLEAN, rating INT); INSERT INTO Hotels (hotel_id, hotel_name, country, eco_friendly, rating) VALUES (1, 'Green Hotel Berlin', 'Germany', true, 5); INSERT INTO Hotels (hotel_id, hotel_name, country, eco_friendly, rating) VALUES (2, 'Eco Lodge Munich', 'Germany', true, 4); INSERT INTO Hotels (hotel_id, hotel_name, country, eco_friendly, rating) VALUES (3, 'Regular Hotel Frankfurt', 'Germany', false, 5);
What is the total number of eco-friendly hotels in Germany with a rating of at least 4?
SELECT COUNT(*) FROM Hotels WHERE country = 'Germany' AND eco_friendly = true AND rating >= 4;
gretelai_synthetic_text_to_sql
CREATE TABLE SupplyChainViolations (country TEXT, num_violations INT); INSERT INTO SupplyChainViolations (country, num_violations) VALUES ('Bangladesh', 50), ('Cambodia', 30), ('Vietnam', 20);
Which countries have the highest number of ethical labor violations in the supply chain?
SELECT country, num_violations FROM SupplyChainViolations ORDER BY num_violations DESC;
gretelai_synthetic_text_to_sql
CREATE TABLE materials (id INT, name VARCHAR(50), quantity INT); INSERT INTO materials (id, name, quantity) VALUES (1, 'organic cotton', 1000), (2, 'recycled polyester', 1500), (3, 'hemp', 500);
What is the total quantity of sustainable materials used?
SELECT SUM(quantity) FROM materials WHERE name IN ('organic cotton', 'recycled polyester', 'hemp') AND name LIKE '%sustainable%';
gretelai_synthetic_text_to_sql
CREATE TABLE ethical_ai_budget (initiative_id INT, initiative_name VARCHAR(255), region VARCHAR(255), budget DECIMAL(10,2)); INSERT INTO ethical_ai_budget (initiative_id, initiative_name, region, budget) VALUES (1, 'AI for social justice', 'North America', 500000), (2, 'Ethical AI guidelines', 'North America', 750000), (3, 'AI for disability', 'South America', 300000), (4, 'AI for healthcare equality', 'North America', 600000), (5, 'Fair AI in education', 'South America', 400000);
What is the average budget for ethical AI initiatives in 'North America' and 'South America'?
SELECT AVG(budget) as avg_budget, region FROM ethical_ai_budget WHERE region IN ('North America', 'South America') GROUP BY region;
gretelai_synthetic_text_to_sql
CREATE TABLE dishes (id INT, type VARCHAR(255), is_vegan BOOLEAN, calories INT, protein INT); INSERT INTO dishes (id, type, is_vegan, calories, protein) VALUES (1, 'Dish A', false, 800, 40), (2, 'Dish A', true, 600, 20), (3, 'Dish B', false, 1000, 50), (4, 'Dish B', true, 700, 30), (5, 'Dish C', false, 1200, 60);
Show the total calories and average protein for each dish type, excluding vegan dishes
SELECT d.type, SUM(d.calories) AS total_calories, AVG(d.protein) AS avg_protein FROM dishes d WHERE d.is_vegan = false GROUP BY d.type;
gretelai_synthetic_text_to_sql
CREATE TABLE Tunnels (id INT, name VARCHAR(100), elevation FLOAT); INSERT INTO Tunnels (id, name, elevation) VALUES (1, 'Chunnel', 115), (2, 'Seikan Tunnel', 240), (3, 'Gotthard Base Tunnel', 570);
What is the average elevation of all tunnels in the database?
SELECT AVG(elevation) FROM Tunnels;
gretelai_synthetic_text_to_sql
CREATE TABLE Ports (PortID INT, PortName VARCHAR(100), City VARCHAR(100), Country VARCHAR(100)); INSERT INTO Ports (PortID, PortName, City, Country) VALUES (1, 'Port of Los Angeles', 'Los Angeles', 'USA'); INSERT INTO Ports (PortID, PortName, City, Country) VALUES (2, 'Port of Rotterdam', 'Rotterdam', 'Netherlands'); CREATE TABLE Vessels (VesselID INT, VesselName VARCHAR(100), VesselType VARCHAR(100), PortID INT); INSERT INTO Vessels (VesselID, VesselName, VesselType, PortID) VALUES (1, 'Ever Ace', 'Container Ship', 1); CREATE TABLE Cargo (CargoID INT, CargoName VARCHAR(100), Quantity INT, VesselID INT); INSERT INTO Cargo (CargoID, CargoName, Quantity, VesselID) VALUES (1, 'Electronics', 10000, 1); INSERT INTO Cargo (CargoID, CargoName, Quantity, VesselID) VALUES (2, 'Vehicles', 5000, 2); CREATE TABLE VesselPorts (VesselID INT, PortID INT); INSERT INTO VesselPorts (VesselID, PortID) VALUES (1, 1);
What is the total quantity of electronics transported by vessels that docked at the Port of Los Angeles?
SELECT SUM(Cargo.Quantity) FROM Cargo INNER JOIN Vessels ON Cargo.VesselID = Vessels.VesselID INNER JOIN VesselPorts ON Vessels.VesselID = VesselPorts.VesselID WHERE VesselPorts.PortID = 1 AND Cargo.CargoName = 'Electronics';
gretelai_synthetic_text_to_sql
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
Name movie titles released in year 1945. Sort the listing by the descending order of movie popularity.
SELECT movie_title FROM movies WHERE movie_release_year = 1945 ORDER BY movie_popularity DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
State the most popular movie? When was it released and who is the director for the movie?
SELECT movie_title, movie_release_year, director_name FROM movies ORDER BY movie_popularity DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the name of the longest movie title? When was it released?
SELECT movie_title, movie_release_year FROM movies ORDER BY LENGTH(movie_popularity) DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
Name the movie with the most ratings.
SELECT movie_title FROM movies GROUP BY movie_title ORDER BY COUNT(movie_title) DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the average number of Mubi users who love movies directed by Stanley Kubrick?
SELECT AVG(movie_popularity) FROM movies WHERE director_name = 'Stanley Kubrick'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the average rating for movie titled 'When Will I Be Loved'?
SELECT AVG(T2.rating_score) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'When Will I Be Loved'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the user avatar url for user 41579158? What is the latest movie rated by him / her?
SELECT T3.user_avatar_image_url, T3.rating_date_utc FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id INNER JOIN ratings_users AS T3 ON T3.user_id = T2.user_id WHERE T3.user_id = 41579158 ORDER BY T3.rating_date_utc DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the percentage of the ratings were rated by user who was a subcriber?
SELECT CAST(SUM(CASE WHEN user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
List all movie title rated in April 2020 from user who was a trialist.
SELECT T1.movie_title FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_trialist = 1 AND T2.rating_timestamp_utc LIKE '2020-04%'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
List ther users who gave the worst rating for movie 'Love Will Tear Us Apart'.
SELECT T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Love Will Tear Us Apart' AND T1.rating_score = 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
List all movies with the best rating score. State the movie title and number of Mubi user who loves the movie.
SELECT DISTINCT T2.movie_title, T2.movie_popularity FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
For all ratings which are rated in year 2020, name the movies which has the rating scored 4 and above.
SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE CAST(SUBSTR(T1.rating_timestamp_utc, 1, 4) AS INTEGER) = 2020 AND CAST(SUBSTR(T1.rating_timestamp_utc, 6, 2) AS INTEGER) > 4
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
For all movies where users left a critic, find the movie name, user, rating and critics comments from the user.
SELECT T2.movie_title, T1.user_id, T1.rating_score, T1.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.critic IS NOT NULL
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
For movie titled 'Welcome to the Dollhouse', how many percentage of the ratings were rated with highest score.
SELECT CAST(SUM(CASE WHEN T2.rating_score = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'Welcome to the Dollhouse'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the percentage of rated movies were released in year 2021?
SELECT CAST(SUM(CASE WHEN T1.movie_release_year = 2021 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
Who is the director of the movie Sex, Drink and Bloodshed?
SELECT director_name FROM movies WHERE movie_title = 'Sex, Drink and Bloodshed'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the name of the most followed list?
SELECT list_title FROM lists ORDER BY list_followers DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What are the URL to the list page on Mubi of the lists with followers between 1-2 and whose last update timestamp was on 2012?
SELECT list_url FROM lists WHERE list_update_timestamp_utc LIKE '2012%' AND list_followers BETWEEN 1 AND 2 ORDER BY list_update_timestamp_utc DESC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the list ID that was first created by user 85981819?
SELECT list_id FROM lists_users WHERE user_id = 85981819 ORDER BY list_creation_date_utc ASC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
For movie id 1269, how many users, who was a paying subscriber and was eligible for trial when he rated the movie, gave the movie a rating score of less than or equal to 2?
SELECT COUNT(*) FROM ratings WHERE movie_id = 1269 AND rating_score <= 2 AND user_eligible_for_trial = 1 AND user_has_payment_method = 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What are the movie popularity of the movies released in 2021 that were directed by Steven Spielberg? List the names of the movies and their corresponding popularity.
SELECT movie_title, movie_popularity FROM movies WHERE movie_release_year = 2021 AND director_name = 'Steven Spielberg'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
When was the first movie released and who directed it?
SELECT movie_release_year, director_name FROM movies WHERE movie_release_year IS NOT NULL ORDER BY movie_release_year ASC LIMIT 1
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
What is the user ID of the user, who was a subscriber when he created the list, who created a list for 10 consecutive years? If there are multiple users, indicate each of their user IDs.
SELECT user_id FROM lists_users WHERE user_subscriber = 1 GROUP BY user_id HAVING MAX(SUBSTR(list_creation_date_utc, 1, 4)) - MIN(SUBSTR(list_creation_date_utc, 1, 4)) >= 10
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
How many users gave "Pavee Lackeen: The Traveller Girl" movie a rating score of 4?
SELECT COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'Pavee Lackeen: The Traveller Girl' AND T2.rating_score = 4
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
Was the user who created the "World War 2 and Kids" list eligible for trial when he created the list? Indicate how many followers does the said list has.
SELECT T2.user_eligible_for_trial, T1.list_followers FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T1.user_id AND T1.list_id = T2.list_id WHERE T1.list_title = 'World War 2 and Kids'
bird
CREATE TABLE movie_platform (user_id integer, list_id integer, list_title text, list_movie_number integer, list_update_timestamp_utc text, list_creation_timestamp_utc text, list_followers integer, list_url text, list_comments integer, list_description text, list_cover_image_url text, list_first_image_url text, list_second_image_url text, list_third_image_url text, movie_id integer, movie_title text, movie_release_year integer, movie_url text, movie_title_language text, movie_popularity integer, movie_image_url text, director_id text, director_name text, director_url text, user_id integer, rating_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial integer, user_has_payment_method integer, user_id integer, list_id integer, list_update_date_utc text, list_creation_date_utc text, user_trialist integer, user_subscriber integer, user_avatar_image_url text, user_cover_image_url text, user_eligible_for_trial text, user_has_payment_method text, movie_id integer, rating_id integer, rating_url text, rating_score integer, rating_timestamp_utc text, critic text, critic_likes integer, critic_comments integer, user_id integer, user_trialist integer, user_subscriber integer, user_eligible_for_trial integer, user_has_payment_method integer)
Which year was the third movie directed by Quentin Tarantino released? Indicate the user ids of the user who gave it a rating score of 4.
SELECT T2.movie_release_year, T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_id = ( SELECT movie_id FROM movies WHERE director_name = 'Quentin Tarantino' ORDER BY movie_release_year ASC LIMIT 2, 1 ) AND T1.rating_score = 4
bird