Re: MERGE as the imperative form of aggregation
From: paul c <toledobythesea_at_oohay.ac>
Date: Sun, 08 Apr 2007 15:54:15 GMT
Message-ID: <He8Sh.44940$DE1.43503_at_pd7urf2no>
Date: Sun, 08 Apr 2007 15:54:15 GMT
Message-ID: <He8Sh.44940$DE1.43503_at_pd7urf2no>
Marshall wrote:
> ...
> So, what else has a transform that has a concept of
> identity and also specifies a key? An aggregate
> with GROUP BY.
>
> MERGE NewFooCount f' into FooCount f
> GROUP BY id
> SET f.count = sum(f.count, f'.count);
>
> It's less general, but syntactically and conceptually
> cleaner and simpler.
> ...
I'd say MERGE is still a bastard because it operates on tuples, not relations, ie., a tuple in one operand is not necessarily in the result, whereas UNION, say, isn't like that. It appears to be using a label to hide the real construction, eg., "UPDATE OR INSERT".
p Received on Sun Apr 08 2007 - 17:54:15 CEST