Re: Examples of SQL anomalies?

From: Marshall <marshall.spight_at_gmail.com>
Date: Tue, 1 Jul 2008 11:19:45 -0700 (PDT)
Message-ID: <ff3a3833-0221-4722-8aae-3da419bd3654_at_l28g2000prd.googlegroups.com>


On Jul 1, 9:20 am, -CELKO- <jcelko..._at_earthlink.net> wrote:
> >> You're mixing up nonexistence with emptiness. The empty set exists. We can count how many members it has. That count [cardinality] is zero. <<
>
> Not quite the same thing ..

What does that mean?

> >> We can add up all the numbers in it and get a total; that total is zero. <<
>
> But there are no members to add!

So what?

That this is completely a non-problem is most evident with count. Start with a bag containing three bananas. Remove three bananas. How many bananas remain? How is that the least bit hard?

> You created zero from nothing as a
> convention to get rid of the term in the sequence.

False! It's not from nothing, and it's not simply a convention. It's the identity of the operator being aggregated.

> In the older
> summation notation, there also is a convention that when the initial
> value of the index is greater than the final value, the summation is
> zero. Pardon my pseudo-code, but how do you defend the traditional
> approach which says:
>
> SUM (i) FOR i FROM 7 TO 9 = 24
> SUM (i) FOR i FROM 9 TO 7 = 0

Again, this is not a convention. This form specifies a sequential loop, with a starting number and an ending number. It's inherently sequential. But since we're aggregating a binary function that is both commutative and associative, and since the sequence has no duplicates, the list-theoretic and set-theoretic answers will be identical.

The first one says to

  add together all the naturals greater than or equal to 7 and   less than or equal to 9.

The second one says to

  add together all the naturals greater than or equal to 9 and   less than or equal to 7.

This is pretty obviously 24 and 0, respectively, which is completely consistent with what I've asserted.

> A set-oriented version might be:
>
> SUM (i) FOR i IN {7,8,9} = 24
> SUM (i) FOR i IN {9,7,8} = 24
> SUM (i) FOR i IN {8,9,7} = 24
> SUM (i) FOR i IN {9,8,7} = 24
> etc.
>
> I can support this convention with associativity, commutativity and
> induction.

You have misapprehended the semantics of the construct.

Marshall Received on Tue Jul 01 2008 - 20:19:45 CEST

Original text of this message