Skip to main contentSkip to solution

____ in SQL, is used to specify the conditions on rows with GROUP BY clause.

Solution

✅ Correct Option: 3

The HAVING clause specifies conditions on the groups formed by GROUP BY. It is applied after grouping, so it can use aggregate functions such as COUNT()\text{COUNT()}, SUM()\text{SUM()} and AVG()\text{AVG()}.

Example: SELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5;


Option 2: WHERE filters individual rows before grouping and cannot use aggregate functions, so it cannot set conditions on groups.

Option 4: ORDER BY only sorts the final result and does not filter anything.

Keyboard Shortcuts

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