Beruflich Dokumente
Kultur Dokumente
ER Relationship Model
Dr. Seema Jehan
Outline!
• ER Model basics
• Entities and Attributes
• Entity Types and Entity Sets
• Relationship types
• Weak Entity Types
Entity Relationship (ER) Model!
• ER Model is one model that helps us fix the perception of
reality.
Employee!
Single-valued Attributes !
• Each entity has attributes/properties.
• Attribute types are represented by ellipses.
• For Employee entity type, we have Email, Name as single
value attribute.
ahmad@seecs.edu.pk!
Isra!
Eisha! isra@seecs.edu.pk!
eisha@seecs.edu.pk!
Ahmad!
Key Attributes !
• Some property types are identifying or key properties.
• That is shown by underlining these types.
• The value of a key attribute can be used to identify an
entity uniquely.
Employee!
isra@seecs.edu.pk!
eisha@seecs.edu.pk!
Email! ahmad@seecs.edu.pk!
Composite Attributes!
Composite Properties!
Ahmad!
Eisha!
Isra!
Employee!
FName!
Name!
Khan!
Ali!
LName! Awan!
Multi-value Properties!
• Most attributes have a single value for a particular entity;
• These are called single-value attributes such as “Age”.
• Some attributes have multi-value properties; these are
modelled by double ellipses.
Lahore! Islamabad!
Locations!
Karachi!
Department!
Example!
Relationship Cardinality!
• The degree of a relationship type is the number of
participating entity types.
Partial Function
1-Many Relationship type!
• Each Department has N number of projects but a project
is controlled by one department.
Department! controls!
Projects!
Total Function
Many-1 Relationship type!
• Each Department has N number of employees but an
employee can work for at most one department.
Works- for!
Employee! Department!
Total Function
N-M Relationship type!
• An employee can work on several projects and a project
can have many employees.
Total Function
N-ary Relationship Types!
Quantity!
S_Name! M
Proj_name!
Part!
Part_no!
Instance Diagram!
N-ary Relationship Types!
• It is not always possible to decompose N-ary relationship
(N>3) into binary relationships.
Quantity!
S_Name! M
Proj_name!
Part!
Part_no!
Attributes of Relationship Types!
• Relationship types can also have attributes, similar to
those of entity types.
Hours!
Weak Entity Types!
• Entity types that do not have key attributes of
their own are called weak entity types.
CNIC!
• Two dependents of two distinct employees
may have the same values for name, DoB and
Employee! relation even though they are two distinct
employees.
1
Gend
er! 1
Controls!
Dependents_of!
1
Manages!
N
Dependent!
Relatio Project!
n!
Name! Works_on! Locatio
Gend Numbe n!
er! DoB! Name!
r!
Exercise!
• Add a recursive relationship SUPERVISION between
EMPLOYEE in the supervisor role and EMPLOYEE in the
subordinate role.
Recursive Relationship!
• Same entity type participates more than once in a relationship
type in different roles.
Supervisee
Employee! Supervision!
CNIC! Supervisor
ER Notations !
ER Notations !
Assignment 1!
• Construct ER diagram for your term project
• Due Date: 9th November 2020
Summary!
• ER basic concepts:
• Entities or attributes
• Relationship types
• Participation roles of entity types
• Cardinality ratios (1:1, 1:N, M:N for binary relationships)
References!
• Chapter 3, Fundamentals of Database systems, Ramez
Elmasri and Shamkant Navathe, 7th Edition, 2016