D Cube Analytics Interview Question | CTE
Question
How can you use a CTE to return the fifth highest (or Nth highest) salary from a table?
in progress
0
Interview Question
55 years
2 Answers
2031 views
Great Grand Master 0
Answers ( 2 )
WITH find5thHighest AS (
SELECT
*,
RANK() OVER (ORDER BY salary DESC) as rnk
FROM table
)
SELECT * FROM find5thHighest
WHERE rnk = 5
DENSE_RANK() would be more accurate