2.CSI2004-ADBMS-Module1_ER Model_compressed
2.CSI2004-ADBMS-Module1_ER Model_compressed
Management Systems
Entity –Relationship Model
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
Entity –Relationship Model
12/18/2024 4:37:37
PM
14.4
Entity –Relationship Model
•In this step, the database designer creates an
entity-relationship (E-R) diagram to show the
entities for which information needs to be stored
and the relationship between those entities.
• E-R diagrams uses several geometric shapes.
•A few of them
❑ Rectangles represent entity sets
❑ Ellipses represent attributes
❑ Diamonds represent relationship sets
Lines link attributes to entity sets and link
entity sets to relationships sets
12/18/2024 4:37:37
PM
14.5
Entity –Relationship Model
12/18/2024 4:37:37
PM Entities, attributes and relationships in an E-R diagram
14.9
Entity – Relationship Model
Attributes
An entity is represented by a set of attributes, that is descriptive
properties possessed by all members of an entity set.
Example:
customer = (customer_id, customer_name, customer_street, customer_city )
loan = (loan_number, amount )
Composite Attributes
E-R Diagram With Composite,
Multivalued, and Derived Attributes
Relationship Sets with Attributes
Entity Sets customer and loan
customer_id customer_ customer_ customer_ loan_ amount
name street city number
Entity –Relationship Model
Relationship Sets
A relationship is an association among several
entities
Example:
Hayes depositor A-102
customer entity relationship set account entity
A relationship set is a mathematical relation among
n 2 entities, each taken from entity sets
{(e1, e2, … en) | e1 E1, e2 E2, …, en En}
Mapping Cardinalities
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
24
Entity –Relationship Model
Cardinality Constraints
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
Entity –Relationship Model
Many-To-One Relationships
In a many-to-one relationship a loan is associated
with several (including 0) customers via borrower, a
customer is associated with at most one loan via
borrower
Entity –Relationship Model
Many-To-Many Relationship
36
Summary of Symbols Used in E-R Notation
Summary of Symbols