Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Nth Highest Salary Query
00:00
5 left

SQL Nth Highest Salary Query

EasySQL · PostgreSQL

Problem

EXL Service Philippines uses salary analysis in its HR reporting workflows. Write a PostgreSQL query to return the third-highest distinct salary from the employee_salaries table.

Requirements

  1. Exclude NULL salaries before ranking salary levels.
  2. Return exactly one row containing the third-highest distinct salary. Treat the highest salary as position 1.

Schema

employee_salaries
ColumnTypeDescription
employee_idPKINTEGERUnique employee identifier
employee_nameVARCHAR(100)Employee's full name
salaryINTEGERAnnual salary in Philippine pesos
Tablesemployee_salaries
Interviewer

Your question is SQL Nth Highest Salary Query. Start with the requirements and the one table in the Question tab.

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.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.