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
How does join work in sql?
Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?
What are different categories of sql commands?
Is left join and outer join same?
how to get a list of indexes of an existing table? : Sql dba
How do I partition in sql?
How do you delete duplicates in sql query using rowid?
What is the difference between sql and isql*plus?
Is keyword pl sql?
Why we use join in sql?
Who is the owner of mysql database?
What is the largest value that can be stored in a byte data field?
What is sql and explain its components?
How many sql are there?
How can you fetch common records from two tables?