Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: data modeling question - child table with multiple parents
jared:
any thoughts on the point at which this becomes a potential performance bottleneck? pretty simple if there are two potential fk's as in your example - but what about 4 or 5 fk id's?
-biill
-----Original Message-----
Sent: Thursday, August 01, 2002 1:48 PM
To: Multiple recipients of list ORACLE-L
> btw, in your first solution, how are you going to implement mutual
> exclusiveness of EMPLOYEE_ID and SUPLIER_ID? trigger? - not very
elegant.
Actually quite simple and elegant:
alter table add constraint only_one
( check (
( employee_id is null and supplier_id is not null ) or ( supplier_id is null and employee_id is not null ))
Jared
"Igor Neyman" <ineyman_at_perceptron.com>
Sent by: root_at_fatcity.com
07/31/2002 02:20 PM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: Re: data modeling question - child table withmultiple parents
yet, another solution:
add another table, called i.e. "ACTOR" (actor_id, actor_type);
sub-entity tables "EMPLOYEE", "SUPLLIER", "CONTRACTOR" will store
sub-entity
specific information, and their PK (employee_id, supplier_id, ...) will be
foreign keys to actor_id in "ACTOR" table;
table "ADDRESS" will reference "ACTOR" table (not multiple sub-entities),
and you can enforce this relationship in the database;
thus, adding new sub_entity (like "VENDOR") will not require any changes
in
existing tables;
also, you can implement "TELEPHONE" table the same way (referencing
"ACTOR"
table).
btw, in your first solution, how are you going to implement mutual exclusiveness of EMPLOYEE_ID and SUPLIER_ID? trigger? - not very elegant.
Igor Neyman, OCP DBA
ineyman_at_perceptron.com
> Good day, all:
>
> Am curious to hear opinions on how to model a child table that has
multiple
> parent tables (i.e., foreign key to multiple parents)
>
>
>
>
>
>
> >
>> To REMOVE yourself from this mailing list, send an E-Mail message
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Igor Neyman INET: ineyman_at_perceptron.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Jared.Still_at_radisys.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Magaliff, Bill INET: Bill.Magaliff_at_lendware.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Aug 01 2002 - 13:18:38 CDT
![]() |
![]() |