Types of Relationships in ER Diagram

Different types of relationships in er diagram are – 1) Relationships based on degree, 2) Recursive Relationship. Let us discuss these one by one.

Relationship and Relationship Set :  

Relationships connect the entities and represent meaningful dependencies between them.It represents an association among several entities.
Relationships sets is a set of relationships of the same type. It is a mathematical relation on entity sets (n>=2). Relationship set R is a subset of –

{(r1,r2,r3,....rn)| r1∈E1, r2∈E2, rn∈En}

where r1,r2,….rn are called relationships and E1,E2,….En are entity sets.

The way in which two or more entity types are related is called relation type.
For example, consider a relationship type WORKS_FOR between the two entity types EMPLOYEE and DEPARTMENT, which associates or links each employee with the department the employee works for.
The WORKS_FOR relation type is shown as –

relationship set example-Types of Relationships in ER Diagram



Binary Relationship-Types of Relationships in ER Diagram

In the above figure, each instance of relation type WORKS_FOR i.e.(r1, r2,…,r5) is connected to instances of employee and department entities. Employee e1, e2 and e5 work for department  d2 and employee e3 and e4 work for department d1.

Notation to Represent Relation Type in ER Diagram-

Relation types are represented as diamond shaped boxes.

Relarionship Notation (Types of Relationships in ER Diagram)

Degree of a Relationship Type-

The number of participating entity types is known as the degree of relationship type.

Types of Relationship Type Based on Degree –

  • Binary Relationship – A relationship type of degree two is called binary relationship. The WORKS_FOR in above figure is a binary relationship as  there are two participating entities-employee and department.
    Binary Relationship-Types of Relationships in ER Diagram
  • Ternary Relationship- A relationship type of degree three is a ternary relationship for example, in the below figure supply relationship connects three entities SUPPLIER, PART AND PROJECT.
    Ternary Relationship-Types of Relationships in ER Diagram
    The above diagram can be read as – a supplier supplies the parts to projects
  • N-ary Relationship Set – A relationship type of degree n is called n ary relationship . For example

N-Array Relationship Set

Role Names-

A relationship type has a name which signifies what role a participating entity plays in that relationship instance. The role names helps to explain what the  relationship means.

In the first example WORKS_FOR  relationship type, employee plays the role of worker and department plays the role of employee(because a department consists of a number of employees.

Recursive  Relationship

If the same entity type participate more than once in a  relationship type in different roles then such  relationship types are called recursive  relationship. For example, in the below figure REPORTS_TO is a recursive relationship as the Employee entity type plays two roles – 1) Supervisor and 2) Subordinate.

Recursive Relationship -types of relationships in er diagram

You can also define the above example of recursive relationship as the relationship between a manager and an employee. An employee is a manager as well as employee.

recursive relationship - employee and manager

This is commonly know as a ‘pig’s ear’.

To implement recursive relationship, a foreign key of the employee’s manager number would be held in each employee record.

Emp_entity( Emp_no,Emp_Fname, Emp_Lname, Emp_DOB, Emp_NI_Number, Manager_no);

Manager no - (this is the employee no of the employee's manager)
Another more Complicated Example of Recursive Relationship :

Relationship between a person and their parents :

recursive relationship between a person and parents


Previous Home Next
Type of Attributes in DBMS Relationship Constraints in DBMS

     

Incoming search terms:

  • Recursive Relationship
  • recursive relationship in dbms
  • what is recursive relationship
  • Recursive relation in dbms
  • recursive relationship example
  • recursive relationship type
  • recursive relationship in er diagram
  • What is recursive relationship in dbms
  • Recursive relationship types
  • recursive relationship type in dbms

Leave a Reply