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.user_id, user_name, week_start, total_sessions, total_minutes_watched, previous_week_sessions, previous_week_minutes_watched, sessions_wow_change, minutes_wow_change.user_id, then ascending by week_start.week_start representing the Monday date.minutes_watched values as 0 when calculating total minutes watched.| 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 |