Homework 1 Solution
Homework 1 Solution
• Each TV show has a unique name, a rating (1-10), and a set of producers.
• A TV show may have multiple (i.e. zero or more) seasons, and for each
season we keep track of the season number and the release date.
• A season consists of multiple (i.e. zero or more) episodes. For each
episode, we store its number within the season, and the length.
• An actor has a unique name and we keep track of the date of birth. Each
actor may play a character in an episode, and, in that case, we store the
name of the character played by the actor.
• For each user of the streaming service, we store a unique user ID and a
credit card number.
• A user can add TV shows to the user’s wish list.
• We associate each TV show with one genre, which has a unique name
(e.g., drama, thriller, etc) and a description.
• The service provides the option for each user to subscribe to any number
of genres.
Design an ER diagram that models the above aspects of the streaming service.
Make sure to identify weak entities and annotate the cardinality of the relationships
between entities. You must state any additional assumptions that you make. [30
marks]
Question A1)
wish list n 1 n
TVs how Season
n Nome Rating Producer
SIuynter Date
y
i
m wish list n 1 n
TVs how Season
y n
n character p
n Genre n Episode
User m
m plays.in
subscribe
n
I GName y
Description character
UID CCNumber ENenekee
n Length
User m n Genre M Episode
plays.in
subscribe
I GName Description
UID CCNumber Actor M
Ekunekee Length
Name DOB
Actor
Name DOB
Alternative (for lower-right part of ER diagram):
Alternative Solution
character
e
Name
n Episode
plays.in
ENenekee Length
m
Actor
Name DOB
Question A2)
Question B)
1) Given {A}→{D,E}
2) Applying decomposition rule to 1): {A} à {E}
3) Given {D}→{I,J,G}
4) Applying decomposition rule to 3): {D}→{G}
5) Applying decomposition rule to 1): {A}→{D}
6) Applying transitive rule to 5) and 4): {A}→{G}
7) Applying union rule to 2) and 6): {A}→{E,G}
• R2,1(A,D,E)
• R2,2(D,G,I,J)
We decompose R4 into:
• R4,1(B,F)
• R4,2(F,H)