Not equal <> != operator on NULL

后端 未结 11 1545
南旧
南旧 2020-11-22 02:50

Could someone please explain the following behavior in SQL?

SELECT * FROM MyTable WHERE MyColumn != NULL (0 Results)
SELECT * FROM MyTable WHERE MyColumn <         


        
11条回答
  •  别那么骄傲
    2020-11-22 03:32

    NULL has no value, and so cannot be compared using the scalar value operators.

    In other words, no value can ever be equal to (or not equal to) NULL because NULL has no value.

    Hence, SQL has special IS NULL and IS NOT NULL predicates for dealing with NULL.

提交回复
热议问题