Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Counts the number of rows in a group depending on the specified parameters.
COUNT( [ * | [ DISTINCT ] expression ] )
Return the number of rows in each group. COUNT(*) and COUNT() are semantically equivalent.
Return the number of rows in each group where the value of expression is not null.
Return the number of distinct values of expression for all of the rows in each group where expression is not NULL.
The COUNT function returns a value of type INT.
COUNT never returns the value NULL. If a group contains no rows, or if there are no non-NULL values of expression in a group, then COUNT returns 0.
The COUNT function returns a maximum value of 2147483647.
The following statement returns each unique city, and the number of employees working in that city.
SELECT City, COUNT( * ) FROM Employees GROUP BY City;