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.

Thanks! You can always email me or use contact form for more questions/comments etc.


sql

45 Words

2022-06-27