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:

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

Next up

LIMITing the amount of data with SQL

Limiting the amount of rows your SQL query returns is a nifty way to see an excerpt of your query's results (or to see if it has no errors).

Go to lesson