January 19th, 2009

COUNT (Rows)

Posted by admin in J. Column Functions

COUNT(expression) counts the number of rows selected that are not null.
COUNT(*) counts all of the rows, including those that are null.
The expression is a column name, numeric expression, or literal.
Nulls are included in the count with COUNT(*), otherwise Nulls are removed from the count.
The argument values can be character, numeric, datetime, or asterisk (*).
The result will be a numeric integer of zero value or greater.
The keyword, DISTINCT, can be used, except when using COUNT(*).

 

          COUNT(expression)                     <- Count the number of non-nulls.

                              or

          COUNT(DISTINCT column-name) <- Count the number of unique non-nulls.

                              or

          COUNT(*)                                      <- Count the number of null and non-nulls.

 

Notes:
COUNT(*) – COUNT(expression)                        <- Gives the number of nulls in a column.
((COUNT(*)-COUNT(expr))*100)/COUNT(*)        <- Gives the percentage of nulls.

Comments are closed.

Sorry, the comment form is closed at this time.