Using SQL HAVING Clause with WHERE Condition

Author: Al-mamun Sarkar Date: 2020-04-16 14:29:10

Using SQL HAVING Clause with WHERE Condition. The following SQL query shows how to use HAVING while querying data from the database using SQL.

 

SQL HAVING Syntax:

SELECT column, column, ...
FROM table_name
WHERE condition
GROUP BY column
HAVING condition
ORDER BY column;

Example:

SELECT COUNT(id), country
FROM employees
GROUP BY country
HAVING COUNT(id) > 2;