What is the difference between WHERE and HAVING?

Question

can you help me with this question

Answer ( 1 )

    0
    2025-02-22T06:00:02+00:00
    • WHERE is used to filter records before grouping (used with SELECT, UPDATE, DELETE).
    • HAVING is used to filter records after grouping (used with GROUP BY).

    📌 Example:

    SELECT department, COUNT(*)
    FROM employees
    WHERE salary > 50000
    GROUP BY department
    HAVING COUNT(*) > 10;

Leave an answer