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 a second highest salary from a table?
Note:Suppose salaries are in duplicate values
eg:
Name Sal
Malli 60000
Pandi 60000
Rudra 45000
Ravi 45000

Answer Posted / shriram

You can also do it by the following query ..

select * from (select name,salary,rank() over(order by
salary desc as r) from employee) where r = 2;

The above query returns the 2nd highest salary from the table.

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is primary key in db?

1004


Does google use sql?

952


Why is %isopen always false for an implicit cursor?

1100


explain normalization concept? : Sql dba

1045


What is a subquery in sql?

1036


how to use like conditions? : Sql dba

1105


Explain architecture of sql server notification services?

1054


How do I know if I have sql express or standard?

1028


what is the difference between undefined value and null value? : Sql dba

1097


Can we insert in view in sql?

1050


write an sql query to find names of employee start with 'a'? : Sql dba

1023


What does count (*) mean in sql?

1579


how is exception handling handled in mysql? : Sql dba

1075


What is constant in pl sql?

1012


How does postgresql compare to mysql?

1032