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 are views in sql?
Which is the correct statement about truncate and delete?
What will you get by the cursor attribute sql%notfound?
Does asenumerable execute the query?
What is scalar and vector?
What is user in sql?
What are the query optimization techniques?
How do you remove duplicates without using distinct in sql?
What is rowtype?
What are joins in sql?
how to start mysql server? : Sql dba
What are the basic techniques of indexing?
how to use regular expression in pattern match conditions? : Sql dba
What is oracle pl sql developer?
What is case function?