Re: GROUP BY
From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 19 May 2007 19:55:32 -0300
Message-ID: <464f801b$0$4042$9a566e8b_at_news.aliant.net>
>>Grouping by the empty set of columns. The input
>>
>>A
>>y
>>-
>>a
>>b
>>
>>[set equality] joined with
>>
>>P
>>y set
>>- -----
>>a {a,b}
>>b {a,b}
>>a {a}
>>b {b}
>>
>>produces
>>
>>set
>>-----
>>{a,b}
>>
>>The empty relation A would naturally produce the output
>>
>>set
>>---
>>{}
>>
>>Hence, my suggestion to define group by empty set to always produce
>>one row.
Date: Sat, 19 May 2007 19:55:32 -0300
Message-ID: <464f801b$0$4042$9a566e8b_at_news.aliant.net>
Vadim Tropashko wrote:
> On May 19, 2:20 pm, Vadim Tropashko <vadimtro_inva..._at_yahoo.com> > wrote: >
>>Grouping by the empty set of columns. The input
>>
>>A
>>y
>>-
>>a
>>b
>>
>>[set equality] joined with
>>
>>P
>>y set
>>- -----
>>a {a,b}
>>b {a,b}
>>a {a}
>>b {b}
>>
>>produces
>>
>>set
>>-----
>>{a,b}
>>
>>The empty relation A would naturally produce the output
>>
>>set
>>---
>>{}
>>
>>Hence, my suggestion to define group by empty set to always produce
>>one row.
> > > Oh, I see the problem! There is no empty set listed in the powerset > relation. Therefore, indeed set equality join would produce the empty > relation...
I don't know if I followed what you wrote at all, but it occurs to me that the grouped aggregation is equivalent to a project joined with a bunch of corresponding ungrouped aggregations.
Thus if we have an empty r, I would expect the following results:
select count(*) as ct from r group by {};
ct
0 rows.
select count(*) as ct from r;
ct
0
1 rows. Received on Sun May 20 2007 - 00:55:32 CEST