Using SQL HAVING Clause with WHERE Condition

Using SQL HAVING Clause with WHERE Condition

Instructor-svgAl-Mamun Sarkar
Apr 16 , 2020

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;

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram