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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Creating a Hierarchical Structure

Re: Creating a Hierarchical Structure

From: Bo Gundersen <bg_at_netnord.dk>
Date: Wed, 05 Sep 2001 16:43:43 +0200
Message-ID: <3B963A1F.7080007@netnord.dk>


KWillets wrote:

>>How would you, or what is the commonly accepted way, of creating a database
>>which represents a hierarchical category structure ala Yahoo!?

>
> This works if every category has a single parent. However if a
> category can have more than one parent (as in most web directories),
> you need a more generalized representation. A typical implementation
> would be as follows:
>
> create table node( node_id int primary key,...)
> create table node_relationship( parent_node_id int references node,
> child_node_id int references node,
> primary key (parent_node_id, child_node_id))
>
> This structure can represent any directed graph structure, so some
> problems can arise if someone creates a loop.

How would you query this schema?
I have no problem visualising a query of depth one (immideate childeren/parents), but I cannot see how/if it is possible to make recursive/hierachical queries (eg. find all children)?

> 4. We need an FAQ to get all these points straightened out.

That would be greate :)

-- 
Bo Gundersen
DBA/Developer
netnord A/S - http://www.netnord.dk
Received on Wed Sep 05 2001 - 09:43:43 CDT

Original text of this message

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