Deutsche Telekom wants to compare subscription churn across regional product portfolios, including MagentaMobil, MagentaTV, and broadband products. Write a PostgreSQL query to identify the top three products by churn rate within each region for subscriptions started during the first half of 2025.
Requirements
- Join regions, products, and subscriptions using their key relationships.
- Calculate each product's churn rate as churned eligible subscriptions divided by eligible subscriptions, expressed as a percentage. A subscription is churned when
churned_at is not null.
- Include products with no eligible subscriptions, treating their churn rate as
0.00 percent.
- Rank products within each region by churn rate descending, then product ID ascending, and return only the top three products per region.