Kinds of Relationships
When modeling a relationship between entities, it is important to determine both directions of the relationship. After both sides of the relationship have been determined, we end up with three main kinds of relationships. If both sides of the relationship have a degree of one and only one, it is called a “one-to-one” or “1-to-1” relationship. As we will find out later, one-to-one relationships are rare. We do not have one in our data model.
If one side has a degree of “one or many,” and the other side has a degree of “one and only one,” the relationship is a “one-to-many” or “1-to-M” relationship. All the relationships in our current data model are one-to-many relationships. This is to be expected since one-to-many relationships are the most common.
The final kind of relationship is where both sides are
“one or many” relationships. These
are called
“many-to-many”
or “M-to-M” relationships. In an
earlier version of our data model, the
Artist/CD relationship was a
many-to-many relationship.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access