What Is Entity Relationship Diagram In DBMS

Entity Relationship Diagram

Introduction To ER Model

The Entity Relationship Diagram ( ERD ) is a graphical representation of the database structure. The ERD is also alternately referred to as ER Model or ER Diagram.

In simple words , the entity relationship diagram is a blueprint that can used to create a database using a specific database management system ( DBMS ).

An architect create blueprints before building a house . Similarly , the database designers create different data models or database blueprints to visualize the database structure.

During the database design stage , the database designers prepare various data models to visualize the database structure. The ER model is one of the data model used by the database designers to describe the database.

Entity Relationship Diagram

In this article , you will learn what is entity relationship diagram ( ERD )  , how it is used during the database design process and how to create a ERD diagram .

We will also discuss in detail various symbols used in the ER diagram , its meaning , concept of entity , relationship , cardinality and other related important topics.

What Is Entity Relationship Diagram ?

Entity Relationship Diagram

Table Of Contents

What Is Entity Relationship Diagram ?

ER Model Explained

The ER diagram is a simply a blueprint created during the database planning and design stage to visualize the database structure.

In DBMS world,  the database entities are represented by table. In relational model , the logical structure of the database consist of number of inter related tables.

 An Entity Relationship Diagram is a visualization tool  used by the database designers to visualize the database structure and relationship between the tables that represents database entities.

Database Development SDLC
Database Development SDLC

The ER model helps the database designers to define the logical structure of the database by defining the  primary and foreign key constraints.

The ER diagram also  includes the attribute ( table column ) names and the symbols that indicate the type of the relationship ( cardinality ) exists between the columns ( one-to-one, one-to-many, many-to-one and many-to-many ).

Components Of ER Diagram

The ER diagram is constructed with the help of four main components.

Components Of ER Diagram

Entity Relationship Diagram

Components Of ER Diagram

Components Of ER Model , Entity Relationship Diagram

ER Diagram Symbols

Since the ER Model is a graphical tool and therefore various graphical symbols and shapes are used in the ERD to highlight different components of the ERD.

The ERD is created using rectangle for an entity , the attributes for respective entities are indicated by oval shape , the relationship between the two entities is indicated by a diamond shape connected to entities by a line.

The ER model also use different symbols for indicating the cardinality ratio or the type of the relationship is shown by using other symbols.

ER Diagram Component

ER Diagram Symbol

Strong Entity

Weak Entity

Simple Attribute

Composite Attribute

Derived Attribute

Prime Attribute

Multi-Valued Attribute

Relationship

Weak Relationship

Entity Relationship Diagram

What Is Entity ?

Let us first start with getting the clarity about the concept of an entity with reference to the database design in DBMS.

During the database design process , the first task for the database designers is to identify various objects or business concepts that needs to be represented into the database .

The entities are either physical objects or business concepts that helps to uniquely describe that particular object or business concept. Let us try to understand the concept of an entity with few examples.

For example, if we are designing a database for a college then the entities that needs to be represented into the college database would include student , teacher , courses , determent , department heads and other such similar entities.

What Is Database , RDBMS , Database
What Is Database , RDBMS

Similarly , if we are designing a database for a company then the entities that needs to be represented into the company database would include employee , department , salary , management , inventory and other such similar entities.

As you can notice in the above two examples some of these entities have physical presence whereas some are merely a business concept that we wish to record the information about into the database.

Each Entity is shown into the ER diagram as a rectangle. The relationship between the two entities is indicated by an diamond shape.

Types Of Entity

The entity types with reference to the database management system ( DBMS ) can be of four types .

Strong Entity

An entity is said to be a strong entity when it has a key attribute ( prime attribute ) that can uniquely identify each instance of an entity.

The strong entity is not dependent upon any other entity for its existence into the database schema rather it has its own prime attribute.

The relationship between the  two strong entities is represented by a single line diamond shape into the ER model.

Example Of Strong Entity

Let us take one example of student database to understand the concept of strong entity .

