Please login


Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

Entity Relationship Diagram in DBMS

Entity Relationship Diagram in DBMS

In this article, we will learn about what is Entity Relationship Diagram in DBMS, Units components of Entity Relationship Diagram ( Entity and its types, Attributes, Relationship, cardinality ).

What is Entity Relationship Diagram in DBMS?

To give a user view of how the data in a given database has a logical relationship amongst one another. With various units involved in the same like –

  • Entities
  • Attributes
  • Various Relationship
  • etc

Read more about DBMS here on this page.

Unit components of Entity Relationship Diagram


Entity is a real object representation in an Entity Relationship diagram. For example if we want to create a database for a college in that case students studying in the college will be considered as an entity.

It can be anything like –

    • Teachers
    • Courses
    • Buildings
    • Classrooms etc

The way of representing an entity is as follows –

Representation : A very simple Rectangular box.
Entity Set

Entity Set

A set of all entities together is called an entity set.

Representation : A vertical Oval listing all entities.


Attributes are the properties of any given entity. For example for student entity the following will be the attributes –

    • ID
    • email ID
    • Age
    • Address
    • Phone Number etc
Representation : A horizontal Oval.

There are the following types of attributes –

    • Key attribute
    • Composite attribute
    • Multivalued attribute
    • Derived attribute
Key Attribute

Key Attribute

A key attribute is the one which will uniquely identify and associate identity for an entity.

For example – For a student, his roll number or his studentID maybe its key attribute. For course offered by university, the course code like IT101 will be its key attribute.

Representation : It is same as Horizontal oval for an attribute. But, has an underline below the same.

Composite Attribute

As clear from its name a composite attribute composes of multiple units of attributes forming a larger one.

For example – Address may have following composite attributes –

    • House Number
    • Street
    • City
    • State
    • Country
    • Pin Code
Representation : Horizontal ovals mapped with further composite vertical ovals
Composite Attribute in DBMS

Multivalued Attribute

A multivalued attribute is one, which may have more than one value for example. The phone number for student maybe multivalued as student may have one or more than 1 phone numbers.

Representation : Double Horizontal Oval

Derived Attribute

A derived attribute as the name suggests is the one that can be derived or calculated with the help of other attribute present itself.

For example – The age of the student can be calculated from date of birth present as an attribute.

Representation : Horizontal Dashed Oval.
Derived Attribute in DBMS
Entity Relationship Diagram in DBMS (1)


The association between different entities that are existing in a database is depicted by relationship. For example in a university there may be thousands of students, which have enrolled in a few subjects each year.

So student entity is related to course entity by enrolment relationship.

Representation : Diamond box with entities connected to its edges as depicted in the image.

There are various types of relationships than can exist in a database which are –

    • Unary
    • Binary
    • n-ary

Relationship set is mapping of different entity set to the others with the help of connected lines are depicted in the image.

Relationship in DBMS
Relationship Set in DBMS
Unary Relationship in DBMS

Unary Relationship

Unary relationship is where there is only entity which is related to itself.

For example –

An entity person is related to itself, in relationship as married to.

Binary Relationship

Binary relationship is when there are 2 different entities associated with some relationship with one another.

For example –

Students enrolled in a course

Binary Relationship in DBMS
n-ary Relationship in DBMS

n-ary Relationship

n-ary relationship is when there is complex relationship amongst various entities. These are generally avoided by programmers to keep database architecture simple

For example –

Men eating animal, Animals eating animals, Men eating Plants, Animal eating plants etc etc. All of them are bound by eating relationship.


For a given entity sites, the number of entities that can participate in a relationship with another entity set is called cardinality.

One to One

When there is only one entity at a given instance participating in a relationship or association with only one different entity.

For example –

Man married woman.

At a given time only one man can marry one woman at a given time. So it is one to one relationship.

Another example would be earth revolves around the sun

One to One Cardinality Relationship in DBMS (1)
One to One Cardinality Relationship using sets in DBMS

Many to One

When there are multiple entities in a given entity set in relationship with only one entity of another or same entity set.

Example –

Assuming there is a rule that student can only enrol in 1 course this semester.

Students enrol in course.

There may be n number of students while the course offered is only 1.

Many to One Cardinality Relationship in DBMS
Many to One Cardinality Relationship using sets in DBMS

Many to Many

Imagine there is no restriction in number of courses that can be enrolled in, then.

Many students can register in many different courses.

n students may register in m different courses.

Many to Many Cardinality Relationship in DBMS
Many to Many Cardinality Relationship using sets in DBMS

Participation Constraint

Total Participation

All the entities in the entity set must participate in the relationship. For example the university forces, you to necessarily enrol in atleast 1 course, in that case it will be called total participation that student end.

It is represented by a double line joining entity and relationship.

Partial Participation

It is when there maybe cases when some entities may and some entities may not participate in a relationship.

This is represented by single line joining entity and relationship.

Total and Partial Participation in DBMS

Weak Entity and Weak Relationship


Weak entities are the one which may not have their own attributes and depend on other entity for their existence. For example the monthly instalment is dependent upon the loan entity and its attributes. The participation for weak entity type is always total.

This is represented by a double rectangle as represented in the image.

Weak relationship which is represented by double diamond connects relationship between a strong entity and a weak entity.

Weak Entity in DBMS
Weak Relationship in DBMS (1)