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
column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.
Define implicit and explicit cursors.
Is postgresql a nosql database?
What is the unique index?
What does pl sql developer do?
What is the difference between between and in condition operators?
Advantages and disadvantages of stored procedure?
How to revise and re-run the last sql command?
How many unique keys can a table have?
Can you select everything, but 1 or 2 fields, without writer's cramp?
What is java sql package?
explain commit and rollback in mysql : sql dba
How many triggers can be applied on a table?
What are the key differences between SQL and PL SQL?
Which is faster subquery or join?