Given a table of user subscription changes, write a query to construct a historical timeline of each user's subscription status.
Use subscription_changes; when multiple changes share a user and timestamp, the greatest change_id is authoritative. Consecutive records with the same status represent one interval.
user_id, status, effective_from, effective_to, and is_current.effective_to is NULL for the current interval.user_id, then effective_from, then change_id.| Column | Type | Description |
|---|---|---|
| change_idPK | INT | Unique identifier for the subscription change |
| user_id | INT | Identifier of the user |
| changed_at | TIMESTAMP | Timestamp when the subscription status changed |
| subscription_status | VARCHAR(30) | Status recorded by the change event |
| change_source | VARCHAR(30) | System or workflow that recorded the change |