How would you use a CTE and window functions to find the top 3 loan officers by monthly funded volume?
Use the provided loan officer and loan tables. Include funded loans only, aggregate volume by calendar month and loan officer, and retain ties at the third rank.
funded_month, loan_officer_id, loan_officer_name, monthly_funded_volume, and monthly_rank.funded_month, monthly_rank, and loan_officer_id.| Column | Type | Description |
|---|---|---|
| loan_officer_idPK | INT | Unique loan officer identifier |
| loan_officer_name | VARCHAR(100) | Loan officer display name |
| branch_name | VARCHAR(100) | Veterans United Home Loans branch name |
| Column | Type | Description |
|---|---|---|
| loan_idPK | INT | Unique loan identifier |
| loan_officer_id | INT | Officer associated with the loan |
| funded_at | TIMESTAMP | Timestamp when the loan was funded |
| loan_amount | DECIMAL(14,2) | Funded loan amount |
| loan_status | VARCHAR(30) | Current loan status |