Group By & Having
GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by one or more columns.
HAVING clause was added to SQL because the WHERE keyword cannot be used with aggregate functions.