Home >> MySql >> Having in MySql

Having in MySql

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
How to see full query from SHOW PROCESSLIST
How do you display the whole query
How To Find Highest Salary
How To Find Second Highest Salary
How To Find Nth Highest salary
How to calculate number of days between two dates
Calculate days between two dates
How to Find the Number of Days Between Two Dates
How to Find the Number of Days Between Current Date to Specific Date
How much query taking long time to execute
How to Identify Performance Issues with Slow Queries
Using results from one query to use in another query
Using Output from one Query in a different Query
How to update a column with another column value from same table

Copyright ©2022 coderraj.com. All Rights Reserved.