BCA / B.Tech 10 min read

What is a Relationship Set?

Relationship Set in DBMS:

A Relationship Set is a collection of relationships of the same type among two or more entity sets. In an ER diagram, it is represented by a diamond shape. The Degree of a relationship set is the number of entity sets that participate in the relationship.

Types of Relationship Sets based on Degree:
  • Unary Relationship (Degree 1): A relationship within a single entity set. This is also called a recursive relationship. For example, an `Employee` entity set where one employee can manage another employee.
  • Binary Relationship (Degree 2): The most common type, involving a relationship between two entity sets. For example, a `Student` entity set and a `Course` entity set are related via "enrolls in."
  • Ternary Relationship (Degree 3): A relationship involving three entity sets. For example, a `Doctor` prescribes a `Medicine` for a `Patient`.

Relationships also have cardinality (one-to-one, one-to-many, many-to-many) which defines the number of entities that can be associated with another entity through the relationship set.