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: Table design question

Re: Table design question

From: zp <zp_at_atN.net>
Date: Thu, 22 Aug 2002 01:07:38 GMT
Message-ID: <uPW89.24698$Ke2.1903080@bgtnsc04-news.ops.worldnet.att.net>

"PeterS" <member_at_dbfoums.com> wrote in message news:1724237.1029973526_at_dbforums.com...
>
> Hello everybody.
> I have a table where foreign key references the same table's primary
> key. Primary key is just one column as well as foreign key.
> Is it good design?
> Would it be better to create a separate lookup table?
> Foreign key column contains parents of a primary key column.
>
> Thanks in advance!
> Peter S.
>
> --
> Posted via http://dbforums.com
>

This is a pretty standard practice. Sometimes can be complicated to explain to users.
You just have to decide if you can have nulls in the foreign key column. If you don't allow nulls then must use a view (stored or inline) in order to use oracle connect by or will get recursive error. The main question is are the parents looked at as there own entity. If so then separate table is ok, if the parents are thought of as a different versions of the child then what you have suggested is usually correct.

zp Received on Wed Aug 21 2002 - 20:07:38 CDT

Original text of this message

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