Please look at the query below:
Expand|Select|Wrap|Line Numbers
- select
- *
- from
- tab1 inner join
- tab2 on tab1.c1 = tab2.c1 inner join
- tab3 on tab1.c2 = tab3.c2
- where
- tab1.c1 = some_value and
- tab2.c1 in
- (select c1 from tab4)
- group by
- tab1.c2
- having
- tab1.c1 = some_value
- order by
- tab1.c1 asc
I wnated to know the sequence in which various clauses in a select query are executed so that I can write correct & better queries. I even googled and found the answer to some extent but not satisfied. The search let me know the following sequence:
1> from
2> where
3> group by
4> having
5> order by
Apparantely there can be more clauses as well as subqueries as in above sample query. Can somebody help me with this?!?!?
Thanks!!