how to find the second highest salary from emp table?

Answer Posted / vijay kintali

select e1.ename,e1.sal from emp e1 where n=(select count
(distinct e2.sal) from emp e2 where e1.sal<=e2.sal);

Note:n here is nth highest salary.......

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is offset-fetch filter in tsql? : Transact sql

539


what is the syntax for using sql_variant_property? : Transact sql

533


what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba

557


What is the sql*loader? : aql loader

589


How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?

601






What is sql integrity?

585


What are string functions in sql?

678


Which query operators in sql is used for pattern matching?

546


What is break?

620


What is program debugging?

566


What is number function in sql?

527


What is execution plan in sql?

550


What is a common use of group by in sql?

592


when MSQL8.0 is in market

1602


Is left join inner or outer by default?

523