• +91 9723535972
  • info@interviewmaterial.com

Database Interview Questions and Answers

Question - Can you get the nth highest salary in Structured Query Language?

Answer -

Here’s how we can get the nth highest salary in SQL SERVER by utilizing the TOP keyword:

SELECT TOP 1 salary FROM ( SELECT DISTINCT TOP N salary FROM #Employee ORDER BY salary DESC ) AS temp ORDER BY salary

To get the nth highest salary in MYSQL, we can use the LIMIT keyword. Here’s the solution:

SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners