I am a database professional, not a developer. And I have my personal war against SQL NULL, for several reasons. To sum up:
- From a theoretical point of view, Ted Codd proposed two different markers for unknown and missing values. SQL mixed them into a single NULL marker, which sometimes behaves as a missing value, and sometimes as an unknown value.
- From a practical point of view, the vast majority of incorrect SQL queries (queries that work but don't return the correct results) don't handle NULL correctly in one or more places.
- Despite this, I admit that using NULL in relational databases is necessary, in some cases.
- However, most of the times columns are NULLable because this is the default, and they contain NULL values because the developer didn't consider any alternative. Or it's just inserted by mistake.
Now I'm learning Rust, and I found out that it has a great way to deal with the idea of NULL without actually implementing NULL - I'm thinking about Option of course.
I wrote an article to show people who follow me the Rust way. This may be of little use (SQL NULL is here to stay), but in my opinion opening minds and trying to open a discussion are always good things.
Here is the article:
https://federico-razzoli.com/do-languages-need-null-rust-example
I hope to see comments from this community, here or in that page. Also, since I'm a Rust newbie, if I wrote anything stupid I would be grateful to whoever show me my mistakes.
Thank you in advance!