Aggregate Functions
An aggregate collapses many rows into one value. COUNT, SUM, AVG, MIN, MAX.
Without GROUP BY they run over the whole table and return a single row. With it, they run over each group.
Group by the id, not just the name. Two people can share a name, and grouping by the name would merge them into one row that belongs to neither. Grouping by a.id, a.name is correct and lets you select the name safely.
Mark this lesson complete
Signed in, your progress follows you to every device.