DBMS Chapter 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

CHAPTER 4

ENHANCED ENTITY –RELATIONSHIP


AND OBJECT MODELING

Outline
Subclass, Super-class and Inheritance

Specialization and Generalization

Constraints and Characteristics of Specialization and


Generalization
1
SUBCLASSES, SUPER CLASSES, AND
INHERITANCE
 In many cases an entity type has numerous sub groupings or
subtypes of its entities that are meaningful and need to be
represented explicitly because of their significance to the
database application.
 For example, the entities that are members of the
EMPLOYEE entity type may be distinguished further into
SECRETARY,
ENGINEER,MANAGER,TECHNICIAN,SALARIED_EMPL
OYEE,HOURLY_EMPLOYEE, and so on.
 The set of entities in each of the latter groupings is a subset of
the entities that belong to the EMPLOYEE entity set, meaning
that every entity that is a member of one of these sub
groupings is also an employee. We call each of these sub
groupings a subclass or subtype of the EMPLOYEE entity
type, and the EMPLOYEE entity type is called the super
class or super type for each of these subclasses. 2
EXAMPLE

3
Relationships and attributes of super class are
inherited to subclass (in particular primary key
attribute(s)); subclass can have additional
attributes and relationships
 An entity cannot exist merely by being a
member of only a subclass.

4
SPECIALIZATION AND GENERALIZATION
Specialization is the process of defining a set of
subclasses of an entity type. (top-down)
This entity type is called the super class of the
specialization. The set of subclasses that forms a
specialization is defined on the basis of some
distinguishing characteristic of the entities in the super
class.
Generalization
 Reverse process of specialization (bottom-up); identify

common features of entity types and generalize them into


single super class (including primary key!) 5
DIAGRAMMATIC NOTATION FOR
SPECIALIZATION

6
CONT…
 HOURLY EMPS is a subclass of EMPLOYEES
and
thus inherits its attributes and relationships (same
for CONTRACT EMPS).

7
DIAGRAMMATIC NOTATION FOR GENERALIZATION

8
DESIGN CONSTRAINTS ON A
SPECIALIZATION/GENERALIZATION
Constraint on which entities can be members of a given lower-level
entity set.
 condition-defined
 Example: all customers over 65 years are members of senior-
citizen entity set; senior-citizen ISA person.
 user-defined
Constraint on whether or not entities may belong to more than one
lower-level entity set within a single generalization.
 Disjoint
 an entity can belong to only one lower-level entity set

 Noted in E-R diagram by having multiple lower-level entity


sets link to the same triangle
 Overlapping
 an entity can belong to more than one lower-level entity set 9
CONT…
Completeness constraint -- specifies whether or not an entity in
the higher-level entity set must belong to at least one of the
lower-level entity sets within a generalization.
 total: an entity must belong to one of the lower-level entity
sets
 partial: an entity need not belong to one of the lower-level
entity sets
Restricts the design of the Data Base Management
System
Restricts the design of the Data Base Management
System
Restricts the design of the Data Base Management
System 10

You might also like