Maximum Employee Salary for a Company
Updated
Problem statement
Use the companies and employees tables to find the maximum employee salary for the company identified by the single row in requested_company.
Return exactly one row with the column max_salary. Ignore unknown (NULL) salaries. The requested company exists. If it has no employees with a known salary, return NULL in that one row.
Company IDs identify companies, even when names are equal. Salaries are nonnegative integers. The request table only tells you which company to use.
Table schema
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.
companies
| Column | Type | Nullable | Description |
|---|---|---|---|
| company_idPK | Integer | No | — |
| company_name | Text | No | — |
employees
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | — |
| company_id | Integer | No | — |
| salary | Integer | Yes | — |
Foreign key: company_id → companies(company_id)
requested_company
| Column | Type | Nullable | Description |
|---|---|---|---|
| company_idPK | Integer | No | — |
Foreign key: company_id → companies(company_id)
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| max_salary | Integer | Yes | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- For this exercise, assume 1 to 10000 companies and 0 to 100000 employees.
- Company and employee IDs are positive unique integers within their respective tables, at most
10^9. - Every employee and the requested company reference an existing company ID.
requested_companycontains exactly one row.- A salary is
NULLor an integer from 0 through10^9. - Company names are nonempty strings of at most 100 characters and need not be unique.
More PeopleStrong Phone Screen questions
- Reverse Linked-List Nodes in Groups of KOA · PHONE SCREEN · Seen Mar 2026
- Level of the Minimum-Sum SubtreePHONE SCREEN · Seen Jan 2026
- Ceiling Value in a Sorted ArrayPHONE SCREEN · Seen Sep 2025
- Valid ParenthesesPHONE SCREEN · Seen Sep 2025
- Number of ProvincesPHONE SCREEN · Seen May 2025
- Shortest Subarray with an Exact Target SumPHONE SCREEN · Seen May 2025
- Add Forward Linked-List Numbers Using RecursionPHONE SCREEN · Seen Oct 2021
- Running Median of a StreamPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2021
- Build an Expression Tree from PostfixPHONE SCREEN · Seen Oct 2021
- Maximum Score from Deleting Neighboring ValuesPHONE SCREEN · Seen Oct 2021
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
- Employees Earning More Than Their ManagerMygate · PHONE SCREENMygate interview questions