Você está na página 1de 2

Database Design and the E-R Model

1. Consider a tiny social network containing high school students and their "crushes" (desired
romantic relationships). Each student may have a crush on at most one other student, and
associated with each crush is the length of time the crush has been going on. Students have a
name and a grade, and names are unique. Draw an ER diagram that models this information.
Make sure to capture the asymmetry and multiplicity of the crush relationship.

2. Consider a class Book with four subclasses: Anthology, Fiction, Children, and Nonfiction. Is the
sub classing relationship overlapping or disjoint (exclusive)? Is it complete or incomplete
(partial)?

Overlapping (Fiction and Children)


complete (all books are Fiction or Nonfiction).

3. This question involves constructing a (simplified) entity-relationship diagram for National


Hockey League statistics over a number of years. Your model must indicate relationship
cardinalities using both graphical notation (e.g. arrow heads, double lines). Reduce the ER
diagram to relational schema thereafter.
a) Each team has an identifying code and a name.
b) Each team has players. Each player has an identifying code, a name, and a birthdate. Your
model should handle the dates when a player started and ended playing for a team (note
that a player can be traded to another team).
c) Your model should have a reflexive relationship set, game, that deals with games played
between teams. Use a relationship set, goal, to record the players who scored goals in a
particular game (ignore assists and penalties, since they can be handled similarly). Note
that goal is a relationship between an entity set and a relationship set, and so you will
need aggregation to properly deal with this in your E-R diagram.
d) Your model should record the date and score of each game as well as the time and period
(e.g. 14:51, third period) of each goal. One of these is a derived attribute; indicate it
appropriately in your model.

4. You will work with video information, user information, ratings of videos, and users’, social
network.
a) Each video has an id, title, release date, producer, color (e.g., black white, or Eastman
color), and which country it comes from.
b) There are 3 categories of videos: movies, TV episodes and collections.
c) Different TV episodes are different videos. A TV episode belongs to a collection and has
an episode number.
d) Each collection can contain one or more seasons. For each collection, we want to
additionally record these season numbers. E.g. we want to model that a collection titled
‘Seinfeld: The Early Episodes’ contains seasons ‘1’ and ‘2’.
e) Movies don’t have different parts e.g. ‘Harry Potter I’ and ‘Harry Potter II’ are different
movies.
f) One or more directors direct each movie or a TV episode. And each director is identified
by an id and has name and age.
g) Each video could belong to one or more genre (e.g., action, comedy, romantic, horror,
thriller, and historical).
h) VTFlix needs to keep the track of user ratings for each video (e.g., 1-5 and 1 for ‘I hate
it!’, to 5, for ‘I love it!’). A particular user rates a particular video at a particular time.
i) One user can rate the same video multiple times.
j) You also need to record the information of performers in the videos. They are identified
by id, name, age, and whether they are actors or actresses.
k) Each video gets a MPAA certification [Motion Picture Association of America]. Each
certification has a unique name and content rating. E.g. “PG-13” rating means that some
content may be inappropriate for children under the age of 13. Here the name of the
certification would be ‘PG-13’ and content rating would be‘Inappropriate for children
under the age of 13’.
l) Each user is identified by id and has name, gender, age, and location.
m) There is also the social network between users. Users can send ‘friend-requests’ to other
users. Such requests can be accepted or ignored. Once accepted, the two users are
considered ‘friends. If ignore, the user can send the request again. We want to
additionally store when the requests were sent (timestamp), the result of the requests
and when the request was answered (timestamp).

4.1 Draw an ER diagram for this database. Make sure to indicate primary keys, cardinality
constraints, weak entities (if any), and participation constraints. There might be extra constraints
which cannot be captured by the E/R diagram, make sure you mention them below the diagram.
List any assumptions you make in the process. Hint: The E/R diagram should contain at least ~6
(may be more) entities;

4.2 For each entity set and relationship, write a short description in plain English of what it
represents or models. One or two sentences per entity set and relationship is enough. These
descriptions are primarily to help us understand that you are modeling the VTFlix database
correctly.

4.3 Translate the ER diagram in 4.1 into relational schemas.

Você também pode gostar