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: Why using "Group By"

Re: Why using "Group By"

From: Bob Badour <bbadour_at_golden.net>
Date: Mon, 17 Mar 2003 12:10:05 -0500
Message-ID: <AOnda.62$ap4.6741046@mantis.golden.net>


"oferbu" <junkbu_at_hotmail.com> wrote in message news:b9b409f2.0303162232.cd259fe_at_posting.google.com...
> So if I sum all the replies by now, there is no really any need for
> the extra information added by the clause "Group by YYY, ZZZ" when the
> SQL already contains an aggregate function, right?

There is for SQL. The decision to allow duplicate rows forces SQL to require GROUP BY.
>
> cheers
> /ofer
>
> junkbu_at_hotmail.com (oferbu) wrote in message
news:<b9b409f2.0303130207.42f8ab91_at_posting.google.com>...
> > Hello All,
> >
> > This is a theoretical question. Why do I need to add the "Group By" in
> > the following SQL:
> >
> > SELECT
> > CUSTOMER_CITY, COUNT(*)
> > FROM
> > CUSTOMER_TABLE
> >
> > Isn't it clear that I want to get the number of rows per city, so why
> > is it necessary to add:
> >
> > GROUP BY
> > CUSTOMER_CITY
> >
> > I mean to say that those added lines didn't give more information, and
> > any resonable person (or a good sql parser...) could have understand
> > what I really want at the first sql.
> >
> >
> > Regards
> > Ofer Buhnik
Received on Mon Mar 17 2003 - 11:10:05 CST

Original text of this message

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