| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: GROUP BY
Marshall <marshall.spight_at_gmail.com> wrote:
[snip]
>What if 3) is empty?
>
>In that case, GROUP BY is equivalent to PROJECT!
>
>SQL obscures this fact, due to the templated nature of a SQL query.
>The 3)-empty case is:
> select b from R group by b
>which would just be simplified to:
> select b from R
>which is how you project in SQL already.
Counterexample:
create table r (a n(5), b n(5), c n(5))
insert into r (a,b,c) values (1,2,1)
insert into r (a,b,c) values (1,2,2)
insert into r (a,b,c) values (1,2,3)
insert into r (a,b,c) values (1,2,4)
insert into r (a,b,c) values (1,2,5)
select b from r group by b
select b from r
The result of the first select is one row of b 2. The result of the second select is five rows of b 2.
[snip]
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.
Received on Fri May 18 2007 - 14:42:09 CDT
![]() |
![]() |