Binary Relationship Type Constraints
In this lesson, we will look at the two major constraints on binary relationship types.
Binary relationship type constraints
In the previous lesson, we learned that there is a degree of relationship that exists between entities. However, sometimes this degree is affected by the constraints of the organization or a particular scenario. Consider, for example, a case where the company has a rule that each employee must work for exactly one department. In this and similar cases, we would like to describe this constraint in our schema. Such rules are usually called the “constraints” on the relationship types that exist in our schema.
These constraints limit the possible combinations of entities that may participate in the corresponding relationship set. There are two main types of binary relationship constraints: mapping cardinality and participation.
Let’s look at each one of them in detail below.
Mapping cardinality
Mapping cardinality describes the maximum number of entities that a given entity can be associated with via a relationship. In this lesson, we consider only the cardinality constraint for the binary relationship. The possible cardinality for binary relationship types are One to One (1:1), One to Many (1:N), and Many to Many (M:N).
The one to one relationship
Given two entity sets A and B, there is a one to one relationship between A and B if each entity in set A is associated with at most one entity in set B and vice versa.
An example of a 1:1 binary relationship is MANAGES, which relates a DEPARTMENT entity to the EMPLOYEE entity. This represents the mini-world constraints that at any point in time, an employee can manage at most one department and a department can have at most one manager. This is represented in the diagram below:
Get hands-on with 1200+ tech skills courses.