Write a SQL query to find the top 5 users by total number of purchases in each month.
Use the users and purchases tables. Include only users with matching purchase records. If users tie on purchase count, order the tied users by user_id ascending.
purchase_month, user_id, and purchase_count.purchase_month ascending, purchase_count descending, and user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| username | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| user_id | INT | User who made the purchase |
| purchased_at | TIMESTAMP | Timestamp when the purchase occurred |