Superclass/Subclass Relationships
Each member of a subclass is also a member of the superclass. In other words, the entity
in the subclass is the same entity in the superclass, but has a distinct role. The relationship
between a superclass and a subclass is one-to-one (1:1) and is called a superclass/subclass
relationship (see Section 11.6.1). Some superclasses may contain overlapping subclasses,
as illustrated by a member of staff who is both a Manager and a member of Sales Personnel.
In this example, Manager and SalesPersonnel are overlapping subclasses of the Staff
superclass. On the other hand, not every member of a superclass need be a member of a
subclass; for example, members of staff without a distinct job role such as a Manager or a
member of Sales Personnel.
We can use superclasses and subclasses to avoid describing different types of staff with
possibly different attributes within a single entity. For example, Sales Personnel may have
special attributes such as salesArea and carAllowance. If all staff attributes and those specific
to particular jobs are described by a single Staff entity, this may result in a lot of nulls
for the job-specific attributes. Clearly, Sales Personnel have common attributes with other
staff, such as staffNo, name, position, and salary. However, it is the unshared attributes that
cause problems when we try to represent all members of staff within a single entity. We
can also show relationships that are only associated with particular types of staff (subclasses)
and not with staff, in general. For example, Sales Personnel may have distinct
relationships that are not appropriate for all staff, such as SalesPersonnel Uses Car.
To illustrate these points, consider the relation called AllStaff shown in Figure 12.1. This
relation holds the details of all members of staff no matter what position they hold. A consequence
of holding all staff details in one relation is that while the attributes appropriate to
all staff are filled (namely, staffNo, name, position, and salary), those that are only applicable