The COUNT(column) function returns the number of rows without a NULL value in the specified column.
Syntax
SELECT COUNT(column) FROM table
Example
With this "Persons" Table:
Name Age
Hansen, Ola 34
Svendson, Tove 45
Pettersen, Kari
This example finds the number of persons with a value in the "Age" field in the "Persons" table:
SELECT COUNT(Age) FROM Persons
Result:
2
The COUNT(column) function is handy for finding columns without a value. Note that the result is one less than the number of rows in the original table because one of the persons does not have an age value stored.
Custom Search
Showing posts with label The SQL COUNT Function Statement. Show all posts
Showing posts with label The SQL COUNT Function Statement. Show all posts
Saturday, August 23, 2008
Subscribe to:
Posts (Atom)