One row per group
In Tier 1 an aggregate like COUNT(*) gave one answer for the whole table. GROUP BY gives one
answer for each group instead:
SELECT channel, COUNT(*) AS orders
FROM orders
GROUP BY channelThis splits the orders into piles, one per channel (Online, Phone, Sales Rep), then counts each pile. You get one row per channel.
The golden rule
Every column in SELECT must either be in the GROUP BY or be inside an aggregate. This fails,
because each channel has thousands of order dates and SQL can't pick one to show:
SELECT channel, order_date, COUNT(*) -- error
FROM orders
GROUP BY channelNULL counts as a group of its own: customers with no region all land in one NULL row.