Sun Life Financial's QA team needs to validate salary-ranking logic in an employee reporting query. Write a PostgreSQL query that identifies employees earning the third-highest distinct salary among active employees with recorded compensation.
Requirements
- Join
employees to employee_compensation using employee_id.
- Exclude inactive employees and rows where
salary is NULL.
- Rank distinct salary values from highest to lowest and return every employee tied at rank 3.
- Order the results by salary descending and employee ID ascending.