Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

From: Bob Badour <bbadour_at_golden.net>
Date: Wed, 12 Mar 2003 00:51:57 -0500
Message-ID: <xuAba.3$CD.281662_at_mantis.golden.net>


"Jan Hidders" <jan.hidders_at_REMOVE.THIS.ua.ac.be> wrote in message news:3e6e6b95.0_at_news.ruca.ua.ac.be...
> Mikito Harakiri wrote:
> >"Jan Hidders" <jan.hidders_at_REMOVE.THIS.ua.ac.be> wrote in message
> >news:3e6e57e3.0_at_news.ruca.ua.ac.be...
> > What I meant was:
> >>
> >> >> SELECT f(x)
> >> >> FROM
> >> >> ( SELECT g(y)
> >> >> FROM y IN Y ) AS x
> >>
> >> and
> >>
> >> >> SELECT f(g(y))
> >> >> FROM Y AS y
> >
> >In set model
> >
> >SELECT f(x) as Fx, y
> >FROM
> > ( SELECT g(y) as x, y
> > FROM Y)
> >
> >reduces to
> >
> >SELECT f(g(y)) as FGy, y
> >FROM Y

>

> Absolutely. However, that rule doesn't apply because aggregation functions
> are used and a group by is included. Just for clarity here is the
reduction
> that you have to derive, in a more proper notation:
>

> SELECT f(x) AS fx, COUNT(*) AS cnt
> FROM
> ( SELECT g(y) AS fy, COUNT(*) AS cnt
> FROM Y AS y
> GROUP BY fy ) AS x
> GROUP BY fx
>

> to
>

> SELECT f(g(y)) AS fx, COUNT(*) AS cnt
> FROM Y AS y
> GROUP BY fx

The outer COUNT(*) needs to be SUM(cnt) Received on Wed Mar 12 2003 - 06:51:57 CET

Original text of this message