SELECT DISTINCT (a.sal) FROM emp a WHERE &n = (SELECT COUNT (DISTINCT (b.sal)) FROM emp B WHERE a.sal<=b.sal);
To Find Second Highest Salary. Enter Value for n = 2
OUTPUT -------------- 16000
SELECT LEVEL MAX(SAL) FROM emp WHERE LEVEL = &n CONNECT BY PRIOR sal>sal GROUP BY LEVEL;
No comments:
Post a Comment