The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.
Select column_name, aggregate_function(column_name) from table_name group by column_name
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions
Select employees.lastname, count(orders.orderid) as [Number of Orders] from (orders inner join employees on orders.employeeid = employees.employeeid) group by lastname having count(orders.orderid) > 10