ERModel
ERModel
Levels of Abstraction
4
The Pieces
Objects
– Entity (including weak entities)
– Attribute
– Relationship
“Structural” Constraints
– Cardinality
– Participation
5 3753 X1
Entities
6
Entity Types
9
Attributes
Attribute: A properity of an entity or a relationship
type. For example: staffNo, name, position... To
describe the entity Staff.
Attribute Domain: The set of allowable values for one
or more attributes.
Attributes can be classified as being: simple or
composite; single-valued or multi-valued; or derived.
Simple and Composite Attributes
First
Professor
Composite Name
Last
12
Single-Valued and Multi-Valued
Attributes
14
Derived Attributes
16
Keys
Candidate Key (never NULL): The minimal set of
attributes that uniquely identifies each occurrence of an
entity type. E.g: branchNo in entity Branch.
Primary Key: The candidate key that is selected to
uniquely identify each ocurrence of an entity type.
E.g:National Insurance Number.
Composite Key: A candidate key that consist of two or
more attributes.
Primary Keys
Professor Employee ID
18
Relationship Types
Relationship Type: A set of meaningful associations
among entity types.
Relationship Occurrence: A uniquely identifiable
association, which includes one occurrence from each
participating entity type.
Staff Solicitor
Registers Branch
Arranges Financial
Buyer Institution
Client
Bid
“Staff registers a client at a branch”
“A solicitor arranges a bid on behalf of a
buyer supported by a financial institution”
Recursive Relationship
Recursive Relationship: A relationship type where
the same entity type participates more than once in
different roles.
Manages
Staff Branch
Has
Diagramatic Representation of
attributes
Primary Key
Staff Branch
satffNo {PK} Manages branchNo {PK}
Area to list name Address
attributes position street Composite
Has
salary/totalStaff city attribute
postcode
telNo[1..3]
Derived attribute
Multi-valued attribute
Strong and Weak Entity Types
Strong Entity Type: An entity type that is not existence-
dependent on some other entity type.
Weak Entity Type: An entity type that is existence-
dependent on some other type.
STRONG ENTITY WEAK ENTITY
Client Preference
States
clientNo {PK} prefType
name maxRent
fName
lName
telNo
Weak entity
24
Weak entity
The discriminator (or partial key) of a weak entity set is the set of
attributes that distinguishes among all the entities of a weak entity
set.
Weak entities always have total participation as they cannot exist
without the identifying relationship.
25
Weak Entity Sets (Cont.)
We depict a weak entity set by double rectangles.
We underline the discriminator of a weak entity set with a dashed line.
payment-number – discriminator of the payment entity set
Primary key for payment – (loan-number, payment-number)
Weak Entity (cont’d)
Section
Section ID
Number
Course
27
Cardinality and Participation
Constraints
Cardinality: Describes the maximum number of
possible relationship occurrences for an entity
participating in a given relationship type. E.g: 1..1, 1..*,
*..*, etc,etc.
Participation: Determines whether all or only some
entity occurrences participate in a relationship
(mandatory or optional).
Branch
Staff
Manages
staffNo 1..1 0..1 branchNo
Participation of an Entity Set in a
Relationship Set
since
name dname
ssn lot did budget
•Dashed line!!
dateAdvert
cost
Cardinality Constraints
Multiplicity: The number (or range) of possible occurrences of an entity type that may relate to a single occurrence of
an associated entity type through a particular relationship.
Staff ProperityForRent
Oversees
staffNo 0..1 0..* properityNo
Staff Branch
Manages
staffNo 1..1 0..1 branchNo
Newspaper ProperityForRent
Advertises
newspaperName 0..* 1..* properityNo
name
Used when we have to
ssn lot
model a relationship
involving (entity sets
Employees
and) a relationship set.
– Aggregation allows
us to treat a Monitors until
relationship set as an
entity set for
purposes of
participation in started_on since
dname
(other) relationships. pid pbudget budget
did