COUNT(*)

COUNT(*) does not require an expression parameter because, by definition, it does not use information about any particular column. It counts the total number of rows in a table. This statement finds the total number of books in titles:

SELECT COUNT(*)
FROM titles



-----------

18



(1 row(s) affected)


COUNT(*) returns the number of rows in the specified table without eliminating duplicates. It counts each row separately, including rows that contain null values.

Like other aggregate functions, COUNT(*) can be combined with other aggregate functions in the select list, with WHERE clauses, and so on. This statement shows COUNT(*) combined with a WHERE clause:

SELECT COUNT(*), AVG(price)
FROM titles
WHERE advance > $1000



---------------
--------------

15
24.20




(1 row(s) affected)