w1coding.comAll tutorials

SQL Having

SQL lessons
  1. Environment Setup
  2. Introduction
  3. Select
  4. Where
  5. Decision
  6. Insert
  7. Delete
  8. Distinct
  9. Limit
  10. Operator
  11. In
  12. Join
  13. Leftjoin
  14. Rightjoin
  15. Fulljoin
  16. Groupby
  17. Having
  18. Order
  19. Update

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.