Steps or evaluation order of the SQL statement

Posted on

Question :

How the SQL statement containing simple statement like

Select x
From y
Where z 

Having, order by , group by etc. are evaluated.( In which order they are evaluated.?)

Answer :

Following is the logical order of execution of the SQL clauses:

  1. FROM clause
  2. WHERE clause
  3. GROUP BY clause
  4. HAVING clause
  5. SELECT clause
  6. ORDER BY clause

Leave a Reply

Your email address will not be published. Required fields are marked *