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
Messages: 1
Registered: November 2006
Location: Hyderabad
Junior Member

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
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.


Closed for your own safety.

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

Current Time: Wed Jul 26 04:19:17 CDT 2017

Total time taken to generate the page: 1.50688 seconds