Write a SQL query using a subquery and a CASE statement to segment users based on their subscription tier and active login frequency at McAfee.
Use login events from March 2025 to calculate each user's active login count. Classify Gold or Platinum users with at least two active logins as Priority, users with at least two active logins as Engaged, users with one active login as At Risk, and users with none as Dormant.
user_id, subscription_tier, active_login_count, and user_segment.user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique McAfee user identifier |
| VARCHAR(255) | User email address | |
| subscription_tier | VARCHAR(30) | Current McAfee subscription tier |
| Column | Type | Description |
|---|---|---|
| login_idPK | INT | Unique login event identifier |
| user_id | INT | User associated with the login event |
| login_at | TIMESTAMP | Timestamp when the user logged in |