Re: Examples of SQL anomalies?

From: Gene Wirchenko <genew_at_ocis.net>
Date: Fri, 27 Jun 2008 14:27:48 -0700
Message-ID: <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.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:

     I have preferences.
     You have biases.
     He/She has prejudices.
Received on Fri Jun 27 2008 - 23:27:48 CEST

Original text of this message