HAVING: It is used to check after the aggregation occurs
WHERE: It is used to check before the aggregation occurs.
For Example:
select State, CNT=Count(1)
From Address
Where Country = 'IND'
Group By State
Results in a table of all States in IND and the number of addresses in each State.
Code:
select State, CNT=Count(1)
From Address
Where Country = 'IND'
Group By State
Having Count(1)>5
Results in a table of States in MA with more than 5 addresses and the number of addresses in each State
If you need to know more about SQL, it is recommended to go for the SQL Certification today.