Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?
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
to
SELECT f(g(y)) AS fx, COUNT(*) AS cnt
FROM Y AS y
GROUP BY fx