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
What is data type in database?
what is self-join? : Sql dba
What is ttitle and btitle?
What are the limitations of sql express?
What is difference between cursor and trigger?
How to add a column ‘salary’ to a table employee_details?
what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba
How can you know that statistics should be updated?
how to increment dates by 1 in mysql? : Sql dba
Can sql function call stored procedure?
When should I use nosql database?
What is sql and also describe types of sql statements?
Why do we need a foreign key?
what are the advantages of using stored procedures? : Sql dba
In what condition is it good to disable a trigger?