Diffence between "select count(null)" and "select count(1)"

Posted by Midhat on Stack Overflow See other posts from Stack Overflow or by Midhat
Published on 2010-03-31T10:37:18Z Indexed on 2010/03/31 10:43 UTC
Read the original article Hit count: 215

Filed under:

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?

© Stack Overflow or respective owner

Related posts about mysql