Re: Examples of SQL anomalies?
Date: Wed, 02 Jul 2008 12:30:13 GMT
"Gene Wirchenko" <genew_at_ocis.net> wrote in message
> -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. Received on Wed Jul 02 2008 - 14:30:13 CEST