← SQL & Databases
#2 most askedVery commonMediumWindow functions

Nth-Highest Salary (with DENSE_RANK)

🏢 Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.
I was asked this

Return the 3rd-highest distinct salary from employees as third_highest, using a window function. Ties share a rank.

🧪 Practice

Write the query, then press Run tests to compare your rows with the expected result.

SQL
SELECT *
FROM employees;

Output appears here. Press Run or Ctrl/⌘ + Enter.

Try it first. Struggling for a few minutes is how it sticks.