Degree of Relationship in DBMS
In this article, we explore the concept of 'degree of relationship' in Database Management Systems (DBMS). This term refers to the number of entities involved in a relationship. Using Entity-Relationship (E-R) diagrams, we'll illustrate how different entities like employees, departments, and projects interconnect within a database. Understanding these relationships is crucial for effective database design, and our guide simplifies this complex topic with clear examples and diagrams.
The above figure illustrates an E-R diagram.
There are 4 types of degrees of relationship based on the involved entities-
- Unary relationship
- Binary relationship
- Ternary relationship
- N-ary relationship
Unary Relationship
As the name suggests, in a unary relationship, only one entity is involved. There is only a single entity set, i.e., the association is between a single entity. Here, the degree of relationship is 1. The unary relationship is also known as a recursive relationship.
Example: In the college presidential elections, a president is chosen among the students. He/she leads the entire community and looks after the student-centric activities. Even though he/she is the president, after all she is a student. So we can say that there is only one entity i.e., the student.
The figure illustrates the unary relationship.
Binary Relationship
You must have rightly guessed that in a binary relationship, there are two entities involved. There are two entities that are participating in the relationship. The degree of relationship is 2. This is the most common type of relationship.
Example- Each Indian citizen has their own Aadhar Card so we can say that citizen and Aadhar Card are two entities involved.
The above figure illustrates the binary relationship.
Ternary Relationship
In a ternary relationship, there are three entities involved. There are three entities that are participating in the relationship created. The degree of the relationship is 3. As in this relationship, the number of entities increases, it is a bit difficult to convert it to a relational table.
Example- A student studies in a school, so student and school are two entities. But, the same student also takes some coaching classes, so he has a relation with coaching as well, so the coaching class is also an entity. Here as there are 3 entities, so it is a ternary relationship.
The figure illustrates the ternary relationship.
N-ary Relationship
This is a generalized form of a relationship when the n number of total entities are participating. When there is an n number of involved entities, we can say that they have an N-ary relationship. As there are many entities involved, it is hard to convert them to a relational table. It is an uncommon relationship that is not as widely used as a binary relationship. The degree of relationship is 'n'.
Example- Let us consider the example of a university. It has many entities like students, teachers, affiliated colleges, courses, etc. Here, there are many entities associated with the university.
The above figure illustrates the N-ary relationship.
Conclusion
- In DBMS, the degree of relationship is the number of entities that have taken part in the relationship.
- We can analyze the E-R diagram and tell the degree of relationship between various entities.
- The degree of relationship in DBMS can be categorized as a Unary, Binary, Ternary, or N-ary relationship.
- In a unary relationship, only one entity is involved. Here, the degree of relationship is 1. The unary relationship is also known as a recursive relationship.
- In a binary relationship, there are two entities involved. The degree of relationship is 2.
- In a ternary relationship, there are three entities involved. The degree of relationship is 3.
- In an N-ary relationship, there is an n number of involved entities. The degree of relationship is 'n'.