skip to today's puzzle

COUNT(*) answers 'how many rows?'

Instead of listing rows, you can ask for one number about them. COUNT(*) counts the rows that made it through your filters and hands back that single number. So the result is one row with one value, not a list.

A tiny example

In plain English: Tell me how many items are in the menu_items table.

SELECT COUNT(*)
FROM menu_items;

Query result

COUNT(*)
24

There are 24 rows in the menu_items table, and COUNT(*) turns them into that single number.

Common questions

What is the difference between COUNT(*) and COUNT(column)?
COUNT(*) counts every row the query finds. COUNT(column) counts only the rows where that column has a value, skipping NULLs.
How do I count only unique values?
Use COUNT(DISTINCT column). It sets repeats aside first, so each different value is counted once.

Related SQL lessons

Practice COUNT(*) step by step

The Foundations Track has beginner puzzles built around this idea. Tap tiles, see real results. No terminal, no setup.

practice this in the course

Ready for a break?

A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.

Try today's free SQL puzzle