Write a query using window functions to rank customers based on their total loan amounts within each region for Lendbuzz.
Use the customers and loans tables. Include customers with at least one loan and a non-null region.
region, customer_name, total_loan_amount, and regional_rank.region, regional_rank, then customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique Lendbuzz customer identifier |
| customer_name | VARCHAR(100) | Customer's full name |
| region | VARCHAR(50) | Customer's geographic region |
| Column | Type | Description |
|---|---|---|
| loan_idPK | INT | Unique loan identifier |
| customer_id | INT | Customer associated with the loan |
| loan_amount | DECIMAL(12,2) | Principal amount of the loan |