Re: Multiple parent design
Date: Fri, 16 Apr 2004 08:26:24 -0400
Message-ID: <bJOdnQJ_0eNfTeLdRVn-uA_at_comcast.com>
Some people may object to my previous suggestion, because it relies on NULLS. Here's an alternative:
Take the parent_id out of the phone table.
Create two new tables:
create table PERSONAL_PHONE
(PHONE_ID,
PERSON_ID);
create table COMPANY_PHONE
(PHONE_ID,
COMPANY_ID);
Put in the appropriate constraints for referential integrity,
and relationships. A PHONE_ID must exist in one and only one of these two
tables.
"Laconic2" <laconic2_at_comcast.net> wrote in message
news:64GdnYurVfsYVOLdRVn-sQ_at_comcast.com...
> Create two columns in the phone table, Person_id and Company_id. Enforce
> referential integrity on each one separately. Allow each one to be NULL.
>
> If necessary, enforce a constraint that either Person_id or Company_id
must
> be null.
>
>
Received on Fri Apr 16 2004 - 14:26:24 CEST