Course: BIT112E1 – Introduction to
Database
CHAPTER 2
Conceptual Data Model
Instructor: VŨ THỊ MỸ HẰNG, Ph.D.
HCM, Spring 2024
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
2
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
3
Chapter 2 – Entity Relationship Model
Recall: Database Design Process
❑ Data Models: A collection of concepts used to describe
the structure of a DB (data types, relationships, and
constraints).
o Conceptual models: Provide concepts that are close to the way
(business) users perceive data (e.g., ER model provides concepts
such as entities, relationships to model database structures).
o Logical data models: Provide concepts that are understood by end
users, but not too far from the way data is organized within the
computer (e.g., Relational data model provides concepts such as
relations, primary keys to represent database structures).
o Physical data models: Provide concepts that describe the details of
how data is stored in the computer.
Database Design Process
4
Chapter 2 – Entity Relationship Model
Conceptual Data Modeling
❑ The process of constructing a conceptual data schema (or an abstract database
schema) used in an enterprise, independent of all physical considerations using
the information documented in the users’ requirements specification.
❑ Inputs to conceptual data modeling: The results of requirements analysis
❑ Outputs: The conceptual data schema (e.g., ER Diagram or ERD)
o A conceptual data schema represents objects of a given problem domain (entities,
attributes, relationships, and constraints).
5
Chapter 2 – Entity Relationship Model
Examples of Conceptual Schema
Example of an ER schema (ERD) Example of a Network Database Schema
6
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
o Entities, Entity Types, and Characteristics
o Relationships, Relationship Types, and Characteristics
o Weak Entities
o ER Diagrams (ERD)
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
7
Chapter 2 – Entity Relationship Model
Entities – Objects
❑ An entity is an object (a thing) in the real world with an independent existence.
o Physical existence (e.g., a particular person, car, house, or employee)
o Or a conceptual/abstract existence (e.g., a company, a job, or a university course)
Entity “Employee e1” Entity “Company c1”
8
Chapter 2 – Entity Relationship Model
Entity Types – Set of Objects
❑ An entity type (or set) is a collection of objects
that share common characteristics.
❑ In the database design, we model entity types
rather than individual concrete entities.
o An entity can be considered as an instance of an entity types.
❑ Notation:
o Entity Type: Rectangle
o Attribute (Entity’s Characteristics): Ellipse
❑ Example:
o Entity Type: CAR with three entities
o Attributes: Vehicle_id, Model, etc.
9
Chapter 2 – Entity Relationship Model
Attributes – Object’s Characteristics
❑ An attribute is a particular property (or characteristics) describing an entity type.
❑ Types of attributes:
o Simple (or Atomic) vs. Composite Attributes
o Single-valued vs Multi-valued Attributes
o Stored vs. Derived Attributes
o Complex Attributes (Composite & Multi-valued Attributes)
o Key Attributes (Identifiers)
10
Chapter 2 – Entity Relationship Model
Attributes: Simple (Atomic) vs. Composite
❑ A simple (atomic) attribute is indivisible (cannot be divided into subparts).
❑ A composite attribute can be divided into smaller, meaningful subparts.
Simple (Atomic)
Attribute
Composite
Attribute
11
Chapter 2 – Entity Relationship Model
Attributes: Single-valued vs. Multi-valued
❑ A single-valued attribute has only one value for a particular entity.
❑ A multi-valued attribute can have a set of values for the same entity.
o Notation: Double Ellipse
Single-valued
Attribute
Multi-valued
Attribute
12
Chapter 2 – Entity Relationship Model
Attributes: Stored vs. Derived
❑ A stored attribute is physically stored in databases.
❑ A derived attribute can be calculated from stored attributes and may not be
physically stored in databases.
o Notation: Dashed Ellipse
Derived Attribute “Age” can be
calculated from “Birth_date”
Age
13
Chapter 2 – Entity Relationship Model
Attributes: Complex Attributes
❑ A complex attribute is a combination of composite and multi-valued attributes.
Complex
Attribute
14
Chapter 2 – Entity Relationship Model
Attributes: Keys (Identifiers)
❑ Key attributes (or Identifiers) of an entity type is a set of attributes whose
values are distinct for each individual entity in the entity set.
o Used to identify each entity uniquely.
o Ensure uniqueness constraint (or entity integrity constraint).
o Each entity type has only one key or identifier.
o Notation: Underlined Car’s ID:
(Vehicle_ID, State, Number)
Project’s ID:
(Name, Number)
Employee’s ID:
SSN (Social Security Number)
15
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
o Entities, Entity Types, and Characteristics
o Relationships, Relationship Types, and Characteristics
o Weak Entities
o ER Diagrams (ERD)
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
16
Chapter 2 – Entity Relationship Model
Relationships & Relationship Types
❑ A relationship (or relationship instance) is an association representing an
interaction among the instances (i.e., entities) of one or more entity types.
❑ A relationship type (or set) consists of a collection of relationships that share
the same name and represent meaningful associations among entity types.
The relationship type
WORKS_FOR between
EMPLOYEE and DEPARTMENT.
Some instances in the WORKS_FOR
relationship type.
17
Chapter 2 – Entity Relationship Model
Relationships & Relationship Types
❑ In the database design, we model relationship types rather than relationships.
o A relationship can be considered as an instance of a relationship type.
❑ Notation: Diamond-box with the relationship name (a singular verb) written inside.
The relationship type
ADMINS between xc
COLLEGE and
DEPT.
xc
x
xc
c
18
Chapter 2 – Entity Relationship Model
Relationship Characteristics
❑ Characteristics of a relationship type:
o Attributes
o Degree
o Cardinality Constraint
xc
xc
x
xc
c
19
Chapter 2 – Entity Relationship Model
Relationship Characteristics: Attributes
❑ Characteristics of a relationship type:
o A relationship may have attributes.
The value of the attribute xc
CStartDate will be
determined by an Instructor
and a Department.
xc
x
xc
c
20
Chapter 2 – Entity Relationship Model
Relationship Characteristics: Degree
❑ Characteristics of a relationship type:
o The degree of a relationship type is the number of participating entity types.
▪ Unary (or recursive) relationship: Degree 1
▪ Binary relationship: Degree 2
▪ Ternary relationship: Degree 3
▪ n-ary relationship: Degree n (General case)
[The Most Popular]
Binary Relationship Ternary Relationship
(Degree = 2) (Degree = 3)
Unary (Recursive) Relationship
(Degree = 1)
SUPERVISE
21
Chapter 2 – Entity Relationship Model
Relationship Characteristics: Cardinality Constraint
❑ Characteristics of a relationship type:
o A cardinality constraint indicates the number of instances of entity B that can (or must)
be associated with each instance of entity A.
▪ The minimum cardinality is the minimum number of B associated with each instance of A.
▪ The maximum cardinality is the maximum number of B associated with each instance of A.
xc An instructor can serve as the chair of zero or at most
one department, while each department must have
only one instructor as its chair
xc
x
xc
c A department can have zero or multiple students, while a student
can be affiliated with zero or only one department.
22
Chapter 2 – Entity Relationship Model
Cardinality Ratio Constraints (Based on Maximum Cardinalities)
❑ One-to-one (1:1)
o Each instance of the first entity is associated with
exactly one instance of the second entity, and
vice versa.
o E.g., MANAGES
❑ One-to-many (1:N)
o Each instance of the first entity is associated with
multiple instances of the second entity, but each
instance of the second entity is associated with at
most one instance of the first entity.
o E.g., WORKS_FOR, CONTROLS
❑ Many-to-many (N:M)
o Each instance of the first entity can be associated
with multiple instances of the second entity, and
vice versa.
o E.g., WORKS_ON
23
Chapter 2 – Entity Relationship Model
Participation Constraints (Based on Minimum Cardinalities)
❑ Total participation
o The total set of an entity type must participate
in a relationship (minimum cardinality = 1).
o Notation: Double line [Optional, except for
supertypes/subtypes relationships]
o E.g., MANAGES (Department Managed)
❑ Partial participation
o Some of the set of an entity type participate in
a relationship (minimum cardinality = 0).
o E.g., MANAGES (Manager)
24
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
o Entities, Entity Types, and Characteristics
o Relationships, Relationship Types, and Characteristics
o Constraints
o Weak Entities
o ER Diagrams (ERD)
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
25
Chapter 2 – Entity Relationship Model
Weak Entity Types
❑ A weak entity type is one whose existence depends on some other entity type (the
owner entity type) through an identifying relationship.
o Notation: Double-lined rectangle
Owner
Entity Type
Identifying The participation constraint of a weak entity
Relationship type must be total participation.
Weak Entity Type
26
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
o Entities, Entity Types, and Characteristics
o Relationships, Relationship Types, and Characteristics
o Constraints
o Weak Entities
o ER Diagrams (ERD)
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
27
Chapter 2 – Entity Relationship Model
Examples of ERDs
Alternative Cardinality Notation
28
Chapter 2 – Entity Relationship Model
Summary of Notation
Entity-Relationship Notation Constraint Notation
Attribute
29
Chapter 2 – Entity Relationship Model
Practice (ER)
Identify entity types, relationships, and constraints from data requirement specification.
▪ A SUPPLIER may supply many ITEMs. Each ITEM is supplied by any number of SUPPLIERs.
▪ Each ITEM must be used in the assembly of at least one PRODUCT and may be used in many
products.
▪ A SUPPLIER may send many SHIPMENTs. However, each shipment must be sent by exactly one
SUPPLIER.
▪ A SUPPLIER may be able to supply an item but may not yet have sent any shipments of that item.
▪ A SHIPMENT must include one (or more) ITEMs. An ITEM may be included on several
SHIPMENTs.
▪ A CUSTOMER may submit any number of ORDERs. However, each ORDER must be submitted by
exactly one CUSTOMER.
▪ An ORDER must request one (or more) PRODUCTs. A given PRODUCT may not be requested on
any ORDER or may be requested on one or more orders.
30
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
o Supertypes and Subtypes
o Supertypes/Subtypes Relationship Constraints
o Specialization and Generalization
❑ Tools
31
Chapter 2 – Entity Relationship Model
Supertypes (Superclasses) and Subtypes (Subclasses)
32
Chapter 2 – Entity Relationship Model
Supertypes (Superclasses) and Subtypes (Subclasses)
33
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
o Supertypes and Subtypes
o Supertypes/Subtypes Relationship Constraints
o Specialization and Generalization
❑ Tools
34
Chapter 2 – Entity Relationship Model
Completeness (or Coverage) Constraint
❑ Specify whether an entity in the supertype must Total
also be a member of at least one subtype. participation
❑ Total specialization rule
o Every entity in the supertype must be a member of at
least one subtype.
o Notation: Double line, or (t)
❑ Partial specialization rule Partial
o An entity in the supertype may not have a participation
corresponding entity in the subtype.
o Notation: Single line, or (p)
35
Chapter 2 – Entity Relationship Model
Disjointedness Constraint
❑ Specify whether an entity in the supertype can be a Overlapping
member of more than one subtype.
❑ Disjoint specialization rule
o An entity in the supertype can belong to only one subtype.
o Notation: d
❑ Overlapping specialization rule
o An entity in the supertype to be a member of more than Disjoint
one subtype simultaneously.
o Notation: o
36
Chapter 2 – Entity Relationship Model
Example
(total, overlapping)
(total, disjoint)
(partial, disjoint)
37
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
o Supertypes and Subtypes
o Supertypes/Subtypes Relationship Constraints
o Specialization and Generalization
❑ Tools
38
Chapter 2 – Entity Relationship Model
Specialization and Generalization
❑ Specialization is a top-down process of defining one or more subtypes of
the supertype and forming supertype/subtype relationships
❑ Generalization is a bottom-up process of defining a more general entity type
(supertype) from a set of more specialized entity types (subtypes).
39
Chapter 2 – Entity Relationship Model
Specialization and Generalization
SPECIALIZATION
Define subtypes
Define supertypes
GENERALIZATION
40
Chapter 2 – Entity Relationship Model
Content
❑ Conceptual Data Modeling
❑ Entity Relationship (ER) Model Concepts
❑ Entity Relationship Diagram (ERD)
❑ Enhanced-ER (EER) Model Concepts
❑ Tools
41
Chapter 2 – Entity Relationship Model
Data Modeling Tools
COMPANY TOOL FUNCTIONALITY
Embarcadero ER Studio Database Modeling in ER and IDEF1X
Technologies DB Artisan Database administration and space and security
management
Oracle Developer 2000 and Designer 2000 Database modeling, application development
Popkin Software System Architect 2001 Data modeling, object modeling, process modeling,
structured analysis/design
Sybase Enterprise Application Suite Data modeling, business logic modeling
Visio Visio Enterprise Data modeling, design and reengineering Visual Basic
and Visual C++
JGraph Ltd Draw.io General tool for creating visual elements.
42
Chapter 2 – Entity Relationship Model
THANK YOU
FOR YOUR ATTENTION!
43