The COUNT(*) function does not require an expression as an argument because, by definition, it does not use information about any particular column. The COUNT(*) function finds the total number of rows in a table. This statement finds the total number of employees:
SELECT COUNT(*) FROM Employees;
COUNT(*) returns the number of rows in the specified table without eliminating duplicates. It counts each row separately, including rows that contain NULL.
Like other aggregate functions, you can combine count(*) with other aggregates in the select list, with where clauses, and so on:
SELECT count(*), AVG( UnitPrice ) FROM Products WHERE UnitPrice > 10;
count(*) |
AVG(Products.UnitPrice) |
---|---|
5 |
18.2 |