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

What are the advantages of test automation?

580


Tell us what is the alternate way to click on login button?

516


Tell us what is the difference between single slash (/) and a double slash ( //) in xpath?

648


Do you know what is selenese?

518


what r the diffence between QTP 8.2 & QTP9.0?

1634






I want a code for a following item in TSL Language. Look up a person in database, If not found, add person to the database.

1445


What are pros and cons of automating tests at ui layer?

555


Do you know what is the difference between "type" and "typeandwait" command?

541


how can i count the no of edit field in a page and fill the multiple edit field

2063


Explain me which web driver implementation is the fastest?

550


Explain what is a relative xpath?

559


Please explain what is a relative xpath?

570


Tell me what kind of tests should not be automated?

526


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

1775


How could you explain the main difference between webdriver and rc?

524