Representing Keys in the E/R Model

Representing Keys in the E/R Model

In our E/R diagram notation, we underline the attributes belonging to a key for an entity set. For instance, the following figure reproduces our E/R diagram for movies, stars, and studios from "Entity-Relationship Diagrams" figure, but with key attributes underlined. Attribute name is the key for Stars. Similarly, Studios has a key consisting of only its own attribute name. These choices are consistent with the discussion in "Keys in the E/R Model" example (a).

E/R diagram; keys are indicated by underlines

The attributes title and year together make the key for Movies, as we discussed in "Keys in the E/R Model" example (a). Note that when various attributes are underlined, as in above figure, then they are each members of the key. There is no notation for representing the situation where there are several keys for an entity set; we underline only the primary key. You should also be aware that in some unusual situations, the attributes forming the key for an entity set do not all belong to the entity set itself. We shall postpone this matter, called "weak entity sets" until "Weak Entity Sets".


Tags