01 / 03
The pattern of analysis never changes
Whatever the question, what you do comes apart into four.
- what comes out? … orders? units? money?
- which tables do you need? … one? a join?
- per what do you gather? … the
GROUP BYcolumn - how do you narrow and sort? …
WHERE/HAVING/ORDER BY
Fill those four in and the query is as good as written.