Computer >> Computer tutorials >  >> Programming >> MySQL

Unary or Recursive Relationship


When there is a relationship between two entities of the same type, it is known as a recursive relationship. This means that the relationship is between different instances of the same entity type.

Some examples of recursive relationship can be shown as follows −

Unary or Recursive Relationship

An employee can supervise multiple employees. Hence, this is a recursive relationship of entity employee with itself. This is a 1 to many recursive relationship as one employee supervises many employees.

Unary or Recursive Relationship

A person can have many children who are also persons. Hence, this is a recursive relationship of entity person with itself. This is a 1 to many recursive relationship as one person can be parent of many persons.

Unary or Recursive Relationship

A student can be a class monitor and handle other students. Hence, this is a recursive relationship of entity student with itself. This is a 1 to many recursive relationship as one student is monitor of many students.