SQL TUTORIAL • LESSON 24, Tips & Tricks
The order of the elements in your query
You’ve just learned a few new elements you can add to your queries, GROUP BY
and ORDER BY
, on top of the SELECT
, FROM
and WHERE
that were introduced earlier. The order of these elements needs to be correct for a query to run. The order in which you write your query should always be as follows:
- SELECT
- FROM
- WHERE
- GROUP BY
- ORDER BY