Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Employees with 4th to 11th Salaries
00:00
5 left

Employees with 4th to 11th Salaries

MediumSQL · PostgreSQL

Problem

Write a SQL query to list employees with the 4th through 11th lowest salaries.

Use the employees table. Treat each employee as a separate position, order salaries ascending, place NULL salaries last, and break salary ties by employee_id ascending.

Output

  1. One row per selected employee
  2. Columns: employee_id, employee_name, salary, salary_position
  3. Include positions 4 through 11, ordered by salary_position

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee's full name
salaryNUMERIC(10,2)Annual employee salary
Tablesemployees
Interviewer

Your question is Employees with 4th to 11th 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.