我的一位同事表示,她有一个疑问,只有使用
NULL
才能“工作”,而不是使用 null
。
她无法给我提供例子。
据我所知应该没有任何区别,我什至进行了一个简单的测试:
select case when NULL is NULL then 1 else 0 end;
select case when NULL is null then 1 else 0 end;
select case when null is NULL then 1 else 0 end;
select case when null is null then 1 else 0 end;
正如所料,他们都回来了
1
。
所以这里的问题是,使用
null
与使用 NULL
不同吗?
也许她比较了字符串
'NULL'
和'null'
不,
Null
不区分大小写。 is NULL
和 is null
将始终产生相同的结果。