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

What is case function?

1034


What is scalar function in sql?

1038


What is pl sql block structure?

1034


What is application trigger?

991


What is execute immediate?

1079


Difference between global and parameter variables?

1963


Which version of sql do I have?

1051


Can I create table without primary key?

997


How to write a query to show the details of a student from students table whose

994


What is Difference Between Unique and Primary Key Constraints?

1103


what are the advantages of using stored procedures? : Sql dba

1103


What are the types of index in sql?

1065


Can you sum a count in sql?

998


Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?

1005


How long does it take to learn pl sql?

1057