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 | In the violations in 2014, how many of them have a low risk category? | in 2014 refers to year(date) = 2014; risk_category = 'Low Risk'; | SELECT COUNT(risk_category) FROM violations WHERE STRFTIME('%Y', `date`) = '2014' AND risk_category = 'Low 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 | Please list the titles of all the podcasts under the category "arts-performing-arts". | category 'arts-performing-arts' refers to category = 'arts-performing-arts'; | SELECT DISTINCT T2.title FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'arts-performing-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 | Which brand in 2012 has the lowest star rating and contains cane sugar as well as honey? | brand refers to BrandName; in 2012 refers to ReviewDate LIKE '2012%'; lowest star rating refers to MIN(StarRating); contains cane sugar as well as honey refers to CaneSugar = 'TRUE' AND Honey = 'TRUE'; | SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CaneSugar = 'TRUE' AND T1.Honey = 'TRUE' AND T2.StarRating = 1 AND T2.ReviewDate LIKE '2012%' | 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
); |
disney | How many PG adventure movies did Ron Clements direct? | Ron Clements refers to director = 'Ron Clements'; PG is an abbreviation for parental guidance and refers to MPAA_rating = 'PG'; adventure movie refers to genre = 'Adventure'; | SELECT COUNT(*) FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Ron Clements' AND T2.MPAA_rating = 'PG' AND T2.genre = 'Adventure' | CREATE TABLE movies_total_gross
(
MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0
release_date TEXT, --
total_gross TEXT, --
foreign key (movie_title) references characters(movie_title),
movie_title TEXT, --
genre TEXT, -- Example Values: `Musical`, `Adventure`, `Drama`, `Comedy`, `` | Value Statics: Total count 579 - Distinct count 13 - Null count 0
inflation_adjusted_gross TEXT, --
primary key (movie_title, release_date),
);
CREATE TABLE voice-actors
(
movie TEXT, --
foreign key (movie) references characters(movie_title),
character TEXT primary key,
"voice-actor" TEXT, --
);
CREATE TABLE director
(
director TEXT, --
name TEXT primary key,
foreign key (name) references characters(movie_title),
);
CREATE TABLE characters
(
villian TEXT, --
hero TEXT, --
foreign key (hero) references "voice-actors"(character),
release_date TEXT, --
song TEXT, --
movie_title TEXT primary key,
);
CREATE TABLE revenue
(
Year INTEGER primary key,
"Disney Consumer Products[NI 2]" REAL, --
Total INTEGER, --
"Studio Entertainment[NI 1]" REAL, --
"Disney Media Networks" TEXT, --
"Walt Disney Parks and Resorts" REAL, --
"Disney Interactive[NI 3][Rev 1]" INTEGER, -- Example Values: `174`, `260`, `206`, `368`, `719` | Value Statics: Total count 12 - Distinct count 12 - Null count 14
); |
public_review_platform | Find the location of businesses that have business hours from 8 am to 9 pm every Friday. | location of businesses refers to city and state; business hours from 8 am to 9 pm refers to opening_time = '8AM', closing_time = '9PM'; every Friday refers to day_of_week = 'Friday' | SELECT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.closing_time LIKE '9PM' AND T2.opening_time LIKE '8AM' AND T3.day_of_week LIKE 'Friday' GROUP BY T1.city | 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 | Among the lists created in 2016, which is the list that was updated most recently. | created in 2016 refers to list_creation_timestamp_utc like '2016%'; updated most recently refers to MAX(list_update_timestamp_utc) | SELECT list_title FROM lists WHERE strftime('%Y', list_update_timestamp_utc) = '2016' 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 | What is the total number of businesses with a tax code H25? | null | SELECT COUNT(tax_code) FROM businesses WHERE tax_code = 'H25' | 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 | Which category is the podcast "Scaling Global" under? | "Scaling Global" is the title of podcast | SELECT category FROM categories WHERE podcast_id IN ( SELECT podcast_id FROM podcasts WHERE title = 'Scaling Global' ) | 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 were made to purchase a bottle of beer using American Express? | bottle of beer refers to ContainerType = 'Bottle'; American Express refers to CreditCardType = 'American Express'; | SELECT COUNT(T1.RootBeerID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID WHERE T1.ContainerType = 'Bottle' AND T2.CreditCardType = 'American Express' | 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 female athletes are from the Philippines? | female athletes refer to id where gender = 'F'; from the Philippines region_name = 'Philippines'; | SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Philippines' AND T3.gender = 'F' | 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 | List down the owner's name with a zip code 94104. | zip code 94104 refers to owner_zip = '94104'; | SELECT DISTINCT owner_name FROM businesses WHERE owner_zip = '94104' | 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 content of the review under the title "really interesting!" and is created on 2018-04-24 at 12:05:16? | "really interesting" is the title of review; created on 2018-04-24 at 12:05:16 refers to created_at = '2018-04-24T12:05:16-07:00' | SELECT content FROM reviews WHERE title = 'really interesting!' AND created_at = '2018-04-24T12:05:16-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, --
); |
beer_factory | What is the amount difference between the bottles of root beer sold from Louisiana and Missouri? | difference = SUBTRACT(COUNT(ContainerType = 'Bottle' WHERE State = 'LA'), COUNT(ContainerType = 'Bottle' State = 'MO')); bottles refers to ContainerType = 'Bottle'; Louisiana refers to State = 'LA'; Missouri refers to State = 'MO'; | SELECT ( SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.State = 'LA' AND T1.ContainerType = 'Bottle' ) - ( SELECT COUNT(T3.BrandID) FROM rootbeer AS T3 INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.State = 'MO' AND T3.ContainerType = 'Bottle' ) AS DIFFERENCE | 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 athletes are there in the region where Clara Hughes is from? | null | SELECT COUNT(person_id) FROM person_region WHERE region_id = ( SELECT T1.region_id FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T2.full_name = 'Clara Hughes' ) | 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, --
); |
disney | Who is the villain in the movie "The Great Mouse Detective"? | The Great Mouse Detective refers to movie_title = 'The Great Mouse Detective'; | SELECT villian FROM characters WHERE movie_title = 'The Great Mouse Detective' | CREATE TABLE movies_total_gross
(
MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0
release_date TEXT, --
total_gross TEXT, --
foreign key (movie_title) references characters(movie_title),
movie_title TEXT, --
genre TEXT, -- Example Values: `Musical`, `Adventure`, `Drama`, `Comedy`, `` | Value Statics: Total count 579 - Distinct count 13 - Null count 0
inflation_adjusted_gross TEXT, --
primary key (movie_title, release_date),
);
CREATE TABLE voice-actors
(
movie TEXT, --
foreign key (movie) references characters(movie_title),
character TEXT primary key,
"voice-actor" TEXT, --
);
CREATE TABLE director
(
director TEXT, --
name TEXT primary key,
foreign key (name) references characters(movie_title),
);
CREATE TABLE characters
(
villian TEXT, --
hero TEXT, --
foreign key (hero) references "voice-actors"(character),
release_date TEXT, --
song TEXT, --
movie_title TEXT primary key,
);
CREATE TABLE revenue
(
Year INTEGER primary key,
"Disney Consumer Products[NI 2]" REAL, --
Total INTEGER, --
"Studio Entertainment[NI 1]" REAL, --
"Disney Media Networks" TEXT, --
"Walt Disney Parks and Resorts" REAL, --
"Disney Interactive[NI 3][Rev 1]" INTEGER, -- Example Values: `174`, `260`, `206`, `368`, `719` | Value Statics: Total count 12 - Distinct count 12 - Null count 14
); |
public_review_platform | Please list the business IDs of all the Yelp_Businesses that are good for kids. | good for kids refers to attribute_name = 'Good for Kids' and attribute_value = 'true'
| SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Good for Kids' AND T2.attribute_value LIKE '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
); |
movie_platform | Between 1970 to 1980, how many movies with a popularity of more than 11,000 were released? | Between 1970 to 1980 refers to movie_release_year between 1970 and 1980; popularity of more than 11,000 refers movie_popularity >11000 | SELECT COUNT(movie_id) FROM movies WHERE movie_release_year BETWEEN '1970' AND '1980' AND movie_popularity > 11000 | 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 of the businesses are located at 1825 POST St #223, San Francisco? | 1825 POST St #223 refers to address = '1825 POST St #223', San Francisco is the name of the city; | SELECT COUNT(business_id) FROM businesses WHERE address = '1825 POST St #223' AND 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 | What percentage of podcasts are "technology" podcasts? List all of them. | "technology" podcast refers to category = 'technology'; percentage = Divide (Count (podcast_id (category = 'technology')), Count (podcast_id)) * 100 | SELECT CAST(SUM(CASE WHEN T1.category = 'technology' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.title) OR '%' "percentage" FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id | 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 location of the Sac State American River Courtyard? | precise location = Latitude, Longitude; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; | SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State American River Courtyard' | 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 athletes playing in Canoeing fall into overweight BMI category in the 2008 Summer games? | fall into overweight BMI category refers to DIVIDE(weight), MULTIPLY(height, height) < 30; Canoeing refers to a sport name; the 2008 Summer games refer to games_name = '2008 Summer'; | SELECT COUNT(T5.id) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id INNER JOIN competitor_event AS T3 ON T2.id = T3.event_id INNER JOIN games_competitor AS T4 ON T3.competitor_id = T4.id INNER JOIN person AS T5 ON T4.person_id = T5.id INNER JOIN games AS T6 ON T4.games_id = T6.id WHERE T1.sport_name = 'Canoeing' AND T6.games_name = '2008 Summer' AND T5.weight * 10000.0 / (T5.height * T5.height) BETWEEN 25.0 AND 30 | 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 business ID of the Yelp_Business with the highest Elitestar rating under the category "Food". | under the category "Food" refers to category_name = 'Food' | SELECT T2.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name LIKE 'Food' ORDER BY T3.stars DESC LIMIT 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
); |
movie_platform | Among all movies in the list, calculate the percentage of movies that were never been rated? | percentage of movies that were never been rated refers to DIVIDE(COUNT(main_movies.movie_id ! = main_ratings.movie_id),COUNT(movie_id)) | SELECT CAST(SUM(CASE WHEN T2.movie_id IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.movie_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id | 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 | List the names and business certificates of the eateries which got inspection score under 50. | eateries which got inspection score under 50 refer to business_id where score < 50; | SELECT T2.name, T2.business_id FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.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 | What is the average rating for the "crime-junkie" podcast? | "crime-junkie" podcast refers to title = 'crime-junkie'; average rating = Divide (Sum(rating), Count(rating)) | SELECT AVG(T2.rating) FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.title = 'Crime Junkie' | 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 businesses with a category of Accessories, what is the percentage of the business with less than 4 stars? | category of Accessories refers to category_name = 'Accessories'; percentage of the business with less than 4 stars = divide(count(Business.business_id(stars < 4)), count(Business.business_id)) * 100% | SELECT CAST(SUM(CASE WHEN T1.stars < 4 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) AS "percentage" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'Accessories' | 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 | List all movies rated by user 39115684. State the title, rating date and rating score. | user 39115684 refers to user_id = 39115684; title refers to movie_title; rating date refers to rating_timestamp_utc
| SELECT T2.movie_title, T1.rating_timestamp_utc, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 39115684 | 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 | List the eateries' names and addresses which had reinspection on 2nd February, 2015. | eateries which had reinspection on 2nd February, 2015 refer to business_id where date = '2015-02-02' and type = 'Reinspection/Followup'; | SELECT T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2015-02-02' AND T1.type = 'Reinspection/Followup' | 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 "Planet Money" have? | "Planet Money" is the title of podcast | SELECT COUNT(T2.podcast_id) FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.title = 'Planet Money' | 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 email address of the customer who made a purchase in transaction 100016? | email address refers to Email; transaction 100016 refers to TransactionID = 100016; | SELECT T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016' | 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 Men's 200 Metres Freestyle events did Ian James Thorpe compete in? | Men's 200 Metres Freestyle events refer to event_name = 'Swimming Men''s 200 metres Freestyle'; events compete in refers to event_id; | SELECT COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN event AS T4 ON T3.event_id = T4.id WHERE T1.full_name = 'Ian James Thorpe' AND T4.event_name LIKE 'Swimming Men%s 200 metres Freestyle' | 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 | Who were the owners of eateries which had highest health hazard by improper cooking time or temperatures? | owners of eateries refer to owner_name; highest health hazard by improper cooking time or temperatures refers to risk_category = 'High Risk' and description = 'Improper cooking time or temperatures'; | SELECT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.description = 'Improper cooking time or temperatures' | 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 content of the earliest review for the "Stuff You Should Know" podcast? | "Stuff You Should Know" is the title of podcast; earliest refers to Min(created_at) | SELECT T2.content FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.title = 'Stuff You Should Know' ORDER BY T2.created_at ASC LIMIT 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, --
); |
beer_factory | Please name any three root beer brands that have the highest market evaluation and acceptance. | root beer brands refers to BrandName; highest market evaluation and acceptance refers to MAX(COUNT(StarRating = 5)); | SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3 | 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 | What are the names of the cities where Carl Lewis Borack competed? | name of the cities refers to city_name | SELECT T4.city_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T1.full_name = 'Carl Lewis Borack' | 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 opening time of the active businesses in Chandler that has a medium review count. | active businesses refers to active = 'true'; in Chandler refers to city = 'Chandler' | SELECT DISTINCT T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city LIKE 'Chandler' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Medium' | 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 was the inspection type when El Aji Peruvian Restaurant got highest inspection score? | El Aji Peruvian Restaurant is the name of the business; highest inspection score refers to MAX(score); | SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'El Aji Peruvian Restaurant' ORDER BY T1.score 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 | List the urls for all the "fiction-science-fiction" podcasts. | fiction-science-fiction podcasts refers to category = 'fiction-science-fiction'; urls refers to itunes_url | SELECT itunes_url FROM podcasts WHERE podcast_id IN ( SELECT podcast_id FROM categories WHERE category = 'fiction-science-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 | Count the total quantity for sales from id 1 to 10. | sales from id 1 to 10 refers to SalesID BETWEEN 1 AND 10; | SELECT SUM(Quantity) FROM Sales WHERE SalesID BETWEEN 1 AND 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 | Which region is Yao Ming from? | region refers to region_name; | SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Yao Ming' | 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 | How many movies directed by Felipe Cazals was realeased on 1976? | directed by Felipe Cazals refers to director_name = 'Felipe Cazals' ; realeased on 1976 refers to movie_release_year = 1976 | SELECT COUNT(movie_id) FROM movies WHERE movie_release_year = 1976 AND director_name LIKE 'Felipe Cazals' | 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 | Among violations on 3rd June, 2014, describe any 5 names, located cities and tax codes of the eateries with high risk category. | eateries with high risk category refer to business_id where risk_category = 'High Risk'; 3rd June, 2014 refers to date = '2014-06-03'; | SELECT DISTINCT T2.name, T2.city, T2.tax_code FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.`date` = '2014-06-03' LIMIT 5 | 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 | Which category has the most reviews? | Most review refers to Max(Count(reviews.podcast_id)) | SELECT T1.category FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id GROUP BY T1.category ORDER BY COUNT(T2.podcast_id) DESC LIMIT 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, --
); |
beer_factory | Which location sold more bottles of beer? | location refers to LocationName; bottle of beer refers to ContainerType = 'Bottle'; location that sold more bottles of beer refers to MAX(COUNT(LocationID WHERE ContainerType = 'Bottle')); | SELECT T2.LocationName FROM rootbeer AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ContainerType = 'Bottle' GROUP BY T2.LocationID ORDER BY COUNT(T1.LocationID) DESC LIMIT 1 | 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 | What is the ratio male to female athletes in the 2012 Summer Olympic? | DIVIDE(COUNT(gender = 'M'), COUNT(gender = 'F')) where games_name = '2012 Summer'; | SELECT CAST(COUNT(CASE WHEN T3.gender = 'M' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) 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 = '2012 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 | Under which categories is Yelp_Business no. 1? | categories refers to category_name; Yelp_Business no.1 refers to business_id = 1 | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T2.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 | Provide the names, risk categories and descriptions for the eateries with violation type ID of 103111. | eateries refer to business_id; | SELECT T2.name, T1.risk_category, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = '103111' | 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 and categories of all the podcasts with a review that has "Absolutely fantastic" in it? | review refers to content; 'Absolutely fantastic' in it refers to content like '%Absolutely fantastic%' | SELECT T2.title, 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 T3.content LIKE '%Absolutely fantastic%' | 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 | What is the average height of male athletes playing basketball sport? | AVG(height) where sport_name = 'Basketball' and event_name = 'Basketball Men''s'; | SELECT AVG(T5.height) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id INNER JOIN competitor_event AS T3 ON T2.id = T3.event_id INNER JOIN games_competitor AS T4 ON T3.competitor_id = T4.id INNER JOIN person AS T5 ON T4.person_id = T5.id WHERE T1.sport_name = 'Basketball' AND T5.gender = 'M' | 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 | Describe the violation dates, risk categories, descriptions and names of the eateries under Jade Chocolates LLC. | eateries under Jade Chocolates LLC refer to business_id where owner_name = 'Jade Chocolates LLC'; | SELECT T1.`date`, T1.risk_category, T1.description, T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_name = 'Jade Chocolates LLC' | 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 podcasts reviewed by a reviewer who has a review titled "Inspired & On Fire!". | "Inspired & On Fire" refers to title of review | SELECT T1.title FROM podcasts AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.title = 'Inspired & On Fire!' | 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 sales ids are there for customer id 80? | null | SELECT COUNT(SalesID) FROM Sales WHERE CustomerID = 80 | 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 city was the 1992 Summer Olympic held? | city refers to city_name; 1992 Summer Olympic refers to games_name = '1992 Summer'; | SELECT T2.city_name 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 T3.games_name = '1992 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 | Which business in fashion category has the most review? | 'Fashion' is the category_name; most review refers to Max(Count(user_id)) | SELECT T3.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Reviews AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name LIKE 'Fashion' AND T1.category_id = 7 GROUP BY T3.business_id ORDER BY COUNT(T4.user_id) DESC LIMIT 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 | Provide eateries' IDs, names and addresses which were inspected on 30th July, 2016. | eateries' IDs inspected on 30th July, 2016 refer to business_id where business_id is not null and date = '2016-07-30'; | SELECT DISTINCT T2.business_id, T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.date = '2016-07-30' | 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 of the two-star reviews and their categories. | two-stars review refers to rating = 2 | SELECT T1.category FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.rating = 2 | 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 | How many users have joined Yelp since the year 2012? | since year 2012 refers to user_yelping_since_year = '2012' | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012 | 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 | List the inspection dates, scores and inspection types for the eateries with tax code AA. | eateries with tax code AA refer to business_id where tax_code = 'AA'; | SELECT T1.`date`, T1.score, T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.tax_code = 'AA' | 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 category for the "Moist Boys" podcast? | "Moist Boys" refers to title of podcast | SELECT category FROM categories WHERE podcast_id IN ( SELECT podcast_id FROM podcasts WHERE title = 'Moist Boys' ) | 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 root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products? | root beer brand refers to BrandName; not caffeinated refers to Caffeinated = 'FALSE'; not containing cane sugar refers to CaneSugar = 'FALSE'; total amount sold = SUM(PurchasePrice); | SELECT T1.BrandName, SUM(T3.PurchasePrice) 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.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName | 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
); |
public_review_platform | List out which business category that are most likely to have average good review in Arizona? | average good review refers to review_count > = 3; Arizona refers to state = 'AZ'; business category refers to category_name | SELECT DISTINCT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.state LIKE 'AZ' AND T1.review_stars >= 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 | Mention the violation type ID and description of high risk category for STARBUCKS. | STARBUCKS is the name of the business; high risk category refers to risk_category = 'High Risk'; | SELECT DISTINCT T1.violation_type_id, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'STARBUCKS' 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 | List all the cagetories for all the podcasts with "jessica" in the title. | podcast with 'jessica' in title refers to title like '%jessica%' | SELECT category FROM categories WHERE podcast_id IN ( SELECT podcast_id FROM podcasts WHERE title LIKE '%jessica%' ) | 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 product id for products with the highest quantity. | highest quantity refers to MAX(Quantity); | SELECT DISTINCT ProductID FROM Sales WHERE Quantity = ( SELECT MAX(Quantity) FROM Sales ) | 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 | Find out which business is opened for 24/7 and list out what is the business attribute. | opened for 24/7 refers to Business_Hours WHERE opening_time = closing_time and business_id COUNT(day_id) = 7; business attribute refers to attribute_name | SELECT T5.attribute_name 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 INNER JOIN Business_Attributes AS T4 ON T3.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T2.day_id LIKE '1' AND '2' AND '3' AND '4' AND '5' AND '6' AND '7' AND T1.opening_time = T1.closing_time GROUP BY T5.attribute_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
); |
food_inspection | Describe the inspection types and violation descriptions under moderate risk category for ART's CAFÉ. | ART's CAFÉ is the name of the business; moderate risk category refers to risk_category = 'Moderate Risk'; | SELECT DISTINCT T2.type, T1.description FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'ART''S CAFÉ' AND T1.risk_category = 'Moderate 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 | Which "music" podcast has the longest title? | music podcasts refers to category = 'music'; longest title refers to title = Max(length(title)) | SELECT T2.title FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'music' ORDER BY LENGTH(T2.title) DESC LIMIT 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, --
); |
beer_factory | What is the transaction ratio being made at Sac State American River Courtyard and Sac State Union? | transaction ratio = DIVIDE(SUM(TransactionID WHERE LocationName = 'Sac State American River Courtyard'), SUM(TransactionID WHERE LocationName = 'Sac State Union')); Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; Sac State Union refers to LocationName = 'Sac State Union'; | SELECT CAST(COUNT(CASE WHEN T2.LocationName = 'Sac State American River Courtyard' THEN T1.TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(CASE WHEN T2.LocationName = 'Sac State Union' THEN T1.TransactionID ELSE NULL END) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID | 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
); |
movie_platform | For all the users who gave "A Shot in the Dark" a rating, how many percent of them is a paying subscriber? | "A Shot in the Dark" refers to movie_title = 'A Shot in the Dark'; paying subscriber refers to user_has_payment_method = 1; percentage refers to DIVIDE(COUNT(user_has_payment_method = 1),COUNT(user_has_payment_method))*100 | SELECT CAST(SUM(CASE WHEN T1.user_has_payment_method = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'A Shot in the Dark' | 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 | When did eateries from San Bruno city get highest score in inspection? | eateries represent business; highest score in inspection refers to score = 100; | SELECT T1.`date` FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'SAN BRUNO' ORDER BY T1.score 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 | What is the review with the title "Hosts bring the show down" for? | "Hosts bring the show down" refers to title of review | SELECT title FROM podcasts WHERE podcast_id = ( SELECT podcast_id FROM reviews WHERE title = 'Hosts bring the show down' ) | 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 names of free gifts. | free gifts refers to Price = 0; | SELECT Name FROM Products WHERE 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 | Which summer Olympic have the highest and lowest number of participants? | the highest number of participants refers to MAX(COUNT(person_id)); the lowest number of participants refers to MIN(COUNT(person_id)); Which summer Olympic refers to games_name where season = 'Summer'; | SELECT ( SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' GROUP BY T1.games_year ORDER BY COUNT(T2.person_id) DESC LIMIT 1 ) AS HIGHEST , ( SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' GROUP BY T1.games_year ORDER BY COUNT(T2.person_id) LIMIT 1 ) AS LOWEST | 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 | Provide eateries' IDs, risk categories and descriptions with violation ID of 103101. | eateries' IDs refer to business_id; violation ID of 103101 refers to violation_type_id = '103101'; | SELECT business_id, risk_category, description FROM violations WHERE violation_type_id = '103101' | 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 longest review? | review refers to content; longest review refers to Max(content) | SELECT title FROM reviews ORDER BY LENGTH(content) DESC LIMIT 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, --
); |
public_review_platform | How many businesses in Phoenix, Arizona is attributed to waiter service? | 'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services' | SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.city LIKE 'Phoenix' AND T3.attribute_name LIKE 'waiter_service' AND T2.attribute_id = 2 | 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 eateries had low risk for violation with unpermitted food facility description? | eateries represent business; low risk for violation refers to risk_category = 'Low Risk'; | SELECT COUNT(DISTINCT business_id) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Unpermitted food facility' | 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 least common category? | least common category refers to Min(Count(category)) | SELECT category FROM categories GROUP BY category ORDER BY COUNT(podcast_id) ASC LIMIT 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 | Calculate the average quantity per sales from sales id 20 to 30. | average quantity = AVG(Quantity); SalesID BETWEEN 20 AND 30; | SELECT AVG(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30 | 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
); |
food_inspection | List down the eateries' IDs with structural inspection type in February 2016. | eateries' IDs refer to business_id; structural inspection type refers to inspections WHERE type = 'Structural Inspection'; in February 2016 refers to year(date) = 2016 and month(date) = 2; | SELECT business_id FROM inspections WHERE type = 'Structural Inspection' AND `date` LIKE '2016-02%' | 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 podcasts in comedy category? | comedy category refers to category = 'comedy'; average rating = Divide (Sum(rating), Count(podcast_id)) | SELECT AVG(T2.rating) FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'comedy' | 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 name of the product with the lowest quantity? | lowest quantity refers to MIN(Quantity); | SELECT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Quantity 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 | How many users received high compliment type in photo? | high compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1 | SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_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 | How many eateries got highest inspection in 2013? | eateries got highest inspection score in 2013 refer to business_id from inspections where score = 100 and year(date) = 2013; | SELECT COUNT(DISTINCT business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' AND score = ( SELECT MAX(score) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' ) | 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 category and itune url of the title "Scaling Global"? | null | SELECT T1.category, T2.itunes_url FROM categories AS T1 INNER JOIN podcasts AS T2 ON T2.podcast_id = T1.podcast_id WHERE T2.title = 'Scaling Global' | 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 product ids have the lowest price? | lowest price refers to MIN(Price); | SELECT COUNT(DISTINCT ProductID) FROM Products WHERE Price = ( SELECT MAX(Price) FROM Products ) | 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 attributes ID owned by business ID 2? | null | SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2 | 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 | Which establishment has the highest number of inspections done? Give the name of the establishment and calculate for its average score per inspection. | establishment refers to business_id; the highest number of inspections refers to MAX(COUNT(business_id)); avg(score); | SELECT T2.name, AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.name ORDER BY COUNT(T2.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 | Which titles have the content "love" but the category is art produced between 2018 and 2019. | content love refers to content = 'love'; 'arts' is the category; produced between 2018 and 2019 refers to year (created_at) BETWEEN 2018 and 2019 | SELECT DISTINCT T2.title FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE (T2.created_at LIKE '2018-%' AND T1.category = 'arts' AND T2.content LIKE '%love%') OR (T2.created_at LIKE '2019-%' AND T1.category = 'arts' AND T2.content LIKE '%love%') | 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 product name for products from id 1 to 10. | products from id 1 to 10 refers to ProductID BETWEEN 1 AND 10; | SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 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
); |
food_inspection | Among the top 5 owners with highest number of establishments, which owner has the highest number of high risk violations? Give the name of the owner. | 5 owners with highest number of establishments refer to owner_name where MAX(COUNT(business_id)) LIMIT 5; the highest number of high risk violations refers to MAX(COUNT(risk_category = 'High Risk')); | SELECT T4.owner_name FROM violations AS T3 INNER JOIN businesses AS T4 ON T3.business_id = T4.business_id INNER JOIN ( SELECT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T1.business_id) DESC LIMIT 5 ) AS T5 ON T4.owner_name = T5.owner_name WHERE T3.risk_category = 'High Risk' GROUP BY T4.owner_name ORDER BY COUNT(T3.risk_category) 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 the names of the podcasts in the music category that have a rating greater than 3. | music category refers to category = 'music'; rating greater than 3 refers to rating > 3; name of the podcast refers to title | SELECT DISTINCT T2.title FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'music' 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 | Please list all the categories of the Yelp_Business in Arizona. | categories refers to category_name; in Arizona refers to state = 'AZ' | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.state LIKE 'AZ' GROUP BY T1.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 | For all the movies that were released in 1995, how many lower than 3 ratings did the most popularity movie had? | released in 1995 refers to movie_release_year = '1995'; lower than 3 ratings refers to rating_score <3; most popularity movie refers to MAX(movie_popularity) | SELECT COUNT(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score < 3 AND T2.movie_release_year = 1995 AND T2.movie_popularity = ( SELECT MAX(movie_popularity) FROM movies WHERE movie_release_year = 1995 ) | 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 highest number of low risk violations in 2014? | establishment with the highest number of low risk violations refers to business_id where MAX(COUNT(risk_category = 'Low Risk')); year(date) = 2014; | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2014' AND T1.risk_category = 'Low Risk' GROUP BY T2.name ORDER BY COUNT(T2.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 | Provide the names of podcasts in the art category in 2018. | art category refers to category = 'arts'; in 2018 refers to created_at like '2018%'; name of podcast refers to title | SELECT DISTINCT T2.title FROM categories AS T1 INNER JOIN reviews AS T2 ON T2.podcast_id = T1.podcast_id WHERE T1.category = 'arts' AND T2.created_at LIKE '2018-%' | 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, --
); |
food_inspection | What is the average score of the establishments owned by the owner with the highest number of establishments? | average score refers avg(score); owner with the highest number of establishments refers to owner_name where MAX(COUNT(business_id)); | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T2.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 | What is the average rating of all the podcasts in category art? | category art refers to category = 'arts'; average rating = Divide (Sum (rating), Count (podcast_id)) | SELECT AVG(T2.rating) 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, --
); |
sales | Calculate the total sales ids that were sales of Flat Washer 8. | Flat Washer 8' is name of product; | SELECT COUNT(T1.SalesID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Flat Washer 8' | 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 Yelp_Businesses in Arizona, how many of them do not provide alcohol? | Arizona refers to state = 'AZ'; do not provide alcohol refers to attribute_name = 'Alcohol' and attribute_value = 'none' | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none' 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
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.