Consider the following tables :
What will be the output of following SQL query ?
SELECT * FROM EMPLOYEE E WHERE 2 = (SELECT COUNT(DISTINCT E1.SALARY) FROM EMPLOYEE E1 WHERE E1.SALARY>E.SALARY)
(A) Second highest salary
(B) Two distinct salary of employees
(C) Third highest salary
(D) Employee with second highest salary
Explanation: Query will give the 3rd highest salary. N-1 = 3-1 = 2
Can be used to find for any value of n.
Quiz of this Question