Back to Developer Roadmap

Second Highest Salary

src/data/question-groups/sql-queries/content/second-highest-salary.md

4.0375 B
Original Source

Given a table Salaries,

idsalary
11000
22000
33000
44000

The query to find the second-highest salary is shown in the code snippet below

sql
SELECT DISTINCT Salary
FROM Salaries
ORDER BY Salary DESC
LIMIT 1 OFFSET 1

The result of the query is shown below

salary
13000