Re: GROUP BY

From: Marshall <marshall.spight_at_gmail.com>
Date: 18 May 2007 19:13:38 -0700
Message-ID: <1179540817.981337.87990_at_h2g2000hsg.googlegroups.com>


On May 18, 11:32 am, Marshall <marshall.spi..._at_gmail.com> wrote:
>
> Discussion welcome.

Ha ha! <cough>

Okay, it appears I made (at least) two errors.

. The functions mentioned in 4) may only use as arguments   the attributes listed in *2) or* 3).

. select b from R group by b

  should have been left as-is; you can't drop the "group by b"   without adding "distinct".

I blame Paris Hilton, the SQL-92 committee, or George Bush. If none of those wash, I'll grudgingly accept personal responsibility. Anyway, apparently I wasn't saying anything the least bit surprising.

So: what *about* that extended extend?

Extend is a particular form of join, yes? So perhaps we ought to apply generators with join?

I note that there is an issue with regards to the uniqueness of values produced by a generator. It's not clear to me if that ought to be required or not. If it's required, it's not clear to me if it's enforceable, since I don't see how to prove uniqueness.

If the outputs of the generator aren't unique, then we have a function from a tuple to a bag, which also matches the fact that aggregate functions are functions from a bag to a tuple.

Ex: a function n_ones(n), which takes a natural number and generates the number 1 that many times. This is a subset of the inverse of sum().

  n_ones(3) = {| 1, 1, 1 |}

  sum( {| 1, 1, 1 |} = 3

So generators are the inverses of aggregates, and join is the inverse of group by, and generators are applied with join and aggregates are applied with group-by.

Marshall Received on Sat May 19 2007 - 04:13:38 CEST

Original text of this message