Update columns with Null values

后端 未结 5 1207
渐次进展
渐次进展 2020-12-17 07:59

I tried updating a table as follows:

update userloginstats set logouttime = sysdate where logouttime = null;

It didn\'t update the columns

5条回答
  •  感情败类
    2020-12-17 08:40

    For nulls you must use "IS NULL" or "IS NOT NULL" rather than the = operator. This is because null is technically neither true or false, rather it's the absence of a value either way.

    Most programming languages typically associate null with false for convenience (and thereby enabling the use of the = operator), but SQL takes a more purist approach, rightly or wrongly.

提交回复
热议问题