FastPrepThird-Highest Known Salary
Problems/Third-Highest Known Salary

Third-Highest Known Salary

Adobe logoAdobe● MediumFULLTIMEPHONE SCREEN
QuestionConstraints

Problem statement

Source note: This problem returns the third-highest different salary in an employees table, or NULL when there is none.

An Adobe report for a software test engineer role in Noida lists this SQL task among its first-round topics, next to questions on test automation, XPath and Git. It names the task only: no table, no rule for equal salaries or missing pay, and nothing on the answer when a third value does not exist.

Our choices: the table and column names, equal salaries count once, a NULL salary means unknown pay and is skipped, one row holding NULL when fewer than three different known salaries exist, MySQL, PostgreSQL or Pandas, and new examples.

The judged task matches the report at about 80%.

Each row of employees describes one person: emp_id identifies them, emp_name is their name, and salary is their pay. salary is NULL when the pay has not been entered yet.

Work out which salary ranks third from the top. Ignore missing pay, and treat equal salaries as a single value: with known salaries 90, 90, 70, 70 and 40, the ranking is 90, 70, 40, so the answer is 40.

Your result must have a single row and a single column, third_highest_salary. When fewer than three different salaries are known, put NULL in that row.

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. salary is NULL when the pay is not known.

ColumnTypeNullableDescription
emp_idPKIntegerNo—
emp_nameTextNo—
salaryIntegerYes—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
third_highest_salaryIntegerYes—

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

Constraints

  • The employees table has from 0 to 1000 rows.
  • emp_id is unique and 1 <= emp_id <= 10^6.
  • salary is NULL or a whole number with 1 <= salary <= 10^9. Salaries can repeat.
  • emp_name is one uppercase English letter followed by 0 to 19 lowercase English letters. Names can repeat.
  • emp_id and emp_name are never NULL.

More Adobe problems

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
All Adobe interview questionsSee Adobe hiring insights