What is ER Model
Hello friends! Today we will read about E-R Model (What is ER model?) in this post and will also see its components, advantages. Read it completely, you will understand it easily. So let’s start:-
What is ER model?
The full name of E-R Model is entity relationship model. It is a high level data model. This model is used to define data elements and relationships for a system.
In other words, “In DBMS, ER model is a data model that describes the structure of the database with the help of diagrams.”
The full name of E-R Model is entity relationship model. It is a high level data model. This model is used to define data elements and relationships for a system.
In other words, “In DBMS, ER model is a data model that describes the structure of the database with the help of diagrams.”
Components of the ER Model
There are three main components of ER model which are as follows:-
- Entities
- relationship
- attribute
Entities
An entity can be any person, place, car and real word object. In ER diagram, an entity is represented by a rectangle. Entity must have an attribute and a unique key.
Entity set: – An entity set is a group of entities of the same type that share the same properties.
Example of this – Student, Teacher, Class and Course can be considered as entity in a school database. If a student is an entity, then the datasets of all students are called entity sets.
Types of entity
There are following two types of entities in DBMS.
weak entity
An entity that is dependent on another entity is called a weak entity. It is displayed by double rectangle. Weak entity cannot be identified in a unique way by its attributes.
strong entity
The entity that has a primary key is called a strong entity. Strong entity can be identified in a unique way by its attributes.
Relationship
Relationship is used to describe the relation between entities. It is displayed by diamond.
For example:- teacher teaches_at school and soldier enrolls in a military. Here teachs_at and enrolls are called relationships.
Types of Relationship
It is of 4 types:-
- One to One
- One to Many
- Many to One
- many to many
- One to one relationship (1:1)
When an instance of entity A is associated with an instance of entity B. So it is called one to one relationship.
For example:- A male can marry only one female and a female can marry only one male. So we will call it one-to-one.
One-to-many relationship (1:M)
This relationship occurs when an instance of entity A is associated with multiple instances of entity B.
For example- An Employee works in a department; A department can have many employees.
Many-to-one relationship (M:1)
This relationship occurs when multiple instances of entity A are associated with only one instance of entity B.
For example – in real world, a student can study in one college and he cannot study in another college simultaneously. While many students study in a college. So we will call it many to one.
Many to Many Relationship (M:M)
This relationship occurs when multiple instances of entity A are associated with multiple instances of entity B.
For example: – Many employees can work in many projects.
Degree of Relationship
There are three types of degree of relationship.
Binary – If the degree of relationship type is two then it is called binary.
Ternary – If the degree of relationship type is three then it is called ternary.
[Ternary = degree 3.]
N-ary – If the degree of relationship type is n, then it is called n-ary.
[n-ary=degree n.]
Attribute
Attribute is used to describe the property of an entity. It is represented by oval.
For example- Student is an entity and its subject name, subject code and gender are its attributes.
Types of Attributes
There are following types of attributes in DBMS:-
Key attributes
The attribute that uniquely identifies each entity in the entity set is called the key attribute. For example – Roll_no is unique for each student.
In ER diagram, the text of key attribute is underline.
Composite attribute
The attribute which is made of combination of other attributes is called composite attribute. For example – Student’s address is a composite attribute because it is made up of other attributes like- pin_code, city, state, and country.
Single value attribute
The attribute which has only one value for a particular entity is called single value attribute. For example- the age of a person is a single value attribute.
Multivalued attribute
An attribute that has multiple values for an entity is called a multivalued attribute. It is presented by double oval.
For example:- Colors for a car and phone numbers of employees.
Derived attribute
The value of this type of attribute is derived from the value of another related attribute. It is represented by dashed oval.
For example: – The age of a person is derived from his date of birth. So age is a derived attribute.
Advantage of ER model
Its advantages are as follows:-
Creating this model is very easy. If you know the relationship between entity and attributes, then you can easily create ER diagram.
Through this model, the structure of the database is presented in the diagram, so it is easy to understand the relationship in it.
It is a very effective communication tool for database designers.
Converting this model to other models is very easy. We can easily convert it into other models.
Disadvantages of ER model
Its disadvantages are given below:-
There is no industry standard for developing this model. so
Another developer cannot understand the notation of one developer.
In this model some information or data gets lost or hidden.
It is difficult to show data manipulation in this.