| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Other tree representations in SQL
>> 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
![]() |
![]() |