Re: How to code a supertype subtype relationship

From: <bogstonkott_at_netscape.net>
Date: 24 Mar 2004 13:18:55 -0800
Message-ID: <901972da.0403241318.7ee14071_at_posting.google.com>


"Tom Hester" <$$tom_at_metadata.com> wrote in message news:<76b19$4060bb79$45033832$26263_at_msgid.meganewsservers.com>...
> The two most common ways are the one that you are using and adding the
> columns of subtypes to the supertype table and allowing attributes of X for
> example to be null for a subtype Y.

Well, that confirms pretty much what my co-workers and I were thinking. Adding the subtypes to the supertype isn't practical in our situation. There is one supertype with ten subtypes. The smallest subtype has 15 columns. To combine into one table there would be over 200 columns. That's not pretty. Thanks.

>
> <bogstonkott_at_netscape.net> wrote in message
> news:901972da.0403231405.2d4711b6_at_posting.google.com...
> > Let's talk about supertype-subtype relationship. Here's the problem:
> > I have to use a column in the supertype to find a corresponding
> > subtype. Here's an example:
> >
> > Say we have a supertype, S, with three subtypes, X, Y, and Z. I add a
> > row, R1, to supertype S. I now add a row to subtype Y that
> > corresponds to the row R1 in supertype S.
> >
> > Later, I query row R1 in supertype S. I now have a problem: which
> > subtype corresponds to R1 in S. X, Y, or Z? Well, I have solved this
> > problem by adding a column to S that tells its type in this case Y.
> > So, I look at the type column in R1 and then lookup the child row in
> > subtype Y.
> >
> > Is there a better way to code this?
> >
> > How do other people work with a supertype-subtype relationship?
> >
> > bogston
Received on Wed Mar 24 2004 - 22:18:55 CET

Original text of this message