Monday, March 28, 2011

Get the top 5th salary of all employees

SELECT SALARY FROM


(SELECT VAL1, RANK() OVER (ORDER BY VAL1 DESC) R from TEMPX)


WHERE R=5;


OR


SELECT DISTINCT (a.sal) FROM EMP A WHERE 5= (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);


No comments:

REFACTORING

 What is Refactoring? A software is built initially to serve a purpose, or address a need. But there is always a need for enhancement, fixin...