home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / 6328 < prev    next >
Encoding:
Text File  |  1992-08-25  |  2.6 KB  |  68 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!wupost!darwin.sura.net!Sirius.dfn.de!chx400!bernina!neptune!nugget.inf.ethz.ch!marti
  3. From: marti@nugget.inf.ethz.ch (Robert Marti)
  4. Subject: Re: nested SQL select
  5. Message-ID: <1992Aug26.072142.14166@neptune.inf.ethz.ch>
  6. Sender: news@neptune.inf.ethz.ch (Mr News)
  7. Nntp-Posting-Host: nugget.inf.ethz.ch
  8. Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
  9. References: <1992Aug14.071343.1758@neptune.inf.ethz.ch> <l990h3INN7it@jethro.Corp.Sun.COM> <1992Aug25.161811.6054@neptune.inf.ethz.ch> <87028@netnews.upenn.edu>
  10. Date: Wed, 26 Aug 1992 07:21:42 GMT
  11. Lines: 55
  12.  
  13. In article <87028@netnews.upenn.edu>, limsoon@saul.cis.upenn.edu
  14. (Limsoon Wong) writes in response to my article:
  15. <1992Aug25.161811.6054@neptune.inf.ethz.ch:
  16. |> >Editorial comment:  This posting is more of an academic exercise
  17. |> >than of practical interest.  All I am trying to show is that any
  18. |> >_pure_ relational algebra expression can be translated into a
  19. |> >single SQL SELECT-statement -- for what it's worth ...
  20. |> >
  21. |> [stuff deleted]
  22. |> >
  23. |> >  project[...](R - S)  ---->  project[...](R) - project[...](S)
  24. |> 
  25. |> This one is not correct under the usual set-based semantics,
  26. |> since after the omission of some columns, previous distinct
  27. |> rows in R can become identified.
  28.  
  29. Oops.  Yes, you are right of course.  As far as I can see, my
  30. argument that any pure relational algebra expression can be
  31. translated into a single SQL SELECT-statement is still true
  32. if the algorithm I proposed is modified as follows:
  33.  
  34. Don't use the incorrect transformation rule above.  Instead,
  35. translate an RA-expression of the form
  36.  
  37.   project[<attribute-list>](R - S)
  38.  
  39. directly into an SQL SELECT-statement of the form
  40.  
  41.   SELECT <attribute-list>
  42.   FROM   R
  43.   WHERE  NOT EXISTS (SELECT * FROM S)
  44.  
  45. If R and S stand for more general RA-expressions than relation
  46. names, the SQL SELECT-statement becomes somewhat more complicated:
  47.  
  48.   SELECT DISTINCT <attribute-list>
  49.   FROM   ...
  50.   WHERE  ...
  51.   AND    NOT EXISTS (SELECT ...
  52.                      FROM   ...
  53.                      WHERE ...)
  54.  
  55. with the dots being filled in when recursively translating the
  56. expressions corresponding to R and S.
  57.  
  58. I hope I didn't overlook something else.  Since -- as I said --
  59. this is an academic exercise, I don't want to put any more of my
  60. time into this.  (Do I hear sighs of relief out there? ;-)
  61. Thanks for the correction, anyway.
  62.  
  63. -- 
  64. Robert Marti                    |  Phone:    +41 1 254 72 60
  65. Informationssysteme             |  FAX:      +41 1 262 39 73
  66. ETH-Zentrum                     |  E-Mail:   marti@inf.ethz.ch
  67. CH-8092 Zurich, Switzerland     |
  68.