Re: Examples of SQL anomalies?

From: Philipp Post <>
Date: Fri, 27 Jun 2008 08:39:03 -0700 (PDT)
Message-ID: <>

> 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.


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

Original text of this message