ER Model
ER Model
• What is ER Diagram?
• What is the ER Model?
• History of ER models
• Why use ER Diagrams?
• Facts about ER Diagram Model
• ER Diagrams Symbols & Notations
• Components of ER Diagram
• Relationship
• Weak Entities
• Attributes
• Cardinality
• How to Create an ER Diagram (ERD)
• Best Practices for Developing Effective ER Diagrams
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.
• Entities
• Attributes
• Relationships
ER Diagram Examples
Examples of entities:
Notation of an Entity
Entity set:
Student
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.
Asperiants
Strong Entity Set Weak Entity Set
Strong entity set always has a primary
It does not have enough attributes to build a primary key.
key.
It is represented by a rectangle symbol. It is represented by a double rectangle symbol.
It contains a Primary key represented It contains a Partial Key which is represented by a dashed
by the underline symbol. underline symbol.
The member of a strong entity set is The member of a weak entity set called as a subordinate entity
called as dominant entity set. set.
Primary Key is one of its attributes In a weak entity set, it is a combination of primary key and
which helps to identify its member. partial key of the strong entity set.
In the ER diagram the relationship
The relationship between one strong and a weak entity set
between two strong entity set shown by
shown by using the double diamond symbol.
using a diamond symbol.
The connecting line of the strong entity The line connecting the weak entity set for identifying
set with the relationship is single. relationship is double.
Let’s learn more about a weak entity by comparing it with a Strong
Entity
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.
Example: One student can register for numerous courses. However, all
those courses have a single line back to that one student.
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.
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
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.
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 labelled.
Now, think through the relationships or verbs taking place within your system. The easiest
way to do this is to look at each entity and try to connect it to another by saying, “What does
the ___ do with the ___.” The customer purchases the phone. The cell service maintains the
phone. The cell service creates a bill. The customer pays the bill.
Another good step to take is to clean up or polish your diagram — if you were drawing by
hand, you might have some stray eraser marks. Take a moment to finalize your diagram by
aligning shapes, adding color, or redrawing lines to more clearly connect your entities,
attributes, and relationships. All these steps are easy if you’re using an online diagramming
tool like Gliffy!