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 / shriram
You can also do it by the following query ..
select * from (select name,salary,rank() over(order by
salary desc as r) from employee) where r = 2;
The above query returns the 2nd highest salary from the table.
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
How do I find duplicates in the same column?
Mention what does plv msg allows you to do?
Is postgresql a server?
What are the different types of dbms?
Which language is used in sql?
What is a function in oracle pl sql?
What is a sql instance vs database?
Explain the insert into statements in sql?
in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.
Is subquery faster than join?
Why do we use sql constraints?
Which certification is best for sql?
What is mdf ldf and ndf?
Is sql a backend language?
what are the 'mysql' command line options? : Sql dba