[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recursive SQL



Actually, what I said was that recursion is not allowed by the relational 
database model--whose *semantics* are given by relational algebra and 
relational calculus. SQL is not exactly relational database--it supports a 
bunch of things outside of it--including order-by clauses and some limited 
form of transitive closures.  (I believe I mentioned this...) You cannot 
give relational algebra semantics to either the order-by clauses (since 
tuples ahve no order) or the recursive queries (since the corresponding 
query tree will be non-acyclic).

Rao


At 05:35 PM 4/16/2001 -0700, you wrote:

>In earlier database lectures. You made a very strong point that SQL could not
>handle recursion and is thus a main weakness. Just a few days ago, however, I
>found myself performing recursion with SQL in an Oracle database. This is
>done by the CONNECT BY clause.
>
>To get all descendents of 'Bret' based on a parents table
>parents(name,parent):
>
>select name
>from parents
>connect by prior name = parent
>start with name = 'Bret'
>
>This type of sql seems like an interesting fix to the recursion problem. I'm
>curious if you have considered it.
>
>Thanks,
>Bret