FastPrepHighest-Paid Employees by Salary Rank
Problems/Highest-Paid Employees by Salary Rank

Highest-Paid Employees by Salary Rank

Amazon logoAmazon● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: In a live Amazon intern SQL round, the candidate used a window function on an employee table to order people by pay and pick out the top earner.

The report does not give the table columns, what happens when several people share the top salary, or the row order. Here, everyone tied at the top salary is returned, sorted by employee_id.

Our version is about 85% the same as the reported question.

The employees table has one row per employee: a unique employee_id, the employee_name, and the employee's salary.

Rank the employees by salary from highest to lowest. Employees with the same salary share the same rank. Return the employees ranked first, which means everyone who earns the highest salary.

Return the columns employee_id, employee_name, and salary, sorted by employee_id from smallest to largest. If the table is empty, return no rows.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

employees

One row per employee.

ColumnTypeNullableDescription
employee_idPKIntegerNo—
employee_nameTextNo—
salaryIntegerNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
employee_idIntegerNo—
employee_nameTextNo—
salaryIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • The employees table has from 0 to 10^5 rows.
  • employee_id is unique and 1 <= employee_id <= 10^9.
  • No column is NULL.
  • 0 <= salary <= 10^9.
  • employee_name has 1 to 50 characters. Two employees can have the same name.

More Amazon Onsite Interview questions

  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Cheapest Flights Within K StopsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dungeon GameONSITE INTERVIEW · Seen Nov 2026
  • Integer BreakONSITE INTERVIEW · Seen Nov 2026
  • LFU CacheONSITE INTERVIEW · Seen Nov 2026
  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Count Adjacent Symbol Pairs for BPEONSITE INTERVIEW · Seen Nov 2026
  • First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
  • Records Created or Updated in a Time WindowPelatro · ONSITE INTERVIEW
  • Top Ten Employee SalariesSolytics Partners · ONSITE INTERVIEW
  • Latest New JobSphere · ONSITE INTERVIEW
  • Employees Whose Manager Left the CompanyZS · ONSITE INTERVIEWZS interview questions
  • Employees Above Average SalaryJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
  • Retrieve Every Student RecordLSEG · ONSITE INTERVIEWLSEG interview questions
  • Conditionally Insert or Update RecordsKlaviyo · ONSITE INTERVIEWKlaviyo interview questions
  • Employees with Matching DepartmentsAMD · ONSITE INTERVIEWAMD interview questions
  • New-User Devices That Opened an AppMicrosoft · ONSITE INTERVIEWMicrosoft interview questions

Interview reports that mention this question

  • Amazon BIE Intern SQL and Interview Questions: 17 Experiences

Amazon interview experiences

  • Amazon SWE OA with AI Coding: 1 Experience
  • Amazon SWE Intern Phone Screen Interview Experience: 1 Experience
  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon Experienced SWE AI-Assisted Debugging OA: 1 Experience
  • Amazon SDE II (L5) Interview Questions: 5 Experiences
See Amazon hiring insights