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
State few characteristics of pl/sql?
How can I speed up sql query?
Can we use delete in merge statement?
How many types of privileges are available in sql?
How do you explain an index?
What is sql partition function?
What is sql catalog?
Is it possible to update views?
How do I kill a query in postgresql?
Can we perform dml in function?
Can we call stored procedure in function?
What is the syntax and use of the coalesce function?
Is primary key is clustered index?
Is a foreign key always unique?
how are mysql timestamps seen to a user? : Sql dba