how to find the second highest salary from emp table?

Answer Posted / susanta

select * from emp e1 where N-1 =
(select count(distinct sal)
from emp e2
where e2.sal > e1.sal)
for Nth highest salary.

Is This Answer Correct ?    20 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use subquery?

481


what is uncommittable transactions? : Transact sql

558


what is auto increment? : Sql dba

563


Name three sql operations that perform a sort.

580


What's the procedure?

484






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...

1908


what are the different type of sql's statements ? : Sql dba

514


Mention what does plv msg allows you to do?

662


What are the types pl/sql code blocks?

604


What are different categories of sql commands?

630


what is primary key? : Sql dba

508


What is the function that is used to transfer a pl/sql table log to a database table?

546


What does cursor do in sql?

512


Explain dml and ddl?

538


What is time based sql injection?

484