Re: Does Codd's view of a relational database differ from that ofDate& Darwin? [M.Gittens]

From: Paul <paul_at_test.com>
Date: Tue, 07 Jun 2005 16:01:25 +0100
Message-ID: <42a5b6c8$0$1688$ed2e19e4_at_ptn-nntp-reader04.plus.net>


mountain man wrote:
> Nulls exist in set theory, they exist in the real world, and
> they exist in data elements. While they may be problematic,
> their problematics can be effectively managed and resolved.

The empty set in set theory isn't really like a SQL NULL though - it's a perfectly well defined value - a set with no elements.

Relational database theory comes from a mix of set theory and predicate logic. Set theory is for the tables and rows, but once you get down to the row level, it switches to predicate logic. And standard predicate logic doesn't say anything about NULL arguments. So a set-theoretical empty set really corresponds to an empty table, I'd say, rather than a NULL attribute.

>>>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.

>
> This is user-definable in TSQL by use of the command
> SET CONCAT_NULL_YIELDS_NULL { ON | OFF }
That's only for binary operations though, not for aggregates like SUM or AVG. I don't think MSSQL has an concatenation aggregate function (it's a non-commutative operation, so it wouldn't be well-defined on a set anyway) and I think this options is mainly for interoperability with Oracle, which I think for some reason didn't used to differentiate between empty strings and NULL strings.

Paul. Received on Tue Jun 07 2005 - 17:01:25 CEST

Original text of this message