GATE | GATE CS Mock 2018 | Set 2 | Question 61
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
Answer: (C)
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
Last Updated :
08 Mar, 2018
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...