Home / SQL / Combining data

GROUP BY

GROUP BY puts rows into groups so you can count or total each group, using COUNT, SUM or AVG. Combine it with select and where.

SELECT city, COUNT(*)
FROM customers
GROUP BY city;

Test yourself on this