Skip to main contentSkip to solution

Which SQL query correctly filters out groups with a total sales amount greater than 10,000?

Solution

✅ Correct Option: 3

HAVING filters groups after GROUP BY, and it can use aggregate functions such as SUM()SUM(). So HAVING SUM(Sales) > 10000 keeps only those customers whose total sales exceed 10,000.


Option 1: WHERE runs before grouping, so it cannot use an aggregate like SUM() and the query gives an error.

Option 2: ORDER BY only sorts the result and never removes groups.

Option 4: WHERE filters individual rows (single orders above 10,000), not the group total.

Memory trick: WHERE filters rows before grouping, HAVING filters groups after grouping.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question