home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!wupost!darwin.sura.net!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: <1992Aug26.072142.14166@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: <1992Aug14.071343.1758@neptune.inf.ethz.ch> <l990h3INN7it@jethro.Corp.Sun.COM> <1992Aug25.161811.6054@neptune.inf.ethz.ch> <87028@netnews.upenn.edu>
- Date: Wed, 26 Aug 1992 07:21:42 GMT
- Lines: 55
-
- In article <87028@netnews.upenn.edu>, limsoon@saul.cis.upenn.edu
- (Limsoon Wong) writes in response to my article:
- <1992Aug25.161811.6054@neptune.inf.ethz.ch:
- |> >Editorial comment: This posting is more of an academic exercise
- |> >than of practical interest. All I am trying to show is that any
- |> >_pure_ relational algebra expression can be translated into a
- |> >single SQL SELECT-statement -- for what it's worth ...
- |> >
- |> [stuff deleted]
- |> >
- |> > project[...](R - S) ----> project[...](R) - project[...](S)
- |>
- |> This one is not correct under the usual set-based semantics,
- |> since after the omission of some columns, previous distinct
- |> rows in R can become identified.
-
- Oops. Yes, you are right of course. As far as I can see, my
- argument that any pure relational algebra expression can be
- translated into a single SQL SELECT-statement is still true
- if the algorithm I proposed is modified as follows:
-
- Don't use the incorrect transformation rule above. Instead,
- translate an RA-expression of the form
-
- project[<attribute-list>](R - S)
-
- directly into an SQL SELECT-statement of the form
-
- SELECT <attribute-list>
- FROM R
- WHERE NOT EXISTS (SELECT * FROM S)
-
- If R and S stand for more general RA-expressions than relation
- names, the SQL SELECT-statement becomes somewhat more complicated:
-
- SELECT DISTINCT <attribute-list>
- FROM ...
- WHERE ...
- AND NOT EXISTS (SELECT ...
- FROM ...
- WHERE ...)
-
- with the dots being filled in when recursively translating the
- expressions corresponding to R and S.
-
- I hope I didn't overlook something else. Since -- as I said --
- this is an academic exercise, I don't want to put any more of my
- time into this. (Do I hear sighs of relief out there? ;-)
- Thanks for the correction, anyway.
-
- --
- 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 |
-