Home >> SQL >> Having in SQL

Having in SQL

The HAVING clause is like WHERE clause,but applies only to groups.

The HAVING clause specifies a condition for a group or an aggregate function used in select statement.

The HAVING clause can not be used without the GROUP BY clause.

Syntax

SELECT columnname FROM tablename WHERE condition GROUP BY columnname HAVING condition

Example

SELECT * FROM faculty GROUP BY dept HAVING count(*)>3

Post Your Comment

Next Questions
Union
Union all
Exits
Not Exits
Any
All
Max
Min
Avg
Count
Sum

Copyright ©2022 coderraj.com. All Rights Reserved.