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: Damjan S. Vujnović <damjan_at_NO_SPAM.galeb.etf.bg.ac.yu>
Date: Thu, 13 Mar 2003 12:58:41 +0100
Message-ID: <b4prme$fnl$1@news.etf.bg.ac.yu>


oferbu wrote:
> 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
How will you write (using your sintax) something like this:

SELECT
   CUSTOMER_CITY, COUNT(*)
FROM
   CUSTOMER_TABLE
GROUP BY
   CUSTOMER_CITY, SOME_OTHER_CUSTOMER_TABLE_ATTRIBUTE

-- 
Regards,
Damjan S. Vujnovic

University of Belgrade
School of Electrical Engineering
Department of Computer Engineering & Informatics
Belgrade, Serbia

http://galeb.etf.bg.ac.yu/~damjan/
Received on Thu Mar 13 2003 - 05:58:41 CST

Original text of this message

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