There is one more aggregate capability that is often overlooked. It is the HAVING
clause. HAVING allows you to perform conditional tests on aggregate
values. It is almost always used with GROUP BY. With HAVING,
you can include/exclude groups based on the aggregate value for that group.
For example, suppose you want to know all the states where there is more than
one friend. Looking at the first query in figure ,
you can see exactly which states have more than one friend. HAVING
allows you to programmatically test on the count column, as shown in