Re: Examples of SQL anomalies?

From: Philipp Post <Post.Philipp_at_googlemail.com>
Date: Fri, 27 Jun 2008 08:39:03 -0700 (PDT)
Message-ID: <5df510ce-9cbd-4260-b5bc-1ac8ba0b17ba@e39g2000hsf.googlegroups.com>


> Others have mentioned nulls. One of my pet peeves in this area
is that in SQL, if I sum zero numbers, the result is null. Mathematically, the result is 0. I have an app where I have had make adjustments where it is possible that zero numbers are summed. <

SQL Server at least stripps off NULLs in the SUM function and returns a number, but not in a simple addition - then it returns NULL if at least one entry is NULL.

> SUM(A) + SUM(B) != SUM(A+B) <

The question is, if these issues are due to the SQL specification or simply due to a problem in a specific SQL product. Or could it be, that the definition is not precise enough in some points, so that database vendors implemented it differently? A quick look at the SQL 92 spec did not sched much light on this for me regarding the source of the problem.

Thanks,

Philipp Post Received on Fri Jun 27 2008 - 10:39:03 CDT

Original text of this message