The HAVING clause is used to ________.
The HAVING clause is used to ________.
Solution
✅ Correct Option: 2
HAVING sets a condition on the groups formed by the GROUP BY clause, so it is used together with GROUP BY. It is applied after grouping, which is why it can use aggregate functions such as , and .
Example: SELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5;
Option 1: this describes WHERE, which filters individual rows before grouping. HAVING works after grouping.
Options 3 and 4: sorting is done by ORDER BY and joining tables by JOIN.
WHERE cannot use aggregate functions, while HAVING can.
Related questions:
2025: 22 May Shift 1
2026: 11 May Shift 2
2025: 15 May Shift 2
2025: 16 May Shift 1
2025: 20 May Shift 1