home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / database / sybase / 365 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  2.9 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!bcm!mparsons
  2. From: mparsons@fleming.csc.bcm.tmc.edu (Mark Parsons)
  3. Newsgroups: comp.databases.sybase
  4. Subject: Re: multiple EXISTS subqueries under Sybase 4.8
  5. Date: 19 Nov 1992 20:41:17 GMT
  6. Organization: Baylor College of Medicine, Houston, Tx
  7. Lines: 54
  8. Distribution: world
  9. Message-ID: <1egu5dINNmie@gazette.bcm.tmc.edu>
  10. References: <1992Nov14.174847.29576@lamont.ldgo.columbia.edu> <1992Nov15.144258.18635@panix.com> <1992Nov15.225853.2269@lamont.ldgo.columbia.edu> <1e8fj7INN1sg@gazette.bcm.tmc.edu> <1992Nov16.184540.11698@lamont.ldgo.columbia.edu> <1ee852INN90m@gazette.bcm.tmc.edu> <1992Nov19.174435.25700@lamont.ldgo.columbia.edu>
  11. Reply-To: mparsons@fleming.csc.bcm.tmc.edu (Mark Parsons)
  12. NNTP-Posting-Host: fleming.csc.bcm.tmc.edu
  13. Keywords: EXISTS, 4.8, sun4, sunos 4.1.1
  14. Originator: mparsons@fleming.csc.bcm.tmc.edu
  15.  
  16.  
  17.  
  18. msolda,
  19.  
  20.     OK, let me ask you this . . . concerning the combined EXIST and
  21. NOT EXIST . . . 
  22.  
  23.     If the EXIST test does not work, i.e., it's false, does the
  24. NOT EXIST test come out true?
  25.  
  26.     In other words, does the NOT EXIST part work, or at least
  27. get tested, if the EXIST part fails?
  28.  
  29.     If so, the problem could be that the server is not evaluating
  30. the NOT EXIST portion of the test since the EXIST portion solves your
  31. overall 'OR' test, i.e., if the EXIST is true, there's no need to 
  32. do the NOT EXIST test.
  33.  
  34.     Of course, if that's the case, then Sybase is definitely
  35. a 'little' screwed up because . . . . APT will evaluate both arguments
  36. to the OR regardless of whether or not the first test is true.  It'd
  37. be interesting to find out the the server and APT handle their OR's
  38. and AND's differently :-(
  39.  
  40.     Hmmmmmmmm, let me confuse this a little bit more?? ;-)
  41.  
  42.     In most languages the clauses that are 'connected' via an OR
  43. are evaluated one at a time.  As soon as one of the tests evaluates as
  44. TRUE the testing is stopped since you only need one of them to be TRUE
  45. for the OR to be TRUE.  Similar logic says that testing on clauses
  46. 'connected' by an AND will halt as soon as one of the tests comes up
  47. FALSE; reason being that all clauses must be TRUE for the AND to be
  48. TRUE soooooo, if any one of them comes up FALSE the entire AND is
  49. FALSE and no more testing is needed.
  50.  
  51.     In APT, this is not the case, *all* clauses 'connected' by an
  52. OR or AND, and I mean *ALL* clauses will be evaluated.  All ten clauses
  53. in a large OR statement will be tested even if the first one evaluates
  54. to TRUE.  And according to tech support, this is the way APT is suppose
  55. to work.
  56.  
  57.     Now, if the server works as I've mentioned above, i.e., testing
  58. stops as soon as one clause evaluates as TRUE(for an OR) or FALSE(for
  59. an AND), then it would appear that Sybase is inconsistent in their 
  60. method of evaluating ANDs and ORs??
  61.  
  62. Does that shed any light on the problem? Or am I beating a dead horse? ;-)
  63.  
  64. Comments from others that have 'played' with this?
  65.  
  66. Mark
  67.  
  68.     
  69.     
  70.