What#39;s the difference between quot; = nullquot; and quot; IS NULLquot;?(quot; 和有什么不一样?= 空和“是否为空?)
问题描述
=null"和IS NULL"有什么区别?它们的用法有何不同?
What is the difference between "=null" and "IS NULL"? How are they used differently?
推荐答案
在 WHERE 子句中,column=null 永远不会为真,使用无效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 运算符部分
这篇关于" 和有什么不一样?= 空"和“是否为空"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:" 和有什么不一样?= 空"和“是否为空"?
				
        
 
            
        - 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
 - 在SQL中,如何为每个组选择前2行 2021-01-01
 - 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
 - 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
 - 更改自动增量起始编号? 2021-01-01
 - 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
 - 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
 - 导入具有可变标题的 Excel 文件 2021-01-01
 - 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
 - SQL 临时表问题 2022-01-01
 
						
						
						
						
						
				
				
				
				