Re: Examples of SQL anomalies?

From: David BL <davidbl_at_iinet.net.au>
Date: Fri, 4 Jul 2008 20:15:34 -0700 (PDT)
Message-ID: <cfb587f5-ff58-48c7-ad1d-53540c7b8d7d_at_e39g2000hsf.googlegroups.com>


On Jul 5, 8:49 am, Marshall <marshall.spi..._at_gmail.com> wrote:
> What can be meaningfully asked is determined by the schema.
>
> If the schema specifies that the weight attribute is nullable,
> then the question of how much a shipment weighs in total
> is a question that cannot be asked.
>
> Marshall

IMO aggregate functions are only defined on well defined sets and only give well defined answers. SUM should never return NULL. Nevertheless it is meaningful to calculate SUM on a nullable weight attribute. Rather than upset the mathematical simplicity of aggregate functions one can easily make sense of the result by correctly interpreting the intensional definition of the set being aggregated. For example in this case it is the set of *known* weights. It is absurd to not allow this to be calculated, by returning NULL. Received on Sat Jul 05 2008 - 05:15:34 CEST

Original text of this message