FastPrepEmployee Promotion Opportunities

Employee Promotion Opportunities

Intuit logoIntuit● EasyFULLTIMEOA

Problem statement

Return one row for every employee in employees. Join ManagerID to the manager's ID in the same table. Return columns Name, Salary, ManagerName, and PromotionOpportunity, in that order.

Display No Manager if ManagerID is null or no matching manager exists. Set PromotionOpportunity to Yes only when a matching manager exists and the employee's salary is strictly greater than that manager's salary; otherwise use No.

Sort by employee salary minus manager salary in descending order. Treat a missing manager salary as 0 for this sort. Break equal differences by employee ID in ascending order. Retain employees with equal or lower salaries and employees without managers.

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

ColumnTypeNullableDescription
IDPKIntegerNo—
NameTextNo—
SalaryIntegerNo—
ManagerIDIntegerYes—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
NameTextNo—
SalaryIntegerNo—
ManagerNameTextNo—
PromotionOpportunityTextNo—

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

Constraints

  • The employees table has 0 to 2000 rows with unique integer ID values between 1 and 1000000.
  • Name is nonempty text with at most 100 characters; Salary is an integer between 0 and 1000000000.
  • ManagerID is null or an integer between 1 and 1000000; it may have no matching employee.
  • Names need not be unique. A manager relationship uses one direct lookup, including a self-reference or cycle.
  • Use every employee exactly once, with the exact result labels and sort order stated above.

More Intuit problems

See Intuit hiring insights