SQL: Nth Highest Salary

Medium
SQL — Subqueries SQL Subquery Variable
Write a function to get the Nth highest salary.

Constraints

Write standard SQL (MySQL 8.0 compatible).

Examples

Example 1:
Input: N=2, salaries: 100,200,300
Output:
Example 2:
Input: N=2, salaries: 100,200,300
Output:

Hints

Use window function or subquery.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.