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 students are in the students table.
SELECT COUNT(*)
FROM students;What comes back
| COUNT(*) |
|---|
| 24 |
There are 24 rows in the students table, and COUNT(*) turns them into that single number.
Related SQL lessons
Ready for a break?
Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.
play today's sip