4 ms·
> My best guess is that there are common old databases that did not have a first class null type where it was common practice to use the string "NULL" for that
by eighthnate 9y ago
> My best guess is that there are common old databases that did not have a first class null type where it was common practice to use the string "NULL" for that purpose.
It isn't a DB issue. It's more of a front-end or middle tier issue.
In SQL standards - NULL is a "marker"/TYPE. NULL and "NULL" are two separate things. One is a null type and the other is a string type.
Or more specifically, it is a "interface" problem between RDBMs and front-end since languages handle null differently. Many languages didn't have null types and null in certain languages mean different things that "lack of information".
For example, if a database column was a nullable int column and you wanted to bring it out to the java or .net space you would have issues since "int" in java and .net are value types and not reference types. So you could assigned null to the values. Where as a string/text/varchar column you could since string in java and .net are reference types and can be null.
In some languages, checking for null means you have to convert null into a string and then compare "null" == "null".
It's a legacy of lack of Nullable types in many programming languages. With the introduction of Nullable types many of these problems went away.