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

Home -> Community -> Usenet -> c.d.o.misc -> SQL + questions

SQL + questions

From: Lee Ka Wo <leekawo_at_netvigator.com>
Date: Sat, 20 Jun 1998 18:53:06 +0800
Message-ID: <358B9492.2C4D@netvigator.com>


Dear experts,

I have a SQL plus question. I have a table like this (just five records):

   Name             Age
   ------------     ---
   chan tai man     10
   lee ka wo        20
   young man        21
   old man          60
   old woman        62


I want to do a query to count the number of people with age <60 (young) and number of people >=60 (old). I hope the result will
be like this:

   Count(*) Age_range

I wonder whether the following statement can serve my purpose.

select count(*), decode(age, <60,'young',>=60,'old')Age_range from people

Please kindly advise. Thanks a lot !!!

Lee Ka wo, Ken

-



All people have one thing in common, they are DIFFERENT

Please visit my homepage (IQ Paradise)
http://home.netvigator.com/~leekawo
My ICQ: 996903 Received on Sat Jun 20 1998 - 05:53:06 CDT

Original text of this message

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