FastPrepEmployees Earning More Than Their Manager
Problems/Employees Earning More Than Their Manager

Employees Earning More Than Their Manager

Mygate logoMygate● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in a Mygate phone screen for a full-time role. The task is to find employees who earn more than their manager. The report leaves out the schema, the result columns, and the rules for employees with no manager. We filled those in.

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

The employees table contains one row per employee, including their salary and the ID of their direct manager.

Return the employee_id and employee_name of every employee whose salary is strictly greater than their direct manager's salary. Sort the result by employee_id in ascending order.

A null manager ID means the employee has no manager and must be excluded. Every non-null manager ID refers to an employee in the table. Employees with equal salaries do not qualify. Compare only with the direct manager, even when a management chain contains more people. Different employees may have the same name.

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 and their direct manager.

ColumnTypeNullableDescription
employee_idPKIntegerNo—
employee_nameTextNo—
salaryIntegerNo—
manager_idIntegerYes—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
employee_idIntegerNo—
employee_nameTextNo—

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

Constraints

  • The table contains between 0 and 10^4 rows.
  • employee_id is unique and between 1 and 10^9.
  • employee_name is nonempty text of at most 100 characters.
  • salary is an integer between 0 and 10^9.
  • An employee cannot be their own manager. Management chains are acyclic.

More Mygate Phone Screen questions

  • Maximum Subarray SumPHONE SCREEN · Seen Sep 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Sep 2026
  • Users Active in Both January and FebruaryPHONE SCREEN · Seen Sep 2026
  • Elements Occurring More Than n/3 TimesPHONE SCREEN · Seen Jan 2025
  • Frog Jump: Minimum EnergyPHONE SCREEN · Seen Jan 2025
  • Left View of a Binary TreePHONE SCREEN · Seen Jan 2025
  • Two SumPHONE SCREEN · Seen Aug 2024
  • Minimum in a Rotated Sorted ArrayPHONE SCREEN · Seen Jul 2024
  • Minimum Subarray SumPHONE SCREEN · Seen Sep 2023
  • Remove the Nth Node from the EndPHONE SCREEN · Seen Sep 2023

Similar questions at other companies

  • Second Highest SalaryPaytm · PHONE SCREENPaytm interview questions
  • Employees Who Earn More Than Their ManagersNykaa · PHONE SCREENNykaa interview questions
  • Employees Who Joined More Than a Week AgoNewgen Software · PHONE SCREEN
  • Departments Without EmployeesDell Technologies · PHONE SCREENDell Technologies interview questions
  • Second-Highest Distinct SalaryChubb · PHONE SCREENChubb interview questions
  • Swap Two Gender ValuesInfosys · PHONE SCREENInfosys interview questions
  • Find Rows Common to Two TablesSalesforce · PHONE SCREENSalesforce interview questions
  • Count Records Present in A but Not BCapital One · PHONE SCREENCapital One interview questions
  • Customer Order Count Distribution by CountryApple · PHONE SCREENApple interview questions
  • Classify Tree Nodes with SQLOracle · PHONE SCREENOracle interview questions
All Mygate interview questionsSee Mygate hiring insights