2 ms·
Lots of languages have several ways to indicate an invalid value. With SQL, I generally prefer dialects where an empty string and null are considered the same,
by perl4ever 7y ago
Lots of languages have several ways to indicate an invalid value.
With SQL, I generally prefer dialects where an empty string and null are considered the same, although that may be just due to what I learned first. Various Microsoft technologies seem to tend towards multiple ways of expressing null/missing/empty.
An interesting thing about null in SQL is that the rule that any operation on a null returns null, only applies sometimes in some contexts. For instance in Oracle SQL:
select max(case when x = 'ABC' then 'ABC' end) as y
from ...
...is taking the maximum of an expression which is null whenever x <> 'ABC', yet it doesn't return null if there are rows where it does = 'ABC'.
(sorry for any errors)