You are on page 1of 19

ER Model

Done By: Thanasegari


Attributes
• An entity is represented by a set of attributes, that is,
descriptive properties possessed by all members of an entity
set.
Examples:
customer = (customer-name, social-security,
customer-street, customer-city)
account = (account-number, balance)
• Domain -- the set of permitted values for each attribute

• An attribute is associated with exactly one entity or


relationship
• Attributes may also be associated with relationships
Types of Attributes
Simple Attributes
- Attributes composed of a single component with
an independent existence

Eg.1
Types of Attributes
Composite Attributes
-Attributes composed of multiple components, each
with an independent existence

Figure 3-7 A composite attribute

An attribute
broken into
component
parts
Attributes
Single Valued Attributes
-Property of an entity or a relationship type

Customer ID Age City


0001 21 CCK
Attributes
Multi-valued Attributes
-Set of allowable values for one or more attributes

First Name Last Name Phone number Email


Lim Hui zhen 84843871, 68924335 thanas@hotmail.com,
ganuejd@hotmail.com

Figure 3-8 Entity with multivalued attribute (Skill)


and derived attribute (Years_Employed)

Multivalued
an employee can have
more than one skill
Attributes
Derived Attributes
-Attributes that represents a value that is derivable
from value of a related attribute, or set of attributes, not
necessarily in the same entity type

Date
Employed + Current Date
= Year
Employed
Keys
A super key of an entity set is a set of one or more attributes whose
values uniquely determine each entity

A candidate key of an entity set is a minimal super key


social-security is candidate key of customer
account-number is candidate key of account

Although several candidate keys may exist, one of the candidate


keys is selected to be the primary key.

The combination of primary keys of the participating entity sets


forms a candidate key of a relationship set.

must consider the mapping cardinality and the semantics of the


relationship set when selecting the primary key.
Weak Entity Sets
An entity set that does not have a primary key is referred to
as a weak entity set.
The existence of a weak entity set depends on the existence of
a strong entity set; it must relate to the strong set via a one-
to-many relationship set.
The discriminator of a weak entity set is the set of attributes
that distinguishes among all the entities of a weak entity set.
The primary key of a weak entity set is formed by the
primary key of the strong entity set on which the weak entity
set is existence dependent, plus the weak entity set's
discriminator.
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)
Strong vs. Weak Entities, and
Identifying Relationships
Strong entities

 exist independently of other types of entities


has its own unique identifier

identifier underlined with single-line

Weak entity

dependent on a strong entity (identifying owner)…cannot


exist on its own
does not have a unique identifier (only a partial identifier)

Partial identifier underlined with double-line

Entity box has double line

Identifying relationship

links strong entities to weak entities


Identifying relationship

Strong entity Weak entity

Umbrella
Example of a weak entity
Attributes on relationships
Attributes may be associated with a many-to-many (or
one-to-one) relationship, as well as with an entity
e.g., an organisation may want to record the date when an
employee completes each course
In the following diagram, the relationship ‘Completes’
joins the EMPLOYEE and COURSE entities, and
Date_Completed is joined to this as it is a property of the
relationship ‘Completes’
(a) Attribute on a relationship
Question
Reference
Reference

You might also like