Grokking SQL for Tech Interviews
Ask Author
Back to course home

0% completed

3. 2nd Highest Salary
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem

Table: Employee

+-------------+------+
| Column Name | Type |
+-------------+------+
| id          | int  |
| salary      | int  |
+-------------+------+
id is the primary key (column with unique values) for this table.
Each row of this table contains information about the salary of an employee.

Problem Definition

Write a solution to find the 2<sup>nd</sup> highest salary from the Employee table. If there is no 2<sup>nd</sup> highest salary, return null.

Example

Here's the employee table:

Expected Output

Try It Yourself

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible