| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Does Codd's view of a relational database differ from that ofDate& Darwin? [M.Gittens]
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.
-- JonReceived on Tue Jun 07 2005 - 10:24:35 CDT
![]() |
![]() |