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...

how to retrieve the top 2 salaried persons from a database?

Answer Posted / srinivas

select * from emp m
where
(select count(distinct sal)+1 from emp s
where s.sal>m.sal)<=2
order by sal desc

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the operators used in select statements?

1043


What is a unique key?

1034


What is normalization in a database?

1142


What is sql data?

972


Does execute immediate commit?

1195


What is string data type in sql?

1115


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

963


what is timestamp in mysql? : Sql dba

1051


How consistent is the view of the data between and within multiple sessions, transactions or statements ?

2207


What are reports usually used for?

1006


What are the benefits of triggers?

1157


What is meant by cursor in sql?

972


What are the usages of sql?

1046


Does truncate table reset auto increment?

977


what is the stuff function and how does it differ from the replace function? : Sql dba

1030