Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Highest Salary

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

Your question is SQL Highest 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

Finastra is reviewing compensation data for employees supporting products such as Fusion. Write a PostgreSQL query that returns the single employee with the highest recorded salary.

Requirements

  1. Return the employee's ID, name, department, and salary.
  2. Sort salaries from highest to lowest and return exactly one employee. Ignore rows where salary is NULL.
  3. If multiple employees share the highest salary, select the employee with the lowest employee_id for deterministic output.

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee's full name
departmentVARCHAR(80)Employee's department
salaryNUMERIC(12,2)Annual salary, which may be unavailable
Tablesemployees
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results