The student entity is a strong entity whereas student address , student contact number are examples of weak entity because their existence depends upon the student entity.

Weak Entity

An entity is said to be a weak entity when it does not have  a key attribute ( prime attribute ) that can uniquely identify each instance of an entity.

The weak entity is dependent upon other strong entity for its existence into the database schema and it not have its own prime attribute.

Example Of Weak Entity

Let us take one example of the employee database to understand the concept of weak entity .

The employee entity is a strong entity whereas employee address , employee nominee  are examples of weak entities because their existence depends upon the employee entity.

The relationship between one strong entity and one weak entity  is represented by a double line diamond shape into the ER model.

Tangible Entity

An entity is said to be a tangible entity when it has a physical existence that can be recorded in terms of its attributes.

For example , a student , customer , employee , mobile phone , car and other such objects have physical existence. And therefore such entities are referred as tangible entities.

Conceptual Intangible Entity

An entity is said to be a conceptual or intangible entity when it does not have a physical existence but it is a business concept that can be recorded in terms of its attributes.

For example , a course , bank account , policy , department , telephone number and other such business concepts do not have physical existence but needs to be recorded into the database.

And therefore such entities are referred as conceptual or intangible entities.

Entity Relationship Diagram

Entity Attributes

What Is An Entity Attribute ?

In DBMS world , an entity is represented in terms of its attributes that gets stored into the database. The entity can have different types of attributes.

An entity attributes are used to describe the various properties of an entity. An entity can have single or many attributes that can be recorded  into the database.

In RDBMS , the table represents an entity and the table columns represents the attributes. For example , the student entity attributes include Student_ID , First_Name , Last_Name , Address , DOB and other such attributes.

Examples Of Attribute

Let us discuss few simple examples to understand the meaning of an attributes in the context of DBMS.

The student entity can be recorded into  the database using its attributes such as Student ID , First Name , Last Name , Date Of Birth , Course ID and other such attributes.

Similarly , The mobile entity can be recorded into  the database using its attributes such as Model Number, Stock ID , Brand Name , Model Type , Date Of Purchase  and other such attributes.

In ER model , the attributes of an entity are indicated by an oval shape connected to the entity rectangle by a line.

Types Of Attribute

Depending upon the property of the attribute values , different types of attributes are used in the DBMS.

Types Of Attributes In DBMS , Entity Relationship Diagram

Prime Attribute

The prime attribute is also called as key attribute or primary key. An attribute is said to a prime attribute when it can be used as a primary key in a relational table.

The prime attribute has unique value for each instance of an entity and used to uniquely identify each record in a relational table.

The prime attribute is indicated in the ER model with underline.

RDBMS Table Structure

Non-Prime Attribute

It is also called as non-key attribute or simple attribute. An attribute is said to a non-prime attribute when it cannot be used as a primary key in a relational table.

The non-prime attribute can have duplicate value for each instance of an entity and therefore it cannot be used to uniquely identify each record in a relational table.

The non-prime attribute or simple attribute is indicated in the ER model without underline.

Composite Attribute

 An attribute is said to a composite attribute when it is made up of more than one attribute .

The student name attribute is a composite attribute because it consist of first name and second name attributes.

Derived Attribute

An attribute is said to a derived attribute when its value is calculated as on date from another attribute . The student age is a derived attribute because its value depends upon the date of birth attribute.

The value of the derived attribute is not stored into the database since its value keeps on changing and depends upon another attribute.

Single-Valued Attribute

As the name suggest this attribute has only one single value . An attribute is said to be a single-valued attribute when it has one single value.

For example , the date of birth attribute for the student entity is a single-valued attribute.

Multi-Valued Attribute

As the name suggest this attribute has more than one single value . An attribute is said to be a multi-valued attribute when it has more than single value.

For example , the mobile number attribute for the student entity is a multi-valued attribute because a student can have more than one mobile contact number.

Entity Relationship

Relationship In Entity Relationship Diagram

The relationship between the two entities is defined as association through which the entities are logically related to each other.

