How do you use window functions in SQL?
Using the provided employees and departments tables, write a PostgreSQL query that demonstrates this by ranking active employees by salary within their department.
department_id, department_name, employee_name, salary, and salary_rank.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department_id | INT | Referenced department identifier |
| salary | NUMERIC(10,2) | Annual employee salary |
| status | VARCHAR(20) | Employment status |
| hire_date | DATE | Employee hire date |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |