Primary key constraints
- All attributes of a primary key are underlined.

- Note that the primary key of an entity with an
isarelationship is at the root.
Movies, stars, and studios

Students applying to colleges. (Draw your own diagram here.)
Movies entity set.Relationship vs Relationship set e.g. Stars-in is a relationsip between the Movies and Stars entities, and the following is an example of a relationship set:
| Movies | Stars |
|---|---|
| Basic Instinct | Sharon Stone |
| Total Recall | Arnold Schwarzenegger |
| Total Recall | Sharon Stone |
A recursive relationship occurs when the same entity set participates in a relationship more than once.



(studio1, studio2, star, movie) in the relationship, studio2 contracts studio1 for the use of studio1’s star by studio2 for the movie.

salary attribute on the Contracts relationship of the diagram on last slide results in this diagram:


A of an entity set B may have special attributes that other members of B do not have. In such a case we say that A is a subclass of B, or A isa B. Instead of a diamond, the isa relationship is drawn as a triangle with its base on the subclass and pointing to the superclass, e.g.
isa relationship is one-one even though no arrowheads are drawn in the diagram.isa relationships must form a tree with one root.isa relationship has a component in each class starting from its deepest class and going up all the way to the root.The design must be faithful to specifications. The designer needs to know about the real world she is modeling. Which of these is faithful?

Redundancy should be avoided. What’s wrong?


isa relationship is at the root.



isa relationships.In the diagram

we can combine the relations Movies(title, year, length, genre) and Owns(title, year, studioName) into one relation Movies(title, year, length, genre, studioName).
Rename attributes, if necessary, to avoid name conflicts.
E.g., the diagram

converts to only two relations
Studios(name, addr)
Crews(number, studioName, crewChief)For this diagram the E/R viewpoint gives 
Movies(title, year, length, genre)
MurderMysteries(title, year, weapon)
Cartoons(title, year)OO viewpoint gives
Movies(title, year, length, genre)
MoviesC(title, year, length, genre)
MurderMM(title, year, length, genre, weapon)
MurderCMM(title, year, length, genre, weapon)Using null values gives
Movies(title, year, length, genre, weapon)