Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Data Modeling Question

Re: Data Modeling Question

From: Ben Ryan <benryan_at_my-deja.com>
Date: Thu, 02 Sep 1999 21:34:06 GMT
Message-ID: <7qmqge$5ta$1@nnrp1.deja.com>


In article <7qmg04$bs9$1_at_nntp3.uunet.ca>,   "Ioan Berbece" <iberbece_at_servicesoft.com> wrote:

One way would be......

Assuming both tables have single column primary keys defined.

Table TB would need two optional (nullable) columns the first with a foreign key constraint on table TA and the second with a foreign key constraint on itself. In addition you would need a trigger on TB to ensure that one, and only one, of the two columns had a value.

Is this elegant? That is up to you.

> Hello,
>
> Suppose I have a table TA which represents entity A and a table TB
which
> represents entity B. Between entity A and entity B there is a
hierarchical
> relationship meaning an object of type B can have an object of type A
as its
> parent. At the same time entity B has a hierarchical relationship with
> itself. The two relationships are exclusive. Something like this:
>
> A1
> |.....B1
> |......B11
> |......B12
> B2
> |.....B21
> |......B211
> |......B212
>
> How can this be modeled in the database in an efficient manner and
> exploiting as much as possible the database built-in features (RI,...)
and
> having an elegant solution (if at all possible)?
>
> Thank you.
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Sep 02 1999 - 16:34:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US