<story><title>Null Values in SQL Queries</title><url>https://mitchum.blog/null-values-in-sql-queries/</url></story><parent_chain><item><author>danso</author><text>There&amp;#x27;s a lot of real-world input situations in which I want NULL to indicate that a record field hasn&amp;#x27;t yet been collected, versus a record in which the answer to that field was &amp;quot;&amp;quot; – i.e. left blank by the respondent&amp;#x2F;data source. Sure I could have the front-facing data app auto-convert blank values to &amp;quot;N&amp;#x2F;A&amp;quot; or &amp;quot;(blank)&amp;quot;, but that&amp;#x27;s unnecessary complexity.</text></item><item><author>juped</author><text>&amp;gt;For example, Oracle database won’t allow you to have an empty string. Anytime Oracle database sees an empty string, it automatically converts the empty string into a NULL value.&lt;p&gt;Damn. This is how you do enterprise.&lt;p&gt;I might be the only person who likes SQL nulls. If you learn how they work up front, they&amp;#x27;re useful and not really that confusing. But if I ran into weird behaviors like this, I might hate them too.</text></item></parent_chain><comment><author>sammorrowdrums</author><text>I&amp;#x27;ve been really enjoying using Rust because it has no NULL. You have to instead use the semantics of Some(x) &amp;#x2F; None()and handle both cases. I&amp;#x27;m not sure how you work around the fact that an empty string is Null.&lt;p&gt;The problem with Null is that it can be either a value or show the lack of presence, and in JS because both undefined and null are values you can&amp;#x27;t depend on them being used for their semantics either (you can try to enforce their use but it that&amp;#x27;s no guarantee).&lt;p&gt;SQL suffers this exact same problem. I wonder what SQL would look like without Null.&lt;p&gt;&lt;pre&gt;&lt;code&gt;    Select id, Option (key)
    From table
 

    Insert... Some(5), None::Int
&lt;/code&gt;&lt;/pre&gt;
From this perspective it still seems that empty string should not be None, but I think you&amp;#x27;re right that many people do use a code like &amp;quot;N&amp;#x2F;A&amp;quot;, but you can just add a supplemental Boolean field which is cleaner for set &amp;#x2F; not set.&lt;p&gt;Interesting</text></comment>
<story><title>Null Values in SQL Queries</title><url>https://mitchum.blog/null-values-in-sql-queries/</url></story><parent_chain><item><author>danso</author><text>There&amp;#x27;s a lot of real-world input situations in which I want NULL to indicate that a record field hasn&amp;#x27;t yet been collected, versus a record in which the answer to that field was &amp;quot;&amp;quot; – i.e. left blank by the respondent&amp;#x2F;data source. Sure I could have the front-facing data app auto-convert blank values to &amp;quot;N&amp;#x2F;A&amp;quot; or &amp;quot;(blank)&amp;quot;, but that&amp;#x27;s unnecessary complexity.</text></item><item><author>juped</author><text>&amp;gt;For example, Oracle database won’t allow you to have an empty string. Anytime Oracle database sees an empty string, it automatically converts the empty string into a NULL value.&lt;p&gt;Damn. This is how you do enterprise.&lt;p&gt;I might be the only person who likes SQL nulls. If you learn how they work up front, they&amp;#x27;re useful and not really that confusing. But if I ran into weird behaviors like this, I might hate them too.</text></item></parent_chain><comment><author>SigmundA</author><text>Empty string isn&amp;#x27;t enough for this situation since it doesn&amp;#x27;t work for data types other than string, I actually prefer null vs undefined in javascript &amp;#x2F; json here, xml also has the concept of null vs undefined.&lt;p&gt;Emtpy string vs null is not that useful if you have null and undefined.</text></comment>