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
What is case function?
What is scalar function in sql?
What is pl sql block structure?
What is application trigger?
What is execute immediate?
Difference between global and parameter variables?
Which version of sql do I have?
Can I create table without primary key?
How to write a query to show the details of a student from students table whose
What is Difference Between Unique and Primary Key Constraints?
what are the advantages of using stored procedures? : Sql dba
What are the types of index in sql?
Can you sum a count in sql?
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
How long does it take to learn pl sql?