COUNT(*) returns the number of rows in the specified table without eliminating duplicates. It counts each row separately, including rows that contain NULL. This function does not require an expression as an argument because, by definition, it does not use information about any particular column.
The following statement finds the total number of employees in the Employees table:
SELECT COUNT(*) FROM Employees; |
Like other aggregate functions, you can combine COUNT(*) with other aggregate functions in the select list, with WHERE clauses, and so on. For example:
SELECT COUNT(*), AVG( UnitPrice ) FROM Products WHERE UnitPrice > 10; |
COUNT( * ) | AVG(Products.UnitPrice) |
---|---|
5 |
18.2 |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |