Tips About NULL in SQL
Select
should use is null
, not = null
because NULL is a special marker to indicate a data value does not exist, not a data value. So that cannot use = to check for equality.
Output NULL
To output null as a value, should use another select clause as a shell, for example:
1 | select ( |
The clause will output the second higher salary but cannot output “NULL” if the database is null. The shell clause will transfer them to the null.
Additional, to assign a variable, using = is Ok.