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
Does truncate remove indexes?
What is the difference between the conventional and direct path loads? : aql loader
What is sql scripting?
How to display the records between two range in Oracle SQL Plus?
how to rename an existing column in a table? : Sql dba
define sql update statement ? : Sql dba
explain access control lists. : Sql dba
What is dba in sql? : SQL DBA
why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba
What does an inner join do?
How many types of keys are there in sql?
How do I count records in sql?
What is left inner join in sql?
What is flag in sql?
what is meant by nl2br()? : Sql dba