ANSI 92 Recursive SQL Statement required?

I'm tolerably certain that no recursive statements were available in SQL-92; the earliest version where that was supported was SQL-99 Consequently, you are stuck with not using SQL-92. Why do you think SQL-92 is desirable? Is it as a base level of SQL functionality, or is there some other reason?

Current versions of DB2 have the WITH clause and can achieve recursive queries. I believe Oracle has the WITH clause too; I'm not sure whether it can achieve recursive queries using them. Oracle also has the wholly non-standard and non-relational CONNECT BY PRIOR.

I'm not sure what MS SQL Server supports There is a reasonably strong chance that you will be unable to find a single syntax that is supported by all three of your specified DBMS.

I'm tolerably certain that no recursive statements were available in SQL-92; the earliest version where that was supported was SQL-99. Consequently, you are stuck with not using SQL-92. Why do you think SQL-92 is desirable?

Is it as a base level of SQL functionality, or is there some other reason? Current versions of DB2 have the WITH clause and can achieve recursive queries. I believe Oracle has the WITH clause too; I'm not sure whether it can achieve recursive queries using them.

Oracle also has the wholly non-standard and non-relational CONNECT BY PRIOR. I'm not sure what MS SQL Server supports. There is a reasonably strong chance that you will be unable to find a single syntax that is supported by all three of your specified DBMS.

There is no SQL-92 solution for recursive queries. The best option is to use one of the solutions for encoding hierarchical relationships so that you can query all descendants or ancestors, using standard SQL. See a brief description here: "What is the most efficient/elegant way to parse a flat table into a tree?".

Or read "Trees and erarchies in SQL for Smarties" by Joe Celko.

1. Nested sets are the way to do arbitrary-depth hierarchies in SQL; a parent-row foreign key is almost never a usable solution. – bobince Nov 24 '08 at 13:38 Actually I prefer the Adjacency Relation design over Nested Sets.

And the "parent_id" solution is still adequate (and simpler) if you never need to query full trees, only immediate children or parent. – Bill Karwin Nov 24 '08 at 17:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions