|
Posted by David Portas on 03/02/06 13:01
Doug wrote:
> Interesting challenge. Can we "prove" that cursors are "REQUIRED" in a
> relational model?
>
> Someone somewhere is having epileptic fits on that statement.
>
Abiteboul, Hull and Vianu p469 describe a language they call "WHILEnew"
and show that it can solve any deterministic query. Of course you can
add non-determinism to the picture but then we aren't discussing
relational problems any more.
> All I have to do is come up with a single example of data selection
> that cannot be solved without cursors. Right?
Not really, no. The relational model forbids explicit "tuple-at-a-time"
operations in any case. It is still perfectly possible to show that
some practical result cannot be obtained in some particular relational
*language*. For example, Codd's original relational algebra doesn't
support aggregation or transitive closure.
For SQL however, the problems are a bit more murky because even
standard SQL allows you to do lots of non-relational and
non-deterministic things in queries. So problems that are hard or
unsolvable with set-based SQL are interesting to those of us who use
the language (especially on usenet) but probably less attractive from a
theory perspective.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Navigation:
[Reply to this message]
|