Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Query for Top Salaries
00:00
5 left

SQL Query for Top Salaries

EasySQL · PostgreSQL

Problem

The Allscripts people operations team wants to identify employees with the highest recorded salary. Write a PostgreSQL query using the employees table to return all employees tied for the highest salary.

Requirements

  1. Group employees by salary and return the highest salary.
  2. Combine the names of every employee at that salary into one comma-separated list, sorted alphabetically.
  3. Ignore employees whose salary is NULL and return exactly one result row.

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee's full name
departmentVARCHAR(80)Allscripts department
salaryNUMERIC(10,2)Annual salary in USD
Tablesemployees
Interviewer

Your question is SQL Query for Top Salaries. 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.