Re: Examples of SQL anomalies?

From: Philipp Post <Post.Philipp_at_googlemail.com>
Date: Thu, 3 Jul 2008 03:04:22 -0700 (PDT)
Message-ID: <59905511-5f34-4b9f-b8f2-a21a51298f38_at_d77g2000hsb.googlegroups.com>


On 2 Jul., 20:39, "David Cressey" <cresse..._at_verizon.net> wrote:
> >b) SUM{1, NULL, 1} = 2, however I could just say that the result is AT
> >LEAST 2 but the function cannot state it that precisely and as such it
> >would make more sense if it would then throw an error like "You cannot
> >apply this function on data containing NULL" what would force the
> >developer to SELECT SUM(SomeAmount) .... WHERE NOT SomeAmount IS NULL.
> >If this would make SQL programming more fun is a different question...
>
> I disagree.  If NULL meant "there is a value for this entry, but we don't
> know what it is"  then your interpretation might be correct.  However, if
> NULL means "there is no value for this entry"  then excluding it from
> consideration is the only sensible approach.

You are right. I get more and more the impression, that all the confusion starts at the definition what NULL actually means. It could be

  • not known = there should be a value lateron
  • not applicable = I can omit it
  • confused with an amount of zero (0) = a mistake, if I mean zero (0) I should use it.

Brian also rightfully said that it similarly.

brgds

Philipp Post Received on Thu Jul 03 2008 - 12:04:22 CEST

Original text of this message