IN Operator SQL

后端 未结 7 1547
庸人自扰
庸人自扰 2020-12-11 22:21

I have a table called NUMS with a single column n.
And I fill values 1,2,3,4,5,null in it.

Now a query

SELECT n FROM Nums 
 WHERE n IN (1, 2,         


        
7条回答
  •  佛祖请我去吃肉
    2020-12-11 23:08

    You cannot compare directly with null. To find whether the value of a column is null, you must use something along the lines of this:

    SELECT n
    FROM Nums
    WHERE n IS NULL
    

提交回复
热议问题