Blog · Guide

SQL COUNT, SUM, AVG, MIN, MAX Explained

Aggregate functions collapse many rows into one number — how many customers, average age, min/max price.

rows Austin Milan Austin Milan GROUP BY Austin → COUNT = 2 Milan → COUNT = 2
GROUP BY buckets rows that share a value, then aggregates each bucket.

One number from many rows

SELECT COUNT(*) AS total_customers
FROM customers;

Aggregates need parentheses

Write COUNT(*), not bare COUNT. When you mix aggregates with plain columns, you usually need GROUP BY.

Try it yourself

The fastest way to lock this in is a short drill on the same Northstar Market tables.

Practice COUNT

Related guides