Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL question ¿why using clause 'ALL'?

SQL question ¿why using clause 'ALL'?

From: schumacker <miguelcampoy_at_hotmail.com>
Date: 2 Feb 2004 11:23:33 -0800
Message-ID: <e1eadaf3.0402021123.6a545db@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US