For example , the student entity and the course entity are logically related when the student joins the course.

In ER Model . the relationship between the two entities is indicated by a diamond shape connected to the entities by a straight line.

However , in relational model , the relationship between the two entities is defined by creating primary key and foreign key constrains for each table . The table represents an entity .

Primary Key And Foreign Key , Entity Relationship Diagram

Relationship Set

The set of similar types of relationships is called relationship set.  The entity can have attributes that describe the properties.

Similarly , the relationship can also have attributes that describes the properties of the relationship . Such attributes are called descriptive attributes.

The relationships in the ER model are shown with the help of diamond shape.

Degree Of Relationship

The number of entity types that participate in a relationship ( association ) is called the degree of relationship.

Let us take one example to understand degree of relationship. If we have two entities that is student entity and college entity .

A student can take admission into only one college in a particular academic year. These two entities are associated with relationship established by primary key and foreign key.

And therefore , the degree of relationship is two.

Degree Of Relationship In ER Model

Entity Relationship Diagram

Cardinality In DBMS

In mathematics, the term cardinality of a set is a measure of the “number of elements” present in the set. For example, let us consider one set with four elements A = { 2,5,7,9 }. 

The set contains 4 elements, and therefore set A  has a cardinality of four. Cardinality = 4.

For example , if the student table contains hundred unique records of the students than the cardinality will 100.

In DBMS , A relation or an entity is represented by a table in a relational model. The entity set contains the number of unique instances present in a set. The number of such unique instances present in a set is referred as cardinality.

The cardinality of relationship in DBMS is defined as the number of instances of one entity set that can be associated with the number of instances present in another entity set in a given relationship.

What Is Cardinality In DBMS

Entity Relationship Diagram

Cardinality Ratio

Mapping Of Cardinalities

In ER model, a relationship between the two or more entities is an association among entity instances of one or more instances of another entity sets.

The Cardinality ratio or mapping cardinalities is a concept that describes the binary relationship set ( An association or a relationship between the two entity sets ) and its types.

In simple words , we can call this relation types expressed in terms of  maximum number of instances of one entity set that are associated with the maximum number of instances of the other entity set in a given relationship.

Types Of Entity Relationship

One To One Relationship

In one to one relationship only one instance of entity set A can be associated with any one instance of entity set B and vice versa.

Let us consider two instance sets for entity A and entity B. In one to one relationship only one instance of  entity A can be associated with any one instance of entity B and vice versa.

For example , A Department Head can head only one department. Similarly ,

each department can have only one department head.

One To One Relationship In DBMS

One To Many Relationship

In one to many relationship one instance of entity A can be associated with more than one instance of entity B.

Let us consider two entity sets that is entity set A and B. In one to many relationship only one instance of entity  A can be associated with more than one instance of entity B.

For example , an employee can work only in one department. But many employees can work in one department.

One To Many Relationship In DBMS , ER Model , ERD

Many To One Relationship

In many to one relationship more than one instance of entity A can be associated with any one instance of entity B.

Let us consider two entity sets that is entity set A and B. In many to one relationship more than one instance of entity  A can be associated with any one instance of entity B.

For example , an employee can work only in one department. But many employees can work in one department.

Many To Many Relationship

In many to many relationship many instance of entity A can be associated with given instance of entity B. Similarly , many instance of entity B can be associated with given instance of entity A.

For example , an employee can work on more than one project. Similarly , many employees can work on one project.

Many To Many Relationship In DBMS , Entity Relationship Diagram

Relationship Symbols Used In Entity Relationship Diagram

Since the ER Model is a graphical tool and therefore various graphical symbols and shapes are used in the ERD to highlight different types of relationships between the entities.

Symbols Used In Entity Relationship Diagram

Entity Relationship Diagram

Related Videos

Entity Relationship Diagram

Join Best Seller

Database Design Online Course

Learn database design and development step by step. This is the most comprehensive  and unique  Database Design  course Online.

This course will give you in depth understanding of most important fundamental concepts in database design with MySQL project .

Don`t copy text!