How would you write a query to get the top N salaries without using the function keyword, and what performance tuning would you apply?
Assume N = 3. Return all active employees whose salary belongs to one of the three highest distinct active salary levels, including ties. Use the provided employee and department tables.
employee_id, employee_name, department_name, and salarysalary descending, then employee_id ascending| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| department_id | INT | Referenced department |
| salary | NUMERIC(12,2) | Annual salary |
| is_active | BOOLEAN | Whether the employee is currently active |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |