Oracle SQL Question:
Download Job Interview Questions and Answers PDF
How to find out nth highest salary from emp table?
Answer:
SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
For Eg:-
Enter value for n: 2
SAL
---------
3700
For Eg:-
Enter value for n: 2
SAL
---------
3700
Download SQL Oracle Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain Which is more faster - IN or EXISTS? | Explain What should be the return type for a cursor variable. Can we use a scalar data type as return type? |