Tuesday, June 22, 2010

SQL queries

Query to find out all the employee records who are having the salary of the third highest salary:
SELECT *
FROM EMPLOYEES A
WHERE 2 = ( SELECT COUNT(*) FROM (SELECT DISTINCT SALARY FROM EMPLOYEES) B WHERE A.SALARY <B.SALARY).


A nice tutorial on Oracle SQL/PLSQL is here.

No comments:

Post a Comment