Recursive Relationship in DBMS

Learn via video course
FREE
View all courses
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
DBMS Course - Master the Fundamentals and Advanced Concepts
DBMS Course - Master the Fundamentals and Advanced Concepts
by Srikanth Varma
1000
5
Start Learning
Topics Covered

Recursive relation in a Database Management System is a type of relationship that is between two entities of a similar type of entity type. Recursion in real life is defining a problem or an object in terms of itself, which means usually we see the relationship between two entities of different entity types but when we define the relationship forms, an entity of the same entity type to another entity of the same entity type it becomes the Recursive relation in DBMS.

Recursive Relationship in ER Diagram

ER diagram or ER model stands for the entity-relationship model and shows the complete data entities and relationships in a high-level model. It helps to visualize the entire data model in a better way, we will learn recursive relationships in DBMS through it.

In the ER diagram, the entities are represented in rectangles, the attributes of the entities are defined in circles, and the relationships are defined in the rhombus. The relationships are present between two entities defining the relationship between them and connecting to both of the entities.

Here is a recursive relationship in DBMS, the entity has a relationship with itself means the entity will be connected to the relationship two times.

Let's see the ER diagram for the Recursive Relation in DBMS:

ER diagram for Recursive Relation in DBMS

In the above image, we can see there are two connections of the entity to a single relationship, which means there is a recursive relationship in DBMS in the entity.

Examples of Recursive Relationship in DBMS

Whenever an entity shows two states related to each other, there is a recursive relationship in DBMS. Let’s see some of its examples:

In a company there are many employees, an employee can be a developer, manager, CEO, etc. All the developers (who are employees) are managed by the manager (who is also an employee) means an employee manages other employees. This means there is a recursive relationship in DBMS between the employee entity.

Let’s see its ER diagram:

Examples of Recursive Relationship in DBMS

In the above diagram, the employee is connected to the relationship 'manages' two times, which indicates employees manage employees.

We can take another example, a person can be an entity in the entity set. Both father and son are the people and there could be a relationship 'parent' between them which will be from person to person and a recursive relationship in DBMS.

Let’s take one more example of a sports team or specifically a cricket team. In a cricket team, there are a total of 11 players with different roles like a batsman, bowler, wicket-keeper, and an all-arounder. Among all the players one is the captain who will manage the whole team. So, the captain is the player who manages the whole team, which is an entity from the same entity set and has a relationship with the entities of the same entity set this makes the recursive relation in dbms from a player to the player.

Conclusion

  • Recursive relation in DBMS is a type of relationship between two entities of a similar type entity type.
  • In recursive relation, the same entity type participates in a relationship type more than once, playing a different role in each instance. In other words, there has always been a relationship between events that occur in two distinct entities.
  • An entity is a real-life object which could be either physically present in the world like a person, a place, etc or it could be logically created like a mathematical concept.
  • In recursive relation in DBMS, the entity has a relationship with itself. It means the entity will be connected to the relationship two times.