When we write an SQL query, we usually read it from top to bottom. SELECT department , COUNT ( * ) FROM employees WHERE salary > 50000 GROUP BY department HAVING COUNT ( * ) > 5 ORDER BY department LIMIT 10 ; But the database does not process this query exactly in the same order that we write it...
Source: [Dev.to](https://dev.to/buddika_b/understanding-sql-execution-order-3clo)