COUNT() in MySQL — How It Works
What the MySQL COUNT() function does, with an example.
Published October 20, 2026
COUNT() returns the number of rows matching a condition (or COUNT(*) for all rows in a group).
Key points
- Part of standard SQL functions available in MySQL for working with query results
Example
SELECT COUNT(*) FROM orders WHERE status = "completed";