COUNT

Returns the number of rows returned by the query.

Syntax

Restrictions

The following restrictions apply when you use the COUNT function in the SELECT command:

  • The expression must be a column, a numeric constant, or a string constant.

  • The function does not support the DISTINCT or ALL keywords.

  • The function does not support the OVER clause.

  • The function always counts all rows for the query, including duplicates and nulls.

Examples

This example returns the number of incidents for which flood_controlled is 0 (zero):

select count(*) from incident where flood_controlled = 0;

This example returns the number of problems for which problem_key includes ORA-600:

select count(*) from problem where problem_key like '%ORA-600%';