Re: GROUP BY
From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 19 May 2007 16:23:19 -0300
Message-ID: <464f4e5d$0$4052$9a566e8b_at_news.aliant.net>
>
> Yes,
>
> SELECT -1
> FROM r
> GROUP BY -1
>
> should be defined to return one row even if r is empty (unfortunately
> it doesn't).
Date: Sat, 19 May 2007 16:23:19 -0300
Message-ID: <464f4e5d$0$4052$9a566e8b_at_news.aliant.net>
Vadim Tropashko wrote:
> On May 19, 12:16 am, David Portas
> <REMOVE_BEFORE_REPLYING_dpor..._at_acm.org> wrote:
>
>>>In that case, GROUP BY is equivalent to PROJECT! >> >>There is the following exception. SQL supports the case where both 2) >>and 3) are empty but it is not quite a projection since: >> >>SELECT 1 >>FROM r >>GROUP BY (); >> >>returns a single tuple even if r is empty. GROUP BY is therefore >>something like TTM's SUMMARIZE operator where in this case the BY >>argument is DEE - possibly the only place that SQL explicitly supports >>a 0-degree relation.
>
> Yes,
>
> SELECT -1
> FROM r
> GROUP BY -1
>
> should be defined to return one row even if r is empty (unfortunately
> it doesn't).
I disagree. Grouped aggregates are simply different from ungrouped aggregates. Grouping by zero columns should be empty if r is empty.
This doesn't contradict group-by being a projection, as
> projection. Then, perhaps a projection to empty set of columns should
> be defined to always return a relation with one tuple and no
> attributes?
Hell no! Received on Sat May 19 2007 - 21:23:19 CEST