Professional Documents
Culture Documents
Chapter 3 ER
Chapter 3 ER
Database modeling
logical structure of a database
define how data is connected to each other and
how they are processed and stored inside the
system
ER Model
based on the notion of real-world entities and
relationships among them
for the conceptual design of a database
ER Model is based on −
Entities and their attributes.
Relationships among entities.
Entity
a real-world entity having properties called
attributes.
Every attribute is defined by its set of values called
domain.
e.g. in a school database, a student is considered as
an entity. Student has various attributes like name,
age, class, etc.
logical association among entities
Mapping cardinalities define the number of
association between two entities
EMPLOYEE DEPENDENT
EMPLOYEE DEPENDENT
EID
DEPENDENT
Age
Entities are instances of an entity type.
All regular entity types must
have a key attribute or set of key attributes
Locations NumEmployees
Multivalued Derived
Attribute Attribute
Composite attributes tree
composed of other attributes.
used for a set of related attributes,
when the set is not a conceptual entity
the composite doesn’t have identity … it doesn’t have a key
Address
City
ZipCode
Street State
Composite
Attribute
Relationships diamonds
Identifying relationship double diamond
WorksOn DependentOf
Relationship Identifying
Relationship
Relationships indicate a meaningful connection
between two entity types
diamond-shaped box
Relationships may have attributes,
but they cannot have key attributes.
Identifying relationships connect a weak entity type
to some other entity type
indicates where the weak entity gets a key
to complete its own partial key
WorksOn DependentOf
Relationship Identifying
Relationship
DEPENDENT Age
DependentOf
EID
Name EMPLOYEE
Phone
Name
PROJECT
WorksOn Budget
StartDate
binary relationship where two entities are participating
Total Participation
Partial Participation
Arrowheads can be used to indicate
an upper bound of 1 for participation
(not used in our textbook)
X R Y
X R Y
1:1 ratio
n 1
EMPLOYEE WorksFor DEPARTMENT
n:1 ratio
n m
EMPLOYEE WorksOn PROJECT
n:m ratio
Structural constraints specify the minimum and
maximum number of relationship instances
that an entity may participate in
(1,1) (4,n)
EMPLOYEE WorksFor DEPARTMENT
(0,1) (1,1)
EMPLOYEE Manages DEPARTMENT
(0,1) (1,1)
EMPLOYEE Manages DEPARTMENT
1 1
EMPLOYEE Manages DEPARTMENT
(1,1) (1,n)
EMPLOYEE WorksFor DEPARTMENT
n 1
EMPLOYEE WorksFor DEPARTMENT
Each DEPARTMENT
instance is connected to
at least one WORKS_FOR
instance.
It is sometimes convenient
to name an entity’s role in a relationship.
particularly useful in recursive relationships
removes ambiguity in direction of relationship
Supervision
supervisor supervisee
(0,N) (0,1)
EMPLOYEE
Supervision
supervisor supervisee
(0,N) (0,1)
EMPLOYEE
1 = supervisor
2 = supervisee
Equivalent Schema defined in UML
Design an ER schema for the following enterprise: