Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Second Highest Employee Salary

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Second Highest Employee Salary. Start with the requirements and the one table on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

You are given an employees table from a Coforge workforce dataset. Write a PostgreSQL query to return the second highest distinct salary from the table. If the highest salary appears multiple times, it should still count only once. If there is no second distinct salary, the query should return no rows.

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee full name
salaryINTEmployee salary amount
Tablesemployees
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results