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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Distinct count 2 - Null count 22
Honey TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Alcoholic TEXT, -- Example Values: `FALSE` | Value Statics: Total count 24 - Distinct count 1 - Null count 0
City TEXT, --
Country TEXT, -- Example Values: `United States`, `Australia` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Caffeinated TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInCans TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BreweryName TEXT, --
FacebookPage TEXT, -- Example Values: `https://www.facebook.com/Dads-Old-Fashioned-Root-Beer-and-Cream-Soda-117159998301204/`, `https://www.facebook.com/Dog-N-Suds-Bottled-Root-Beer-117372294947833/`, `https://www.facebook.com/fitzsrootbeer`, `https://www.facebook.com/Gales-Root-Beer-207365072632626/`, `https://www.facebook.com/MugRootBeer/` | Value Statics: Total count 6 - Distinct count 6 - Null count 18
FirstBrewedYear INTEGER, -- Example Values: `1919`, `1926`, `1986`, `1898`, `1984` | Value Statics: Total count 24 - Distinct count 19 - Null count 0
BrandID INTEGER primary key,
CurrentRetailPrice REAL, -- Example Values: `1.0`, `3.0`, `44.0` | Value Statics: Total count 24 - Distinct count 3 - Null count 0
ArtificialSweetener TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BrandName TEXT, --
CornSyrup TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInBottles TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInKegs TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
WholesaleCost REAL, -- Example Values: `0.42`, `0.98`, `1.13`, `0.4`, `1.1` | Value Statics: Total count 24 - Distinct count 17 - Null count 0
Description TEXT, --
CaneSugar TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
);
CREATE TABLE rootbeerreview
(
CustomerID INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
ReviewDate DATE, --
BrandID INTEGER, --
Review TEXT, -- Example Values: `You could have done better Sactown.`, `Too much bite, not enough barq.`, `The drink is fine, but the crest on the label is pretentious.`, `Fantastic!`, `Love stopping by Fitz's in St. Louis.` | Value Statics: Total count 16 - Distinct count 16 - Null count 697
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
StarRating INTEGER, -- Example Values: `5`, `1`, `3`, `2`, `4` | Value Statics: Total count 713 - Distinct count 5 - Null count 0
primary key (CustomerID, BrandID),
);
CREATE TABLE customers
(
StreetAddress TEXT, --
Email TEXT, --
FirstPurchaseDate DATE, --
CustomerID INTEGER primary key,
State TEXT, -- Example Values: `CA` | Value Statics: Total count 554 - Distinct count 1 - Null count 0
SubscribedToEmailList TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
City TEXT, --
Gender TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
Last TEXT, --
PhoneNumber TEXT, --
First TEXT, --
ZipCode INTEGER, --
);
CREATE TABLE location
(
LocationID INTEGER primary key,
LocationName TEXT, -- Example Values: `LOST`, `Sac State American River Courtyard`, `Sac State Union` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
ZipCode INTEGER, -- Example Values: `95819` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
StreetAddress TEXT, -- Example Values: `6000 J St` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
City TEXT, -- Example Values: `Sacramento` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
State TEXT, -- Example Values: `CA` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
);
CREATE TABLE geolocation
(
Longitude REAL, -- Example Values: `0.0`, `-121.426432`, `-121.42243` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references location(LocationID),
LocationID INTEGER primary key,
Latitude REAL, -- Example Values: `0.0`, `38.566129`, `38.559615` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE rootbeer
(
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
RootBeerID INTEGER primary key,
foreign key (LocationID) references location(LocationID),
PurchaseDate DATE, --
ContainerType TEXT, -- Example Values: `Bottle`, `Can` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
LocationID INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
BrandID INTEGER, --
);
CREATE TABLE transaction
(
CreditCardType TEXT, -- Example Values: `Discover`, `Visa`, `MasterCard`, `American Express` | Value Statics: Total count 6312 - Distinct count 4 - Null count 0
CreditCardNumber INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
LocationID INTEGER, -- Example Values: `2`, `1` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
foreign key (RootBeerID) references rootbeer(RootBeerID),
TransactionID INTEGER primary key,
CustomerID INTEGER, --
RootBeerID INTEGER, --
TransactionDate DATE, --
foreign key (LocationID) references location(LocationID),
PurchasePrice REAL, -- Example Values: `3.0`, `1.0` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 BY T4.name, date(T4.years || '-01-01', '-' || (T4.rowNumber - 1) || ' years') HAVING COUNT(T4.years) = 4 | 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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 BY COUNT(T2.competitor_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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Distinct count 2 - Null count 22
Honey TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Alcoholic TEXT, -- Example Values: `FALSE` | Value Statics: Total count 24 - Distinct count 1 - Null count 0
City TEXT, --
Country TEXT, -- Example Values: `United States`, `Australia` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Caffeinated TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInCans TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BreweryName TEXT, --
FacebookPage TEXT, -- Example Values: `https://www.facebook.com/Dads-Old-Fashioned-Root-Beer-and-Cream-Soda-117159998301204/`, `https://www.facebook.com/Dog-N-Suds-Bottled-Root-Beer-117372294947833/`, `https://www.facebook.com/fitzsrootbeer`, `https://www.facebook.com/Gales-Root-Beer-207365072632626/`, `https://www.facebook.com/MugRootBeer/` | Value Statics: Total count 6 - Distinct count 6 - Null count 18
FirstBrewedYear INTEGER, -- Example Values: `1919`, `1926`, `1986`, `1898`, `1984` | Value Statics: Total count 24 - Distinct count 19 - Null count 0
BrandID INTEGER primary key,
CurrentRetailPrice REAL, -- Example Values: `1.0`, `3.0`, `44.0` | Value Statics: Total count 24 - Distinct count 3 - Null count 0
ArtificialSweetener TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BrandName TEXT, --
CornSyrup TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInBottles TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInKegs TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
WholesaleCost REAL, -- Example Values: `0.42`, `0.98`, `1.13`, `0.4`, `1.1` | Value Statics: Total count 24 - Distinct count 17 - Null count 0
Description TEXT, --
CaneSugar TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
);
CREATE TABLE rootbeerreview
(
CustomerID INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
ReviewDate DATE, --
BrandID INTEGER, --
Review TEXT, -- Example Values: `You could have done better Sactown.`, `Too much bite, not enough barq.`, `The drink is fine, but the crest on the label is pretentious.`, `Fantastic!`, `Love stopping by Fitz's in St. Louis.` | Value Statics: Total count 16 - Distinct count 16 - Null count 697
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
StarRating INTEGER, -- Example Values: `5`, `1`, `3`, `2`, `4` | Value Statics: Total count 713 - Distinct count 5 - Null count 0
primary key (CustomerID, BrandID),
);
CREATE TABLE customers
(
StreetAddress TEXT, --
Email TEXT, --
FirstPurchaseDate DATE, --
CustomerID INTEGER primary key,
State TEXT, -- Example Values: `CA` | Value Statics: Total count 554 - Distinct count 1 - Null count 0
SubscribedToEmailList TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
City TEXT, --
Gender TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
Last TEXT, --
PhoneNumber TEXT, --
First TEXT, --
ZipCode INTEGER, --
);
CREATE TABLE location
(
LocationID INTEGER primary key,
LocationName TEXT, -- Example Values: `LOST`, `Sac State American River Courtyard`, `Sac State Union` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
ZipCode INTEGER, -- Example Values: `95819` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
StreetAddress TEXT, -- Example Values: `6000 J St` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
City TEXT, -- Example Values: `Sacramento` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
State TEXT, -- Example Values: `CA` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
);
CREATE TABLE geolocation
(
Longitude REAL, -- Example Values: `0.0`, `-121.426432`, `-121.42243` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references location(LocationID),
LocationID INTEGER primary key,
Latitude REAL, -- Example Values: `0.0`, `38.566129`, `38.559615` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE rootbeer
(
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
RootBeerID INTEGER primary key,
foreign key (LocationID) references location(LocationID),
PurchaseDate DATE, --
ContainerType TEXT, -- Example Values: `Bottle`, `Can` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
LocationID INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
BrandID INTEGER, --
);
CREATE TABLE transaction
(
CreditCardType TEXT, -- Example Values: `Discover`, `Visa`, `MasterCard`, `American Express` | Value Statics: Total count 6312 - Distinct count 4 - Null count 0
CreditCardNumber INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
LocationID INTEGER, -- Example Values: `2`, `1` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
foreign key (RootBeerID) references rootbeer(RootBeerID),
TransactionID INTEGER primary key,
CustomerID INTEGER, --
RootBeerID INTEGER, --
TransactionDate DATE, --
foreign key (LocationID) references location(LocationID),
PurchasePrice REAL, -- Example Values: `3.0`, `1.0` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 != 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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Distinct count 2 - Null count 22
Honey TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Alcoholic TEXT, -- Example Values: `FALSE` | Value Statics: Total count 24 - Distinct count 1 - Null count 0
City TEXT, --
Country TEXT, -- Example Values: `United States`, `Australia` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
Caffeinated TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInCans TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BreweryName TEXT, --
FacebookPage TEXT, -- Example Values: `https://www.facebook.com/Dads-Old-Fashioned-Root-Beer-and-Cream-Soda-117159998301204/`, `https://www.facebook.com/Dog-N-Suds-Bottled-Root-Beer-117372294947833/`, `https://www.facebook.com/fitzsrootbeer`, `https://www.facebook.com/Gales-Root-Beer-207365072632626/`, `https://www.facebook.com/MugRootBeer/` | Value Statics: Total count 6 - Distinct count 6 - Null count 18
FirstBrewedYear INTEGER, -- Example Values: `1919`, `1926`, `1986`, `1898`, `1984` | Value Statics: Total count 24 - Distinct count 19 - Null count 0
BrandID INTEGER primary key,
CurrentRetailPrice REAL, -- Example Values: `1.0`, `3.0`, `44.0` | Value Statics: Total count 24 - Distinct count 3 - Null count 0
ArtificialSweetener TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
BrandName TEXT, --
CornSyrup TEXT, -- Example Values: `TRUE`, `FALSE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInBottles TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
AvailableInKegs TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
WholesaleCost REAL, -- Example Values: `0.42`, `0.98`, `1.13`, `0.4`, `1.1` | Value Statics: Total count 24 - Distinct count 17 - Null count 0
Description TEXT, --
CaneSugar TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 24 - Distinct count 2 - Null count 0
);
CREATE TABLE rootbeerreview
(
CustomerID INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
ReviewDate DATE, --
BrandID INTEGER, --
Review TEXT, -- Example Values: `You could have done better Sactown.`, `Too much bite, not enough barq.`, `The drink is fine, but the crest on the label is pretentious.`, `Fantastic!`, `Love stopping by Fitz's in St. Louis.` | Value Statics: Total count 16 - Distinct count 16 - Null count 697
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
StarRating INTEGER, -- Example Values: `5`, `1`, `3`, `2`, `4` | Value Statics: Total count 713 - Distinct count 5 - Null count 0
primary key (CustomerID, BrandID),
);
CREATE TABLE customers
(
StreetAddress TEXT, --
Email TEXT, --
FirstPurchaseDate DATE, --
CustomerID INTEGER primary key,
State TEXT, -- Example Values: `CA` | Value Statics: Total count 554 - Distinct count 1 - Null count 0
SubscribedToEmailList TEXT, -- Example Values: `FALSE`, `TRUE` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
City TEXT, --
Gender TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 554 - Distinct count 2 - Null count 0
Last TEXT, --
PhoneNumber TEXT, --
First TEXT, --
ZipCode INTEGER, --
);
CREATE TABLE location
(
LocationID INTEGER primary key,
LocationName TEXT, -- Example Values: `LOST`, `Sac State American River Courtyard`, `Sac State Union` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
ZipCode INTEGER, -- Example Values: `95819` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
StreetAddress TEXT, -- Example Values: `6000 J St` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
City TEXT, -- Example Values: `Sacramento` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
State TEXT, -- Example Values: `CA` | Value Statics: Total count 2 - Distinct count 1 - Null count 1
);
CREATE TABLE geolocation
(
Longitude REAL, -- Example Values: `0.0`, `-121.426432`, `-121.42243` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
foreign key (LocationID) references location(LocationID),
LocationID INTEGER primary key,
Latitude REAL, -- Example Values: `0.0`, `38.566129`, `38.559615` | Value Statics: Total count 3 - Distinct count 3 - Null count 0
);
CREATE TABLE rootbeer
(
foreign key (BrandID) references rootbeerbrand(BrandID),
foreign key (BrandID) references rootbeerbrand(BrandID),
RootBeerID INTEGER primary key,
foreign key (LocationID) references location(LocationID),
PurchaseDate DATE, --
ContainerType TEXT, -- Example Values: `Bottle`, `Can` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
foreign key (LocationID) references geolocation(LocationID),
foreign key (LocationID) references geolocation(LocationID),
LocationID INTEGER, -- Example Values: `1`, `2` | Value Statics: Total count 6430 - Distinct count 2 - Null count 0
BrandID INTEGER, --
);
CREATE TABLE transaction
(
CreditCardType TEXT, -- Example Values: `Discover`, `Visa`, `MasterCard`, `American Express` | Value Statics: Total count 6312 - Distinct count 4 - Null count 0
CreditCardNumber INTEGER, --
foreign key (CustomerID) references customers(CustomerID),
LocationID INTEGER, -- Example Values: `2`, `1` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
foreign key (RootBeerID) references rootbeer(RootBeerID),
TransactionID INTEGER primary key,
CustomerID INTEGER, --
RootBeerID INTEGER, --
TransactionDate DATE, --
foreign key (LocationID) references location(LocationID),
PurchasePrice REAL, -- Example Values: `3.0`, `1.0` | Value Statics: Total count 6312 - Distinct count 2 - Null count 0
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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 categories ) "differenct BETWEEN arts-books and arts-design" | 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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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_timestamp_utc LIKE '2011-03-27 02:06:34' | 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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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 license or inspection report not posted' | 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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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 Statics: Total count 100000 - Distinct count 2 - Null count 0
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
user_id INTEGER references lists_users (user_id), --
);
CREATE TABLE movies
(
director_name TEXT, --
movie_title TEXT, --
director_id TEXT, --
movie_image_url TEXT, --
movie_title_language TEXT, -- Example Values: `en` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0
director_url TEXT, --
movie_popularity INTEGER, --
movie_url TEXT, --
movie_release_year INTEGER, --
movie_id INTEGER not null primary key,
);
CREATE TABLE lists
(
list_creation_timestamp_utc TEXT, --
list_third_image_url TEXT, --
list_cover_image_url TEXT, --
list_description TEXT, --
list_movie_number INTEGER, --
list_first_image_url TEXT, --
user_id INTEGER references lists_users (user_id), --
list_title TEXT, --
list_comments INTEGER, --
list_second_image_url TEXT, --
list_update_timestamp_utc TEXT, --
list_id INTEGER not null primary key,
list_url TEXT, --
list_followers INTEGER, --
);
CREATE TABLE lists_users
(
list_update_date_utc TEXT, --
user_subscriber INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_eligible_for_trial TEXT, -- Example Values: `0`, `1` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
user_has_payment_method TEXT, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
foreign key (list_id) references lists(list_id),
foreign key (user_id) references lists(user_id),
user_avatar_image_url TEXT, --
user_cover_image_url TEXT, --
primary key (user_id, list_id),
user_id INTEGER not null, --
user_trialist INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 80311 - Distinct count 2 - Null count 0
list_id INTEGER not null, --
list_creation_date_utc TEXT, --
);
CREATE TABLE ratings
(
user_subscriber INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
movie_id INTEGER, --
rating_url TEXT, --
user_eligible_for_trial INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (rating_id) references ratings(rating_id),
critic TEXT, --
user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
foreign key (movie_id) references movies(movie_id),
foreign key (user_id) references lists_users(user_id),
foreign key (user_id) references lists_users(user_id),
rating_score INTEGER, -- Example Values: `3`, `2`, `4`, `5`, `1` | Value Statics: Total count 99731 - Distinct count 5 - Null count 269
critic_likes INTEGER, --
foreign key (user_id) references ratings_users(user_id),
foreign key (user_id) references ratings_users(user_id),
rating_id INTEGER, --
rating_timestamp_utc TEXT, --
user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
critic_comments INTEGER, --
user_id INTEGER, --
); |
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` (`business_id`),
`description` TEXT NOT NULL, --
`business_id` INTEGER NOT NULL, --
);
CREATE TABLE businesses
(
`phone_number` INTEGER DEFAULT NULL, --
`postal_code` TEXT DEFAULT NULL, --
`owner_city` TEXT DEFAULT NULL, --
`owner_name` TEXT NOT NULL, --
`business_certificate` INTEGER NOT NULL, --
PRIMARY KEY (`business_id`),
`owner_zip` TEXT DEFAULT NULL, --
`address` TEXT DEFAULT NULL, --
`longitude` REAL DEFAULT NULL, --
`owner_state` TEXT DEFAULT NULL, --
`tax_code` TEXT DEFAULT NULL, --
`latitude` REAL DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
`name` TEXT NOT NULL, --
`city` TEXT DEFAULT NULL, --
`owner_address` TEXT DEFAULT NULL, --
`application_date` DATE DEFAULT NULL, --
);
CREATE TABLE inspections
(
`type` TEXT NOT NULL, -- Example Values: `Routine - Unscheduled`, `Reinspection/Followup`, `Complaint Reinspection/Followup`, `Non-inspection site visit`, `Complaint` | Value Statics: Total count 23764 - Distinct count 13 - Null count 0
`score` INTEGER DEFAULT NULL, --
`business_id` INTEGER NOT NULL, --
FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`),
`date` DATE NOT NULL, --
); |
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, --
content TEXT not null, --
created_at TEXT not null, --
);
CREATE TABLE categories
(
category TEXT not null, --
podcast_id TEXT not null constraint categories_podcasts_podcast_id_fk references podcasts, --
constraint "PRIMARY" primary key (podcast_id, category),
);
CREATE TABLE runs
(
reviews_added integer not null, -- Example Values: `1215223`, `13139`, `11561`, `11855`, `11714` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
run_at text not null, -- Example Values: `2021-05-10 02:53:00`, `2021-06-06 21:34:36`, `2021-07-02 18:04:55`, `2021-08-01 17:54:42`, `2021-09-02 18:00:30` | Value Statics: Total count 12 - Distinct count 12 - Null count 0
max_rowid integer not null, -- Example Values: `3266481`, `3300773`, `3329699`, `3360315`, `3390165` | Value Statics: Total count 12 - Distinct count 11 - Null count 0
);
CREATE TABLE podcasts
(
itunes_id integer not null, --
title text not null, --
itunes_url text not null, --
podcast_id text primary key,
slug text not null, --
); |
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 not null, --
foreign key (CustomerID) references Customers (CustomerID) on update cascade on delete cascade,
Quantity INTEGER not null, --
ProductID INTEGER not null, --
foreign key (ProductID) references Products (ProductID) on update cascade on delete cascade,
);
CREATE TABLE Customers
(
MiddleInitial TEXT null, --
FirstName TEXT not null, --
LastName TEXT not null, --
CustomerID INTEGER not null primary key,
);
CREATE TABLE Products
(
Price REAL null, --
ProductID INTEGER not null primary key,
Name TEXT not null, --
);
CREATE TABLE Employees
(
EmployeeID INTEGER not null primary key,
LastName TEXT not null, --
FirstName TEXT not null, --
MiddleInitial TEXT null, -- Example Values: `e`, `l`, `a`, `u`, `r` | Value Statics: Total count 22 - Distinct count 11 - Null count 0
); |
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 NULL, --
id INTEGER not null primary key,
);
CREATE TABLE games_city
(
city_id INTEGER default NULL, --
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
foreign key (city_id) references city(id),
);
CREATE TABLE competitor_event
(
foreign key (event_id) references event(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (competitor_id) references games_competitor(id),
foreign key (medal_id) references medal(id),
medal_id INTEGER default NULL, -- Example Values: `4`, `1`, `3`, `2` | Value Statics: Total count 100000 - Distinct count 4 - Null count 0
event_id INTEGER default NULL, --
competitor_id INTEGER default NULL, --
);
CREATE TABLE person
(
weight INTEGER default NULL, --
height INTEGER default NULL, --
id INTEGER not null primary key,
full_name TEXT default NULL, --
gender TEXT default NULL, -- Example Values: `M`, `F` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0
);
CREATE TABLE noc_region
(
region_name TEXT default NULL, --
id INTEGER not null primary key,
noc TEXT default NULL, --
);
CREATE TABLE medal
(
id INTEGER not null primary key,
medal_name TEXT default NULL, -- Example Values: `Gold`, `Silver`, `Bronze`, `NA` | Value Statics: Total count 4 - Distinct count 4 - Null count 0
);
CREATE TABLE person_region
(
foreign key (region_id) references noc_region(id),
region_id INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
);
CREATE TABLE games
(
season TEXT default NULL, -- Example Values: `Summer`, `Winter` | Value Statics: Total count 51 - Distinct count 2 - Null count 0
id INTEGER not null primary key,
games_name TEXT default NULL, --
games_year INTEGER default NULL, --
);
CREATE TABLE games_competitor
(
id INTEGER not null primary key,
foreign key (games_id) references games(id),
games_id INTEGER default NULL, --
age INTEGER default NULL, --
foreign key (person_id) references person(id),
person_id INTEGER default NULL, --
); |
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' AND T3.attribute_value = 'true' | 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 - Null count 0
constraint Elite_pk primary key (user_id, year_id),
user_id INTEGER constraint Elite_Users_user_id_fk references Users, --
);
CREATE TABLE Business_Hours
(
closing_time TEXT, --
business_id INTEGER constraint Business_Hours_Business_business_id_fk references Business, --
day_id INTEGER constraint Business_Hours_Days_day_id_fk references Days, -- Example Values: `2`, `3`, `4`, `5`, `6` | Value Statics: Total count 47831 - Distinct count 7 - Null count 0
opening_time TEXT, --
constraint Business_Hours_pk primary key (business_id, day_id),
);
CREATE TABLE Categories
(
category_id INTEGER constraint Categories_pk primary key,
category_name TEXT, --
);
CREATE TABLE Business_Categories
(
business_id INTEGER constraint Business_Categories_Business_business_id_fk references Business, --
category_id INTEGER constraint Business_Categories_Categories_category_id_fk references Categories, --
constraint Business_Categories_pk primary key (business_id, category_id),
);
CREATE TABLE Tips
(
likes INTEGER, -- Example Values: `0`, `1`, `2`, `3` | Value Statics: Total count 87157 - Distinct count 4 - Null count 0
user_id INTEGER constraint Tips_Users_user_id_fk references Users, --
tip_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 87157 - Distinct count 3 - Null count 0
business_id INTEGER constraint Tips_Business_business_id_fk references Business, --
constraint Tips_pk primary key (business_id, user_id),
);
CREATE TABLE Reviews
(
business_id INTEGER constraint Reviews_Business_business_id_fk references Business, --
review_length TEXT, -- Example Values: `Medium`, `Short`, `Long` | Value Statics: Total count 100000 - Distinct count 3 - Null count 0
constraint Reviews_pk primary key (business_id, user_id),
review_votes_funny TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_stars INTEGER, -- Example Values: `2`, `1`, `5`, `4`, `3` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
review_votes_cool TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
user_id INTEGER constraint Reviews_Users_user_id_fk references Users, --
review_votes_useful TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 100000 - Distinct count 5 - Null count 0
);
CREATE TABLE Checkins
(
label_time_7 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_19 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_17 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_1 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_13 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_20 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_14 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_5 TEXT, -- Example Values: `None`, `Low`, `Medium`, `Uber`, `High` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_2 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_22 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
day_id INTEGER constraint Checkins_Days_day_id_fk references Days, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 80038 - Distinct count 7 - Null count 0
label_time_8 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_0 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_4 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_21 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_23 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High` | Value Statics: Total count 80038 - Distinct count 4 - Null count 0
label_time_9 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_11 TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_16 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_10 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_15 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
business_id INTEGER constraint Checkins_Business_business_id_fk references Business, --
constraint Checkins_pk primary key (business_id, day_id),
label_time_12 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_18 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
label_time_3 TEXT, -- Example Values: `None`, `Low`, `Medium` | Value Statics: Total count 80038 - Distinct count 3 - Null count 0
label_time_6 TEXT, -- Example Values: `None`, `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 80038 - Distinct count 5 - Null count 0
);
CREATE TABLE Days
(
day_id INTEGER constraint Days_pk primary key,
day_of_week TEXT, -- Example Values: `Sunday`, `Monday`, `Tuesday`, `Wednesday`, `Thursday` | Value Statics: Total count 7 - Distinct count 7 - Null count 0
);
CREATE TABLE Years
(
actual_year INTEGER, -- Example Values: `2005`, `2006`, `2007`, `2008`, `2009` | Value Statics: Total count 10 - Distinct count 10 - Null count 0
year_id INTEGER constraint Years_pk primary key,
);
CREATE TABLE Business
(
business_id INTEGER constraint Business_pk primary key,
state TEXT, -- Example Values: `AZ`, `SC`, `CA` | Value Statics: Total count 15585 - Distinct count 3 - Null count 0
city TEXT, --
active TEXT, -- Example Values: `true`, `false` | Value Statics: Total count 15585 - Distinct count 2 - Null count 0
stars REAL, -- Example Values: `3.0`, `4.5`, `4.0`, `5.0`, `3.5` | Value Statics: Total count 15585 - Distinct count 9 - Null count 0
review_count TEXT, -- Example Values: `Low`, `Medium`, `High`, `Uber` | Value Statics: Total count 15585 - Distinct count 4 - Null count 0
);
CREATE TABLE Business_Attributes
(
business_id INTEGER constraint Business_Attributes_Business_business_id_fk references Business, --
attribute_value TEXT, --
constraint Business_Attributes_pk primary key (attribute_id, business_id),
attribute_id INTEGER constraint Business_Attributes_Attributes_attribute_id_fk references Attributes, --
);
CREATE TABLE Users_Compliments
(
user_id INTEGER constraint Users_Compliments_Users_user_id_fk references Users, --
constraint Users_Compliments_pk primary key (compliment_id, user_id),
number_of_compliments TEXT, -- Example Values: `Medium`, `Low`, `High`, `Uber` | Value Statics: Total count 98810 - Distinct count 4 - Null count 0
compliment_id INTEGER constraint Users_Compliments_Compliments_compliment_id_fk references Compliments, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 98810 - Distinct count 11 - Null count 0
);
CREATE TABLE Compliments
(
compliment_type TEXT, -- Example Values: `photos`, `cool`, `hot`, `note`, `more` | Value Statics: Total count 11 - Distinct count 11 - Null count 0
compliment_id INTEGER constraint Compliments_pk primary key,
);
CREATE TABLE Users
(
user_votes_cool TEXT, -- Example Values: `Low`, `Uber`, `None`, `High`, `Medium` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_yelping_since_year INTEGER, -- Example Values: `2012`, `2010`, `2009`, `2008`, `2013` | Value Statics: Total count 70817 - Distinct count 11 - Null count 0
user_average_stars TEXT, -- Example Values: `4.0`, `2.5`, `4.5`, `5.0`, `2.0` | Value Statics: Total count 70817 - Distinct count 10 - Null count 0
user_review_count TEXT, -- Example Values: `Medium`, `High`, `Low`, `Uber` | Value Statics: Total count 70817 - Distinct count 4 - Null count 0
user_votes_useful TEXT, -- Example Values: `Low`, `Medium`, `Uber`, `None`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_id INTEGER constraint Users_pk primary key,
user_votes_funny TEXT, -- Example Values: `Low`, `None`, `Uber`, `Medium`, `High` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
user_fans TEXT, -- Example Values: `Low`, `None`, `Medium`, `High`, `Uber` | Value Statics: Total count 70817 - Distinct count 5 - Null count 0
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.