Deepak, if you're indeed on Oracle, you might use
analytic functions to do this:
Other databases may also support analytics.
However, "second highest salary" is a bit ambiguously defined. Consider salaries 5000, 5000, 4000. Which of them is second highest? One interpretation (the one I used in the above query) is that 4000 is the second highest. Another interpretation is that there is no second-highest salary, there are two maximum salaries and one third-highest salary. Depending on context, one or the other of these interpretations can be the "right" one.