An SQL query is evaluated by:

  1. Including tables in FROM clause
  2. Applying conditions in WHERE clause
  3. Performing Grouping (SQL)
  4. Applying conditions in Having Clause (SQL)
  5. Selecting attributes in the SELECT clause
  6. Running ORDER BY on the resulting tuples