Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Second Highest Trader Salary
00:00
5 left

Second Highest Trader Salary

EasySQL · PostgreSQL

Problem

You are given a table of employee salaries from a trading analytics environment. Write a SQL 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.

Rows where salary is NULL should be ignored.

Schema

employee_salaries
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee full name
salaryINTEmployee salary amount
Tablesemployee_salaries
Interviewer

Your question is Second Highest Trader Salary. 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.