Your question is Highest Salary by Department. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Caterpillar's workforce analytics team needs a department-level view of compensation. Write a PostgreSQL query that identifies the employee or employees with the highest non-null annual salary in every department represented in the employee data.
department_id.NULL, and sort the result by department name and employee name.| Column | Type | Description |
|---|---|---|
| department_idPK | INTEGER | Unique department identifier |
| department_name | VARCHAR(100) | Caterpillar department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INTEGER | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| department_id | INTEGER | Department assigned to the employee |
| annual_salary | NUMERIC(12,2) | Annual salary in U.S. dollars |