Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

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

From: Jan Hidders <jan.hidders_at_REMOVE.THIS.ua.ac.be>
Date: 12 Mar 2003 08:35:08 +0100
Message-ID: <3e6ee32c.0@news.ruca.ua.ac.be>


Bob Badour wrote:
>"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)

Yes, you are right, in fact, all COUNTs need to be SUM(cnt)'s.

Received on Wed Mar 12 2003 - 01:35:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US