home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.databases:6383 comp.databases.theory:411 comp.databases.oracle:1409
- Newsgroups: comp.databases,comp.databases.theory,comp.databases.oracle
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!alberta!isagate!edm.isac.ca!darius
- From: darius@edm.isac.ca (Darius S. Naqvi)
- Subject: Re: Is this a bug or a limitation of the SQL language
- Organization: ISA Corporation, Edmonton, AB
- Date: Wed, 26 Aug 92 16:26:06 GMT
- Message-ID: <1992Aug26.162606.1899@edm.isac.CA>
- References: <1992Aug23.074048.16681@prism.poly.edu>
- Sender: news@edm.isac.CA (News daemon pseudo-user account)
- Lines: 33
-
- In article <1992Aug23.074048.16681@prism.poly.edu> sjha@prism.poly.edu (Salil Kumar Jha) writes:
- >I tried to do this query in Oracle and DB2 and both failed. I know its
- >not allowed but why not?
- >
- >Assume the use of the classic oracle emp table
- >
- >select * from emp
- >where salary between
- >(select salary from emp where ename = 'Larry')
- >and
- >(select salary from emp where ename = 'John')
- >
- >Isnt this the best way of finding all people whose salaries lie between those
- >of Larry and John (without knowing whose is larger)
- >
- >sjha@prism.poly.edu
- >
-
- Even if the syntax were allowed, you would still have to know that
- John's salary were greater than or equal to Larry's, because
-
- where salary between x and y
-
- is simply an abbreviation for
-
- where salary >= x and salary <= y
-
- If x > y, the where clause will always fail, so you get no rows
- selected.
- --
- Darius S. Naqvi mail at work: darius@edm.isac.ca
- ISA Corp. mail at home: darius%naqvi.uucp@isac.ca
- Edmonton, Alberta, Canada phone: (403) 420-8081
-