Problem Statement
Which is the best practice when filtering rows on a simple column value for a grouped report?
Explanation
Row-level predicates belong in WHERE. That reduces data before grouping and often yields simpler plans.
Reserve HAVING for predicates that depend on aggregates.
Code Solution
SolutionRead Only
SELECT store_id, SUM(total) FROM sales WHERE region='APAC' GROUP BY store_id;
Practice Sets
This question appears in the following practice sets:
