How would you write a SQL query to calculate total annual sales for each employee and then return the employee with the highest total sales?
Use the employees and sales tables. Treat each calendar year separately and return one highest-performing employee-year.
employee_id, employee_name, sales_year, and total_annual_sales.employee_id, then the earliest year.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee full name |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| employee_id | INT | Employee responsible for the sale |
| sale_date | DATE | Date when the sale occurred |
| sale_amount | NUMERIC(12,2) | Sale amount in dollars |