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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
COUNTreturns the number of non-NULL values, that’s why it returns 0 for NULL.