Write a SQL query using window functions to rank users by transaction amount within each region.
Calculate each user's total transaction amount across their transactions. Include users with at least one transaction, assign the same rank to tied totals, and exclude users without transactions.
user_id, user_name, region, total_transaction_amount, and user_rankregion ascending with NULL regions last, then user_rank ascending and user_id ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User's display name |
| region | VARCHAR(50) | User's geographic region |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| user_id | INT | User associated with the transaction |
| amount | DECIMAL(12,2) | Transaction amount |