home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!Sirius.dfn.de!chx400!bernina!neptune!nugget.inf.ethz.ch!marti
- From: marti@nugget.inf.ethz.ch (Robert Marti)
- Subject: Re: nested SQL select
- Message-ID: <1992Aug14.071343.1758@neptune.inf.ethz.ch>
- Sender: news@neptune.inf.ethz.ch (Mr News)
- Nntp-Posting-Host: nugget.inf.ethz.ch
- Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
- References: <3761@keele.keele.ac.uk>, <l8h5i5INNhvg@jethro.Corp.Sun.COM>
- Date: Fri, 14 Aug 1992 07:13:43 GMT
- Lines: 65
-
- In article <3761@keele.keele.ac.uk>, csa09@seq1.keele.ac.uk (Paul
- Singleton) writes:
- ps> How, in general, can I nest SQL 'select' expressions?
- ps> I have a table T(A,B,C) and I want effectively to
- ps> select A, count(B) from ( project A, B from T ) group by A
- ps> [ ... ]
- ps> Is there a general algorithm for translating relational algebra
- ps> expressions into SQL?
-
- I agree that "good" (orthogonal) language design should indeed
- allow something like
- select <attribute-list>
- from ( select <attribute-list>
- from <table-name>
- ... )
- ...
- However, I would just like to point out that "count" and in
- particular "group by" are not considered as part of relational
- algebra: Relational algebra operators are selection, projection,
- union, intersection, difference, cartesian product/join, and
- division (but see also section 6.3 in [ElMasri & Navathe 89]).
- In any case, I don't have a "one-SQL-statement-solution" to your
- problem, either ...
-
-
- Paul Singleton's article was then followed up by
- jdr@starflight.Corp.Sun.COM (Jon Roland) who writes in article
- <l8h5i5INNhvg@jethro.Corp.Sun.COM>:
- jr> You've missed our thread on "SQL Shortcomings", in which we have
- jr> shown why SQL is brain-damaged and needs to be stamped out.
-
- I didn't follow that thread. While I (again, see above) agree that
- SQL has its flaws ("brain-damaged" is a bit too strongly worded for
- my taste), you will certainly have a hard time to "stamp it out" --
- at least for the time being. Even Mike Stonebraker, whose QUEL
- language design is regarded by most academics to be superior to
- SQL, has termed SQL "intergalactic data speak". (Sorry, I don't
- remember where.)
-
-
- jr> Relational algebra allows expressions which have no SQL
- jr> equivalents, because SQL is not an implementation of relational
- jr> theory, and doesn't threaten to become one in the future.
-
- An interesting statement. Could you give me a few examples of
- relational algebra expressions which have no SQL equivalent?
- (Please only use operators from the set {selection, projection,
- union, difference, cartesian product}. This set of operators
- has been shown to be complete.)
-
-
- jr> If you want to get some real work done, try something like
- jr> Progress.
-
- I am not familiar with Progress. However, I think that lots of
- people get plenty of real work done with SQL-based DBMSs, despite
- SQL's shortcomings. (This is of course no reason that the
- researchers should not strive for better languages than SQL
- and for better data models than the relational data model.)
-
- --
- Robert Marti | Phone: +41 1 254 72 60
- Informationssysteme | FAX: +41 1 262 39 73
- ETH-Zentrum | E-Mail: marti@inf.ethz.ch
- CH-8092 Zurich, Switzerland |
-