sql - is null vs. equals null -
i have rough understanding of why = null
in sql , is null
not same, questions this one.
but then, why is
update table set column = null
a valid sql statement (at least in oracle)?
from answer, know null
can seen "unknown" , therefore , sql-statement where column = null
"should" return rows, because value of column
no longer an unknown value. set null
explicitly ;)
where wrong/ not understand?
so, if question maybe unclear: why = null
valid in set
clause, not in where
clause of sql statement?
sql doesn't have different graphical signs assignment , equality operators languages such c or java have. in such languages, =
assignment operator, while ==
equality operator. in sql, =
used both cases, , interpreted contextually.
in where
clause, =
acts equality operator (similar ==
in c). i.e., checks if both operands equal, , returns true
if are. mentioned, null
not value - it's lack of value. therefore, cannot equal other value.
in set
clause, =
acts assignment operator (similar =
in c). i.e., sets left operand (a column name) value of right operand. legal statement - declaring not know value of column.