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 15:07:09 +0200
Message-ID: <MPG.1d0fba64506d6069989680_at_news.ntnu.no>


In article <42a591c4$0$41901$ed2619ec_at_ptn-nntp-reader03.plus.net>, paul_at_test.com says...
> Alfredo Novoa wrote:
> >>Why not say then that all aggregates that involve a NULL return NULL?
> >
> > This is what SQL does. Sometimes we want to get a value but we get a
> > null instead.
>
> Are you sure? I've just tried summing a column that contains a NULL in
> PostgreSQL and it doesn't return NULL - it treats the NULLs as zeros.

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.

-- 
Jon
Received on Tue Jun 07 2005 - 15:07:09 CEST

Original text of this message