In MySQL, NULL
is considered as a ‘missing, unknown value’, as opposed to no value. Take a look at this MySQL Reference on NULL.
Any arithmetic comparison with NULL
does not return true or false, but returns NULL
instead., So, NULL != 'C'
returns NULL
, as opposed to returning true.
Any arithmetic comparison with ‘NULL’ will return false. To check this in SQL:
SELECT IF(NULL=123,'true','false')
To check NULL
values we need to use IS NULL
& IS NOT NULL
operator.