MySQL NULL 安全等于运算符,相当于标准 SQL IS NOT DISTINCT FROM 运算符,执行类似于 = 运算符的相等比较。它的符号是。当我们将 NULL 作为两个操作数时,它的执行方式与比较运算符不同。请考虑以下示例来了解 NULL 安全运算符及其与比较运算符的区别 –
mysql> Select 50 <=> 50, NULL <=> NULL, 100 <=> NULL; +-----------+---------------+--------------+ | 50 <=> 50 | NULL <=> NULL | 100 <=> NULL | +-----------+---------------+--------------+ | 1 | 1 | 0 | +-----------+---------------+--------------+ 1 row in set (0.00 sec) mysql> Select 50 = 50, NULL = NULL, 100 = NULL; +---------+-------------+------------+ | 50 = 50 | NULL = NULL | 100 = NULL | +---------+-------------+------------+ | 1 | NULL | NULL | +---------+-------------+------------+ 1 row in set (0.00 sec)原文来自:www.php.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容