Intuit wants a compensation view for employees supporting TurboTax, QuickBooks, and Credit Karma. Write a PostgreSQL query that joins employee records to salary records and ranks employees by salary within each company.
Requirements
- Join employees to salaries using
employee_id and include only employees with a non-null salary record.
- Assign a salary rank within each company using
RANK(), with the highest salary receiving rank 1. Employees with equal salaries must share the same rank.
- Return the employee name, company, salary, and rank.
- Order the final result by company name, salary rank, and employee name.