May 01, 1999 04:01 PM

SQL by Design: Supertypes and Subtypes

Rating: (0)
SQL Server Magazine
InstantDoc ID #5226
Accounting for all the people
We're all people, whether we're employees, supervisors, or customers. Why do so many databases store different categories of people in separate tables? Databases segregate customers, employees, and vendors into separate tables, even though each of these groups has numerous common attributes. Everyone has a first and last name, an address and phone number—or more likely, several—and some unique identifier to make data management and people administration easier.

In ...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

I'd like to see a bit more on WHEN super/subtypes are not approriate. For instance, in an inventory system, one may say all items are "Inventory" (the supertype) then create a table for every type of product (subtype) -- you can reach this conclusion simply by transposing "inventory" for "people" in this article (more or less). However that design would be a nightmare, as everytime a new product type is added, the database schema would have to be updated, and the application using it would need to be extended.

In the example above, what if a new position is added? Say the company grows and needs "Associate Directors"? The application/database need a redesign.

Rather than super/subclass, how about a "metadata" approach -- a table of employee (or inventory) "types", and a table of "type characteristics"? Then adding a new employee/product type becomes a matter of adding a row to the types table, and adding relevant characteristics to the characteristics table. The application is writen once to use the types/charateristics structure...

I'd like to see an article discussing the two approaches...


In these cases,

KURT7/3/2006 11:40:09 AM


The listings are in the zip file download

Anonymous User 1/31/2005 12:48:55 PM


The article is superb. It celared the concept of subtype/supertype. But the listings referred in the article could not be found . .please help me to find them thank u

Mahesh4/29/2004 6:27:10 AM


How can the relationship between person and director be 1-M? Same for Person-Prospect?

In other words, for a given person row, how can there be multiple prospect rows?

Emmad 10/22/2003 9:46:16 AM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS