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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Table design question.

Re: Table design question.

From: DA Morgan <damorgan_at_exesolutions.com>
Date: Wed, 29 Jan 2003 09:31:57 -0800
Message-ID: <3E38100D.ACB462D1@exesolutions.com>


Jackie wrote:

> Hi all!
> I have a question about designing database tables.
> Suppose I have a table that I hold information regarding my corporate
> customers. Some corporate customers are also customers of other
> customers in the table. I need to save this hierarchy in my database.
> I thought of designing an additional table that holds hierarchical
> information about companies.
>
> Suppose that my customer table is designed like this:
>
> CustID Company Name Phone Address
> ------------ ------------------- ------------ ------------------
> 100200 Company A 545 5543 Fict. Street.
> 102011 Company B 11111111
>
> Company B is also a customer of Company A. So the hierarchy table will
> be like this:
>
> Comp1ID Comp2ID
> ------------ --------------
> 100200 102011
>
> Comp1ID field means the company with ID 100200 is the parent and
> company with the ID 102011 is the child (or customer of Company A).
>
> I can add as many as hierarchical info like this. Is this approach
> correct? Is there any other way to achieve this?
>
> Thanks in advance.

I would suggest an intersecting entity ... a table of just primary keys ... because what you have here is a many-to-many relationship.

Daniel Morgan Received on Wed Jan 29 2003 - 11:31:57 CST

Original text of this message

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