• HAVING is only for conditions involving aggregates used in conjunction with the GROUP BY clause. eg.COUNTSUMAVGMAXMIN.
  • WHERE is for any non-aggregage conditions
  • HAVING applies to groups.
  • WHERE applies to rows.

Example:

select StudentName from students where Age > 20

select className, count(studentId) from classes group by className 
                                      having count(studentId) > 10