db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
food_inspection | Between 2014 to 2016, what is the average inpsection score of the establishment owned by Yiu Tim Chan in 808 Pacific Ave, San Francisco? | average inspection score refers to avg(score); establishment owned by Yiu Tim Chan refers to business_id where owner_name = 'Yiu Tim Chan'; Between 2014 to 2016 refers to year(date) between 2014 and 2016; address = '808 Pacific Ave'; city = 'San Francisco'; | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) BETWEEN '2014' AND '2016' AND T2.owner_name = 'Yiu Tim Chan' AND T2.address = '808 Pacific Ave' AND T2.city = 'San Francisco' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | List the titles of the art category. | art category refers to category = 'arts' | SELECT DISTINCT T2.title FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'arts' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
beer_factory | What is the precise coordinate of Sac State Union? | precise coordinate = Latitude, Longitude; Sac State Union refers to LocationName = 'Sac State Union'; | SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State Union' | CREATE TABLE rootbeerbrand
(
Website TEXT, --
State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1
Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist... |
olympics | How many Olympics games were held during the 90s? | games refer to id; during the 90s refers to games_year BETWEEN 1990 AND 1999; | SELECT COUNT(games_year) FROM games WHERE games_year BETWEEN '1990' AND '1999' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
food_inspection | What are the names of the establishments that met all the required standards for 4 consecutive years? | establishment has the same meaning as business; score of 90 or more refers to score ≥ 90; year(date) = 2015; ; met all required standards for 4 consecutive years refers to COUNT(year(date)) = 4 where score = 100; | SELECT DISTINCT T4.name FROM ( SELECT T3.name, T3.years, row_number() OVER (PARTITION BY T3.name ORDER BY T3.years) AS rowNumber FROM ( SELECT DISTINCT name, STRFTIME('%Y', `date`) AS years FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = 100 ) AS T3 ) AS T4 GROUP B... | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Calculate the average rating of the true crime category. | average rating = Divide (Sum(rating(category = 'true-crime')), Count(podcast_id(category = 'true-crime'))) | SELECT AVG(T2.rating) FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'true-crime' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | List down the first name of customers who placed order for product id 1. | null | SELECT T1.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.ProductID = 1 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | List out all the gold medalist winners in cycling sport. | gold medalist winners refer to full_name where medal_name = 'Gold'; cycling sport refers to sport_name = 'Cycling'; | SELECT DISTINCT T5.full_name FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN sport AS T4 ON T1.sport_id = T4.id INNER JOIN person AS T5 ON T3.person_id = T5.id WHERE T4.sport_name = 'Cycling' AND T2.medal_id = 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | Calculate the increment percentage of elite user for each year since year 2005. | since year 2005 refers to year_id Between 2005 and 2014; increment percentage = Divide(Count(user_id(year_id < 2014)), Count (user_id(year_id = 2015))) * 100 | SELECT CAST(COUNT(CASE WHEN year_id < 2014 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(CASE WHEN year_id = 2005 THEN 1.0 ELSE NULL END) AS increment FROM Elite | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
food_inspection | Among the establishments with a postal code of 94102, how many establishments have a score of 90 or more in 2015? | establishment has the same meaning as business; score of 90 or more refers to score ≥ 90; year(date) = 2015; | SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id INNER JOIN inspections AS T3 ON T2.business_id = T3.business_id WHERE STRFTIME('%Y', T1.`date`) = '2015' AND T2.postal_code = '94102' AND T3.score > 90 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | In how many categories were podcast reviews created in the last six months of 2016? List them. | created in last six months of 2016 refers to created_at BETWEEN '2016-07-01T00:00:00-07:00' and '2016-12-31T23:59:59-07:00' | SELECT COUNT(DISTINCT T1.category) FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.created_at BETWEEN '2016-07-01T00:00:00-07:00' AND '2016-12-31T23:59:59-07:00' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
olympics | How many gold medals were given to the winners in the Ice Hockey Men's Ice Hockey event? | gold medals given to the winners refer to competitor_id where medal_name = 'Gold'; Ice Hockey Men's Ice Hockey refers to event_name = 'Ice Hockey Men''s Ice Hockey'; | SELECT COUNT(T2.competitor_id) FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id WHERE T1.event_name LIKE 'Ice Hockey Men%s Ice Hockey' AND T2.medal_id = 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | How many Yelp_Business in Arizona has user no. 3 reviewed? | in Arizona refers to state = 'AZ'; user no. 3 refers to user_id = 3 | SELECT COUNT(T2.business_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.state LIKE 'AZ' AND T1.user_id = 3 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
food_inspection | In 2013, what are the names of the establishments with contaminated or adulterated food? | establishments have the same meaning as businesses; contaminated or adulterated food refers to violations where description = 'Contaminated or adulterated food'; date = '2013'; | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.description = 'Contaminated or adulterated food' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | What dates were the Don't Lie To Your Life Coach podcast reviews created? | "Don't Lie To Your Life Coach" refers to title of podcast; date refers to created_at | SELECT created_at FROM reviews WHERE podcast_id = ( SELECT podcast_id FROM podcasts WHERE title = 'Don''t Lie To Your Life Coach' ) | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | How many customer ids have purchased Hex Nut 9? | Hex Nut 9' is name of product; | SELECT COUNT(T1.CustomerID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 9' | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | Which region has the highest medal number? | region refers to region_name; the highest medal number refers to MAX(COUNT(medal_id <> 4)); | SELECT T5.region_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.id != 4 GROUP BY T5.region_name ORDER B... | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | What is the ratio of having the best to worse elite user in 2013? | best elite refers to user_average_stars = 5; worse eliter refers to user_average_stars = 1: in 2013 refers to year_id = 2013; ratio = Divide(Count(user_id(user_average_stars = 5)), Count(user_id(user_average_stars = 1))) | SELECT CAST(SUM(CASE WHEN T1.user_average_stars = 1 THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.user_id) , SUM(CASE WHEN T1.user_average_stars = 5 THEN 1 ELSE 0 END) * 1.0 / COUNT(T2.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T2.year_id = 2013 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
food_inspection | How many establishments with the tax code H24 have complaint inspections of 5 or more? | establishments with the tax code H24 refer to business_id where tax_code = 'H24'; complaint inspections of 5 or more refer to inspections where type = 'Complaint' and COUNT(business_id) ≥ 5; | SELECT COUNT(*) FROM ( SELECT T1.business_id FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.tax_code = 'H24' AND T1.type = 'Complaint' GROUP BY T1.business_id HAVING COUNT(T1.business_id) > 5 ) T3 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Indicate the slug and the itunes url of the podcast whose review content was written Can't stop listening. | review content was written Can't stop listening refers to content = 'Can't stop listening' | SELECT slug, itunes_url FROM podcasts WHERE podcast_id IN ( SELECT podcast_id FROM reviews WHERE content = 'Can''t stop listening' ) | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | List down all of the product names that were placed by sales person with id 10. | id refers to SalesPersonID; SalesPersonID = 10 | SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesPersonID = 10 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | How many athlete from China participate in the 2016 Summer Olympics? | athletes from China refer to person_id where region_name = 'China'; the 2016 Summer Olympics refer to games_name = '2016 Summer'; | SELECT COUNT(T3.id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id INNER JOIN person_region AS T4 ON T3.id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.games_name = '2016 Summer' AND T5.region_name = 'China' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
movie_platform | For the lists that got more than 3000 followers, how many did the users who created those lists are paying subscribers? | got more than 3000 followers refers to list_followers > 3000; paying subscribers refer to user_has_payment_method = 1 | SELECT COUNT(T1.user_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 3000 AND T1.user_has_payment_method = 1 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many high risks violations did the Tiramisu Kitchen violate? | Tiramisu Kitchen is the name of the business; high risks violations refer to risk_category = 'High Risk'; | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'High Risk' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | To which categories do the podcasts of the reviewer whose id is EFB34EAC8E9397C belong? | reviewer whose id is EFB34EAC8E9397C refers to author_id = 'EFB34EAC8E9397C' | SELECT DISTINCT T1.category FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.author_id = 'EFB34EAC8E9397C' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | List down product ids that were purchased by customers called Abby. | null | SELECT DISTINCT T1.ProductID FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Abby' | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
public_review_platform | Among the users who have posted more than 10 reviews, how many users are elite users? | posted more than 10 reviews refers to count(Reviews.user_id) > 10 | SELECT COUNT(T4.user_id) FROM ( SELECT T1.user_id FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id INNER JOIN Reviews AS T3 ON T1.user_id = T3.user_id WHERE T3.user_id IS NOT NULL GROUP BY T3.user_id HAVING COUNT(T3.user_id) > 10 ) T4 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What is the URL to the movie director page on Mubi of the movie titled "Red Blooded American Girl" | movie titled "Red Blooded American Girl" refers to movie_title = 'Red Blooded American Girl' | SELECT director_url FROM movies WHERE movie_title LIKE 'Red Blooded American Girl' | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | What is the name of the establishment with the lowest inspection score of all time? | the lowest inspection score refers to MIN(score); | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = ( SELECT MIN(score) FROM inspections ) | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | What are the titles of the podcasts whose reviews were created between 2018-08-22T11:53:16-07:00 and 2018-11-20T11:14:20-07:00? | created between 2018-08-22T11:53:16-07:00 and 2018-11-20T11:14:20-07:00 refers to created at BETWEEN '2018-08-22T11:53:16-07:00' and '2018-11-20T11:14:20-07:00' | SELECT DISTINCT T1.title FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.created_at BETWEEN '2018-08-22T11:53:16-07:00' AND '2018-11-20T11:14:20-07:00' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
public_review_platform | When does Yelp_Business no.1 open on Tuesdays? | Yelp_Business no.1 refers to business_id = 1; open on refers to opening_time; Tuesdays refers to day_of_week = 'Tuesday' | SELECT T1.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Tuesday' AND T1.business_id = 1 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
food_inspection | In 2016, which city has the highest number of establishments with the highest health and safety hazards? | the highest health and safety hazards refer to risk_category = 'High Risk'; year(date) = 2016; establishments has the same meaning as businesses; | SELECT T2.city FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T1.risk_category = 'High Risk' GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Indicate the id of the reviewer whose itunes id is 1516665400. | "151665400" is itunes_id; id of reviewer refers to author_id | SELECT T2.author_id FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.itunes_id = 1516665400 | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
beer_factory | How many transactions have been made to purchase a root beer brand from California? | California refers to State = 'CA'; | SELECT COUNT(T3.RootBeerID) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.State = 'CA' | CREATE TABLE rootbeerbrand
(
Website TEXT, --
State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1
Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist... |
olympics | List out all the medals won by Lee Chong Wei. | medals refer to medal_id where medal_id <> 4; | SELECT DISTINCT T1.medal_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person AS T4 ON T3.person_id = T4.id WHERE T4.full_name = 'Lee Chong Wei' AND T2.medal_id <> 4 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | How long does Yelp_Business no.1 open on Tuesdays? | "How long" and "how much time" are synonyms; how much time does this business open refers to subtract(closing_time, opening_time); Yelp_Business no.1 refers to business_id = 1; Tuesdays refers to day_of_week = 'Tuesday' | SELECT T1.closing_time - T1.opening_time AS "opening hours" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Tuesday' AND T1.business_id = 1 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
food_inspection | What are the names of the establishments that met all of the required standards in 2013? | establishments have the same meaning as businesses; met all of the required standards refers to score = 100; year(date) = 2013 | SELECT DISTINCT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.score = 100 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | What is the rating and category of the podcast entitled Sitcomadon? | entitled refers to title; 'Sitcomadon' is the title of podcast | SELECT DISTINCT T3.rating, T1.category FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id INNER JOIN reviews AS T3 ON T3.podcast_id = T2.podcast_id WHERE T2.title = 'Sitcomadon' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | What is the last name of sales person for sales id 100? | null | SELECT T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T2.SalesID = 100 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | What is the percentage of female athletes below 20s who participated in the 2002 Winter Olympic? | DIVIDE(COUNT(person_id where gender = 'F' and age < 20), COUNT(person_id)) as percentage where games_name = '2002 Winter'; | SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2002 Winter' AND T2.age < 20 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | What is the yearly average review done by user ID 3? | yearly average review = Divide( Count(business_id), Subtract('%Y'(CURRENT_TIME), user_yelping_since_year)) | SELECT COUNT(review_stars) / (strftime('%Y', 'now') - T1.user_yelping_since_year) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | Who created the list that has 142 comments? Indicate the user id of the user, if there are multiple lists with 142 comments, list the user id of the person who created the list | list that has 142 comments refers to list_comments = 142 | SELECT user_id FROM lists WHERE list_comments = 142 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many owners have 5 or more establishments? | 5 or more establishments COUNT(business_id) > = 5; | SELECT COUNT(T1.owner_name) FROM ( SELECT owner_name FROM businesses GROUP BY owner_name HAVING COUNT(owner_name) > 5 ) T1 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Indicates the title of all podcasts in the fiction category. | null | SELECT T2.title FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'fiction' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | What is the last name of the customer who placed an order for sales id 178? | null | SELECT T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.SalesID = 178 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | How many athletes from region 151 have won a medal? | athletes refer to person_id; region 151 refers to region_id = 151; won a medal refers to medal_id <> 4; | SELECT COUNT(T3.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN person_region AS T3 ON T2.person_id = T3.person_id WHERE T3.region_id = 151 AND T1.medal_id != 4 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
movie_platform | What is the percentage of users gave "5" to the movie "Go Go Tales"? | movie "Go Go Tales" refers to movie_title = 'Go Go Tales'; gave "5" refers to rating_score = 5; percentage refers to DIVIDE(COUNT(rating_score = 5),COUNT(rating_score))*100 | SELECT CAST(SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Go Go Tales' | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many foodborne illness investigations were done in 2014? | foodborne illness investigations refer to inspections where type = 'Foodborne Illness Investigation'; investigations in 2014 refers to date between '2014-01-01' and '2014-12-31'; | SELECT COUNT(business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2014' AND type = 'Foodborne Illness Investigation' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | What is the percentage of reviews added each year of the total reviews added? | review added each year refers to runs_at like '2021%' and runs_at like '2022%'; percentage for 2021 = Divide (Sum(reviews_added(runs_at like '2021%)), Sum(reviews_added)) * 100; percentage of 2022 = Divide (Sum(reviews_added(runs_at like '2022%')), Sum(reviews_added)) * 100 | SELECT CAST((SUM(CASE WHEN run_at LIKE '2022-%' THEN reviews_added ELSE 0 END) - SUM(CASE WHEN run_at LIKE '2021-%' THEN reviews_added ELSE 0 END)) AS REAL) * 100 / SUM(reviews_added) OR '%' "percentage" FROM runs | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
olympics | Give the id of the event "Shooting Mixed Skeet". | "Shooting Mixed Skeet" refers to event_name = 'Shooting Mixed Skeet'; | SELECT id FROM event WHERE event_name = 'Shooting Mixed Skeet' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | How many Yelp_Business close after 8PM on Mondays? | close after 8PM refers to closing_time = '9PM' or closing_time = '10PM' closing_time = '11PM' closing_time = '12PM'; Mondays refers to day_of_week = 'Monday' | SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Monday' AND T1.closing_time > '8PM' | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | Who is the director that directed the highest number of movies in the 70s? If there are multiple directors with the same amount of movies, list all of their names and indicate the highest rating score that those movies got from the users. | highest number of movies COUNT(T1.movie_id); in the 70s refers to movie_release_year between 1970 and 1979 | SELECT T2.director_name, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year BETWEEN 1970 AND 1979 GROUP BY T2.director_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many eateries applied in 2012? | eateries applied in 2012 refer to business_id where application_date between '2012-01-01' and '2012-12-31'; | SELECT COUNT(business_id) FROM businesses WHERE STRFTIME('%Y', application_date) = '2012' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | What is the average rating of all the podcasts with reviews created in 2019? | created in 2019 refers to created_at BETWEEN '2019-01-01T00:00:00' and '2019-12-31T23:59:59'; average rating = Divide (Sum(rating), Count(podcast_id)) | SELECT AVG(rating) FROM reviews WHERE created_at BETWEEN '2019-01-01T00:00:00-07:00' AND '2019-12-31T23:59:59-07:00' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | Write down all of the product ids that were placed by Meander. | null | SELECT DISTINCT T2.ProductID FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T1.FirstName = 'Meander' | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | How many Summer games were held in Stockholm? | Summer games refer to id where season = 'Summer'; in Stockholm refers to city_name = 'Stockholm'; | SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Stockholm' AND T3.season = 'Summer' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | How many business have been reviewed by user ID 3 and how long have this user been with Yelp? | year with yelp = Subtract ('%Y'(CURRENT TIME), user_yelping_since_year) | SELECT COUNT(T1.business_id) , strftime('%Y', 'now') - T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What is the name of the list that was updated most recently? | updated most recently refers to MAX(list_update_date_utc) | SELECT list_title FROM lists WHERE list_update_timestamp_utc = ( SELECT list_update_timestamp_utc FROM lists ORDER BY list_update_timestamp_utc DESC LIMIT 1 ) | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many establishments have an inspection score of no more than 50? | establishments have the same meaning as businesses; inspection score of no more than 50 refers to score < 50; | SELECT COUNT(DISTINCT business_id) FROM inspections WHERE score < 50 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Calculate the percentage of podcasts in the fiction-science-fiction category. | percentage = Divide (Count(podcast_id(category = 'fiction-science-fiction')), Count(podcast_id)) * 100 | SELECT CAST(SUM(CASE WHEN category = 'fiction-science-fiction' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(podcast_id) OR '%' "percentage" FROM categories | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | How many free gifts have customer with id 11782 received? | free gifts refers to Price = 0; | SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID = 11782 AND T1.Price = 0 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | How many athletes from Malaysia have won a medal? | Malaysia refers to region_name = 'Malaysia'; athletes won a medal refer to competitor_id where medal_id <> 4; | SELECT COUNT(T3.person_id) FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T5.region_name = 'Malaysia' AND T1.id... | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
movie_platform | What is Jeannot Szwarc's most popular movie and what is its average rating score? | Jeannot Szwarc's refers to director_name = 'Jeannot Szwarc'; most popular movie refers to MAX(movie_popularity); average rating score refers to avg(rating_score) | SELECT T2.movie_title, AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Jeannot Szwarc' ORDER BY T2.movie_popularity DESC LIMIT 1 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many eateries are located in Hayward? | eateries in Hayward refer city = 'HAYWARD'; | SELECT COUNT(business_id) FROM businesses WHERE city = 'HAYWARD' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | How many podcast reviews with a rating of 3 were created during the first quarter of 2015? | rating of 3 refers to rating = 3; created during the first quarter of 2015 refers to created_at BETWEEN'2015-01-01T00:00:00-07:00' and '2015-03-31T23:59:59-07:00' | SELECT COUNT(podcast_id) FROM reviews WHERE rating = 3 AND created_at BETWEEN '2015-01-01T00:00:00-07:00' AND '2015-03-31T23:59:59-07:00' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
public_review_platform | Please list the opening time on Mondays of all the Yelp_Businesses in Anthem that are still running. | Mondays refers to day_of_week = 'Monday'; in Anthem refers to city = 'Anthem'; are still running refers to active = 'true' | SELECT T1.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Monday' AND T3.city LIKE 'Anthem' AND T3.active LIKE 'True' GROUP BY T1.opening_time | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What is the name of the movie whose critic received the highest amount of likes? Indicate the URL to the rating on Mubi. | critic received the highest amount of likes refers to MAX(critic_likes); | SELECT T2.movie_title, T1.rating_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 1 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | What percentage of the violations for "Melody Lounge" are moderate risks? | DIVIDE(COUNT(risk_category = 'Moderate Risk' where name = 'Melody Lounge'), COUNT(business_id where name = 'Melody Lounge')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | How many total reviews runned at in June 2022 were added to the podcasts? | run at in June 2022 refers to run_at BETWEEN '2022-06-01 00:00:00' and '2022-06-30 23:59:59'; reviews refers to review_added | SELECT SUM(reviews_added) FROM runs WHERE run_at LIKE '2022-06-%' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
beer_factory | List out the root beer ID for the brand Bulldog, Bundaberg, Dad's, Dog n Suds and Virgil's. | Bulldog, Bundaberg, Dad's, Dog n Suds and Virgil's refers to BrandName IN('Bulldog', 'Bundaberg', 'Dad''s', 'Dog n Suds', 'Virgil''s'); | SELECT T1.RootBeerID FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T2.BrandID = T1.BrandID WHERE T2.BrandName IN ('Bulldog', 'Bundaberg', 'Dad''s', 'Dog n Suds', 'Virgil''s') | CREATE TABLE rootbeerbrand
(
Website TEXT, --
State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1
Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist... |
food_inspection | What is the average score for "Chairman Bao" in all its unscheduled routine inspections? | DIVIDE(SUM(score where type = 'Routine - Unscheduled' and name = 'Chairman Bao'), COUNT(type = 'Routine - Unscheduled' where name = 'Chairman Bao')); | SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Of the arts-books and arts-design categories, which one has more podcasts and what is the numerical difference between them? | arts-books' and 'arts-design' are category; numerical difference = Subtract(Count(podcast_id(category = 'arts-books')), Count(podcast_id(category = 'arts-design'))); one has much more podcast refers to Max(Count(podcast_id)) | SELECT ( SELECT category FROM categories WHERE category = 'arts-books' OR category = 'arts-design' GROUP BY category ORDER BY COUNT(podcast_id) DESC LIMIT 1 ) "has more podcasts" , ( SELECT SUM(CASE WHEN category = 'arts-books' THEN 1 ELSE 0 END) - SUM(CASE WHEN category = 'arts-design' THEN 1 ELSE 0 END) FROM categori... | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | List down all of the sales IDs for sales handled by sales people with first name starting with alphabet "s". | first name starting with alphabet "s" refers to FirstName LIKE 's%'; | SELECT T1.SalesID FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE SUBSTR(T2.FirstName, 1, 1) = 's' | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | What is the name of the event where competitors received the most gold medals? | received the most gold medals refers to MAX(COUNT(medal_name = 'Gold')); | SELECT T2.event_name FROM competitor_event AS T1 INNER JOIN event AS T2 ON T1.event_id = T2.id INNER JOIN medal AS T3 ON T1.medal_id = T3.id WHERE T3.medal_name = 'Gold' GROUP BY T2.id ORDER BY COUNT(T1.event_id) DESC LIMIT 1 | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | Please list the categories of the Yelp_Business that closes at 12PM on Sundays. | categories refers to category_name; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday' | SELECT T4.category_name FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business_Categories AS T3 ON T1.business_id = T3.business_id INNER JOIN Categories AS T4 ON T4.category_id = T4.category_id WHERE T1.closing_time = '12PM' AND T2.day_of_week = 'Sunday' GROUP BY T4.category_name | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What is the average number of followers of the lists created by the user who rated the movie "Pavee Lackeen: The Traveller Girl" on 3/27/2011 at 2:06:34 AM? | average number of followers refers to AVG(list_followers); movie "Pavee Lackeen: The Traveller Girl" refers to movie_title = 'Pavee Lackeen: The Traveller Girl'; on 3/27/2011 at 2:06:34 AM refers to rating_timestamp_utc = '2011-03-27 02:06:34' | SELECT CAST(SUM(T4.list_followers) AS REAL) / COUNT(T2.list_id) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN movies AS T3 ON T1.movie_id = T3.movie_id INNER JOIN lists AS T4 ON T2.list_id = T4.list_id WHERE T3.movie_title LIKE 'Pavee Lackeen: The Traveller Girl' AND T1.rating_ti... | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | For the business whose business certificate number is 304977, how many violations did it have on 2013/10/7? | date = '2013-10-07'; | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_certificate = '304977' AND T1.`date` = '2013-10-07' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | The 'More Stupider: A 90-Day Fiance Podcast' belongs to which category and what is the average rating of the podcast? | More Stupider: A 90-Day Fiance Podcast' is the title of podcast; average rating = Divide (Sum(rating), Count(rating)) | SELECT AVG(T3.rating) FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id INNER JOIN reviews AS T3 ON T3.podcast_id = T2.podcast_id WHERE T2.title = 'More Stupider: A 90-Day Fiance Podcast' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | What is the first name of employee who handled sales for customer called Abigail? | null | SELECT DISTINCT T3.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T1.FirstName = 'Abigail' | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
public_review_platform | How many Yelp_Business falls under the category of "Shopping"? | category of "Shopping" refers to category_name = 'Shopping' | SELECT COUNT(T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Shopping' | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | Between 1/1/2010 to 12/31/2020, how many users, who were a trialist when they created the list, gave the movie "The Secret Life of Words" a rating score of 3? | Between 1/1/2010 to 12/31/2020 refers to rating_timestamp_utc between '2010-01-01%' and '2020-12-31%'; a trialist refers to user_trialist = 1; movie "The Secret Life of Words" refers to movie_title = 'The Secret Life of Words'; rating score of 3 refers to rating_score = 3 | SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'The Secret Life of Words' AND T1.rating_score = 3 AND T1.user_trialist = 0 AND T1.rating_timestamp_utc BETWEEN '2010%' AND '2020%' | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | For the business which got the most number of violations, how many inspections did it have? | null | SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id GROUP BY T1.business_id ORDER BY COUNT(T1.business_id) DESC LIMIT 1 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | How many reviews does 'LifeAfter/The Message' have which were rated below 3? | LifeAfter/The Message' is the title of podcast; rated below 3 refers to rating < 3 | SELECT COUNT(T2.rating) FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.title = 'LifeAfter/The Message' AND T2.rating <= 3 | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
public_review_platform | Among the Yelp_Business in Arizona, how many of them closes at 12PM on Sundays? | in Arizona refers to state = 'AZ'; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday' | SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM' AND T3.state LIKE 'AZ' | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What is the average number of number of movies added to the lists of user 8516503? Indicate how many movies did he/she give a rating score of 5. | average number of number of movies refers to AVG(list_movie_number); user 8516503 refers to user_id = 8516503; rating score of 5 refers to rating_score = 5 | SELECT AVG(T3.list_movie_number) , SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN lists AS T3 ON T2.user_id = T3.user_id WHERE T1.user_id = 8516503 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | Which business was the first one to get a low risk violation because of "Permit license or inspection report not posted"? Give the name of the business. | low risk violation because of "Permit license or inspection report not posted" refers to risk_category = 'Low Risk' where description = 'Permit license or inspection report not posted'; business was the first one refers to name where MIN(date); | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = ( SELECT MIN(`date`) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Permit license or inspection report not posted' ) AND T1.risk_category = 'Low Risk' AND T1.description = 'Permit ... | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Write all the review titles and the contents belonging to the podcast 'More Stupider: A 90-Day Fiance Podcast' with a review rating of 1. | podcast 'More Stupider: A 90-Day Fiance Podcast' refers to title = 'More Stupider: A 90-Day Fiance Podcast'; rating of 1 refers to rating = 1 | SELECT title, content FROM reviews WHERE podcast_id = ( SELECT podcast_id FROM podcasts WHERE title = 'More Stupider: A 90-Day Fiance Podcast' ) AND rating = 1 | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | Among customers with the last name of Valdez, who purchased the highest quantity? | highest quantity refers to MAX(Quantity); | SELECT T1.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.LastName = 'Valdez' ORDER BY T2.Quantity DESC LIMIT 1 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
public_review_platform | List out the user who is an elite user for consecutively 5 years or more and what is the user average star? How many likes does this user gets? | elite user for consecutively 5 years or more refers to user_id COUNT(year_id) > 5; Average star = AVG(likes) | SELECT T2.user_average_stars, COUNT(T3.likes) FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Tips AS T3 ON T3.user_id = T2.user_id GROUP BY T1.user_id HAVING COUNT(T1.user_id) > 5 | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
movie_platform | What are the top 5 most popular movies of the 21st century? Indicate how many users gave it a rating score of 5. | most popular movies refers to MAX(movie_popularity); rating score of 5 refers to rating_score = 5; movies of the 21st century refers to movie_release_year> = 2000 | SELECT DISTINCT T2.movie_id, SUM(T1.rating_score = 5) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T2.movie_popularity DESC LIMIT 5 | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | Give the address of the business with the most number of the low risk violations. | the most number of the low risk violations refers to MAX(COUNT(business_id)) where risk_category = 'Low Risk' ; | SELECT T2.address FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' GROUP BY T2.address ORDER BY COUNT(T1.business_id) DESC LIMIT 1 | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | Write all the review content belonging to StormCast: The Official Warhammer Age of Sigmar Podcast. | review content refers to content; 'StormCast: The Official Warhammer Age of Sigmar Podcast' is the title of podcast; | SELECT content FROM reviews WHERE podcast_id = ( SELECT podcast_id FROM podcasts WHERE title = 'StormCast: The Official Warhammer Age of Sigmar Podcast' ) | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | What is the full name of customers who dealt with sales person with id 5? | full name = FirstName, MiddleInitial, LastName; | SELECT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.SalesPersonID = 5 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | How many athletes are from Australia? | from Australia refer region_name = 'Australia'; | SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'Australia' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
movie_platform | Between 1/1/2017 to 12/31/2017, how many users who were eligible for trial when they rated the movie "Patti Smith: Dream of Life"and what is the image URL to the movie on Mubi? | Between 1/1/2017 to 12/31/2017 refers to rating_timestamp_utc between '2017-01-01 00:00:00' and '2017-12-31 00:00:00'; eligible for trial refers to user_eligible_for_trial = 1; movie "Patti Smith: Dream of Life" refers to movie_title = 'Patti Smith: Dream of Life' | SELECT COUNT(T1.user_id), T2.movie_image_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE datetime(T1.rating_timestamp_utc) BETWEEN '2017-01-01 00:00:00' AND '2017-12-31 00:00:00' | CREATE TABLE ratings_users
(
user_cover_image_url TEXT, --
user_avatar_image_url TEXT, --
rating_date_utc TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S... |
food_inspection | How many unscheduled routine inspections did "Soma Restaurant And Bar" have? | "Soma Restaurant And Bar" is the name of the business; unscheduled routine inspections refer to type = 'Routine - Unscheduled'; | SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Soma Restaurant And Bar' AND T1.type = 'Routine - Unscheduled' | CREATE TABLE violations
(
`risk_category` TEXT NOT NULL, -- Example Values: `Moderate Risk`, `Low Risk`, `High Risk` | Value Statics: Total count 36050 - Distinct count 3 - Null count 0
`date` DATE NOT NULL, --
`violation_type_id` TEXT NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`busine... |
music_platform_2 | List all the names of podcasts under the 'true crime' category. | name of the podcast refers to title of the podcast | SELECT T2.title FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'true-crime' | CREATE TABLE reviews
(
author_id TEXT not null, --
rating INTEGER not null, -- Example Values: `5`, `1`, `3`, `4`, `2` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
title TEXT not null, --
podcast_id TEXT not null constraint reviews_podcasts_podcast_id_fk references podcasts, --
co... |
sales | Among customers with IDs from 1 to 100, what is the highest price of products they purchased? | IDs from 1 to 100 refers to CustomerID BETWEEN 1 AND 100 ; highest price refers to MAX(Price); | SELECT T1.Price FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID BETWEEN 1 AND 100 ORDER BY T1.Price DESC LIMIT 1 | CREATE TABLE Sales
(
CustomerID INTEGER not null, --
SalesID INTEGER not null primary key,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
foreign key (SalesPersonID) references Employees (EmployeeID) on update cascade on delete cascade,
SalesPersonID INTEGER no... |
olympics | Provide hockey's sport id. | hockey's sport refers to sport_name = 'hockey'; | SELECT id FROM sport WHERE sport_name = 'Hockey' | CREATE TABLE event
(
event_name TEXT default NULL, --
sport_id INTEGER default NULL, --
foreign key (sport_id) references sport(id),
id INTEGER not null primary key,
);
CREATE TABLE sport
(
id INTEGER not null primary key,
sport_name TEXT default NULL, --
);
CREATE TABLE city
(
city_name TEXT default NUL... |
public_review_platform | How many "Good for Kids" Yelp_Businesses are open everyday of the week? | Good for Kids refers to attribute_name = 'Good for Kids'and attribute_value = 'true'; open everyday refers to day_id between 1 and 7 | SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business_Attributes AS T3 ON T1.business_id = T3.business_id INNER JOIN Attributes AS T4 ON T4.attribute_id = T4.attribute_id WHERE T2.day_id IN (1, 2, 3, 4, 5, 6, 7) AND T4.attribute_name = 'Good for Kids' ... | CREATE TABLE Attributes
(
attribute_name TEXT, --
attribute_id INTEGER constraint Attributes_pk primary key,
);
CREATE TABLE Elite
(
year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.