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: Peter Koch Larsen <pkl_at_mailme.dk>
Date: 19 Mar 2003 02:24:01 -0800
Message-ID: <61c84197.0303190224.4ed81d12@posting.google.com>


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

This is not legal SQL but wouldn't it be nice to have something like:

select person.name, person.income/(sum (person.income) group by person.division) from person?

The intention is for each person to detect how large a relative salary he earns within each division.

Kind regards
Peter Received on Wed Mar 19 2003 - 04:24:01 CST

Original text of this message

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