FastPrepSecond Highest Salary
Problems/Second Highest Salary

Second Highest Salary

Hartford Financial Services logoHartford Financial Services● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: The report names the salary query but leaves out its table and edge rules. We assume distinct salaries that are not NULL, and a single NULL result when there is no second salary. Our version is about 90% the same as the reported question.

The table employees contains salary values. Find the second-highest distinct, non-NULL salary.

Equal salaries share one rank. Ignore rows whose salary is NULL.

Return exactly one row and one column named second_highest_salary. If fewer than two distinct non-NULL salaries exist, that row must contain NULL.

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

Only the salary column is needed for this query.

ColumnTypeNullableDescription
salaryIntegerYesEmployee salary; NULL denotes an unknown salary.

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
second_highest_salaryIntegerYesSecond-highest distinct known salary, or NULL when absent.

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

Constraints

  • employees contains between 0 and 2000 rows.
  • Each known salary is an integer from 0 through 10^9, inclusive.
  • The table may contain duplicate salary values and NULL salaries.

More Hartford Financial Services interview questions

  • Maximum Product SubarrayONSITE INTERVIEW · Seen Sep 2026
  • Bubble SortONSITE INTERVIEW · Seen Mar 2019
  • Swap Adjacent Character PairsONSITE INTERVIEW · Seen Mar 2019
  • Assign Student Grades from CSV MarksONSITE INTERVIEW
  • Average Grades per StudentPHONE SCREEN · Seen Aug 2026

Similar questions at other companies

  • Latest New JobSphere · ONSITE INTERVIEW
  • In-Memory Database QueriesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
  • Benchmarking Tool ReportPalantir · OAPalantir interview questions
  • Prepare Taxi Driver Classification DataBoston Consulting Group · OABoston Consulting Group interview questions
  • Clean the TapeMillennium · OAMillennium interview questions
  • Summarize Customer RecordsAgoda · OAAgoda interview questions
  • Group Transactions by HourAffirm · ONSITE INTERVIEWAffirm interview questions
  • Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
  • Count Adjacent Symbol Pairs for BPEAmazon · ONSITE INTERVIEW
All Hartford Financial Services interview questionsSee Hartford Financial Services hiring insights