SQL COUNT statement (other than COUNT(*))

The most common case is not that interesting - select count(*) from ... simply returns the number of rows, including null values. d

select count(columnName) is similar, but it does not count null values in columnName.

select count(distinct columnName) counts distinct values, excluding null values.


To contact me, send an email anytime or leave a comment below.