ITE 2422 - Week 4 - L6
ITE 2422 - Week 4 - L6
ENHANCED
ENTITY-
R E L AT I O N S H I P
(EER)
MODELLING
LESSON 6
LEARNING OUTCOMES
• After completing this lesson, you will be able to design a EER diagram
to a real-world scenario.
2
OUTLINE
• EER Vs. ER diagrams
• Super classes and sub classes
• Specialization and generalization
• Distjointness constraint
• Completeness constraint
3
ENHANCED ER (EER)
MODELLING
• Since the 1980s there has been an increase in the emergence of new
database applications with more demanding requirements.
4
EER MODELLING
• EER is also Known as Extended ER model
5
SUPERCLASS AND
SUBCLASS
• A Superclass – is an entity type that includes distinct Subclasses that
require to be represented in a data model. The superclass is also
known as the parent class or base class.
• A Subclass is an entity type that has a distinct role and is also a
member of the Superclass
Vehicle
Vehicle is the Superclass and its
subclasses are Car, Truck and
Motorcycle.
6
SUPERCLASS AND
SUBCLASS EXAMPLES
• Member (superclass): Life_Member, Regular_Member,
Season_Member (subclasses)
• Staff (superclass): Full_Time_Staff, Part_Time_Staff (subclasses)
Staff_No DOB
Employee
SName Address
Sales_
Technician Secretary
Personnel
Technical Sales_Area
Typing_Speed
grade 8
IS-A (‘IS A’) HIERARCHIES
Inheritance IS-A (instance) Relationship
• If we declare A is a B. Every A entity is considered to be a B entity.
• Secretary IS-A Employee
9
IS-A RELATIONSHIP
Student sid
name
Generalization Is A Specialization
Undergraduate Graduate
This introduces two new terms, so, what is Generalization and Specialization?
SPECIALIZATION AND
GENERALIZATION
• Specialization
– The process of maximizing the differences between members of an entity by
identifying their distinguishing characteristics.
– Identify subclasses and their distinguishing characteristics (attributes,
relationships)
– Start with entity type then define subclasses by successive specialization
Top-Down
• Generalization
– The process of minimizing the differences between entities by identifying their
common characteristics.
– Aggregates entities into a superclass entity types by identifying their common
characteristics
Bottom up
11
SPECIALIZATION AND
GENERALIZATION
• CAR, TRUCK generalized into VEHICLE;
12
SPECIALIZATION The circle with d
specifies that the
AND specializations are
disjoint. A member of
GENERALIZATION Undergrad entity set
NOT a member of the
Notations used: graduate entity set.
Student sid
Student sid
name
Is A
Undergraduate Graduate
14
ACTIVITY 1
• Explain how specialization minimizes amount of null values?
• Explain it using a suitable example.
15
SPECIALIZATION
CONSTRAINTS
Rather than the usual cardinality symbols, the subclass association line is
labeled with specialization constraints.
Constraints are described along two dimensions: incomplete versus
complete, and disjoint versus overlapping.
• Non-Disjoint (overlap)
– Members in a Superclass can be enrolled in more than one Subclass
– That is the same entity may be a member of more than one subclass of
the specialization
– Specified by o in EER diagram
17
Specialization of employee entity into job roles and contract of
employment subclasses.
d d
Full_time_ Part_time_
Sales_ Permanent Temporary
Technician Secretary
Personnel
Salary_Sc Hourly_
ale Rate
Typing_Speed Holiday_
Tgrad Sales_Area Allowance 18
NON-DISJOINT
CONSTRAINTS Subclasses may have overlapping
sets of entities.
Musician That is, a musician can be both a
singer as well as a guitarist.
O = Overlap
Singer Guitarist
19
COMPLETENESS
CONSTRAINTS
• Total specialization
– All member in the Superclass must participate in either one Subclass.
– Shown in EER diagrams by a double line
• Partial specialization
– At least one member in the Superclass does not participate in the Subclass.
– Partial allows an entity not to belong to any of the subclasses
– Shown in EER diagrams by a single line
20
Specialization of employee entity into job roles and contract of
employment subclasses.
Address
EName Emp_No
Partial constraint- DOB
At least one staff
is not a
Employee
Technician,
Secretary, or
Sales Personnel Total
Constraints
d Partial d
Constraints
Full_time_ Part_time_
Sales Permanent Temporary
Technician Secretary
Personnel
Hourly_
Salary_Scale Rate
Typing_Speed Holiday_
Tgrade Sales_Area Allowance 21
SPECIALIZATION LATTICE
(MULTIPLE INHERITANCE)
Employee
d d
Engineering_Manager
22
SPECIALIZATION LATTICE
• Multiple inheritance
– A subclass with more than one superclass
– If attribute (or relationship) originating in the same superclass inherited
more than once via different paths in lattice
• Included only once in shared subclass. E.g. Engineer-Manager
• Single inheritance
– Some models and languages limited to single inheritance
23
Multiple
Inheritance
24
ACTIVITY 2
25
BUILDING EER
Steps:
• Identify entity types.
• Identify relationship types.
• Determine cardinality and participation constraints of relationship
types.
• Identify and associate attributes with entity or relationship types.
• Determine candidate and primary key attributes.
• Determine Specialize / generalize entity types.
• Draw the EER Diagram.
26
ACTIVITY
Draw the EER diagram.
• The Motor Vehicle Branch administers driving tests and issues driver's licenses.
Any person who wants a driver's license must first take a learner's exam at
any Motor Vehicle Branch in their province.
• If s/he fails the exam, he can take the exam again any time after a week of the
failed exam date, at any branch.
• If s/he passes the exam, s/he is issued a license (type = learner's) with a unique
license number. A learner's license may contain a single restriction on it. The
person may take his driver's exam at any branch any time before the learner's
license expiry date (which is usually set at six months after the license issue
date).
• If he passes the exam, the branch issues him a driver's license. A driver's license
must also record if the driver has completed driver's education, for insurance
purposes.
27
SUMMARY
• In this lesson, we have learnt about the Enhanced ER (EER) diagrams.
Some of the semantic information in the real world cannot be
indicated in ER diagrams. As such, EER diagram was proposed.
• Super class/subclass relationships are indicated in the EER diagram.
• In the next lesson we will be learning about the relational model.
28