Interview Questions

Find out nth highest salary from emp table

DATABASE Administrator (DBA) Interview Questions and Answers


(Continued from previous question...)

64. Find out nth highest salary from emp table

SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
Enter value for n: 2
SAL
---------
3700

(Continued on next question...)

Other Interview Questions