FastPrepN-th Highest Salary
Problems/N-th Highest Salary

N-th Highest Salary

Bank of America logoBank of America● MediumNEW GRADONSITE INTERVIEW

Updated Dec 2020

QuestionConstraints

Problem statement

Source note: Reported by a Bank of America new grad from a 2020 campus drive, in the first live technical round after the video step. The task was an SQL query that finds the n-th highest salary in an employee table.

The report gives no table layout, data or rule for equal salaries. Here, n comes from a one-row table, equal salaries count once, and the answer is a single row that holds NULL when there are fewer than n different salaries. The table and column names and all data are ours.

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

The employees table lists the staff of one bank branch, one row per employee, with each person's yearly salary. Several employees can earn exactly the same amount. The one-row table rank_request holds a positive integer n.

Write a query that returns the n-th highest salary in employees. Salaries are ranked as values, so equal salaries count once: the highest salary is rank 1, the next smaller amount is rank 2, and so on, however many people earn each amount.

Return exactly one row with one column, nth_highest_salary. When the table has fewer than n different salaries, return that one row with NULL (None in Pandas).

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 of the branch.

ColumnTypeNullableDescription
employee_idPKIntegerNoUnique employee ID.
employee_nameTextNoThe employee's name.
salaryIntegerNoYearly salary.

rank_request

Exactly one row: which salary rank to return.

ColumnTypeNullableDescription
nPKIntegerNoThe salary rank to find, 1 for the highest.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
nth_highest_salaryIntegerYes—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • The employees table has between 1 and 1000 rows.
  • employee_id values are unique, with 1 <= employee_id <= 100000.
  • employee_name has 1 to 40 characters.
  • 1 <= salary <= 1000000
  • The rank_request table has exactly one row, with 1 <= n <= 1000.

More Bank of America Onsite Interview questions

  • Centered Star PyramidONSITE INTERVIEW · Seen Nov 2025
  • Employees Without a ManagerONSITE INTERVIEW · Seen Nov 2025
  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2025
  • N-th Fibonacci NumberONSITE INTERVIEW · Seen Nov 2025
  • Reverse Each Word in a SentenceONSITE INTERVIEW · Seen Nov 2025
  • Second Highest SalaryONSITE INTERVIEW · Seen Nov 2025
  • Three Numbers That Add Up to a TargetONSITE INTERVIEW · Seen Apr 2025
  • Duplicate RowsONSITE INTERVIEW · Seen Oct 2023
  • Factorial of a NumberONSITE INTERVIEW · Seen Oct 2023
  • Palindrome String CheckONSITE INTERVIEW · Seen Sep 2023

Similar questions at other companies

  • Daily USD Totals with Effective-Dated Exchange RatesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Most Recent Order for Each CustomerCapgemini · ONSITE INTERVIEWCapgemini interview questions
  • Tenth-Highest Distinct SalaryInfosys · ONSITE INTERVIEWInfosys interview questions
  • Fifth Highest Salary In A DepartmentZS · ONSITE INTERVIEWZS interview questions
  • In-Memory Database QueriesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Order Book Data ValidationJane Street · ONSITE INTERVIEWJane Street interview questions
  • Nth-Highest Distinct Salary Without Ranking FunctionsMastercard · ONSITE INTERVIEWMastercard interview questions
  • Contest Participants with Long Totals and Short QuestionsThe Walt Disney Company · ONSITE INTERVIEWThe Walt Disney Company interview questions
  • First Order per Merchant per DateAmazon · ONSITE INTERVIEW
  • Block Transaction Count TrendsChainalysis · ONSITE INTERVIEWChainalysis interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America hiring insights