SQL Structure

A typical SQL query has the following six steps.

SELECT columns to display

FROM table(s) to pull from

WHERE filter rows

GROUP BY split rows into groups

HAVING filter grouped rows

ORDER BY columns to sort by