Thursday, December 3, 2026 | London 11°C · Drizzle
DailyGlimpse

AI

SQL Tip: How to Find the Employee with the Nth Highest Salary

Durga Software Solutions 1 min read

Ever wondered how to retrieve the employee with the Nth highest salary from a database? This short explains the logic using SQL to find the second highest salary, a common interview question.

Key insight: Use a subquery with DISTINCT and ORDER BY to rank salaries, then apply LIMIT and OFFSET to pinpoint the Nth position.

The technique works for any N by adjusting the offset. Master this pattern to handle ranking queries with ease.

React