Assume the company stores employee compensation by department assignment.
employee_dept_salaryemployee_id
INT
employee_name
VARCHAR
department_id
INT
department_name
VARCHAR
salary
NUMERIC
effective_date
DATE (optional; if present, assume you want the most recent salary)
Notes:
(employee_id, department_id)
(e.g., historical changes) unless otherwise stated.
Write a SQL query to return the top 1 highest-paid employee per department.
For each department, return:
department_id
,
department_name
employee_id
,
employee_name
salary