SQL – Syntax of a (SELECT) Query

Sometimes when I haven’t written any queries in a while I need to remind myself what order some of the clauses come in.

FROM & JOIN – Determines which rows are to be selected, and filters out records from similar tables.
WHERE – Applies additional filtering to rows. Used to exclude individual records.
GROUP BY – Combines rows into groups
HAVING – Basically a “where” clause that works on groups!
ORDER BY – Arranges the results by a specified column.

Leave a Reply