Thread: SQL Recursion

SQL Recursion

From
Ron Peterson
Date:
Aha!

I have had this thing about trying to figure out how to program
trees/hierarchies/graphs in SQL for awhile now.  Something I've
complained about in this list an others, including a Byte newsgroup.

Well whaddya know, but I read Jon Udell's Byte column today, and it
begins by quoting my complaint:
http://www.byte.com/column/BYT20000518S0001.

There's a great link further down in the article
(http://www.dbmsmag.com/9603d06.html) that addresses this very subject.
Check it out.  There *are* solutions to this problem!!!  You can bet
I'll be buying Joe Celko's book shortly.

Anyway, just wanted to share my glee.

-Ron-

Re: SQL Recursion

From
Michael Meskes
Date:
On Tue, May 23, 2000 at 05:42:24PM -0400, Ron Peterson wrote:
> I have had this thing about trying to figure out how to program
> trees/hierarchies/graphs in SQL for awhile now.  Something I've
> complained about in this list an others, including a Byte newsgroup.

You mean for instance the classical shortest path problem? Something like

insert into path select fromnode, tonode from arc
insert into path select fromnode, tonode from path, arc where path.tonode = arc.fromnode

I wanted to add something like this for years but I never found the time. In
fact I still have some ideas on how the syntax could be.

Just to explain this my dissertation was about deductive database systems,
an area where you mostly regard recursive queries.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!