tags:

views:

83

answers:

1

In MySQL

Select 1 from mytable

and

select null from mytable

both return the same number of rows. While select count(1) from mytable returns the rowcount and select count(null) from mytable always returns 0. Why?

+6  A: 

COUNT returns the number of non-NULL values, that's why it returns 0 for NULL.

reko_t
Thanks. here is the documentation link i found for this http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_count
Midhat