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 / dewesh

With cte as (
Select *, Dense_rank() over (order by salary desc) as s from emp)
Select EmpName, Salary from cte where s =2
It has work. But duplicate value is not removed if name is different

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

State few characteristics of pl/sql?

971


How can I speed up sql query?

966


Can we use delete in merge statement?

1040


How many types of privileges are available in sql?

1350


How do you explain an index?

1285


What is sql partition function?

1215


What is sql catalog?

1026


Is it possible to update views?

960


How do I kill a query in postgresql?

1137


Can we perform dml in function?

1071


Can we call stored procedure in function?

963


What is the syntax and use of the coalesce function?

1175


Is primary key is clustered index?

1002


Is a foreign key always unique?

946


how are mysql timestamps seen to a user? : Sql dba

1140