Is there a reason not to use <=> (null safe equals operator) in mysql instead of =?

后端 未结 5 2262
自闭症患者
自闭症患者 2021-02-13 16:47

MySQL provides a nice operator <=> that works with comparisons that could contain a null such as null <=> null or null <=> 5

5条回答
  •  情书的邮戳
    2021-02-13 17:15

    Yes.

    This must be because relational databases use the theory of three-valued logic (TRUE, NULL, FALSE).

    And the three-valued logic must work so because it must be internally consistent.

    It follows from the rules of mathematics.

    Comparisons with NULL and the three-valued logic

提交回复
热议问题