Write a SQL query to segment customers into new, returning, and churned users based on their activity dates.
Use the activity period from 2025-01-01 through 2025-01-31. A new customer first became active during this period, a returning customer was active during the period and had earlier activity, and a churned customer had no activity during the period but last activity on or before 2024-12-01.
customer_id, segment, first_activity_date, and last_activity_date.customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity identifier |
| customer_id | INT | Customer associated with the activity |
| activity_date | DATE | Date on which the customer was active |