Re: GROUP BY

From: Vadim Tropashko <vadimtro_invalid_at_yahoo.com>
Date: 19 May 2007 11:02:53 -0700
Message-ID: <1179597773.180213.138050_at_y80g2000hsf.googlegroups.com>


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). 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? Received on Sat May 19 2007 - 20:02:53 CEST

Original text of this message