Lecture 9 Sem I 2025
Lecture 9 Sem I 2025
Lecture 9
Previous Lecture Content
The Entity Relationship Model
Lecture Content
The Entity Relationship Model (cont..)
What Should an Entity Be?
• Entity: A person, place, object, event, concept in
the user environment about which the organization
wishes to maintain data
• SHOULD BE:
• An object that will have many instances each with
distinguishing characteristic
• An object that will be composed of multiple attributes
• An object that we are trying to model
4
What Should an Entity Not
Be?
• SHOULD NOT BE:
• A user of the database system
• Treasurer manages account
• An output of the database system (e.g. a report)
• TREASURER receives EXPENSE REPORT
• STUDENT receives CGCARD
• PAYSLIP sent to FACULTY
• The names receives, sent to refer to activities that
transfer or translate data but does not indicate any
association between data.
5
Figure 3-4 Inappropriate entities
Appropriate entities
6
Strong Vs Weak Entity
Types
• Strong Entity Type: An entity that exists
independently of other entity types.
• It has identifier, attribute or combination of
attributes that uniquely distinguish each
occurrence of that entity
• Ex: COURSE, STUDENT, FACULTY
• Weak Entity Type: An entity type whose
existence depends on some other entity type
• It doesn’t have its own identifier
• Ex: COURSE and LECTURE SECTION
• EMPLOYEE and DEPENDENT
• Identifying owner: The entity type on which
the weak entity type depends
• Ex: COURSE and LECTURE SECTION
• EMPLOYEE and DEPENDENT
7
Attributes
8
Attributes
9
Attributes
• Single-Valued versus Multivalued Attribute
• Multivalued: An attribute that can take more than
one value for a given entity instance
• Ex: STUDENT having multiple skills
10
Attributes
• Derived Attribute –
• An attribute which can be derived from
other attributes of the entity type is known as derived
attribute. e.g.; Age (can be derived from DOB). In ER
diagram, derived attribute is represented by dashed
oval
11
Attributes[2]
• Classifications of attributes:
• Identifier Attributes (primary key)
• An attribute ( or combination of attributes) that uniquely
identifies individual instances of an entity type
• Ex: Employee: Employee_ID
• Identifier attribute is underlined
• Composite identifier: An identifier that consists of a
composite attribute
• Ex: Flight_ID (Flight_Number, Date)
12
Criteria for selecting Identifiers (primary
keys)
• Should not change its value over the life of each instance of the entity type
• Ex: Idno
• Should not take null values
• NULL -> no value
• Avoid intelligent identifiers
• e.g. containing locations or classifications that might change
• Intelligent identifiers: Idno, course code AAOC C311
• Consider substituting single attribute surrogate identifiers for long,
composite keys
• Ex: comp code for Course_Code, Record_No for Idno
13
Figure 3-8 -- Entity with a multivalued attribute (Skill) and
derived attribute (Years_Employed)
Multivalued:
Derived an employee can have
from date employed and current date
more than one skill
14
Figure 3-19 – an attribute that is both multivalued and composite
This is an
example of
time-
stamping
15
References:
16