Entity Relationship (ER)
Modeling
• Entity relationship components
• Developing ER Diagram
Database Management –
COMP3140
Billy Yu
1
The Entity Relationship Model
• Graphical representation of entities and
their relationships in a database structure
• Entity relationship diagram (ERD)
– Uses graphic representations to model
database components
• Entity instance or entity occurrence
– Rows in the relational table
• Connectivity: Term used to label the
relationship types
2
Introduction to ER modeling
Video
• https://www.youtube.com/watch?v=QpdhBUYk7Kk&t=193s
3
Attributes
• Characteristics of entities
• Required attribute: Must have a value,
cannot be left empty
• Optional attribute: Does not require a
value, can be left empty
• Domain - Set of possible values for a
given attribute
• Identifiers: One or more attributes that
uniquely identify each entity instance
4
Attributes
• Composite identifier: Primary key
composed of more than one attribute
• Composite attribute: Attribute that
can be subdivided to yield additional
attributes
• Simple attribute: Attribute that
cannot be subdivided
• Single-valued attribute: Attribute
that has only a single value
• Multivalued attributes: Attributes
that have many values
5
Figure 2.3 - The ER Model
Notations
6
More example
https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model
7
Figure 2.4 - A Comparison of
OO, UML and ER Models
• invoices are generated by customers,
• each invoice references one or more lines, and
• each line represents an item (or items) purchased by a customer.
8
Figure 4.1 - The Attributes of
the Student Entity: Chen and
Crow’s Foot
9
Figure 4.3 - A Multivalued
Attribute in an Entity
10
Figure 4.8 - A Weak (Non-
Identifying) Relationship
between COURSE and CLASS
11
Figure 4.9 - A Strong
(Identifying) Relationship
between COURSE and CLASS
12
Figure 4.13 - CLASS is Optional
to COURSE
13
Figure 4.14 - COURSE and CLASS
in a Mandatory Relationship
14
Special relationships….
• Rare they are, but still possible
15
Relationship Degree
• Indicates the number of entities or
participants associated with a relationship
• Unary relationship: Association is
maintained within a single entity
– Recursive relationship: Relationship exists
between occurrences of the same entity set
• Binary relationship: Two entities are
associated
• Ternary relationship: Three entities are
associated
16
Figure 4.15 -
Three Types
of
Relationship
Degree
17
Entity Relationship Model
Advantages Disadvantages
• Visual modeling yields • Limited constraint
conceptual simplicity representation
• Visual representation • Limited relationship
makes it an effective representation
communication tool • No data manipulation
• Is integrated with the language
dominant relational model • Loss of information
content occurs when
attributes are removed
from entities to avoid
crowded displays
18
Figure 4.17 - An ER
Representation of Recursive
Relationships
19
Database Design Challenges:
Conflicting Goals
Database design must conform to design standards
Need for high processing speed may limit the
number and complexity of logically desirable
relationships
Need for maximum information generation may lead
to loss of clean design structures and high
transaction speed
20