Database Answers Header Idea
Inheritance Design Notes for Physical Databases
Home Ask a Question Careers Data Models FAQs SQL Scripts Search Site Map  

Discussion Nr.1
The first discussion relates to the City Tourist Guide Data Model :-
1) A Super-Type called 'Things of Interest'.
2) Two Sub-Types of Hotels and Restaurants.

Each of these Sub-Types inherits all the attributes of the parent Super-Type of 'Things of Interest'.
In addition, they have attributes of their own.

The design of the corresponding Physical Database for Inheritance offers three choices :-
1. Create separate Tables for the Sub-Type and each Super-Type.
2. Combine all attributes of the Sub-Types upwards into the Super-Type, which results, of course, in one physical Table.
This is shown in the Denormalized Design.
3. Combine all attributes of the Super-Type downwards into Tables for each the Super-Type which results, of course, in two physical Tables in this example of a City Guide.
This is left as an exercise for the student.

Discussion Nr.2
The second discussion relates to the Customers Data Model

1. A CUSTOMER can be either a COMMERCIAL CUSTOMER or a PERSONAL CUSTOMER, which both inherit characteristics from CUSTOMER.
2. A PERSONAL CUSTOMER is also a PERSON, and inherits characteristics from PERSON.
3. A COMMERCIAL CUSTOMER has a CONTACT, who is also a PERSON, and therefore inherits characteristics from both CUSTOMER and PERSON.

NOTE that the Physical Data Model can have be generated in different ways to reflect the ways in which these logical relationships can be implemented in a Relational Database.

There are four alternatives :-
1. One Consolidated Table.
2. One SubType Product Table
3. One SuperType Table, Many SubTypes each in its own Table, each containing all the shared Attributes. 
4. One SuperType Table with an 'extensible' table defined to identify the Attributes 
   specific to each Product Type.
5.  A "products" table, an "attributes" table, and a "specs" table. 
  The products table is like in 3.  
  The attributes table simply lists all available attributes and the Product_Atttributes table maps an 
  attribute to a product, and provides an attribute value.

In the Logical Data Model we have a Circle symbol that shows an
Inheritance Relationship where we have a Parent Customer with 3 Children Customers.

Each of the Children inherits all the charactistics of the Parent and has some additional charactistics of its own.

Discussion Nr.3 Another option occurred to me recently (March, 2017) which consists of two steps :- Step 1. Copy all Attributes from the 'Children' to the 'Parent' Step 2. Create SQL Views for each 'Child' for only the Attributes for each View. This gives us flexibility and power.

Barry Williams
Principal Consultant
Database Answers

[ Home Page | Ask Us a Question | Day in the Life | Email Us | FAQs | Search & Site Map ]

© Database Answers 2001