StreamWave wants to measure how each user’s activity changes from one week to the next. Write a SQL query to compare weekly behavior using window functions.
user_id and week_start.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | Full name of the user |
| signup_date | DATE | Date the user signed up |
| plan_type | VARCHAR(20) | Subscription plan type |
| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique session identifier |
| user_id | INT | User associated with the session |
| session_start | TIMESTAMP | Timestamp when the session started |
| minutes_watched | INT | Minutes watched during the session |
| device_type | VARCHAR(20) | Device used for the session |