SQL Notes: Nth Highest Salary

XuanKhanh Nguyen
Nothingaholic
Published in
2 min readSep 26, 2021

--

177. Nth Highest Salary

Problem

Table: Employee

+-------------+------+
| Column Name | Type |
+-------------+------+
| Id | int |
| Salary | int |
+-------------+------+
Id is the primary key column for this table.
Each row of this table contains information about the salary of an employee.

Write an SQL query to report the nth highest salary from the Employee table. If there is no nth highest salary, the query should report null.

--

--

XuanKhanh Nguyen
Nothingaholic

Interests: Data Science, Machine Learning, AI, Stats, Python | Minimalist | A fan of odd things.