Path: newssvr20.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!newsfeed.stueberl.de!peer1.stngva01.us.to.verio.net!news.verio.net!washdc3-snh1.gtei.net!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed2.dallas1.level3.net!news.level3.com!postnews1.google.com!not-for-mail
From: miguelcampoy@hotmail.com (schumacker)
Newsgroups: comp.databases.oracle.misc
Subject: =?ISO-8859-1?Q?SQL_question_=BFwhy_using_clause_'ALL'=3F?=
Date: 2 Feb 2004 11:23:33 -0800
Organization: http://groups.google.com
Lines: 34
Message-ID: <e1eadaf3.0402021123.6a545db@posting.google.com>
NNTP-Posting-Host: 130.206.158.233
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1075749813 14989 127.0.0.1 (2 Feb 2004 19:23:33 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 2 Feb 2004 19:23:33 +0000 (UTC)
Xref: newssvr20.news.prodigy.com comp.databases.oracle.misc:135258

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
