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: Other tree representations in SQL

Re: Other tree representations in SQL

From: Alfredo Novoa <alfredo_at_ncs.es>
Date: 6 Dec 2002 04:23:34 -0800
Message-ID: <e4330f45.0212060423.26bd1317@posting.google.com>


>> var Tree = real relation { N Char, P Char } key { N, P };
>> Tree := relation { tuple { 'A', 'A' }, tuple { 'B', 'A' }, tuple { 'C', 'A' },
>> tuple { 'D', 'B' }, tuple { 'E', 'B' }, tuple { 'F', 'C' },
>> tuple { 'G', 'C' } };

>How would you rename the data part of a Tree node, let's say
>if "A" had to become "Z"?

var Tree = real relation { N Char, P Char } key { N, P } foreign key { rename P as N } references Tree on update cascade;

update Tree where N = 'A' { N := 'Z' } ;

>Joe was looking for three different tree traversals and for
>two queries. Where are they in your example?

The 5040 different transversals are here:

Tree { N };

The parent of F here:

Tree { P } where N = 'F';

The childs of A:

Tree { N } where P = 'A';

The descendants of B:

((TClose Tree) where P = 'B') { N } ;

Alfredo Received on Fri Dec 06 2002 - 06:23:34 CST

Original text of this message

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