Write a SQL query to identify customer churn patterns over a rolling three-month window, accounting for seasonal variations.
Use the provided customer, monthly activity, and seasonal factor data. Evaluate the latest available month, treating missing activity as inactivity and preserving customers with no activity.
Output
- One row per customer for the latest available month.
- Columns:
customer_id, customer_name, window_end, rolling_active_months, rolling_spend, seasonal_expected_active_months, seasonally_adjusted_activity_ratio, and churn_pattern.
- Classify customers as
churned, at_risk, or retained; sort by customer_id ascending.