aving

SQL HAVING Clause

SQL HAVING Clause

The

The HAVING clause is used to filter the results of a GROUP BY query. It is similar to the WHERE clause, but HAVING works on aggregated data.

Example of HAVING

SELECT gender, COUNT(*) AS total_users
FROM Users
GROUP BY gender
HAVING COUNT(*) > 10;
    

This query retrieves genders with more than 10 users.