Skip to main contentSkip to solution

Which of the following statement will correctly filter products having an average price of 50?

Solution

✅ Correct Option: 1

GROUP BY Category puts the rows into one group per category, and HAVING then filters those groups on an aggregate such as AVG(Price). Option 1 is the only statement with valid syntax and the correct clause order: GROUP BY first, then HAVING.


Option 2: WHERE cannot follow GROUP BY, and it cannot use aggregate functions like AVG().

Option 3: HAVING without GROUP BY treats the whole table as one group, so selecting Category on its own is invalid.

Option 4: GROUP BY takes column names, not a condition.

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