Referential Integrity in E/R Diagrams

Referential Integrity in E/R Diagrams

We can extend the arrow notation in E/R diagrams to show whether a relationship is expected to support referential integrity in one or more directions. Suppose R is a relationship from entity set E to entity set F. We shall use a rounded arrowhead pointing to F to show not only that the relationship is many-one or one-one from E to F, but that the entity of set F related to a given entity of set E is required to exist. The same concept applies when R is a relationship among more than two entity sets.

Example : The following figure shows some suitable referential integrity constraints among the entity sets Movies, Studios, and Presidents. These entity sets and relationships were first introduced in "Entity-Relationship Diagrams" figure and "Multiplicity of Binary E/R Relationships" figure. We see a rounded arrow entering Studios from relationship Owns. That arrow expresses the referential integrity constraint that every movie must be owned by one studio, and this studio exists in the Studios entity set.

E/R diagram showing referential integrity constraints

Likewise, we see a rounded arrow entering Studios from Runs. That arrow expresses the referential integrity constraint that every president runs a studio that is present in the Studios entity set.

Note that the arrow to Presidents from Runs remains a pointed arrow. That choice reflects a reasonable assumption about the relationship between studios and their presidents. If a studio discontinues to exist, its president can no longer be called a (studio) president, so we would expect the president of the studio to be deleted from the entity set Presidents. Therefore there is a rounded arrow to Studios. On the other hand, if a president were deleted from the database, the studio would continue to exist. In this way, we place an ordinary, pointed arrow to Presidents, showing that each studio has at most one president, but might have no president at some time.



Tags