This content has been marked as final. Show 4 replies
Have a look at this article from tom kyte :
Think of it as being processed in this order:
1. The FROM/WHERE clause goes first.
2. ROWNUM is assigned and incremented to each output row from the FROM/WHERE clause.
3. SELECT is applied.
4. GROUP BY is applied.
5. HAVING is applied.
6. ORDER BY is applied.
Normally SQL queries will work in some order..
For example if you want to find total amount of salary and it should be grouped by empname for some XYZ table,
group by ename;
In this case sql query works
Execution No. 1 - From
Execution No. 2 - Where
Execution No. 3 - Group by
Execution No. 4 - Select
For reference http://www.bennadel.com/blog/70-SQL-Query-Order-of-Operations.htm