Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Maximum Salary Query

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

Your question is Maximum Salary Query. 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

Newgen Software is reviewing compensation data for employees supporting its OmniDocs platform. Write a PostgreSQL query to find the highest salary recorded in the employees table.

Requirements

  1. Return one row containing the maximum non-NULL salary.
  2. Name the result column maximum_salary.

The MAX aggregate function should evaluate all rows in the table. PostgreSQL automatically ignores NULL values during this aggregation. Do not return employee details or group the result by department.

Schema

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