COUNT returns the number of rows returned by the query where the expression is not NULL.

Syntax:

COUNT([DISTINCT] expression)

If you pass the count function the (*) wildcard then it will return the count of all rows, including the rows with NULL values.

You can optionally use the DISTINCT keyword to count only unique instances of data.

This example shows there are 20 rows in the EMP table:

SELECT COUNT(*) FROM EMP;

COUNT(*)
————–
20

Count – Oracle SQL Function
Tagged on: