What SQL query would you write to compare user engagement across two time periods?
Use January and February 2024 as the comparison periods. Treat each row in engagement_events as one engagement event, and include users with no activity.
user_id.user_id, user_email, first_period_events, second_period_events, event_change, and percent_change.event_change is February events minus January events. Return NULL for percent_change when January events are zero.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_email | VARCHAR(255) | User email address |
| created_at | DATE | Date the user account was created |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique engagement event identifier |
| user_id | INT | User associated with the event |
| event_type | VARCHAR(100) | Type of engagement event |
| event_timestamp | TIMESTAMP | Timestamp when the event occurred |