Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: HI
Perhaps worth telling the original poster that Mark assumes, of course,
thatyou request a sort by the columns you have grouped by, in which case the
sort has already been done for grouping. If you sort by something else (for
instance if the purpose of your GROUP BY is to compute a COUNT(*) and you
want to order by decreasing COUNT(*), a common occurrence) there will be a
(hopefully small and fast) sort.
Regards,
Stephane Faroult
RoughSea Ltd
http://www.roughsea.com
On Mon, 20 Sep 2004 15:41 , Mark Richard <mrichard_at_transurban.com.au> sent:
The trick of course is that Oracle is smart... In the process of applying the group by it has effectively accomplished the order by clause so it most likely won't execute another sort procedure.
"Srinivas T"
<SrinivasT_at_KPITCum[1] To: <oracle-l_at_freelists.org[2]>
mins.com> cc:
Sent by: Subject: HI
oracle-l-bounce_at_fr[3]
eelists.org
20/09/2004 15:28
Please respond to
SrinivasT
Hi Friends,
I am having a very fundamental doubt,
what is the order of retrival of the clauses when all are inclueded in the
select stament like.
Where
Group by
having
order by.
eg : select deptno,max(sal) from emp where job like 'SAL%' group by deptno having max(sal)>1000 order by deptno
Regards,
Srinivas
![]() |
![]() |