| 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 of Date&Darwin? [M.Gittens]
mountain man wrote:
>>>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. >> >>Thanks for the clarification.
I'd rather the SUM of a column containing a NULL return NULL. If I want to override the behaviour, I can always do a SUM(COALESCE(col)). But if the default is to treat NULLs as zero, I can't manually override it to the behaviour I want.
At least MSSQL warns you that it's eliminated a NULL from an aggregate, although that's not much use if you're not running the query interactively.
And the default behaviour of pretty much all SQL DBMSs is that x + NULL is NULL. Maybe some obscure settings can override it but I doubt they are used much.
Paul. Received on Wed Jun 08 2005 - 05:26:05 CDT
![]() |
![]() |