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

Answer Posted / ashish

select salary from
(select dense_rank() over(order by salary desc) as highest, salary from employee)as y
where highest=2

: replace 2 with n.... it will give nth highest salary
: rank() will work correctly only if all the salaries in employee table are distinct.
: dense_rank() will work correctly, does'nt matter salaries are distinct or NOT.

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 the difference between automation tools and management tools?

547


Tell me how can the user get a text of a web element?

522


What are the types of framework used in software automation testing ?

511


What are the points that are covered while planning phase of automation ?

630


Can you list some other automation testing tools that you are familiar with?

578






Explain about basics of rational robot - ibm test automation tool?

550


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

555


Do you know what is a data-driven framework?

581


What are the main differences between Loadrunner and QTP tools? Describe briefly a "real world" scenario that would make you use the first one versus the other? Thank you for your answers....

2321


Tell me what is the firefoxdriver, class or an interface? And which interface does it implement?

492


In general, how do you see automation fitting into the overall process of testing?

1421


Tell us how to select a value in a dropdown?

538


Do you know how can we make one test method dependent on other using testng?

565


List some advantages and disadvantages of manual testing.

502


Stop automating the tests which run once?

570