Re: Does Codd's view of a relational database differ from that ofDate& Darwin? [M.Gittens]
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.
> 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?
> 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.
-- JonReceived on Tue Jun 07 2005 - 17:24:35 CEST