Skip to main contentSkip to solution

The ____________ clause is used to filter grouped records based on aggregate function results.

Solution

✅ Correct Option: 4

The HAVING clause filters groups after GROUP BY has formed them, so it can use aggregate functions such as COUNT, SUM, AVG, MAX and MIN. For example, SELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5; keeps only departments with more than 5 employees.


WHERE: filters individual rows before grouping, so it cannot use aggregate functions.

GROUP BY: forms the groups but does not filter them.

ORDER BY: only sorts the final result.

WHERE filters rows, HAVING filters groups.

Keyboard Shortcuts

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