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: Modelling hierarchy in the relational database

Re: Modelling hierarchy in the relational database

From: Vadim Tropashko <nospam_at_newsranger.com>
Date: Tue, 04 Sep 2001 06:51:16 GMT
Message-ID: <ER_k7.2904$4z.4167@www.newsranger.com>


In article <4aUf7.7166$2u.55372_at_www.newsranger.com>, Mikito Harakiri says...
>
>Paul Brown wrote:
>PB> I used Joe's scheme and the one you describe here for years. In
>PB> fact, my first effort at this used the tree scheme from the Celko
>PB> book (which is kind of cool). But this scheme
>
>
>('1.0')
>/ | \
>/ | \
>/ | \
>/ | \
>('1.1') ('1.2') ('1.3')
>/ \ / \ |
>/ | / \ |
>('1.1.1') ('1.1.2') ('1.2.1')('1.2.2')('1.3.1')
>
>PB>works better for most things.
>
>Such as? Insertion speed is the only one obvious to me.

Try printing out hierarchy like this:

EMPNAME                        DNAME          CBP
------------------------------ -------------- ------------------------------
**KING                         ACCOUNTING     /KING
****BLAKE                      SALES          /KING/BLAKE
******ALLEN                    SALES          /KING/BLAKE/ALLEN
******JAMES                    SALES          /KING/BLAKE/JAMES
******MARTIN                   SALES          /KING/BLAKE/MARTIN
******TURNER                   SALES          /KING/BLAKE/TURNER
******WARD                     SALES          /KING/BLAKE/WARD

with nested sets.

In "Materialised paths" approach the solution is trivial: we just substitute node indexes with names so that 1.2.3, for example, becomes /KING/BLAKE/MARTIN. Received on Tue Sep 04 2001 - 01:51:16 CDT

Original text of this message

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