Table name: T1, it has only one column.

col1
------
c
b
a
b
b
b
b
d
s
a
a
t
s


Requirement:

I need the following output from the above base table by
using SQL query.


col1 Cnt
----- -------
a 3
b 5
Others 5


Please help.

Thanks
Guru
v.gurus@in.com








Answer Posted / sandhya

SELECT col1, count(*) cnt
FROM T1
GROUP BY col1
ODER BY col1

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pl/sql table? Why it is used?

556


What are the parameter modes supported by pl/sql?

532


How do I find sql profiler?

516


how is myisam table stored? : Sql dba

603


what is blob? : Sql dba

560






Which normal form is best?

513


What do you mean by table in sql?

524


Can we use insert statement in function?

516


How to run sql commands in sql*plus?

585


What are actual parameters and formal parameters?

567


how to select first 5 records from a table? : Sql dba

509


How many types of keys are there in sql?

552


Can we create foreign key without primary key?

532


Which one is better subquery or joins?

553


How does cross join work in sql?

533