Employees Without a Manager
Updated
Problem statement
The employees table stores a bank team's reporting lines. Each row is one employee, and manager_id holds the employee_id of the person that employee reports to, who is also a row of the same table. An employee who reports to no one, such as a department head, has NULL in manager_id.
Write a query that lists every employee who has no manager. Return their employee_id and employee_name, in any order.
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 with the ID of their manager.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | Unique employee ID. |
| employee_name | Text | No | The employee's name. |
| manager_id | Integer | Yes | employee_id of this employee's manager, or NULL if they report to no one. |
Foreign key: manager_id → employees(employee_id)
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_id | Integer | No | — |
| employee_name | Text | No | — |
Row order: any order is accepted. Numeric tolerance: 0.
Constraints
- The
employeestable has between1and1000rows. employee_idvalues are unique, with1 <= employee_id <= 100000.employee_namehas 1 to 40 characters. Different employees can have the same name.manager_idisNULLor theemployee_idof another row of the table.- At least one employee has no manager.
More Bank of America Onsite Interview questions
- Centered Star PyramidONSITE 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
- Second Largest Element in an ArrayONSITE INTERVIEW · Seen Jun 2023
Similar questions at other companies
- Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
- Records Created or Updated in a Time WindowPelatro · ONSITE INTERVIEW
- Top Ten Employee SalariesSolytics Partners · ONSITE INTERVIEW
- Latest New JobSphere · ONSITE INTERVIEW
- Employees Whose Manager Left the CompanyZS · ONSITE INTERVIEWZS interview questions
- Employees Above Average SalaryJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
- Retrieve Every Student RecordLSEG · ONSITE INTERVIEWLSEG interview questions
- Combine Winner and Loser NamesAmazon · ONSITE INTERVIEW
- Conditionally Insert or Update RecordsKlaviyo · ONSITE INTERVIEWKlaviyo interview questions
- Employees with Matching DepartmentsAMD · ONSITE INTERVIEWAMD interview questions