Chapter 4: SQL Language Elements
4.9.1.2 COUNT
Syntax
COUNT ( { [ALL] expression } | { DISTINCT column_ref } | * )
Description
The aggregate function COUNT computes either the number of rows in a group of rows or the number of non-null values in a group of values.
- The keyword DISTINCT specifies that the duplicate values are to be eliminated before computing the count.
- If the argument to COUNT function is '*', then the function computes the count of the number of rows in group.
- If the argument to COUNT function is not '*', then null values are eliminated before the number of rows is computed.
- The argument column_ref or expression can be of any type.
- The result of the function is of INTEGER type. The result is never null.
Example
SELECT COUNT (*)
FROM orders
WHERE order_date = SYSDATE ;