Today is Friday night, so my question is not practical, but of a purely philosophical nature, for fray. Some materials you can probably google, but reluctant to google, I want to talk.
There is such a concept - NULL-values. Meaning: meaning is missing, unknown, does not make sense, etc.
If we are talking about, for example, the date of birth, then the given date is the date of birth, and NULL means that we do not know the date of birth of a citizen. Well, or that he has not yet been born, sits at my mother's stomach.
At the same time, numeric 0 and NULL carry different meaning. If we are talking about, for example, the amount of money in a citizen’s bank accounts, then 0 can mean that he doesn’t have money, and NULL - that we don’t know how much money he has (they haven’t considered it yet).
In many cases, NULL is not applicable. For example, in a bank software in an account about a bank account, the amount is always known for sure - what kind of bank is it if he himself does not know how much money is in the account?
What has been said above has long been known; this was the prelude to the question. And the question is:
If we have a text field, then in what cases does an empty string and NULL carry different meaning?
I thought and could not think of any practically applicable example. It seems that the empty text and NULL in all cases should be considered as equivalents.
If you allow yourself to philosophize a little, then I think the reason is that the text is a very special type, expressing in its most general form the ancient, pre-computer idea of ​​writing. Here we have a clean wax tablet, no damn on it, it's empty. And then we put some style on it and now we have the text. It is easy to see that the “empty text” and “lack of text” do not differ in any way. The text drops out of the "missing" state only when at least one character appears in it.
Here it is appropriate to argue that NULL may indicate the absence of the wax tablet itself, however, returning to the information technologies of the 21st century, I would like to ask: are there any examples where this is necessary?
And what do you think about the equivalence of NULL and the empty string? When does an empty string and NULL carry a different meaning?
Any examples and considerations are interesting.
PS This, of course, is not only about classic SQL DBMS, but about the type and value system as a whole, wherever it is used.