Hitachi

Hitachi Advanced Database SQL Reference


7.23.1 COUNT(*)

COUNT(*) determines the number of input rows to the set function.

Organization of this subsection

(1) Specification format

set-function-COUNT(*) ::= COUNT(*)

(2) Rules

  1. The data type of the execution result is the BIGINT type#.

    #

    If the integer data type format is a legacy format, it will be an INTEGER type.

  2. If the number of input rows is 0, the execution result will be 0.

(3) Example

Example

Using the data in the employee table (EMPLIST), this example determines the number of male employees in section S001.

SELECT COUNT(*) AS "COUNT"
    FROM "EMPLIST"
        WHERE "SCODE"='S001' AND "SEX"='M'

Example of execution results

[Figure]