Re: Does Codd's view of a relational database differ from that ofDate& Darwin? [M.Gittens]

From: Jon Heggland <heggland_at_idi.ntnu.no>
Date: Tue, 7 Jun 2005 17:24:35 +0200
Message-ID: <MPG.1d0fda8950d6126d989683_at_news.ntnu.no>


In article <42a5b411$0$8714$ed2619ec_at_ptn-nntp-reader02.plus.net>, paul_at_test.com says...
> > Not exactly: SQL ignores NULLs in aggregate functions (except COUNT(*)).
> > It is not treated as zero for AVG, for instance. Also note that x + NULL
> > evaluates to NULL; therefore, SQL's SUM is not iterated addition -- it
> > has a much more complicated definition.
>
> I'd suggest that SQL's SUM *should* be iterated addition.

I agree. Which would also mean that the empty sum is 0, not NULL. Date has written quite a lot on this.

> And that all
> aggregates should return NULL if any of the attributes in the aggregated
> column are NULL. Surely if any of them are unknown, we must say that the
> sum or average is unknown also?

Yes, if NULL means unknown.

> What are the arguments for not doing this?

I don't know; you'd have to ask the SQL designers. Probably convenience; practice without theory. Quite a lot of people seem to prefer a (slightly?) incorrect answer instead of no answer.

-- 
Jon
Received on Tue Jun 07 2005 - 17:24:35 CEST

Original text of this message