<?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: Is this a bug in Analytical Functions? NULL is supposed to be UNEQUAL to NULL?</title>
	<atom:link href="http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/feed/" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null</link>
	<description></description>
	<lastBuildDate>Fri, 12 Apr 2013 10:04:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3905</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Sat, 14 Oct 2006 12:42:40 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3905</guid>
		<description><![CDATA[Oracle is just following the rules layed out by ANSI SQL.]]></description>
		<content:encoded><![CDATA[<p>Oracle is just following the rules layed out by ANSI SQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Sinke</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3904</link>
		<dc:creator>Patrick Sinke</dc:creator>
		<pubDate>Sat, 14 Oct 2006 10:45:54 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3904</guid>
		<description><![CDATA[I think, though, that you alway should see the result of those queries from the point of view from the end user. And what an end user wants to see is not

DEPTNO COUNT(*)
===== =======
30 6
â€œnullâ€ 1
â€œnullâ€ 1
â€œnullâ€ 1
â€œnullâ€ 1
â€œnullâ€ 1
â€œnullâ€ 1

20 5
10 1

That&#039;s just not convenient. Any query I would write for an end user that yields this result would not be accepted by that user. He would want me to rewrite the query so that all the &#039;null&#039;  or &#039;unknown&#039; departments to be put together in one result, because separate records with count=1 have no meaning at all.
So probably Oracle has made the choice to handle nulls like that, and my opinion is that they made the most logical (or call it: intuitive) choice :)]]></description>
		<content:encoded><![CDATA[<p>I think, though, that you alway should see the result of those queries from the point of view from the end user. And what an end user wants to see is not</p>
<p>DEPTNO COUNT(*)<br />
===== =======<br />
30 6<br />
â€œnullâ€ 1<br />
â€œnullâ€ 1<br />
â€œnullâ€ 1<br />
â€œnullâ€ 1<br />
â€œnullâ€ 1<br />
â€œnullâ€ 1</p>
<p>20 5<br />
10 1</p>
<p>That&#8217;s just not convenient. Any query I would write for an end user that yields this result would not be accepted by that user. He would want me to rewrite the query so that all the &#8216;null&#8217;  or &#8216;unknown&#8217; departments to be put together in one result, because separate records with count=1 have no meaning at all.<br />
So probably Oracle has made the choice to handle nulls like that, and my opinion is that they made the most logical (or call it: intuitive) choice <img src='http://technology.amis.nl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mr. Ed</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3903</link>
		<dc:creator>Mr. Ed</dc:creator>
		<pubDate>Sat, 14 Oct 2006 10:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3903</guid>
		<description><![CDATA[Giving each NULL value its own group seems unwieldy, especially if you have an N-column GROUP BY, and then all-but-1, all-but-2, ..., or all-but-(N-1) of those columns have NULL values.

And what about:

     select null from dual union select null from dual;

It only returns 1 row.  Should GROUP BY be any different?]]></description>
		<content:encoded><![CDATA[<p>Giving each NULL value its own group seems unwieldy, especially if you have an N-column GROUP BY, and then all-but-1, all-but-2, &#8230;, or all-but-(N-1) of those columns have NULL values.</p>
<p>And what about:</p>
<p>     select null from dual union select null from dual;</p>
<p>It only returns 1 row.  Should GROUP BY be any different?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3902</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 23:34:24 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3902</guid>
		<description><![CDATA[Hmmmm, even wordpress has problems with (or NOT?)

;-)

Second try...

Who argues for outcome:

DEPTNO  COUNT(*)
=====  =======
30          6
&quot;null&quot;      1
&quot;null&quot;      1
20          5
10          1

(hopefully it will now print correctly, otherwise &quot;Lucas Help?!!!&quot;)]]></description>
		<content:encoded><![CDATA[<p>Hmmmm, even wordpress has problems with (or NOT?)<br />
 <img src='http://technology.amis.nl/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Second try&#8230;</p>
<p>Who argues for outcome:</p>
<p>DEPTNO  COUNT(*)<br />
=====  =======<br />
30          6<br />
&#8220;null&#8221;      1<br />
&#8220;null&#8221;      1<br />
20          5<br />
10          1</p>
<p>(hopefully it will now print correctly, otherwise &#8220;Lucas Help?!!!&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3901</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 23:29:37 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3901</guid>
		<description><![CDATA[Who argues for outcome:

DEPTNO   COUNT(*)
---------    -----------
30            6
                1]]></description>
		<content:encoded><![CDATA[<p>Who argues for outcome:</p>
<p>DEPTNO   COUNT(*)<br />
&#8212;&#8212;&#8212;    &#8212;&#8212;&#8212;&#8211;<br />
30            6<br />
                1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3900</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 23:25:56 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3900</guid>
		<description><![CDATA[From &quot;An introduction to Database Systems&quot; (International Editon - Eighth Edition) by C.J.Date:


Possible meanings / reasons why there is a absence of a value (page 577):

- value unknown
- value not applicable
- value does not exist
- value undefined
- value not supplied
- ...


(page 595): Aggregate Operators:

The SQL aggregate operators (SUM,AVG,etc.) do not behave in accordance with the rules for scalar operators explained in Section 19.2, but instead simply ignore any nulls in their argument (except for count(*), where nulls are treated as if they were regular values). Also if the argument to such an operator happens to evaluate to an empty set, COUNT returns zero; the other operators all return NULL. (As noted in Chapter 8, this bahaviour is logically incorrect, but it is the way SQL is defined.)

MG]]></description>
		<content:encoded><![CDATA[<p>From &#8220;An introduction to Database Systems&#8221; (International Editon &#8211; Eighth Edition) by C.J.Date:</p>
<p>Possible meanings / reasons why there is a absence of a value (page 577):</p>
<p>- value unknown<br />
- value not applicable<br />
- value does not exist<br />
- value undefined<br />
- value not supplied<br />
- &#8230;</p>
<p>(page 595): Aggregate Operators:</p>
<p>The SQL aggregate operators (SUM,AVG,etc.) do not behave in accordance with the rules for scalar operators explained in Section 19.2, but instead simply ignore any nulls in their argument (except for count(*), where nulls are treated as if they were regular values). Also if the argument to such an operator happens to evaluate to an empty set, COUNT returns zero; the other operators all return NULL. (As noted in Chapter 8, this bahaviour is logically incorrect, but it is the way SQL is defined.)</p>
<p>MG</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3899</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 22:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3899</guid>
		<description><![CDATA[@Patrick: &quot;...and the employees that are not in any department are summed&quot;, but this is the problem using NULL Patrick, you are assuming that they &quot;are not in any department&quot;. A NULL coudl also imply &quot;we KNOW the belong to a department but it is UNKNOWN to us in which...&quot;

@Jurgen: you don&#039;t want to get into that one... It could be the difference between a salary check with a VALUE on it at the end of the month or a salary check without a VALUE... (you could think of more worse-case real life example of course...you did a 911 call, which is registered in a database, which triggers...).]]></description>
		<content:encoded><![CDATA[<p>@Patrick: &#8220;&#8230;and the employees that are not in any department are summed&#8221;, but this is the problem using NULL Patrick, you are assuming that they &#8220;are not in any department&#8221;. A NULL coudl also imply &#8220;we KNOW the belong to a department but it is UNKNOWN to us in which&#8230;&#8221;</p>
<p>@Jurgen: you don&#8217;t want to get into that one&#8230; It could be the difference between a salary check with a VALUE on it at the end of the month or a salary check without a VALUE&#8230; (you could think of more worse-case real life example of course&#8230;you did a 911 call, which is registered in a database, which triggers&#8230;).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3898</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 22:49:32 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3898</guid>
		<description><![CDATA[If think your

 select deptno
 ,      count(*)
 from   emp
 group
 by     deptno

is a great example of Oracle desperatly wanting to give answer where it should not give one.

A department with value NULL is not equal to a department with value NULL. Also a nice example why one should avoid NULL&#039;s]]></description>
		<content:encoded><![CDATA[<p>If think your</p>
<p> select deptno<br />
 ,      count(*)<br />
 from   emp<br />
 group<br />
 by     deptno</p>
<p>is a great example of Oracle desperatly wanting to give answer where it should not give one.</p>
<p>A department with value NULL is not equal to a department with value NULL. Also a nice example why one should avoid NULL&#8217;s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marco Gralike</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3897</link>
		<dc:creator>Marco Gralike</dc:creator>
		<pubDate>Fri, 13 Oct 2006 22:45:42 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3897</guid>
		<description><![CDATA[&quot;The results also suggest an equality between NULLâ€¦&quot;

From the viewpoint of Oracle&#039;s implementation of NULL&#039;s, it does. Your &quot;count(*)&quot;  spoils the soup. See the examples (nice post) of beter nullogy on http://www.databasedesign-resource.com/null-values-in-a-database.html. I think we are dealing with a &quot;this is an error in the COUNT function: Any column would give the same COUNT result...&quot; problem here.

Nice links found regarding nullogy:

*) Fabian Pascal: http://www.dbdebunk.com/page/page/1396241.htm
*) Hugh Darwen: http://web.onetel.com/~hughdarwen/TheThirdManifesto/Missing-info-without-nulls.pdf
*) http://www.dbdebunk.com/about.html]]></description>
		<content:encoded><![CDATA[<p>&#8220;The results also suggest an equality between NULLâ€¦&#8221;</p>
<p>From the viewpoint of Oracle&#8217;s implementation of NULL&#8217;s, it does. Your &#8220;count(*)&#8221;  spoils the soup. See the examples (nice post) of beter nullogy on <a href="http://www.databasedesign-resource.com/null-values-in-a-database.html" rel="nofollow">http://www.databasedesign-resource.com/null-values-in-a-database.html</a>. I think we are dealing with a &#8220;this is an error in the COUNT function: Any column would give the same COUNT result&#8230;&#8221; problem here.</p>
<p>Nice links found regarding nullogy:</p>
<p>*) Fabian Pascal: <a href="http://www.dbdebunk.com/page/page/1396241.htm" rel="nofollow">http://www.dbdebunk.com/page/page/1396241.htm</a><br />
*) Hugh Darwen: <a href="http://web.onetel.com/~hughdarwen/TheThirdManifesto/Missing-info-without-nulls.pdf" rel="nofollow">http://web.onetel.com/~hughdarwen/TheThirdManifesto/Missing-info-without-nulls.pdf</a><br />
*) <a href="http://www.dbdebunk.com/about.html" rel="nofollow">http://www.dbdebunk.com/about.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PaweÅ‚ Barut</title>
		<link>http://technology.amis.nl/2006/10/13/is-this-a-bug-in-analytical-functions-null-is-supposed-to-be-unequal-to-null/#comment-3896</link>
		<dc:creator>PaweÅ‚ Barut</dc:creator>
		<pubDate>Fri, 13 Oct 2006 16:15:55 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1356#comment-3896</guid>
		<description><![CDATA[This is rather natural as its defined in ANSI SQL. Similar effect will be with DISTINCT clause, NULL is returned only once.]]></description>
		<content:encoded><![CDATA[<p>This is rather natural as its defined in ANSI SQL. Similar effect will be with DISTINCT clause, NULL is returned only once.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
