Conditions on groups
Example: Find customers owing more that $100
SQL provides a way to restrict the aggregate directly:
select name, address, sum(unpaid)
from purchase join customer using (customer_id)
group by customer_id, name, address
having sum(unpaid) > 100
|