Re: does a table always need a PK?
Date: Wed, 03 Sep 2003 05:29:51 GMT
Message-ID: <j%e5b.338494$Ho3.50014_at_sccrnsc03>
"Christopher Browne" <cbbrowne_at_acm.org> wrote in message news:bj3q4j$eaohu$2_at_ID-125932.news.uni-berlin.de...
> The world rejoiced as "Marshall Spight" <mspight_at_dnai.com> wrote:
> > "Christopher Browne" <cbbrowne_at_acm.org> wrote in message news:bj30il$eoev7$3_at_ID-125932.news.uni-berlin.de...
> >> "Marshall Spight" <mspight_at_dnai.com> wrote:
> >> But it is /not/ obvious that the "+" operator represents a reduction
> >> operator.
> >
> > Well, "obvious" is a highly subjective word, I suppose. My
> > experience of the idea of sum() as being the same as reduce over '+'
> > is that it is obvious.
>
> I know what "reduce" means, as do you; I suspect that most people that
> use SQL haven't a clue.
Okay; I misinterpreted some of what you said in your earlier posting.
> [snipped cogent explanation of the distinction between
> reduce over n-ary vs. binary + ]
>
> I don't see reason to consider it mandatory to apply reduction inside
> the SQL expression for much the same reason that Common Lisp doesn't
> assume that all expressions involve REDUCE.
IIUC, then I agree.
> >> select count(a + b) from table_t;
> >>
> >> The nature of the addition there is different from the nature of the
> >> COUNT()ing.
Yes, definitely.
> I'm not assuming 2VL or 3VL here.
Okay, I'll drop that part of it.
> Merely that while reduction sure seems appropriate to apply to
> aggregates, it doesn't seem to forcibly have to apply to things that
> aren't aggregates. And (a*a-b*b+25) is not, in and of itself, an
> aggregate the way SUM() is.
I think we agree; I'll try to restate, and please let me know what you think.
In the case of 'SELECT sum(a+b) from table' it would be possible to consider the subcomponents of the expression inside the parentheses as first-class members of the list being reduced:
a1+b1+a2+b2+...+an+bn
And you're saying, while that might make sense, it's mostly coincidental that it does.
But in fact, I'm considering the expression to be:
(a1+b1)+(a2+b2)+...+(an+bn)
Marshall Received on Wed Sep 03 2003 - 07:29:51 CEST