1
1
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
Chapter 6: Entity-Relationship Model
A database can be modeled as:
a collection of entities,
relationship among entities.
An entity is an object that exists and is distinguishable from other
objects.
Example: specific person, company, event, plant
Entities have attributes
Example: people have names and addresses
An entity set is a set of entities of the same type that share the same
properties.
Example: set of all persons, companies, trees, holidays
2
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
E-R Diagrams
Rectangles represent entity sets.
Diamonds represent relationship sets.
Lines link attributes to entity sets and entity sets to relationship sets.
Underline indicates primary key attributes
2
3
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
E-R Diagram With Composite, Multivalued, and
Derived Attributes
•Ellipses represent attributes
•Double ellipses represent multivalued attributes.
•Dashed ellipses denote derived attributes.
4
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
Relationship Sets with Attributes
3
5
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
Roles
Entity sets of a relationship need not be distinct
The labels “manager” and “worker” are called roles; they specify how
employee entities interact via the works_for relationship set.
Roles are indicated in E-R diagrams by labeling the lines that connect
diamonds to rectangles.
Role labels are optional, and are used to clarify semantics of the
relationship
6
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
One-To-Many Relationship
In the one-to-many relationship a loan is associated with at most one
customer via borrower, a customer is associated with several (including
0) loans via borrower
4
7
INFSCI1022
Textbook: Database System Concepts - 5th Edition, 2005
Many-To-One Relationships
In a many-to-one relationship a loan is associated