Structured type hierarchies

This section provides information about the structured type hierarchies.

It is certainly possible to model objects such as people using traditional relational tables and columns. However, structured types offer an additional property of inheritance. That is, a structured type can have subtypes that reuse all of its attributes and contain additional attributes specific to the subtype. The original type is the supertype. For example, the structured type Person_t might contain attributes for Name, Age, and Address. A subtype of Person_t might be Employee_t that contains all of the attributes Name, Age, and Address and, in addition, contains attributes for SerialNum, Salary, and BusinessUnit.

Figure 1. Structured type Employee_t inherits attributes from supertype Person_t
The diagram shows the attributes of a type Person_t.

A set of subtypes based (at some level) on the same supertype is known as a type hierarchy. For example, a data model might need to represent a special type of employee called a manager. Managers have more attributes than employees who are not managers. The Manager_t type inherits the attributes defined for an employee, but also is defined with some additional attributes of its own, such as a special bonus attribute that is only available to managers.

The following figure presents an illustration of the various subtypes that might be derived from person and employee types:
Figure 2. Type hierarchies (BusinessUnit_t and Person_t)
Type hierarchies (BusinessUnit_t and Person)

In Figure 2, the person type Person_t is the root type of the hierarchy. Person_t is also the supertype of the types below it--in this case, the type named Employee_t and the type named Student_t. The relationships among subtypes and supertypes are transitive; this means that the relationship between subtype and supertype exists throughout the entire type hierarchy. So, Person_t is also a supertype of types Manager_t and Architect_t.

The department type, BusinessUnit_t is considered a trivial type hierarchy. It is the root of a hierarchy with no subtypes.