Discussion
The HAVING clause does which of the following?
Answer: A
Correct answer: Acts like a WHERE clause but is used for groups rather than rows.
HAVING filters after aggregation, WHERE before it, and the order is what makes them different rather than redundant.
WHERE decides which rows enter the groups; GROUP BY forms them; HAVING then decides which groups survive, and it may test aggregate values. So HAVING COUNT(*) > 5 is legal and WHERE COUNT(*) > 5 is not, because at the time WHERE runs no group exists to count. That is also why filtering on plain columns belongs in WHERE, where it reduces the work.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development