Professional Documents
Culture Documents
Modeling
Basic concept:
Subset/Superset
Examples:
Some Employees are Hourly
Some Employees are Managers
All Employees are either technical,
clerical, or managerial
All employees are either Hourly or
Salaried
EMPLOYEE
Employee
WORKS
FOR
Department
Bonus
MANAGES
MANAGER
Mgrs can get bonuses
ISA = Inheritance
MANAGER gets all attribs of
EMPLOYEE
can participate in all relations
EMPLOYEE participates in.
this is called INHERITANCE:
every MANAGER is also an
EMPLOYEE.
All of this is idea of "ISA" or
"Superclass/Subclass"
Specializing Employee
d: employee
cannot be both
clerical and
technical.
EMPLOYEE
o: can be
both
Clerical
Technical
Managerial
Total
Participation
Cant
belong to
more than
one
Clerical
Partial
Participation
o
Managerial
Technical
Can
belong to
both
Hourly
Contractor
Kinds Of Specialization
Condition (Predicate) defined involves
several attributes
EX: (Job_type=Managerial and Salary >
100K Upper_Managerial subclass)
User Defined
User places entity in subclass when
entity is created
Generalization
Build Up Superclass from SubClasses
Diagram Looks the same as in
Specialization
Process goes in reverse direction
Generalization
Ex: Company buys Steel and Paper Mills and
merges Databases
Attributes of FACTORY: INTERSECTION
of attributes of the Subclasses.
FACTORY
d
Steel Mill
Paper Mill
Specialization Lattice
Overlapping Specialization
Specializations of Specializations
Multiple Inheritance
Lattice Example
Student graduates and so is Alumnus
Returns to School and so is a Student
too
Gets TA position and so is an
Employee
Lattice
Example
Student
Person
o
Employee
Alumnus
Grad Asst
2001 Irwin Levinstein
Converting an EER-Diagram
To a Relational Schema
The Problem
KEY
1. Solution must
associate base
attributes with
specialized attributes
for each object
A
BASE
2. Desirable to enforce
disjoint constraint
d
C
D
Sub1
3. Avoid Nulls
G
E
F
Sub2
Sub3
BASE
d
B
Join on FK
to get all
attribs
KEY
BASE
A
KEY
Sub1
C
Sub2
E
Sub3
KEY
G
Sub1
Sub2
KEY
Sub3
KEY
BASE
KEY
d
C
D
G
E
Sub1
KEY
Sub2
Sub3
Sub1
A B
C D
Sub2
A B
E F
Sub3
A B
G H
KEY
BASE
A B Type C D E
123 aa bb Sub1
456 a4 b4 sub2
Sub1
Sub2
f1
cc dd
234 a2Type
b2 Sub2
ff row
will
says which
fields
ee each
345 a3have
b3 Sub3 gg hh
BASE
Sub3
e1
Disjoint constraint
enforced by PK
LOTS of NULLS ()
Summary
3 Solutions
super/sub tables
subtables only
one big table
None is perfect
Part of reason for development of
Object Relational Databases
2001 Irwin Levinstein
10