The COUNT(*) function returns the number of selected rows in a selection.
Syntax
SELECT COUNT(*) FROM table
Example
With this "Persons" Table:
Name Age
Hansen, Ola 34
Svendson, Tove 45
Pettersen, Kari 19
This example returns the number of rows in the table:
SELECT COUNT(*) FROM Persons
Result:
3
Example
Return the number of persons that are older than 20 years:
SELECT COUNT(*) FROM Persons WHERE Age>20
Result:
2
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)