how to find the second highest salary from emp table?

Answer Posted / ram achare

for 2nd highest salary
select sal from(select distinct sal from emp order by sal desc limit 2)emp order by salary limit 1;
for 3rd highest salary
select sal from(select distinct sal from emp order by sal desc limit 3)emp order by salary limit 1;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is data control language? : Sql dba

588


What does trigger mean in psychology?

538


What are the most important ddl statements in sql?

578


how does a local variable is defined using t-sql? : Transact sql

547


What is meant by user defined function?

583






What is transaction control language (tcl)?

639


What is the difference between delete and truncate commands?

516


What does (+) mean in sql joins?

528


How do you delete a table?

540


what is the difference between delete and truncate commands? : Sql dba

539


Is keyword pl sql?

562


What can you do with pl sql?

569


Can one improve the performance of sql*loader? : aql loader

587


What is sql basics?

586


What is the default isolation level in sql server? : Transact sql

569