MySQL - NULL safe NOT equal operator

前端 未结 4 817
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 06:58

I am just curious - I know about NULL safe equal operator <=>, but is there some NULL safe NOT equal operator? Or I have to always use something like this

4条回答
  •  醉话见心
    2020-12-03 07:25

    Now MySQL does not have a NULL-safe not equal operator.

    Using MySQL the most universal solution is:

    !(tab.id <=> 1)
    

    or

    NOT tab.id <=> 1
    

    because it will work properly if even in place of 1 you will use NULL.

提交回复
热议问题