Home » SQL & PL/SQL » SQL & PL/SQL » Select Vs Order by Clause
Select Vs Order by Clause [message #202303] Thu, 09 November 2006 01:04 Go to next message
aparnadevik
Messages: 1
Registered: November 2006
Location: Hyderabad
Junior Member
Hi,

In a query which gets executed first:
Select clause or Order by clause?

In a query if a psuedo-column rownum is selected, then if we use order by on the rownum column, what happens?

What would be the output of the following query and why?
Which part of the query is first executed, is it select clause or order by clause?

select empno,ename,rownum from emp order by rownum desc;
Re: Select Vs Order by Clause [message #202305 is a reply to message #202303] Thu, 09 November 2006 01:11 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
sigh. What do you reckon? Do you need the data to get it sorted or would you sort the entire database and then fetch from that sorted database? ROWNUM is fetched before a sort is applied.

http://www.orafaq.com/forum/fa/448/0/

Closed for your own safety.

MHE
Previous Topic: produce 1 row
Next Topic: QP_PRICE_LIST_PUB.Process_Price_List not inserting Data
Goto Forum:
  


Current Time: Wed Dec 07 16:13:13 CST 2016

Total time taken to generate the page: 0.18624 seconds