0% found this document useful (0 votes)
16 views34 pages

EER Modelling

Uploaded by

aashir.aftab01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views34 pages

EER Modelling

Uploaded by

aashir.aftab01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

ENHANCED ENTITY-

RELATIONSHIP (EER)
MODELING
INTRODUCTION
 Enhanced Entity Relationship (EER) model is
an extension of the original ER model

 Why do we need EER Model ?

 Which concepts and relationships cannot be


captured by ER Model ?
AN EXAMPLE: EMPLOYEE
SUPERTYPE
 Suppose that an organisation has 3 types of
employees:
 Hourly:
 Employee_Number, Employee_Name, Address,
Date_Hired, Hourly_Rate
 Salaried:
 Employee_Number, Employee_Name, Address,
Date_Hired, Annual_Salary, Stock_Option
 Contract consultants:
 Employee_Number, Employee_Name, Address,
Date_Hired, Contract_Number, Billing_Rate
Employee supertype with three subtypes

All employee
subtypes will have
emp_no., name,
address, and date-
hired

Each employee
subtype will also
have its own
attributes
SUPERTYPE/SUBTYPE RELATIONSHIPS
 Allows us to model a general entity type (the
supertype) and then subdivide it into several
specialised entity types (called subtypes)

 Each subtype inherits from its supertype and


may have special attributes of its own
Basic notation for supertype/subtype relationships
SUBCLASSES AND SUPERCLASSES
 An entity type may have different sub-
groupings
 Example: EMPLOYEE may be grouped into:
 SECRETARY, ENGINEER, TECHNICIAN, …
 MANAGER

 SALARIED_EMPLOYEE, HOURLY_EMPLOYEE

7
SUBCLASSES AND SUPERCLASSES

8
Subclasses and Superclasses

9
ATTRIBUTE INHERITANCE IN
SUPERCLASS / SUBCLASS RELATIONSHIPS
 An entity that is member of a subclass inherits
 All attributes of the superclass
 All relationships of the superclass

 Example:
 The SECRETARY (as well as TECHNICIAN and ENGINEER)
inherit the attributes Name, SSN, …, from EMPLOYEE
 Every SECRETARY entity will have values for the
inherited attributes

 Superclass/Subclass Relationships are also called IS-A


relationships
 SECRETARY IS-A EMPLOYEE,
 TECHNICIAN IS-A EMPLOYEE, 10
SUBCLASSES AND SUPERCLASSES
 Examples:
A salaried employee who is also an engineer
belongs to the two subclasses:
 ENGINEER, and
 SALARIED_EMPLOYEE

A salaried employee who is also an


engineering manager belongs to the three
subclasses:
 MANAGER,
 ENGINEER, and

 SALARIED_EMPLOYEE

 It is not necessary that every entity in a 11


superclass be a member of some subclass
Subclasses and Superclasses

12
WHEN TO USE SUPERTYPE/SUBTYPE
RELATIONS
 We use subtypes when
 There are attributes that apply to some (but
not all) of the instances of an entity type
 The instances of a subtype participate in a
relationship unique to that subtype
Supertype/subtype relationships of patients

Both outpatients
and resident
patients are cared
for by a responsible
physician

Only resident patients are


assigned to a bed
GENERALIZATION AND
SPECIALIZATION
 Generalization
 Theprocess of defining a more general entity
type from a set of more specialized entity types.
 BOTTOM-UP

 Specialization
 The process of defining one or more subtypes of
the supertype, and forming supertype/subtype
relationships.
 TOP-DOWN
Example of Generalization
Three entity types: CAR, TRUCK, and MOTORCYCLE

All these types


of vehicles have
common
attributes
Generalization to VEHICLE supertype

So we put
the shared
attributes in
a supertype

Note: no subtype for motorcycle, since it has no unique attributes


SPECIALISATION
 An entity type PART has attributes
 Part_No,Description, Unit_price, Location,
