← All SQL interview questions

Flag subscription churn risk

MediumCASE StatementsZoomInfoPayPal

A retention squad triages accounts by how long they have been inactive and whether auto-renew is switched on.

From subscriptions, return account_code, days_inactive, auto_renew and a risk_band computed as:

  • Critical when days_inactive is 60 or more and auto_renew is false
  • High when days_inactive is 60 or more (auto-renew on)
  • Watch when days_inactive is between 30 and 59
  • Healthy otherwise

Sample data

Table: subscriptions

14 row(s) · showing first 8

sub_idINTaccount_codeTEXTplanTEXTdays_inactiveINTauto_renewBOOLEAN
1AC-501Starter4true
2AC-502Growth34true
3AC-503Growth61false
4AC-504Scale88true
5AC-505Starter29false
6AC-506Scale59true
7AC-507Growth60true
8AC-508Starter120false

Practising alone only goes so far — our live cohorts pair SQL depth with dashboards, agentic analytics projects and mock interviews.

Explore the program