Author: Divya Jagtap Type: Pure MySQL / SQL portfolio project (no BI tools, no ML, no external scripts)
This project analyzes churn, revenue, usage, payment behaviour, and support-ticket patterns for a simulated telecom company using only SQL. It's built to be small enough to fully explain in a data analyst / data science internship interview, while still covering the SQL skills companies actually screen for: joins, subqueries, CTEs, window functions, and business-metric calculation.
The entire dataset (~1,500 customers, 12 months of usage and billing, ~800 support
tickets) is generated inside MySQL itself using RAND(), recursive CTEs, and
date functions — there are no CSV imports and no external data source.
Telecom is one of the clearest industries to demonstrate churn analysis because the core metrics (churn rate, retention rate, MRR, ARPU) map directly onto subscription businesses in general — the same logic applies to SaaS, OTT platforms, gyms, and insurance. It's a natural project to discuss in a Data Analyst / Data Science interview.
Five tables, connected by customer_id / plan_id:
| Table | Purpose | Approx. Rows |
|---|---|---|
subscription_plans |
Master list of plans (price, data/call/SMS limits) | 6 |
customers |
One row per customer (demographics, plan, churn status) | ~1,500 |
usage_details |
Monthly data/call/SMS usage per customer | ~15,000 |
billing |
Monthly invoice + payment status per customer | ~15,000 |
support_tickets |
Customer support interactions | ~800 |
See 01_database_schema.sql for full DDL with constraints and indexes.
Run the files in this exact order:
| # | File | What it does |
|---|---|---|
| 1 | 01_database_schema.sql |
Creates the database and all 5 tables |
| 2 | 02_data_quality.sql |
Generates the full synthetic dataset + runs data quality checks |
| 3 | 03_customer_analysis.sql |
Customer demographics and tenure segmentation |
| 4 | 04_churn_analysis.sql |
Churn rate, retention rate, churn by plan and by month |
| 5 | 05_revenue_analysis.sql |
MRR trend, ARPU, top revenue customers |
| 6 | 06_usage_billing_support.sql |
Usage utilisation, payment behaviour, ticket analysis |
| 7 | 07_advanced_sql.sql |
RANK / DENSE_RANK / ROW_NUMBER / LAG demonstrations |
| 8 | 08_churn_risk.sql |
Rule-based churn-risk scoring model (Low/Medium/High) |
| 9 | 09_business_questions.sql |
18 business questions answered end-to-end |
- Install MySQL 8.0+ (Workbench, CLI, or any MySQL client).
- Open each
.sqlfile in numeric order and execute it fully. - File 2 (
02_data_quality.sql) can take a few seconds since it generates ~30,000+ rows — this is expected. - Because the dataset uses
RAND(), your exact numbers will differ slightly from any example numbers inbusiness_insights.md— that's normal for a randomly generated dataset. The patterns and relationships will hold.
SELECT,WHERE,GROUP BY,HAVING,ORDER BY- Multiple
JOINtypes (INNER, LEFT) CASE WHENfor segmentation and scoring logic- Correlated and non-correlated subqueries
- Common Table Expressions (CTEs), including multiple chained CTEs
- Window functions:
RANK(),DENSE_RANK(),ROW_NUMBER(),LAG(),PARTITION BY - Date functions:
DATE_ADD,DATE_FORMAT,TIMESTAMPDIFF,DATEDIFF - Aggregate functions with
ROUND()for clean reporting
08_churn_risk.sql builds a transparent, rule-based (not machine-learning)
risk score out of 5 factors, each worth 0–2 points (short tenure is 0-or-2):
- Overdue/failed payments
- Low overall data usage (vs. plan limit)
- Declining usage trend (via
LAG()) - Multiple support tickets
- Short tenure (< 6 months)
Total score (0–10) maps to Low (0–2) / Medium (3–6) / High (7–10) risk. This is intentionally simple and 100% explainable — a good middle ground between "no churn model at all" and a full ML pipeline, and appropriate for a SQL-only portfolio project.
- Not a machine learning project — the churn-risk score is rule-based SQL logic.
- Not a BI/dashboard project — no Tableau, Power BI, or Excel.
- Not using Python/Flask/Streamlit — 100% SQL, run in any MySQL client.
telecom_churn_project/
├── 01_database_schema.sql
├── 02_data_quality.sql
├── 03_customer_analysis.sql
├── 04_churn_analysis.sql
├── 05_revenue_analysis.sql
├── 06_usage_billing_support.sql
├── 07_advanced_sql.sql
├── 08_churn_risk.sql
├── 09_business_questions.sql
├── README.md
├── business_insights.md
├── interview_questions.md
└── resume_bullets.md