Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...



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








Answers were Sorted based on User's Feedback



Table name: T1, it has only one column. col1 ------ c b a b b b b d s a a t s ..

Answer / dinakar

select col1,count(*) cnt from T1 where col1 in
(select distinct col1 from T1 )
group by col1

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

List the ways to get the count of records in a table?

0 Answers  


What is the most restrictive isolation level? : Transact sql

0 Answers  


What is lexical units in pl sql?

0 Answers  


Explain the advantages and disadvantages of stored procedure?

0 Answers  


What is the purpose of using pl/sql?

0 Answers  


How do I run a query in pl sql developer?

0 Answers  


What do you mean by stored procedures?

0 Answers  


How to display the current date in sql?

0 Answers  


Where the integrity constrints are stored in Data Dictionary?

1 Answers  


How does index help in query performance?

0 Answers  


What is the use of partition by in sql?

0 Answers  


What does truncate mean in sql?

0 Answers  


Categories