Components of ER Diagram

Rumman Ansari   Software Engineer   2023-03-23   6409 Share
☰ Table of Contents

Table of Content:


An ER Diagram consists of the following components:

  1. Entity
  2. Attributes
  3. Relationships

We already discussed about Entity and Attributes. In this session we will discuss about Relationships.

Relationship

A relationship is used to describe the relation between entities. Diamond or rhombus is used to represent the relationship.

An association between two or more entities is known as a relationship. A relationship describes how two or more entities are related to each other.

Degree of a relationship

The number of entity types participating in a relationship type determines the degree of the relationship type. The relationship that involves just one entity type is called a unary relationship. In other words, the relationship that exists between the instances of the same entity type is the unary relationship. The relationship between two entity types is known as a binary relationship and the relationship between three entity types is known as the ternary relationship. In general, the relationship between n entity types is known as an n-ary relationship. Thus, a unary relationship has a degree 1, a binary relationship has a degree 2, a ternary relationship has a degree 3 and an n-ary relationship has a degree n

Types of relationship are as follows:

One-to-One Relationship

When only one instance of an entity is associated with the relationship, then it is known as one to one relationship.

For example, A female can marry to one male, and a male can marry to one female.

One-to-many relationship

When only one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then this is known as a one-to-many relationship.

For example, Scientist can invent many inventions, but the invention is done by the only specific scientist.

Many-to-one relationship

When more than one instance of the entity on the left, and only one instance of an entity on the right associates with the relationship then it is known as a many-to-one relationship.

For example, Student enrolls for only one course, but a course can have many students.

Many-to-many relationship

When more than one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then it is known as a many-to-many relationship.

For example, Employee can assign by many projects and project can have many employees.