Top Ten Employee Salaries
Updated
Problem statement
The employees DataFrame contains employee identities, and the salaries DataFrame contains one current salary per employee.
Using Pandas, return the ten employees with the highest salaries. Return the columns employee_id, employee_name, and salary, ordered by salary descending and then employee ID ascending. If fewer than ten employees have salary rows, return all matched employees.
Table schema
Pandas
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.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | — |
| employee_name | Text | No | — |
salaries
At most one current salary row per employee.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | — |
| salary | Integer | No | — |
Foreign key: employee_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 | — |
| salary | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
employees.employee_idandsalaries.employee_idare unique.- Every row in
salariesreferences an employee. - Salaries are non-negative integers.
- Employees without a salary row are excluded.
- Return at most ten rows with deterministic tie ordering.
Similar questions at other companies
- Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
- Records Created or Updated in a Time WindowPelatro · 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
- New-User Devices That Opened an AppMicrosoft · ONSITE INTERVIEWMicrosoft interview questions