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 / rajat

SELECT * FROM (
SELECT RANK()OVER( ORDER BY SALARY DESC) NUM, A.* FROM RAJ A)
WHERE NUM=2;

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many functions are there in sql?

542


Does mysql_real_escape_string prevent sql injection?

539


How to avoid using cursors?

599


Is sql scripting language?

528


Can we group by two columns in sql?

507






What are sql queries used for?

537


how to convert numeric values to character strings? : Sql dba

570


What is a recursive stored procedure?

621


What is the use of sql trace?

481


How do you go back in sql?

535


What does stand for in sql?

524


What is a procedure in pl sql?

550


how is exception handling handled in mysql? : Sql dba

553


1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...

1916


What are all different types of collation sensitivity?

528