“"和"= null"和“是"NULL"吗? [英] What's the difference between " = null" and " IS NULL"?
问题描述
"= null"和"IS NULL"之间有什么区别?它们的用法有何不同?
What is the difference between "=null" and "IS NULL"? How are they used differently?
推荐答案
在WHERE
子句中,column=null
永远不会为true,以这种方式使用null无效,您需要说column IS NULL
或column IS NOT NULL
.这说明了NULL
的特殊性质,它不是要检查其是否相等的值,它是未知值,因此您需要使用IS
或IS NOT
语法.
In a WHERE
clause, column=null
will never be true, it is not valid to use null this way, you need to say column IS NULL
or column IS NOT NULL
. This speaks to the special nature of NULL
, it is not a value to check for equality of, it is an unknown value, so you need to use the IS
or IS NOT
syntax.
您可以使用=
等于来分配NULL
值.例如:UPDATE TableX SET Column=NULL...
You may assign something the NULL
value using the =
equal. For example: UPDATE TableX SET Column=NULL...
链接:
维基百科NUll(SQL)
w3schools SQL NULL值
SQL教程,请参见"IS NULL运算符"部分
links:
Wikipedia NUll (SQL)
w3schools SQL NULL Values
SQL Tutorial, see IS NULL Operator section
这篇关于“"和"= null"和“是"NULL"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!