{
  "id": 5796933,
  "title": "How to Solve a Month-over-Month Churn SQL Interview Question",
  "url": "https://urgent.news/2026/09/05/how-to-solve-a-month-over-month-churn-sql-interview-question",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-05T16:21:20.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/rahmanfrr/how-to-solve-a-month-over-month-churn-sql-interview-question-1abo"
  },
  "original_language": "en",
  "account": "The task at hand is to compute the month-over-month churn rate for each month in the year 2025, using a subscriptions table with specific columns. A user is deemed active during a month if their subscription either started before the beginning of that month, ended on or after the start of the current month, or has no end date indicating ongoing subscription. The churn rate is calculated by dividing the number of users who churned during a given month by the total number of users active in the preceding month. To achieve this, a series of SQL steps are employed.\n\nFirstly, a calendar of months is created, ensuring each month from December 2024 to December 2025 is represented. This calendar includes a reference to the previous and next month for comparison purposes. Subsequently, a list of active users for each month is generated by joining the subscriptions table with the calendar. This list is filtered to include only those users whose subscription status aligns with the current month's date criteria. The resulting list ensures each user is counted only once per month, even if they have multiple subscription records.\n\nThe second phase focuses on identifying users who have churned, i.e., those who were active in the previous month but not in the current month. This is accomplished through an anti-join operation between the active users of the previous and current months. Any user appearing in the previous month's list but absent in the current month's list is flagged as churned.\n\nFinally, the churn rate is calculated by dividing the number of churned users by the total number of active users from the previous month. This calculation is executed for each month, yielding a churn rate that reflects the proportion of users who ceased their subscriptions compared to those who were active a month prior. This SQL solution effectively addresses the problem statement by systematically filtering and comparing user activity across consecutive months, providing a clear metric for assessing churn trends throughout 2025.",
  "summary": "Churn questions are common in data engineering and business intelligence interviews because they test more than basic aggregation. You need to work with time periods, define when a user is active, handle open-ended subscriptions, and compare one month with another. I added this scenario to DataCurlew , where you can practice it directly in your browser. Let’s walk through the solution. The…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}