SQL interview question

1. How to find nth highest salary in SQL Server using a Sub-Query
2. How to find nth highest salary in SQL Server using a CTE
3. How to find the 2nd, 3rd or 15th highest salary

















To find 2nd highest salary we can use any of the above queries. Simple replace N with 2. 

Similarly, to find 3rd highest salary, simple replace N with 3. 







Comments

Popular posts from this blog

Prime Number Program in C#

Fibonacci Series in C#

Joins in SQL server