Re: How to ensure only one of two sets of optional information?

From: Bob Badour <bbadour_at_golden.net>
Date: Fri, 19 Dec 2003 17:51:42 -0500
Message-ID: <i76dnWRQR7GNHH6iRVn-sw_at_golden.net>


"Marshall Spight" <mspight_at_dnai.com> wrote in message news:UHKEb.432884$275.1302916_at_attbi_s53...
> "Bob Badour" <bbadour_at_golden.net> wrote in message
news:vO6dncxSy8Cxwn6iRVn-iw_at_golden.net...
> > > I could do it with a database constraint. Is there a structural
> > > way to do it that I'm not seeing? If I have to use a constraint,
> > > is there a canonical form for this particular example? It seems
> > > like a common thing to want to do, but I haven't come across
> > > how to address the subtype-data-exclusion issue anywhere.
> >
> > Make account type part of the account candidate key and include a
constant
> > attribute in the referencing relations.
>
> OMG that is *such* a cool solution! Thanks!
>
> Does SQL have the concept of a "constant attribute?" Coincidentally
> I've actually been thinking lately that such a thing would be useful.
> Generically speaking it's just a type constraint and probably not
> anything all that special.

Of course, my suggestion won't enforce the reverse that each account tuple has a corresponding tuple in one of the other relation variables.

Haven't you read Fabian's latest book? He has a whole chapter on these sorts of referential constraints. Received on Fri Dec 19 2003 - 23:51:42 CET

Original text of this message