Aggregate
Functions that return a single value from a bag of tuples:
AVG()
COUNT()
SUM()
MAX()
MIN()
Non-aggregated values in SELECT output clause must appear in GROUP BY clause.
GROUP BY
Used in collaboration with aggregate functions like COUNT()
, SUM()
, AVG()
, MAX()
, or MIN()
. It arranges the result set into groups based on the values of specified columns.
If you’re going to do any grouping / aggregation at all, then you must only SELECT grouped / aggregated columns.
Multiple Group By: Need multiple columns to be the same.
HAVING
Like WHERE
but for GROUP BY