{"id":26662661,"url":"https://github.com/shubhamnaiik/bank-churn-analysis-sql","last_synced_at":"2025-03-25T14:17:38.238Z","repository":{"id":284038242,"uuid":"953621945","full_name":"ShubhamNaiik/Bank-Churn-Analysis-SQL","owner":"ShubhamNaiik","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-24T22:09:41.000Z","size":209,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T22:24:03.924Z","etag":null,"topics":["mysql","visual-studio-code"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShubhamNaiik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-23T19:18:35.000Z","updated_at":"2025-03-24T22:09:44.000Z","dependencies_parsed_at":"2025-03-24T22:34:12.411Z","dependency_job_id":null,"html_url":"https://github.com/ShubhamNaiik/Bank-Churn-Analysis-SQL","commit_stats":null,"previous_names":["shubhamnaiik/bank-churn-analysis","shubhamnaiik/bank-churn-analysis-sql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamNaiik%2FBank-Churn-Analysis-SQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamNaiik%2FBank-Churn-Analysis-SQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamNaiik%2FBank-Churn-Analysis-SQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShubhamNaiik%2FBank-Churn-Analysis-SQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShubhamNaiik","download_url":"https://codeload.github.com/ShubhamNaiik/Bank-Churn-Analysis-SQL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245476718,"owners_count":20621699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","visual-studio-code"],"created_at":"2025-03-25T14:17:37.369Z","updated_at":"2025-03-25T14:17:38.227Z","avatar_url":"https://github.com/ShubhamNaiik.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bank Churn Analysis – SQL Project\n\n**Author:** Shubham Naik  \n**Tools Used:** SQL (MySQL), Visual Studio  \n\n---\n\n## Introduction\n\nThis SQL-based project analyzes churned bank customers using demographic and financial data. The purpose is to identify key trends, behavioral patterns, and risk segments associated with customer churn. Insights derived from this project help inform customer retention strategies and product improvements.\n\n---\n\n## Objective\n\nThe goal is to build a comprehensive SQL-driven backend to explore **why customers leave** the bank. Through a series of structured queries, the analysis uncovers churn trends across age, income, card usage, tenure, and demographic factors.\n\n---\n\n##  Dataset Overview\n\nThe dataset `bank_churn_data.csv` includes **1,627 records** representing **only churned customers**.  \n\n| Column Name         | Description                                      |\n|---------------------|--------------------------------------------------|\n| clientnum           | Unique client identifier                         |\n| customer_age        | Age of the customer                              |\n| gender              | Gender of the customer                           |\n| dependent_count     | Number of dependents                             |\n| education_level     | Educational background                           |\n| marital_status      | Marital status                                   |\n| income              | Income category                                  |\n| card_category       | Type of credit card held                         |\n| months_on_book      | Duration as a client (in months)                 |\n| credit_limit        | Credit limit assigned to the customer            |\n| utilization_ratio   | Ratio of utilized credit to credit limit         |\n| balance             | Current account balance                          |\n| churn               | Indicates if the client churned (all = Yes)      |\n\n---\n##  Core Questions Answered\n1. What are the average financial metrics (e.g., credit limit, utilization ratio, age)?\n2. Which card categories and income groups churn the most?\n3. How long do customers typically stay before churning?\n4. Which demographic groups (gender, age, marital status) have higher churn?\n5. How does credit utilization differ among churned clients?\n--- \n\n##  SQL Queries and Analysis\n\n### 1. Total Customers, Age, Credit \u0026 Utilization\n```sql\nSELECT \n        COUNT(clientnum), \n        ROUND(AVG(customer_age)), \n        ROUND(AVG(credit_limit), 2), \n        ROUND(AVG(utilization_ratio), 2) \nFROM bank_churn_data;\n```\n\n![image](https://github.com/user-attachments/assets/2c3b891a-bfb0-47bc-8868-08ff4da0afa8)\n\nKey Insight:\n- Total Customers: 1,627\n- Average Age: 47 years\n- Average Credit Limit: $8,136.04\n- Average Utilization Ratio: 16.0%\n\n### 2. Average Balance and Credit by Income Group\n```sql\n\nSELECT \n    income, \n    AVG(balance) AS avg_balance, \n    AVG(credit_limit) AS avg_credit_limit \nFROM bank_churn_data \nGROUP BY income\nORDER BY avg_balance DESC;\n```\n![image](https://github.com/user-attachments/assets/29841096-06c3-48c2-8a2e-b571b5702780)\n\nKey Insight: Customers earning $80K–$120K have higher balances and access to more credit. However, even lower-income groups hold significant credit limits, suggesting broad access.\n\n### 3. Utilization Distribution Categories\n``` SQL \nSELECT \n    CASE \n        WHEN utilization_ratio \u003c 0.2 THEN 'Low (0-20%)'\n        WHEN utilization_ratio BETWEEN 0.2 AND 0.5 THEN 'Moderate (20-50%)'\n        ELSE 'High (50%+)' \n    END AS utilization_category,\n    COUNT(*) AS total_customers\nFROM bank_churn_data\nGROUP BY \n    CASE \n        WHEN utilization_ratio \u003c 0.2 THEN 'Low (0-20%)'\n        WHEN utilization_ratio BETWEEN 0.2 AND 0.5 THEN 'Moderate (20-50%)'\n        ELSE 'High (50%+)' \n    END;\n```\n\n![image](https://github.com/user-attachments/assets/5e055cf8-712a-4cc7-9cf2-fc0de4be716a)\n\nKey Insight: 58.5% of churned customers had low credit utilization (0–20%), indicating churn may be driven by lack of engagement, not debt pressure.\n\n### 4. Top 10 Customers by Utilization\n```SQL \nSELECT \n    clientnum, \n    customer_age, \n    income, \n    credit_limit, \n    ROUND(utilization_ratio, 3) AS utilization_ratio\nFROM bank_churn_data\nORDER BY utilization_ratio DESC\nLIMIT 10;\n```\n![image](https://github.com/user-attachments/assets/ec88f387-b0a8-44aa-a136-590293f51d4b)\n\n### 5. Gender-Based Financial Behavior\n```sql\nSELECT \n    gender, \n    COUNT(*) AS total_customers, \n    ROUND(AVG(balance), 2) AS avg_balance, \n    ROUND(AVG(utilization_ratio), 2) AS avg_utilization_ratio\nFROM bank_churn_data \nGROUP BY gender \nORDER BY gender;\n```\n![image](https://github.com/user-attachments/assets/bd3e7f29-059b-49db-beab-39e9c9ca3e12)\n\nKey Insight:\n- Female customers: 57.2% of churned clients\n- Their credit usage is slightly lower on average than males.\n\n### 6. Card Category and Churn Volume\n```sql\n\nSELECT \n    card_category, \n    COUNT(clientnum) AS number_of_customers, \n    ROUND(AVG(balance), 2) AS avg_balance, \n    ROUND(AVG(utilization_ratio), 2) AS avg_utilization_ratio\nFROM bank_churn_data \nGROUP BY card_category \nORDER BY number_of_customers DESC;\n``` \n\n![image](https://github.com/user-attachments/assets/77e114c6-5744-41d1-881e-4bc44b304e5a)\n\nKey Insight:\n- Blue cardholders: 93% of churned clients\n- Suggests the basic credit card tier is underperforming in terms of retention.\n\n### 7. Average Balance by Income Group\n```sql\n-- Average Bank Balance by Income Level\nSELECT \n    income, \n    ROUND(AVG(balance)) AS average_balance \nFROM bank_churn_data \nGROUP BY income \nORDER BY average_balance DESC;\n```\n\n![image](https://github.com/user-attachments/assets/d79ad1b5-f659-4b00-b8f5-45618b53a8ca)\n\nKey Insight: Higher income = higher average balance, as expected. However, mid-tier income groups churn rapidly.\n\n### 8. Marital Status Distribution\n```sql\nSELECT \n    marital_status, \n    COUNT(clientnum) AS number_of_customers \nFROM bank_churn_data \nGROUP BY marital_status \nORDER BY number_of_customers DESC;\n\n```\n![image](https://github.com/user-attachments/assets/d0c48135-fea0-45a8-a72a-88d45e4f4924)\n\nKey Insight: \n- Married customers: 43.6% of all churned users.\n- Programs should address relationship-based financial needs and family planning stages.\n\n\n### 9. Customer Tenure (Months on Book)\n```sql\nSELECT \n    months_on_book, \n    COUNT(*) AS total_customers \nFROM bank_churn_data \nGROUP BY months_on_book \nORDER BY months_on_book DESC;\n``` \n\n![image](https://github.com/user-attachments/assets/078b3fc9-508c-4195-924b-a9ccb608f722)\n\nKey Insight:\n- Most customers churn between 35 and 50 months of tenure.\n- Indicates a critical drop-off point after ~3 years.\n\n### 10. Income Group with Shortest Tenure\n```sql\nSELECT \n    income, \n    COUNT(*) AS total_churned, \n    ROUND(AVG(months_on_book), 2) AS avg_tenure_before_churn\nFROM bank_churn_data \nGROUP BY income \nORDER BY avg_tenure_before_churn ASC;\n```\n![image](https://github.com/user-attachments/assets/a53bcdb4-a23f-49e6-bfaf-8246e43ac7e5)\n\nKey Insight:\n- $40K–$60K income group has the shortest average tenure at ~35.77 months\n- These mid-income customers may need targeted value-based programs.\n\n### 11.Age Group Segmentation\n``` sql \nSELECT \n    age_group, \n    COUNT(*) AS number_of_customers\nFROM (\n    SELECT \n        CASE\n            WHEN customer_age BETWEEN 18 AND 25 THEN '18-25'\n            WHEN customer_age BETWEEN 26 AND 35 THEN '26-35'\n            WHEN customer_age BETWEEN 36 AND 45 THEN '36-45'\n            WHEN customer_age BETWEEN 46 AND 55 THEN '46-55'\n            ELSE '56+' \n        END AS age_group\n    FROM bank_churn_data\n) AS age_groups\nGROUP BY age_group\nORDER BY number_of_customers DESC;\n```\n\n![image](https://github.com/user-attachments/assets/276afe5b-730e-4421-bdee-25df7b5e7280)\n\nInsight: \n| Age Group | % of Churned Customers |\n|-----------|------------------------|\n| 46–55     | 28.6%                  |\n| 36–45     | 23.8%                  |\n| 26–35     | 20.7%                  |\n| 56+       | 18.1%                  |\n| 18–25     | 8.8%                   |\n\n- Middle-aged customers (36–55) are at highest risk of churn. These groups should be prioritized for retention and product redesign.\n\n---\n\n##  Key Insights Summary\n\n| Insight Area           | Findings                                                  |\n|------------------------|-----------------------------------------------------------|\n| Utilization Ratio      | 58.5% of churned customers had low utilization (\u003c20%)     |\n| Credit Limit           | Average credit limit = $8,136.04                          |\n| Tenure Risk            | Highest churn at 35–50 months                             |\n| Blue Card Impact       | 93% of churned clients used the basic Blue card           |\n| Mid-Income Sensitivity | $40K–$60K earners had shortest tenure: 35.77 months       |\n| Demographics           | 57.2% female, 43.6% married among churned clients         |\n| Age Risk Zone          | 46–55 age group = highest churn segment                   |\n\n---\n\n###  Key Metrics\n\n- **Total Churned Clients:** 1,627  \n- **Average Age:** 47 years  \n- **Average Credit Limit:** $8,136.04  \n- **Average Utilization Ratio:** 16.0%\n\n###  Financial Behavior\n\n- **58.5%** of customers used **less than 20%** of their credit (Low Utilization)\n- Churn isn't always due to financial stress—**inactivity may be the cause**\n- Higher-income clients tend to have larger balances and credit limits\n\n###  Card Category Insights\n\n- **Blue Card** holders account for **93% of churned customers**\n- Premium cardholders (Silver, Gold, Platinum) also churned—indicating benefit gaps\n\n###  Demographics\n\n- **57.2%** of churned users were **female**\n- **43.6%** were **married**\n- Most churned clients fall into the **46–55 age group**\n\n### Tenure Analysis\n\n- Churn peaks between **35–50 months** of customer relationship\n- Clients with **$40K–$60K** income had the **shortest tenure** (~35.77 months)\nThis SQL-based analysis provides actionable insights into customer churn behavior.\n---\n\n##  Recommendations\n\n- **Improve Blue card benefits** to increase engagement  \n- **Introduce re-engagement campaigns** before the 36-month mark  \n- **Create personalized offers** for mid-income earners  \n- **Target 46–55 age group** with tailored retention strategies  \n- **Monitor low utilization** as an early signal for churn risk  \n- **Strengthen onboarding** and first-year experiences\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhamnaiik%2Fbank-churn-analysis-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubhamnaiik%2Fbank-churn-analysis-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubhamnaiik%2Fbank-churn-analysis-sql/lists"}