Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Top 10 Highest Paid

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

Your question is SQL Top 10 Highest Paid. Start with the requirements and the two tables 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

Write a SQL query to find the top 10 highest-paid employees in a database.

Use the employee and department data available in the schema. Exclude employees without a salary and retain employees whose department does not have a matching record.

Output

  1. One row per employee, with employee_id, employee_name, salary, and department_name
  2. Return the 10 highest salaries first; break salary ties by ascending employee_id

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee full name
department_idINTReferenced department identifier
salaryNUMERIC(12,2)Annual employee salary
departments
ColumnTypeDescription
department_idPKINTUnique department identifier
department_nameVARCHAR(100)Department name
Tablesemployeesdepartments
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results