Re: Design question regarding data typing

From: Jacob JKW <jacobcdf_at_yahoo.com>
Date: 24 Feb 2006 09:54:54 -0800
Message-ID: <1140803694.536887.236920_at_t39g2000cwt.googlegroups.com>


Marshall Spight wrote:
> Jacob JKW wrote:
> > Sure. I was trying to explain that one column of my Insitutions table
> > was the foreign key InstitutionTypeId which indexes the name (and
> > description) of the type of institution (which in this simplification
> > can be either "school" or "bank"). I have this in addition to separate
> > Banks and Schools tables. The reason for using the InstitutionType
> > descriptor (or as I gather it's called from Roy's post above,
> > "discriminant") is so that if I want summary instituition data from
> > Insitutions I can easily figure out the institution type without having
> > to scan for each InstutionId foreign key of interest in Banks Schools.
> > And that's the kludge that's causing me such consternation. :-( It just
> > reeks of bad form.
> >
> > Am I making any sense?
>
> Hi,
>
> What you are describing is actually the canonical way to model
> a base type and two subtypes in SQL. I am unclear why you
> object to the design; you haven't said anything negative about
> it so far besides the fact that you don't like it.
OK. That's perfectly faiir. It actually makes me a little feel better that what I assumed was my own ugly little kludge is in fact proper. It's just *feels* like sloppy design to me. It certainly would be improper in the context of an OO programming model, but if you're assuring me it's kosher then I'll just plow on ahead. :-)

Thanks much,
Jacob. Received on Fri Feb 24 2006 - 18:54:54 CET

Original text of this message