P.S.

From: Michael C# (xyz_at_abcdef.com)
Date: 02/27/05


Date: Sun, 27 Feb 2005 14:55:30 -0500

Seeing as how I got your attention for a hot minute, I'd like to ask you
some questions about implementing your improved Soundex algorithm. Do you
have a few minutes to answer them?

Thx,
Mike C.

"--CELKO--" <jcelko212@earthlink.net> wrote in message
news:1109512331.792043.28870@z14g2000cwz.googlegroups.com...
>>> I'm no mathematician, but if SUM(100, NULL, 150) is defined
> differently from
> 100+NULL+150 mathematically, then I suppose there's no room to question
> the
> choices made. <<
>
> I am and it is! A summation is not the same as an addition.
> Summation works on sets, and those sets can be infinite. Addition is a
> binary operation that works on scalars. This was part of the big jump
> that Cantor made with set theory; the whole does not behave like the
> parts. Before then, we worked with series and sequences that were
> coutable and talked about limits.
>
>>> I'd like to hear a mathematician speak to whether this is a
> standard mathematical definition or if SUM() or if it was an arbitrary
> decision made by ANSI. <<
>
> We talked about this in the ANSI X3H2 committee. A lot of the behavior
> was justified after the fact, since we had existing products at the
> point that SQL-86 was written. The decison was that *all* aggreate
> functions begin by computing a group of values from the expression they
> are given, then remove NULLs from the group, if there is a DISTINCT
> option also remove redundant duplicates and finally perform the
> computation to reduce the group to a scalar value. It is not a matter
> of changing NULLs to 0 or 1; they are dropped.
>
> The reasoning was that this is the most useful way to compute an
> aggregate 98% of the time. For the other 2%, there is a SQLSTATE
> warning that tells you which groups have dropped NULLs so you can catch
> it in the program one group at a time. And we already mentioned using
> COALESCE() in the expression as a solution for some of these problem.
> And there is the "COUNT(*) <> COUNT(<key_col>)" test in a CASE
> expression.
>
> COUNT(*) is a very different animal. It is the cardinality of the
> whole set and not an aggregate of the data elements at all. Play with
> aggregates on a table with only NULLs and one that is empty. An empty
> set has cardinality zero, but returns an empty set of aggregations (ab
> null, ex nullo).
>
> The syntax probably should have been something like "CARD (<table
> expression>)" to match "[NOT] EXIST (<table expression>)" and then we
> would use "COUNT(<key col>)" instead of "COUNT(*)".
>



Relevant Pages

  • Re: Question about SUM and Nulls
    ... Summation works on sets, and those sets can be infinite. ... are given, then remove NULLs from the group, if there is a DISTINCT ... whole set and not an aggregate of the data elements at all. ... aggregates on a table with only NULLs and one that is empty. ...
    (microsoft.public.sqlserver.programming)
  • Re: All hail Neo!
    ... That said perhaps the fact that nulls do exist in the RM today taken with your confirmed view that they shouldn't is implied confirmation of my rather unlikely original thought...he says stepping back two full paces - did I write that? ... is the set containing an empty set and is the canonical form of all sets with cardinality 1. ... Goedel established limitations to formalism as the foundation of mathematics, and I am not sure that philosophy is meant to have an endpoint. ... I can state that I don't hold that nulls cause _great_ damage and I certainly believe that they do serve a purpose. ...
    (comp.databases.theory)
  • Re: All hail Neo!
    ... That said perhaps the fact that nulls do exist in the RM today taken with your confirmed view that they shouldn't is implied confirmation of my rather unlikely original thought...he says stepping back two full paces - did I write that? ... is the set containing an empty set and is the canonical form of all sets with cardinality 1. ... and 1 figure by tying into the formalism for whole numbers as shown above. ... I can state that I don't hold that nulls cause _great_ damage (although neither does Semtex in capable hands for a proper purpose) and I certainly believe that they do serve a purpose. ...
    (comp.databases.theory)
  • Re: All hail Neo!
    ... From there I expect anything brought to this issue by theory will be elegant, ... Bags and nulls are quite apparently not but from where I am now the null at least seems the lesser of evils viz my post in the "beautiful mind" thread. ... is the set containing an empty set and is the canonical form of all sets with cardinality 1. ... I can state that I don't hold that nulls cause _great_ damage and I certainly believe that they do serve a purpose. ...
    (comp.databases.theory)
  • Re: Question about SUM and Nulls
    ... A summation is not the same as an addition. ... and those sets can be infinite. ... > are given, then remove NULLs from the group, if there is a DISTINCT ... assuming that we have an aggregate function SUM() and a set S which is ...
    (microsoft.public.sqlserver.programming)

Quantcast