Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Usage » Query and modify data » Summarizing, grouping, and sorting query results » Aggregate functions that summarize query results


COUNT( * )

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:

   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