Entity-Relationship Model: Assoc. Prof. Tran Minh Quang Assoc. Prof. Dang Tran Khanh
Entity-Relationship Model: Assoc. Prof. Tran Minh Quang Assoc. Prof. Dang Tran Khanh
Entity-Relationship Model: Assoc. Prof. Tran Minh Quang Assoc. Prof. Dang Tran Khanh
Assoc. Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 2
What is ER Model? And Why?
External External External
Schema 1 Schema 2 Schema N
Interface between
conceptual schema and
external schemas
ER model is a logical
organisation of data within Conceptual
Schema
a database system
Three-level architecture: Interface between
Internal
Schema
Database
physically stored
in files on disks
Assoc. Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 3
What is ER Model? And Why?
Assoc. Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 4
Overview of Database Design Process
Types of Attributes
• In general, composite and multi-valued attributes
may be nested arbitrarily to any number of levels
although this is rare
→E.g., PreviousDegrees of a STUDENT is a composite
multi-valued attribute denoted by
{ PreviousDegrees (College, Year, Degree, Field) }
• 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
e1
r1 d1
e2 r2
e3 d2
r3
e4
r4
e5 d3
r5
e6
e7 r6
r7
e1
r1 p1
e2 r2
e3 p2
r3
e4
r4
e5 p3
r5
e6
e7 r6
r7
r8
PERSON MARRY
M
1
N PART COMPRISE
EMPLOYEE SUPERVISE
N
Assoc. Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 34
ER Diagram
An ER model can be expressed in the form of
the ER diagram
• An entity type is represented by a rectangular box
• A relationship is represented by a diamond-shaped
box
• Relationships are linked to their constituent entity
types by arcs
• The functionality of a relationship is indicated on the
arc
• Attributes of entity types/relationships, and
membership classes of entity types are listed
separately from the diagram
• The key attribute(s) is underlined
Assoc.Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 35
ER Diagram
(min, max) notation for relationship structural constraints
(0,1) (1,1)
(1,1) (4,N)
Assoc. Prof. Dr. Dang Tran Khanh, Faculty of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 42
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
Next lecture: you want to talk ? (some initial materials
are provided in my HP)
Assoc.Prof. Dr. Dang Tran Khanh, Facult Assoc.Prof. y of CSE, HCMUT (khanh@cse.hcmut.edu.vn) 44
Q&A