Re: super type & sub type, interested too
Date: Thu, 07 Nov 2002 09:37:12 GMT
Message-ID: <cvqy9.3465$1r1.113298_at_newsc.telia.net>
"Lennart Jonsson" <lelle2_at_bonetmail.com> wrote
> On Wed, 06 Nov 2002 21:43:30 +0100, Lennart Jonsson wrote:
>
> Oh, another thing I have been thinking about regarding this. Has any one
> thought of ways/strategies to prevent someone from just adding a
> supertype, and not a subtype. I cant seem to come up with a clever way of
> doing this. Anyone else?
Not sure I'm 100% with you::
You want to protect one adding a supertype, unless one also add at least one subtype for that supertype. Catch 22, one cannot add the subtype first and vice versa?
I think that deferrable constraint would do it. (The DBMS I use, MS SQL
Server, don't have this.)
One could have a regular foreign key where the subtype table refers to the
super type table. And one could also have a rule on the supertype table that
verifies that there is at least one row in the subtype table for each
supertype. Unfortunately, I have a feeling that deferrable constraints is
not that common in today's DBMS's.
-- Tibor KarasziReceived on Thu Nov 07 2002 - 10:37:12 CET