COUNT

 

The function COUNT returns the number of not NULL items in a group. Without a GROUP BY clause it will calculated with all rows of the SELECT.

SQL Syntax:
   COUNT( expression | * )
Parameters:
  expression

Any type of expression without a aggregate function.

*

Specifies that all rows should be counted, including NULL values and duplicates.

Return Type:
  INT

Examples:

  • SELECT COUNT(*) FROM mytable
  • SELECT COUNT( surname ) FROM mytable
  • SELECT COUNT( surname ) FROM mytable t GROUP BY t.name

see also:
SQL Aggregate Functions


100% pure Java DBMS
Mirror Site