Your question is SQL Highest Salary Per 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.
Turing's engineering operations team needs a department-level view of the highest employee compensation. Write a PostgreSQL query that reports the employees earning the maximum salary in each department.
A NULL salary should not be treated as a department's maximum salary. Departments with no qualifying employee should still appear with NULL employee and salary values.
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Primary key for the department |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Primary key for the employee |
| employee_name | VARCHAR(100) | Employee's full name |
| department_id | INT | Referenced department, when assigned |
| salary | NUMERIC(12,2) | Annual salary |