Degree of Relationship in DBMS

Challenge Inside! : Find out where you stand! Try quiz, solve problems & win rewards!

Learn via video course

DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
By Srikanth Varma
Free
star5
Enrolled: 1000
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
Srikanth Varma
Free
5
icon_usercirclecheck-01Enrolled: 1000
Start Learning

Overview

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 Unary, Binary, Ternary or N-ary relationship.

Scope

  • This article deals with the degree of relationship in DBMS.
  • The different types of relationships in DBMS will be discussed along with their examples.

Introduction

Everyone in this world has a certain relationship with one another. As an individual, you have a certain relationship with your friends, family, and colleagues, and all of them differ in terms of the relationship. In the same way, there are various degrees of relationship in DBMS, and we'll be comprehending the same in this article.

In DBMS, the degree of relationship is the number of entities that have taken part in the relationship. So, while designing a database, we decide on the entities first. Then the relationship between the entities is decided.

Consider that you are designing a database for a company. You will decide the entities like an employee, department, project, etc. Now you have to establish the relationship between these entities. So, the total entities that have taken part in a particular relationship are defined as the degree of the relationship. One or more entities can be associated with a relationship.

The E-R diagram helps us to analyze the degree of a relationship. The E-R diagram is the Entity-Relation diagram which shows the conceptual design of a database. The relationship between entities is shown using an E-R diagram. Various symbols like- rectangles are used to represent entities, ovals to define attributes, and diamond shapes are used to represent relationships.

er diagram of the degree of relationship in dbms

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, but after all is a student. So we can say that there is only one entity i.e., the student.

Unary relationship in dbms

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.

Binary relationship in dbms

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 coaching class is also an entity. Here as there are 3 entities, so it is a ternary relationship.

Ternary relationship in dbms

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.

N-ary relationship in dbms

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 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'.

Read More: