Your question is Stock Span and SQL Salary Query. 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.
Avalara needs a compensation report showing employees who earn the second-highest distinct salary among active employees. Write a PostgreSQL query using a window function and a join to return all employees tied at that salary.
is_active is TRUE and salary is not NULL.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(12,2) | Annual employee salary |
| is_active | BOOLEAN | Whether the employee is currently active |
| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Avalara department name |