04.DIS_ER
04.DIS_ER
Entity-Relationship Modeling
(Chapter 12, Connolly & Begg)
Lecture Objectives
How to use Entity–Relationship (ER) modeling in
database design.
Entity types
Relationship types
Attributes
Entity Type
Entity type
Group of objects with same properties, identified by
enterprise as having an independent existence.
Entity occurrence
Uniquely identifiable object of an entity type.
Relationship occurrence
Uniquely identifiable association, which includes one
occurrence from each participating entity type.
E.g. Has associates the Branch and Staff entities.
ER Diagram of Branch Has Staff Relationship
Semantic Net of Has Relationship Type
Degree of a Relationship
Number of participating entities in relationship.
Relationship of degree :
two is binary
three is ternary
four is quaternary
Binary Relationship
Ternary Relationship
Quaternary Relationship
Relationship Types
Recursive Relationship
Relationship type where same entity type participates more
than once in different roles.
Attribute
Property of an entity or a relationship type.
Attribute Domain
Set of allowable values for one or more attributes.
ER Diagram of Staff and Branch Entities
Attributes
Simple Attribute
Attribute composed of a single component with an
independent existence.
Composite Attribute
Attribute composed of multiple components, each
with an independent existence.
E.g. address
Attributes
Single-valued Attribute
Attribute that holds a single value for each occurrence
of an entity type.
Multi-valued Attribute
Attribute that holds multiple values for each
occurrence of an entity type.
E.g. tel No
Attributes
Derived Attribute
Attribute that represents a value that is derivable from
value of a related attribute, or set of attributes, not
necessarily in the same entity type.
E.g. leaseDuration, totalStaff
Keys (Reminder)
Candidate Key
Minimal set of attributes that uniquely identifies each
occurrence of an entity type.
Primary Key
Candidate key selected to uniquely identify each occurrence
of an entity type.
Composite Key
A candidate key that consists of two or more attributes.
ER Diagram of Staff and Branch Entities
Attributes on Relationships
one-to-one
(1:1)
Multiplicity of Staff Manages Branch (1:1) Relationship
Semantic Net of Staff Oversees
PropertyForRent Relationship Type
one-to-many
(1:*)
Multiplicity of Staff Oversees
PropertyForRent (1:*) Relationship Type
Semantic Net of Newspaper Advertises
PropertyForRent Relationship Type
many-to-many
(*:*)
Multiplicity of Newspaper Advertises
PropertyForRent (*:*) Relationship Semantic
Summary of Multiplicity Constraints
Learning objectives
Two main types of connection traps are called fan traps and
chasm traps.
Problems with ER Models
Fan Trap
Where a model represents a relationship between entity types,
but pathway between certain entity occurrences is ambiguous.
Chasm Trap
Where a model suggests the existence of a relationship between
entity types, but pathway does not exist between certain entity
occurrences.
Chasm Trap
Where a model suggests the existence of a relationship between
entity types, but pathway does not exist between certain entity
occurrences.
An Example of a Chasm Trap
Entity
Types
An Example ER Diagram
Primary
Keys
An Example ER Diagram
Relationships
An Example ER Diagram
Attributes on
Relationships
An Example ER Diagram
Multiplicities
An Example ER Diagram