Programming · Flashcard
Filter 2026 orders, group by customer, keep counts over 3. How?
Why this is the answer
Filter rows as early as possible: the year is a per-row test so it belongs in WHERE, where it also reduces how much data is grouped. The count only exists once groups are formed, so it has to be in HAVING. Getting this the wrong way round is either an error or a much slower query.
Read more in the docs