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.
expression Return the number of rows in each group where the value of expression is not null.
DISTINCT expression 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.
SQL/2008 Core feature.
The following statement returns each unique city, and the number of employees working in that city.
SELECT City, COUNT( * ) FROM Employees GROUP BY City; |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |