SELECT CASE WHEN null = null THEN 'I LOVE YOU RANGA' ELSE 'I HATE YOU RANGA' end as Message;
Output: 'I HATE YOU RANGA'
The reason for this is that the proper way to compare a value to
null
in SQL is with the is
operator, not with =
.SELECT CASE WHEN null IS null THEN 'I LOVE YOU RANGA' ELSE 'I HATE YOU RANGA' end as Message;
Output: 'I LOVE YOU RANGA'
0 comments:
Post a Comment