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

What is nested table in pl sql?

0 Answers  


What does desc stand for?

0 Answers  


what are sequences

0 Answers  


What is the sql query to display the current date?

0 Answers  


How to check if a column is nullable before setting to nullable?

0 Answers  


What are the possible values for the boolean data field?

0 Answers  


Can a key be both primary and foreign?

0 Answers  


Is sql a programming?

0 Answers  


What is the importance of sqlcode and sqlerrm?

0 Answers  


Can you create a table with Primary Key not as the clustered index.

2 Answers   CGI,


What is indexing oracle sql?

0 Answers  


What is the most important ddl statements in sql are?

0 Answers  


Categories