count with having or where in sql code example
Example 1: sql count having
-- Classes with more than 10 students
SELECT student_class, COUNT(*) FROM students GROUP BY student_class
HAVING count(*) > 10;
Example 2: sql count having
SELECT COUNT( * )
FROM agents
HAVING COUNT(*)>1; --count is greater than 1