Sopra Steria's people analytics team needs to identify employees earning the second-highest distinct salary among currently active employees. Write a PostgreSQL query that returns every employee tied at that salary, including department information when available.
Requirements
- Consider only active employees with a non-null salary.
- Determine the second-highest distinct salary, so employees tied at the highest salary do not occupy two ranking positions.
- Return the employee name, salary, and department name. Preserve employees whose department reference does not match a department record.
- Order the results by employee name ascending.