Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQL question ¿why using clause 'ALL'?
Hi everyone.
I am learning Oracle and SQL. I have a little question about
subqueries and
grouping.
Look at this two SQL sentences:
SQL> SELECT ename, job, sal 2 FROM emp 3 WHERE sal > ALL 4 (SELECT sal 5 FROM emp 6 WHERE job = 'CLERK') 7 ORDER BY sal DESC; SQL> SELECT ename, job, sal 2 FROM emp 3 WHERE sal > 4 (SELECT MAX(sal) 5 FROM emp 6 WHERE job = 'CLERK') 7 ORDER BY sal DESC;
As you will see, this two sentences look for those employees in the
"emp" table whose salary ("sal") is higher than the salary of all of
the clerks.
These sentences are different, but they do the same work (that´s what
i think).
What i would like to know if this last phrase is correct, and, if yes,
which
one of the two sentences is better.
Thank you very much Received on Mon Feb 02 2004 - 13:23:33 CST