Entity Relationship (ER)
Entity Relationship (ER)
What is ER Model?
ER Model stands for Entity Relationship Model is a high-level
conceptual data model diagram. ER model helps to systematically
analyze data requirements to produce a well-designed database.
The ER Model represents real-world entities and the relationships
between them. Creating an ER Model in DBMS is considered as a
best practice before implementing your database.
ER Modeling helps you to analyze data requirements systematically
to produce a well-designed database. So, it is considered a best
practice to complete ER modeling before implementing your
database.
History of ER models
ER diagrams are visual tools that are helpful to represent the ER
model. Peter Chen proposed ER Diagram in 1971 to create a
uniform convention that can be used for relational databases and
networks. He aimed to use an ER model as a conceptual modeling
approach.
ER Diagram Symbols
Components of the ER Diagram
This model is based on three basic concepts:
Entities
Attributes
Relationships
ER Diagram Examples
Examples of entities:
Notation of an Entity
Entity set
Student
Example of Entities:
A university may have some departments. All these departments
employ various lecturers and offer several programs.
Relationship
Relationship is nothing but an association among two or more
entities. E.g., Tom works in the Chemistry department.
For example:
Weak Entities
A weak entity is a type of entity which doesn’t have its key attribute.
It can be identified uniquely by considering the primary key of
another entity. For that, weak entity sets need to have participation.
In above ER Diagram examples, “Trans No” is a discriminator within
a group of transactions in an ATM.
Attributes
It is a single-valued property of either an entity-type or a
relationship-type.
Cardinality
Defines the numerical attributes of the relationship between two
entities or entity sets.
One-to-One Relationships
One-to-Many Relationships
May to One Relationships
Many-to-Many Relationships
1.One-to-one:
One entity from entity set X can be associated with at most one
entity of entity set Y and vice versa.
2.One-to-many:
One entity from entity set X can be associated with multiple entities
of entity set Y, but an entity from entity set Y can be associated with
at least one entity.
For example, one class is consisting of multiple students.
3. Many to One
More than one entity from entity set X can be associated with at
most one entity of entity set Y. However, an entity from entity set Y
may or may not be associated with more than one entity from entity
set X.
4. Many to Many:
One entity from X can be associated with more than one entity from
Y and vice versa.
Student
Course
Professor
Step 2) Relationship Identification
We have the following two relationships
Once, you have a list of Attributes, you need to map them to the
identified entities. Ensure an attribute is to be paired with exactly
one entity. If you think an attribute should belong to more than one
entity, use a modifier to make it unique.
Once the mapping is done, identify the primary Keys. If a unique
key is not readily available, create one.
Entity Primary Key Attribute
Student Student_ID StudentName
Professor Employee_ID ProfessorName
Course Course_ID CourseName
Summary
ER Model in DBMS stands for an Entity-Relationship model
The ER model is a high-level data model diagram
ER diagrams are a visual tool which is helpful to represent the
ER model
ER diagrams in DBMS are blueprint of a database
Entity relationship diagram DBMS displays the relationships of
entity set stored in a database
ER diagrams help you to define terms related to entity
relationship modeling
ER Model in DBMS is based on three basic concepts: Entities,
Attributes & Relationships
An entity can be place, person, object, event or a concept,
which stores data in the database (DBMS)
Relationship is nothing but an association among two or more
entities
A weak entity is a type of entity which doesn’t have its key
attribute
It is a single-valued property of either an entity-type or a
relationship-type
It helps you to defines the numerical attributes of the
relationship between two entities or entity sets
ER- Diagram DBMS is a visual representation of data that
describe how data is related to each other
While Drawing ER diagrams in DBMS, you need to make sure
all your entities and relationships are properly labeled.