NULL-safe equal

Posted rsapaper

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NULL-safe equal相关的知识,希望对你有一定的参考价值。

http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_equal-to

SELECT 1=1,1=NULL,0=NULL,NULL=NULL;

1 NULL NULL NULL

SELECT 1<=>1,1<=>NULL,0<=>NULL,NULL<=>NULL;

1 0 0 1

 

<=>

NULL-safe equal. This operator performs an equality comparison like the = operator, but returns 1 rather than NULL if both operands are NULL, and 0rather than NULL if one operand is NULL.

The <=> operator is equivalent to the standard SQL IS NOT DISTINCT FROM operator.

For row comparisons, (a, b) <=> (x, y) is equivalent to:

(a <=> x) AND (b <=> y)

 

以上是关于NULL-safe equal的主要内容,如果未能解决你的问题,请参考以下文章

如何重构这个 Java 代码片段

如何在 python 中并行化以下代码片段?

Python代码阅读(第13篇):检测列表中的元素是否都一样

Java习惯用法总结

Java8 Stream流

DB--运算符