Which SQL clause is used to filter individual rows before grouping takes place?

Options

  • A. HAVING
  • B. WHERE
  • C. ORDER BY
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. WHERE

Detailed Explanation

  • WHERE: Filters individual rows before GROUP BY is applied.
  • HAVING: Filters groups after grouping.
  • Example: SELECT department_id, COUNT(*) FROM employees WHERE salary > 20000 GROUP BY department_id;