Tuesday, October 11, 2016

HAVING clause

The HAVING clause use for  specify conditions that filter which group by in the final results  and work with aggregate functions.


Table name Student
StuId
City
20
France
20
japan
20
France
30
India
10
Bangladesh

Query:
SELECT COUNT(StuId), City
FROM Student GROUP BY City
HAVING COUNT(StuId) > 1


Result:


Count
City
2
France

No comments:

Post a Comment