Write a query to find second highest salary of an employee.

Answer Posted / khurram

The Simplest, easy, Understandable solution is

select max(sal) from emp where
sal not in
(select distinct Top 1 sal from emp order by sal desc)


Go Check Out for yourself
[replace "top 1" by "top 2" to get 3rd highest sal]
[replace "top 1" by "top 3" to get 4th highest sal] so on..

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Generic function for selecting a Radio Button in a Dialog

1965


What are the advantages of automation testing?

537


What are the most popular tools for automation testing?

539


What is junit? And what is junit annotation?

518


Does automation testing have any disadvantages?

551






Do you know what is functional testing?

562


Tell me how would you test your own element locator?

535


What is in-house tool?

547


What is testng and why is it better than junit?

559


Do you know when autoit is used?

561


I am fresher and i have completed my software testing course and i don't have real time experience,can anybody help me regarding financial domain projects,main testcases in that domain.

1787


What are the various kinds of frameworks that can be used in software automation testing?

497


Tell us what is the difference between getwindowhandles() and getwindowhandle()?

500


Kindly let me know how to setup JMeter for functionality testing of a Web application.. The apache help doc is good but i m little confused with it... :(

1736


What is the difference between automation tools and management tools?

527