Describe how you would solve SQL ranking questions and aggregation problems.
Use the supplied employees, departments, and sales tables. Return each employee's completed sales total and position within their department.
department_name, employee_id, employee_name, total_sales, and rank_position.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique department identifier |
| department_name | VARCHAR(100) | Department name |
| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| employee_name | VARCHAR(100) | Employee name |
| department_id | INT | Assigned department identifier |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique sale identifier |
| employee_id | INT | Employee associated with the sale |
| amount | DECIMAL(10,2) | Sale amount |
| status | VARCHAR(20) | Sale processing status |