SQL · Question 1 · Easy

Which SQL clause is used to filter groups formed by GROUP BY, for example to keep only departments whose average salary exceeds a limit?

  1. WHERE
  2. ORDER BY
  3. HAVING
  4. GROUP BY
Answer and explanation

Answer: C. HAVING

Explanation: WHERE filters individual rows before grouping, and HAVING filters groups after aggregation. A condition on an aggregate such as AVG(salary) belongs in HAVING.

Next: Table Employee: id | name | dept | salary 1 | Asha | HR | 30000 2 | Ravi | IT…

Practise sql

Try a fresh set of sql questions with an explanation after every answer, free and without signing up: SQL practice. Or sit a full placement mock test.

More sql questions

More technical & programming practice

Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics · Pseudo-code · C Programming · Java

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge