Your question is Rank Employees Within Departments. 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.
Revature wants a salary ranking for active employees across its internal departments. Write a PostgreSQL query that returns each qualifying employee with their department, salary, and salary rank within that department.
employees to departments and include only employees assigned to a valid department.employment_status is Active and whose salary is not NULL.RANK() so employees with equal salaries receive the same rank, and order the results by department name, salary descending, and employee ID.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee's full name |
| department_id | INT | References departments.department_id |
| salary | NUMERIC(10,2) | Annual employee salary |
| employment_status | VARCHAR(20) | Employee status such as Active or Inactive |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department display name |