Multiway Relationships

Multiway Relationships

The E/R model makes it easy to describe relationships involving more than two entity sets. In practice, ternary (three-way) or higher-degree relationships are infrequent, but they are rarely necessary to reflect the true state of affairs. A multiway relationship in an E/R diagram is represented by lines from the relationship diamond to each of the involved entity sets.

Example : In the following figure is a relationship Contracts that involves a studio, a star, and a movie. This relationship represents that a studio has contracted with a specific star to act in a specific movie. Generally, the value of an E/R relationship can be thought of as a relationship set of tuples whose elements are the entities participating in the relationship, as we discussed in "Instances of an E/R Diagram".

a three-way relationship

In this way relationship Contracts can be explained by triples of the form

(studio, star, movie)

In multiway relationships, an arrow pointing to an entity set E means that if we select one entity from each of the other entity sets in the relationship, those entities are related to at most one entity in E. (Note that this rule expresses the notation used for many-one, binary relationships.) In above figure, we have an arrow pointing to entity set Studios, indicating that for a specific star and movie, there is only one studio with which the star has contracted for that movie. However, there are no arrows pointing to entity sets Stars or Movies. A studio may contract with several stars for a movie, and a star may contract with one studio for more than one movie.

Implications Among Relationship Types

We should be well-informed that a many-one relationship is a special case of a many-many relationship, and a one-one relationship is a special case of a many-one  relationship. That is, any useful property of many-many relationships applies to many-one relationships as well, and a useful property of many-one relationships holds for one-one relationships too. For instance, a data structure for representing many-one relationships will work for one-one relationships, though it might not work for many-many relationships.



Tags