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?
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?
COUNT returns the number of non-NULL values, that's why it returns 0 for NULL.