<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: What is the deal with NULLs?</title>
	<atom:link href="http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/feed/" rel="self" type="application/rss+xml" />
	<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/</link>
	<description>Ideas on Databases, Logic, and Language by Jeff Davis</description>
	<lastBuildDate>Sat, 10 Jul 2010 14:36:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Morgan32Tracy</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-235</link>
		<dc:creator>Morgan32Tracy</dc:creator>
		<pubDate>Wed, 07 Jul 2010 23:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-235</guid>
		<description>The &lt;a href=&quot;http://bestfinance-blog.com/topics/credit-loans&quot; rel=&quot;nofollow&quot;&gt;credit loans&lt;/a&gt; suppose to be very useful for people, which are willing to organize their business. In fact, this is not very hard to receive a college loan.</description>
		<content:encoded><![CDATA[<p>The <a href="http://bestfinance-blog.com/topics/credit-loans" rel="nofollow">credit loans</a> suppose to be very useful for people, which are willing to organize their business. In fact, this is not very hard to receive a college loan.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xavier</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-230</link>
		<dc:creator>Xavier</dc:creator>
		<pubDate>Thu, 01 Jul 2010 08:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-230</guid>
		<description>&gt; SQL’s approach to missing information is, well, “unique”.

Not so unique. You might be interested in the way R  handles NULL value. It is fairly similar (even though many examples are not applicable). For instance:

&gt; sum(NULL, 3)
[1] 3
&gt; NULL + 3
numeric(0)</description>
		<content:encoded><![CDATA[<p>&gt; SQL’s approach to missing information is, well, “unique”.</p>
<p>Not so unique. You might be interested in the way R  handles NULL value. It is fairly similar (even though many examples are not applicable). For instance:</p>
<p>&gt; sum(NULL, 3)<br />
[1] 3<br />
&gt; NULL + 3<br />
numeric(0)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cleaning ladies</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-222</link>
		<dc:creator>cleaning ladies</dc:creator>
		<pubDate>Thu, 10 Jun 2010 01:58:16 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-222</guid>
		<description>Thanks for taking this opportunity to talk about this, I feel strongly about it and I benefit from learning about this subject. If possible, as you gain data, please update this blog with new information. I have found it extremely useful.</description>
		<content:encoded><![CDATA[<p>Thanks for taking this opportunity to talk about this, I feel strongly about it and I benefit from learning about this subject. If possible, as you gain data, please update this blog with new information. I have found it extremely useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darren Duncan</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-200</link>
		<dc:creator>Darren Duncan</dc:creator>
		<pubDate>Mon, 15 Mar 2010 04:01:04 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-200</guid>
		<description>Tim, thanks for the lip-service to my project.  It also gives more support to what I&#039;m doing when I hear that others have wanted or tried to do similar, as it shows more that demand is there.</description>
		<content:encoded><![CDATA[<p>Tim, thanks for the lip-service to my project.  It also gives more support to what I&#8217;m doing when I hear that others have wanted or tried to do similar, as it shows more that demand is there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Bunce</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-163</link>
		<dc:creator>Tim Bunce</dc:creator>
		<pubDate>Mon, 07 Dec 2009 21:46:55 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-163</guid>
		<description>FYI Darren Duncan has been working on just such a project for several years.
http://pugs.postgresql.org/node/404
http://www.mail-archive.com/dbi-users@perl.org/msg31943.html</description>
		<content:encoded><![CDATA[<p>FYI Darren Duncan has been working on just such a project for several years.<br />
<a href="http://pugs.postgresql.org/node/404" rel="nofollow">http://pugs.postgresql.org/node/404</a><br />
<a href="http://www.mail-archive.com/dbi-users@perl.org/msg31943.html" rel="nofollow">http://www.mail-archive.com/dbi-users@perl.org/msg31943.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-96</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Sat, 15 Aug 2009 06:32:30 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-96</guid>
		<description>&gt; NULL is the empty set.
&gt;
&gt; Set operations can appear to be very similar to “normal” mathematical operations, but since they may be missing key properties of that operation (say closure), they act in what appears to be a non-intuitive fashion.

What set operations lack closure? As far as I know set operations are a well-defined mathematical system, and the empty set is just a value in that system. Sets are closed over the operations UNION, INTERSECT, DIFFERENCE, etc.

Set operations are nothing like NULL semantics, which involve 3VL and strange exceptions. You certainly can&#039;t explain all of my examples by just saying &quot;NULL is the empty set&quot;.

&gt; {NULL} != NULL (i.e. the set containing NULL != NULL alone)

If you do &quot;SELECT * FROM foo WHERE NULL = NULL&quot;, which NULL is &quot;{NULL}&quot; and which NULL is &quot;NULL&quot;? They look indistinguishable to me, but the predicate does not evaluate to TRUE.

&gt; Does that help anyone?

I think that this line of reasoning will lead to mistakes. For instance, how do you explain the fact that COUNT(*) doesn&#039;t ignore NULLs? Or that &quot;x IS NOT NULL&quot; is not the same as &quot;NOT x IS NULL&quot; for all x?</description>
		<content:encoded><![CDATA[<p>> NULL is the empty set.<br />
><br />
> Set operations can appear to be very similar to “normal” mathematical operations, but since they may be missing key properties of that operation (say closure), they act in what appears to be a non-intuitive fashion.</p>
<p>What set operations lack closure? As far as I know set operations are a well-defined mathematical system, and the empty set is just a value in that system. Sets are closed over the operations UNION, INTERSECT, DIFFERENCE, etc.</p>
<p>Set operations are nothing like NULL semantics, which involve 3VL and strange exceptions. You certainly can&#8217;t explain all of my examples by just saying &#8220;NULL is the empty set&#8221;.</p>
<p>> {NULL} != NULL (i.e. the set containing NULL != NULL alone)</p>
<p>If you do &#8220;SELECT * FROM foo WHERE NULL = NULL&#8221;, which NULL is &#8220;{NULL}&#8221; and which NULL is &#8220;NULL&#8221;? They look indistinguishable to me, but the predicate does not evaluate to TRUE.</p>
<p>> Does that help anyone?</p>
<p>I think that this line of reasoning will lead to mistakes. For instance, how do you explain the fact that COUNT(*) doesn&#8217;t ignore NULLs? Or that &#8220;x IS NOT NULL&#8221; is not the same as &#8220;NOT x IS NULL&#8221; for all x?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-95</link>
		<dc:creator>Ken</dc:creator>
		<pubDate>Fri, 14 Aug 2009 16:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-95</guid>
		<description>Why is it that no one seems to know that ...

NULL is the empty set.

All operations in SQL are based on set theory, not algebra as we normally consider it.  Set theory is the *basis* for (ordinary) mathematics and mathematical operations.  Set operations can appear to be very similar to &quot;normal&quot; mathematical operations, but since they may be missing key properties of that operation (say closure), they act in what appears to be a non-intuitive fashion.

So the definition of NULL is always consistent, it is the definition of operations over a set which may treat NULL elements in the set differently.

What is often the case is that what appears to be a case of ...
NULL == NULL
is really a case of ...
{NULL} != NULL (i.e. the set containing NULL != NULL alone)

For example, Aggregates often appear to be mathematical operations, like SUM(), but it is really defined as the operation over a set of elements which are either a number or elements convertible to a number.  And when converting a NULL to a number for the purposes of a &quot;SUM&quot;, it is easy to say that its number value is zero (which is the same as ignoring it).  Otherwise, SUM would be largely useless as an operation.

As such the SUM *operator* is not &quot;+&quot; it is a different (albeit similar) operator, and it inherently ignores NULL elements in the set in its computation.  It isn&#039;t inconsistent with &quot;+&quot;, because it was never meant to be the same as &quot;+&quot;.

Does that help anyone?</description>
		<content:encoded><![CDATA[<p>Why is it that no one seems to know that &#8230;</p>
<p>NULL is the empty set.</p>
<p>All operations in SQL are based on set theory, not algebra as we normally consider it.  Set theory is the *basis* for (ordinary) mathematics and mathematical operations.  Set operations can appear to be very similar to &#8220;normal&#8221; mathematical operations, but since they may be missing key properties of that operation (say closure), they act in what appears to be a non-intuitive fashion.</p>
<p>So the definition of NULL is always consistent, it is the definition of operations over a set which may treat NULL elements in the set differently.</p>
<p>What is often the case is that what appears to be a case of &#8230;<br />
NULL == NULL<br />
is really a case of &#8230;<br />
{NULL} != NULL (i.e. the set containing NULL != NULL alone)</p>
<p>For example, Aggregates often appear to be mathematical operations, like SUM(), but it is really defined as the operation over a set of elements which are either a number or elements convertible to a number.  And when converting a NULL to a number for the purposes of a &#8220;SUM&#8221;, it is easy to say that its number value is zero (which is the same as ignoring it).  Otherwise, SUM would be largely useless as an operation.</p>
<p>As such the SUM *operator* is not &#8220;+&#8221; it is a different (albeit similar) operator, and it inherently ignores NULL elements in the set in its computation.  It isn&#8217;t inconsistent with &#8220;+&#8221;, because it was never meant to be the same as &#8220;+&#8221;.</p>
<p>Does that help anyone?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Four short links: 6 August 2009 &#124; Design Website</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-92</link>
		<dc:creator>Four short links: 6 August 2009 &#124; Design Website</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:56:57 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-92</guid>
		<description>[...] What is the Deal with NULLs? &#8212; In the past, I&#8217;ve criticized NULL semantics, but in this post I&#8217;d just like to explain some corner cases that I think you&#8217;ll find interesting, and try to straighten out some myths and misconceptions. [...] I believe the above shows, beyond a reasonable doubt, that NULL semantics are unintuitive, and if viewed according to most of the &#8220;standard explanations,&#8221; highly inconsistent. (via bos on Delicious) [...]</description>
		<content:encoded><![CDATA[<p>[...] What is the Deal with NULLs? &#8212; In the past, I&#8217;ve criticized NULL semantics, but in this post I&#8217;d just like to explain some corner cases that I think you&#8217;ll find interesting, and try to straighten out some myths and misconceptions. [...] I believe the above shows, beyond a reasonable doubt, that NULL semantics are unintuitive, and if viewed according to most of the &#8220;standard explanations,&#8221; highly inconsistent. (via bos on Delicious) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-90</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Sun, 09 Aug 2009 18:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-90</guid>
		<description>&gt; #1 – Always add a not null constraint on all your fields when creating a table.

Unfortunately, I don&#039;t think that&#039;s a universal solution. (a) NULLs will be generated anyway, by outer join and aggregates; and (b) most SQL implementations don&#039;t effectively optimize physical designs that avoid NULLs, so there may be a significant performance penalty.

&gt; #3 – When you have a nullable field, go all over your client code and make sure you coalesce your comparisons, your strings concatenation, etc.

That&#039;s certainly good practice. When you have a query, look at any fields that can possibly be NULL, consider how those might affect your application differently, and handle them appropriately.

&gt; #5 – Never use null as a meaningful value. e.g. if you want to store the date value “infinite time in the past”, use the lowest date available in the system, not “null value”.

I think that&#039;s a good rule. Don&#039;t use NULL as an arbitrary &quot;special value&quot;</description>
		<content:encoded><![CDATA[<p>> #1 – Always add a not null constraint on all your fields when creating a table.</p>
<p>Unfortunately, I don&#8217;t think that&#8217;s a universal solution. (a) NULLs will be generated anyway, by outer join and aggregates; and (b) most SQL implementations don&#8217;t effectively optimize physical designs that avoid NULLs, so there may be a significant performance penalty.</p>
<p>> #3 – When you have a nullable field, go all over your client code and make sure you coalesce your comparisons, your strings concatenation, etc.</p>
<p>That&#8217;s certainly good practice. When you have a query, look at any fields that can possibly be NULL, consider how those might affect your application differently, and handle them appropriately.</p>
<p>> #5 – Never use null as a meaningful value. e.g. if you want to store the date value “infinite time in the past”, use the lowest date available in the system, not “null value”.</p>
<p>I think that&#8217;s a good rule. Don&#8217;t use NULL as an arbitrary &#8220;special value&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: IT Security Blog&#187; Blog Archive &#187; delicious/cdman83</title>
		<link>http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/comment-page-1/#comment-87</link>
		<dc:creator>IT Security Blog&#187; Blog Archive &#187; delicious/cdman83</dc:creator>
		<pubDate>Fri, 07 Aug 2009 15:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://davisjeff.wordpress.com/?p=4#comment-87</guid>
		<description>[...] What is the deal with NULLs? [...]</description>
		<content:encoded><![CDATA[<p>[...] What is the deal with NULLs? [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
