0% found this document useful (0 votes)
2 views

04.DIS_ER

The document covers the fundamentals of Entity-Relationship (ER) modeling in database design, including key concepts such as entity types, relationship types, and attributes. It discusses the importance of multiplicity constraints and identifies common problems like fan traps and chasm traps that can arise in ER models. Various examples and diagrams illustrate these concepts to enhance understanding.

Uploaded by

yabai onnanoko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

04.DIS_ER

The document covers the fundamentals of Entity-Relationship (ER) modeling in database design, including key concepts such as entity types, relationship types, and attributes. It discusses the importance of multiplicity constraints and identifies common problems like fan traps and chasm traps that can arise in ER models. Various examples and diagrams illustrate these concepts to enhance understanding.

Uploaded by

yabai onnanoko
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

COMP518: Database and Information Systems

Entity-Relationship Modeling
(Chapter 12, Connolly & Begg)
Lecture Objectives
— How to use Entity–Relationship (ER) modeling in
database design.

— Basic concepts associated with the ER model.

— Diagrammatic technique for displaying ER model


using Unified Modeling Language (UML).
An Example ER Diagram
Concepts of the ER Model

— 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.

— E.g. “Staff” would be an entity type, whereas “John” or


“Alice”, as members of staff, would be entity occurrences.
Examples of Entity Types
ER Diagram of Staff and Branch Entity Types
Relationship Types
— Relationship type
— Set of meaningful associations among entity types.

— 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

We use primary key


attributes. Why?
Relationship Types

— 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.

— Relationships may be given role names to indicate purpose


that each participating entity type has in a relationship.
Example - Recursive Relationship
Entities Associated through two Distinct Relationships
Attributes

— 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

Note that sometimes


relationships themselves
can have attributes.
Entity Type

— Strong Entity Type


— Entity type that is not existence-dependent on some
other entity type.

— Weak Entity Type


— Entity type that is existence-dependent on some
other entity type.
Example Strong and Weak Entity Types
An Example ER Diagram
Learning objectives

Next we will look at multiplicity constraints


which are structural constraints on relationships.
Structural Constraints
— The main type of constraint on relationships is called multiplicity.

— Multiplicity is number (or range) of possible occurrences of an


entity type that may relate to a single occurrence of an associated
entity type through a particular relationship.
Structural Constraints
— The main type of constraint on relationships is called multiplicity.

— Multiplicity is number (or range) of possible occurrences of an


entity type that may relate to a single occurrence of an associated
entity type through a particular relationship.

— Represents policies (business rules) established by user or company.


— E.g. A property for rent must have an owner
— E.g. Each branch must have a manager.
Multiplicity Example
Structural Constraints
— Multiplicity is made up of two types of restrictions on
relationships: cardinality and participation.
— Cardinality
— Describes maximum number of possible relationship occurrences
for an entity participating in a given relationship type.
— Participation
— Determines whether all or only some entity occurrences
participate in a relationship.
Multiplicity as Cardinality and Participation Constraints
Multiplicity as Cardinality and Participation Constraints
Structural Constraints
— The most common degree for relationships is binary.

— Binary relationships are generally referred to as being either:


— one-to-one (1:1) [a member of staff manages a branch]
— one-to-many (1:*) [a member of staff oversees properties]
— many-to-many (*:*) [newspapers advertise properties]
Semantic Net of Staff Manages Branch Relationship Type

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

Next we will look at problems with Entity-Relationship models:


— Fan Traps
— Chasm Traps
Problems with ER Models
— Problems may arise when designing a conceptual data
model called connection traps.

— Often due to a misinterpretation of the meaning of certain


relationships.

— 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.

— We shall now look at these two traps in more detail..


An Example of a Fan Trap

At which division does staff number SG37 work?


At which branch office does staff number SG37 work?
Semantic Net of ER Model with Fan Trap

At which division does staff number SG37 work?


At which branch office does staff number SG37 work?
Restructuring ER Model to Remove Fan Trap

• Question: On a conceptual level, does this model make more


sense than the previous model before restructuring?
• Imagine a similar situation where we have the entity types,
Person, City and Country. In what way should they be connected?
Semantic Net of Restructured ER Model
with Fan Trap Removed

SG37 works at branch B003.


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.
An Example of a Chasm Trap

At which branch office is property PA14 available?


We know that every property must be
assigned to some branch office.
Semantic Net of ER Model with Chasm Trap

At which branch office is property PA14 available?


We know that every property must be
assigned to some branch office.
ER Model Restructured to Remove Chasm Trap
Semantic Net of Restructured ER Model
An Example ER Diagram

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

You might also like