On Thu, 8 Sep 2005, Marcus Welz wrote:

> Yes, the NULL as it is returned by SUM means "No data to answer your
> question".
>
> If that query returned 0 (as SQLite currently does), rather than NULL (as
> the standard specifies), it would not allow me to figure out whether I sold
> $0 worth of items or if I didn't sell anything at all.

Exactly! I was reading through the thread wondering when this point would
be made (and getting ready to make it myself.)

The SUM() of non-NULL values can be 0! If SQL(ite) would return 0 for all
NULL input there would be no way do make the distiction between a SUM()
that's 0 and 'no data to be summed'. Which can be an important
distinction.

Please! Make SQLite return NULL for all NULL input.

I totally agree that null handeling seems/is inconsistent as hell at
times... It seems hackish here and there. Which, IMHO, is the ALL THE
REASON jou need to to just follow the standard!

Rgds,
Mark.


> -----Original Message-----
> From: Puneet Kishor [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 08, 2005 6:50 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] SUM and NULL values
>
>
> On Sep 8, 2005, at 5:45 PM, Marcus Welz wrote:
>
> > If "SELECT SUM(amt)" means "How much did I sell?"
> >
> > Then the "NULL" should mean, "You didn't sell anything.", no?
> >
>
> no... NULL means, "I don't have any data to answer that question" which
> is very different from "I sold $0 worth of things" or "I didn't sell
> anything."
>
> --
> Puneet Kishor
>
>


Regards,
Mark

Reply via email to