Qty_On_Hand, Routing_Number and Supplier
 There may be more than one supplier
 Some parts are internally Manufactured Parts
while others are externally Purchased Parts
 Some parts are obtained from both sources
 The choice depends on factors such as
manufacturing capacity, unit price of the parts
etc.
Example of Specialization
Entity type PART
Applies only to purchased parts

Only applies
to
manufactured
parts
Specialization to MANUFACTURED PART and PURCHASED PART

Created 2 subtypes

(0,N)

(1,N)

Note: multivalued attribute was replaced by a relationship


to another entity
COMPLETENESS CONSTRAINTS
 TotalSpecialization: An entity instance of a
supertype must also be a member of at least
one subtype.

 Partial
Specialization : An entity instance of the
supertype is allowed not to belong to any
subtype.
Examples of completeness constraints
Total specialization rule

(0,N)
(1,1)

A patient must be
either an
outpatient or a
resident patient
(1,1) (0,1)
Partial specialization rule

A vehicle could be
a car, a truck, or
neither
(motorcycle)
DISJOINTNESS CONSTRAINT
 Can an instance of a supertype may
simultaneously be a member of two (or
more) subtypes?
 Yes
 We have two possibilities: Disjoint or
Overlapping Subtypes
DISJOINTNESS CONSTRAINT
 Disjoint Rule: An instance of the supertype
can be only ONE of the subtypes.
 It is specified by the letter ‘d’

 Example: At any one time a PATIENT must


be either an outpatient or a resident patient
but cannot be both
 The subclass of a patient may change over

time, but at any given time a patient is of


only one type
Examples of disjointness constraints

(1,1)
(0,N)

A patient can either be


outpatient or resident, but
not both

(1,1) (0,1)
DISJOINTNESS CONSTRAINT
• Overlap Rule: An instance of the supertype
can simultaneously be a member of more than
one of the subtypes.

• Example: Some PARTs are both Manufactured


and Purchased.
• An instance of PART is a particular Part Number
(i.e. type of part) rather than the individual part
itself.
• Consider Part Number 4000, at a given time there
may be 250 of this part to hand, of which 100 are
manufactured and 150 are purchased.
Overlap rule

A part may be
both
purchased and
manufactured (0,N)

(1,N)

Double line suggests any part must be either a


purchased part or a manufactured part, or it may
simultaneously be both of these
DEFINING SUPERTYPE/SUBTYPE
HIERARCHIES
Let us model Human resources in a University

 We have three types of resources: EMPLOYEE, STUDENT and


ALUMNUS (already graduated). All three types have
attributes such as SSN, Name, Address, Gender and
BirthDate.
 A person may belong to more than one subtype such as
ALUMNUS and EMPLOYEE. Alumnus have degrees. And
Employee gets salary.
 The two major subtypes of Employee are: FACULTY and
STAFF. There may be other types of employees. Each staff
member have position and faculty member have rank. An
employee cannot be both Faculty and Staff at the same time.
 There are only two subtypes for student: GRADUATE and
UNDERGRADUATE. For Graduate we record test-scores and
for Undergrad we record class standing.
Example of supertype/subtype hierarchy
THE DIAGRAM IS SUPPOSED TO MODEL A COMPANY BUYING
PRODUCTS FROM PRODUCERS AND SELLING TO CUSTOMERS.
FIND ERRORS ??
ALTERNATIVE DIAGRAMMATIC
NOTATIONS
 ER/EER diagrams are a specific notation for
displaying the concepts of the model
diagrammatically
 DB design tools use many alternative

notations for the same or similar concepts


 One popular alternative notation uses UML

class diagrams

32
ALTERNATIVE DIAGRAMMATIC NOTATIONS

33
SUMMARY
 Introduced the EER model concepts
 Class/subclass relationships
 Specialization and generalization
 Inheritance
 These augment the basic ER model concepts
introduced in Chapter 3
 EER diagrams and alternative notations were

presented

34

You might also like