Interview Query

2nd Highest Salary

Start Timer

0:00:00

Upvote
132
Downvote
Save question
Mark as completed
View comments (165)
Next question

Write a SQL query to select the 2nd highest salary in the engineering department.

Note: If more than one person shares the highest salary, the query should select the next highest salary.

Example:

Input:

employees table

Column Type
id INTEGER
first_name VARCHAR
last_name VARCHAR
salary INTEGER
department_id INTEGER

departments table

Column Type
id INTEGER
name VARCHAR

Output:

Column Type
salary INTEGER
.
.
.
.
.


Comments

Loading comments