home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / database / 6755 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  1.4 KB

  1. Xref: sparky comp.databases:6755 comp.databases.ingres:1374 comp.databases.oracle:1590 comp.databases.informix:1943 comp.databases.sybase:19
  2. Newsgroups: comp.databases,comp.databases.ingres,comp.databases.oracle,comp.databases.informix,comp.databases.sybase
  3. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!pacbell.com!rtech!binky!irwin
  4. From: irwin@binky.Binky.COM (Irwin Schafer)
  5. Subject: ANSI Semantics with NULL and NOT IN
  6. Message-ID: <1992Sep16.024053.1744@binky.Binky.COM>
  7. Reply-To: irwin@binky.Binky.COM (Irwin Schafer)
  8. Organization: Binky, Inc.
  9. Date: Wed, 16 Sep 92 02:40:53 GMT
  10. Lines: 27
  11.  
  12. Given table "r1":
  13.  
  14.         a1      a2      a3
  15.         1       A       null
  16.         2       B       1
  17.         3       C       1
  18.  
  19. On Ingres, this query returns the value "A"
  20.         select a2 from r1 where a1 in
  21.                 (select distinct a3 from r1);
  22.  
  23. However, this query returns no rows
  24.         select a2 from r1 where a1 not in
  25.                 (select distinct a3 from r1);
  26.  
  27. Where one may expect two rows ("B" and "C")
  28.  
  29. The Ingres explanation is that "this is ANSI semantics when NULL is
  30. involved in the subselect,  NOT IN is equivalent to !=ALL which
  31. means the values must satisfy "!=" for all values in the subselect,
  32. since, for example, 3 != NULL is FALSE given ANSI semantics, the qualification
  33. is FALSE for all rows so zero rows are returned."
  34.  
  35. Is this true?  What do Sybase, Oracle, Informix do?
  36.  
  37. Thanks,
  38. Irwin     irwin@Binky.COM
  39.