I have a table with 1118 records. In these records there is one field flag which is by default NULL. 556 of these records have field flag marked as true while the rest are NULL.
When I run the following query :
select count(*) from table_name where flag!='true'
I get result as 0. Where as actual result should be 1118-556 i.e 562.
What Am I doing wrong?
NULL never compares to anything, not even another NULL
or
It depends if you have another value apart from
true(false?) as well as NULLsFinally, see these to understand COUNT and null/not null values