Re: Examples of SQL anomalies?

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Wed, 02 Jul 2008 10:05:39 -0300
Message-ID: <486b7d26$0$4052$9a566e8b_at_news.aliant.net>


David Cressey wrote:

> "Gene Wirchenko" <genew_at_ocis.net> wrote in message
> news:foma64l9qgshnt7pdopcu9b53i9atpcp4p_at_4ax.com...
>

>>-CELKO- <jcelko212_at_earthlink.net> wrote:
>>
>>
>>>>>I do not use nulls in my tables.  I still get null when I sum what

>
> turns out to be zero rows. If I want the total amount charged on invoices
> for a client in a certain date range, and there are no such invoices, the
> total is zero. <<
>
>>>No, that is flat wrong.  There is no such invoice, so the question of
>>>its total makes no sense.  It is a totally different kind of thing
>>
>>>from an invoice that actually totaled to zero.  Zero, empty set, empty
>>
>>>strings, NULLs, etc. are all different concepts around the idea of
>>>missing data of some kind.
>>
>>     If I want the total amount invoiced in a time period and there
>>are no invoices, the total amount invoiced was zero.
>>
>>
>>>Also, why are you using cursors?  If you want to give this misleading
>>>data, then use a COALESCE(invoice_tot, 0.00) in your code.
>>
>>     Null is the misleading datum.

>
> Except that null isn't a datum. If you consider it a datum, that may be why
> you are misled.

Except that the total invoiced is a datum, and he requested that datum, which has no reason or excuse for NULL. Received on Wed Jul 02 2008 - 15:05:39 CEST

Original text of this message