nitish4393 / BANK_CUSTOMER_CHURN_ANALYSIS_USING_SQL

This project focuses on analyzing bank customer churn, also known as customer attrition, using SQL and Power BI. Customer churn refers to the phenomenon where customers cease doing business with a bank or switch to another bank, impacting the bank's customer base and revenue.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BANK_CUSTOMER_CHURN_ANALYSIS_USING_SQL & Power BI

What is Bank Churn?

Bank customer churn, also known as customer attrition, refers to the phenomenon where customers stop doing business with a bank or switch to another bank. Churn is a critical metric for banks as it directly impacts their customer base and revenue. Customer churn can occur due to various reasons, such as dissatisfaction with services, better offers from competitors, changes in financial needs, or poor customer experiences.

Understanding and predicting bank customer churn is crucial for banks to proactively manage customer relationships, improve customer satisfaction, and reduce revenue loss. By identifying customers who are at a higher risk of churning, banks can implement targeted retention strategies, personalized marketing campaigns, and tailored customer service to mitigate churn and enhance customer loyalty.

bank_project

ABOUT DATA :-

  • IN THIS DATASET WE HAVE 12 COLUMN WITH 10000 ROWS

This dataset is for ABC Multistate bank with following columns:

customer_id, credit_score, country, gender, age, tenure, balance, products_number, credit_card, active_member, estimated_salary, churn

AIM :-

The aim of the data will be predicting the Customer Churn.

ANALYSIS :-

create database portfoli;
use portfoli;

create table bank_customer_churn 
(customer_id int,
credit_score int,
country varchar(15),
gender varchar(8),
age int,
tenure int,
balance float,
products_number int,
credit_card int,
active_member int,
estimated_salary float,
churn int)

A] Overview of the dataset:

select count(*) from bank_customer_churn;
Screenshot 2024-03-13 233842

Q]Are there any missing values in the dataset?

 select count(distinct customer_id) AS TOTAL_UNIQUE_RECORDS
 from bank_customer_churn;
  • NO THERE ARE NO MISSING ITEMS
Screenshot 2024-03-13 234320
  • In this case, you're aiming to enrich the bank_customer_churn table by incorporating a new column named credit_score_category.
  • This code snippet enhances the data by adding a new dimension (credit score category). This WILL be beneficial for further analysis and data visualization tasks.
alter table bank_customer_churn
add column credit_score_category varchar(10);

update bank_customer_churn
set credit_score_category = CASE
    WHEN credit_score >= 800 THEN 'Excellent'
    WHEN credit_score >= 740 THEN 'Very Good'
    WHEN credit_score >= 670 THEN 'Good'
    WHEN credit_score >= 580 THEN 'Fair'
    ELSE 'Poor'
  END ;

  -- Modify the data type of the age_category column in the bank_customer_churn table to varchar(20). This allows for
     storing more descriptive category labels.
  -- Update the age_category values by categorizing customers based on their age ranges using a CASE statement. This enhances
     data organization and facilitates further analysis.
  
alter table bank_customer_churn
modify age_category varchar(20);


update bank_customer_churn
set age_category=CASE
    WHEN age < 18 THEN 'Minor'
    WHEN age >= 18 AND age < 30 THEN 'Young Adult'
    WHEN age >= 30 AND age < 50 THEN 'Middle-aged Adult'
    WHEN age >= 50 AND age < 65 THEN 'Mature Adult'
    ELSE 'Senior'
  END ;

B] Exploratory Data Analysis (EDA):

Q] What is the distribution of the target variable (churn)?

select churn,count(churn) as tot ,
concat(round(COUNT(churn) * 100.0 / SUM(COUNT(churn)) OVER (),2),'%') AS churn_percentage
 FROM bank_customer_churn 
group by churn;
Screenshot 2024-03-14 003713

Q] How do the input variables (credit score, age, balance, etc.) vary with respect to churn?

select credit_score_category,count(case when churn=1 then 1 end ) as tot_churn_customer
from bank_customer_churn
group by credit_score_category
order by tot_churn_customer desc;
Screenshot 2024-03-14 003919
select age_category,count(case when churn=1 then 1 end ) as tot_customer_churn
from bank_customer_churn
group by age_category
order by tot_customer_churn desc;
Screenshot 2024-03-14 004329
select gender,count(case when churn=1 then 1 end ) as tot_churn_customer
from bank_customer_churn
group by gender;
Screenshot 2024-03-14 004449
select country,count(case when churn=1 then 1 end ) as tot_churn_customer
from bank_customer_churn
group by country
order by tot_churn_customer desc;
Screenshot 2024-03-14 004659

Q] Are there any correlations between the input variables and churn?

  • Approximately 81% of churn is contributed by customers categorized under the credit score categories of 'Poor', 'Fair', and 'Good'.
  • Among the total of 2037 churned customers, Middle-aged Adults accounted for 1279 (approximately 62.82%), while Mature Adults contributed 591 (approximately 29.01%) to the churn rate.
  • Out of the 2037 churned customers, approximately 55.93% were Female, and approximately 44.07% were Male.
  • Out of the 2037 churned customers, approximately 39.98% were from Germany, 39.75% were from France, and 20.27% were from Spain.

c] Customer demographics analysis:

Q] What is the distribution of customers by country?

select country,count(*) as TOT_CUSTOMER
from bank_customer_churn
group by country
ORDER BY TOT_CUSTOMER DESC;
Screenshot 2024-03-14 085016

Q] How does churn vary across different demographic groups?

select country,count(case when churn=1 then 1 end ) as tot_churn_customer
from bank_customer_churn
group by country
order by tot_churn_customer desc;
Screenshot 2024-03-14 085659
  • INSIGHT
    • France has the highest number of total customers.
    • Germany has the highest number of churned customers, followed closely by France and then Spain.
    • Despite having a lower total number of customers compared to France, Germany has a higher number of churned customers, indicating a potentially higher churn rate.

d] Product and service analysis:

What is the distribution of customers by the number of products they have?

select products_number,count(*) as tot_customer
from bank_customer_churn
group by products_number
order by tot_customer desc;
Screenshot 2024-03-14 091952

How does churn vary based on the number of products a customer has?

select products_number,tot_churn_customer,tot_customer,
concat(round((tot_churn_customer / tot_customer) * 100,1),' %') as churn_rate from
(select products_number,count(case when churn=1 then 1 end ) as tot_churn_customer,count(*) as tot_customer
from bank_customer_churn
group by products_number
order by tot_churn_customer desc) as x;
Screenshot 2024-03-14 093134
  • INSIGHT
    • high churn rate observed in product categories 3 and 4. This could involve factors like product pricing, competition, customer service quality, or lack of features.

E] Customer behavior analysis:

Q] How does tenure (length of time as a customer) vary with churn?

SELECT tenure,count(case when churn=1 then 1 end ) as tot_churn_customer
from bank_customer_churn
group by tenure
order by tot_churn_customer desc;

Q] Do active members have lower churn rates compared to inactive members?

select active_member,CONCAT(round(tot_churn_customer/tot,2) * 100,'%') as churn_rates from(
SELECT active_member,count(case when churn=1  then 1 end ) as tot_churn_customer,
count(*) tot
from bank_customer_churn
group by active_member
order by active_member desc) x;
Screenshot 2024-03-14 100642
  • INSIGHTS
    • Customers who are not active members (active_member = 0) have a higher churn rate at approximately 27.00%. Customers who are active members (active_member = 1) have a lower churn rate at approximately 14.00%.
    • Being an active member appears to be associated with a lower churn rate compared to inactive membership. This suggests that active engagement with the bank's services may contribute to higher customer retention rates.

Are there any specific customer segments that are more prone to churn, and how can the bank address their needs?

     WITH churn_data AS (
  SELECT credit_score_category,
         COUNT(CASE WHEN churn = 0 and active_member=0 THEN 1 END) AS tot
  FROM bank_customer_churn
  GROUP BY credit_score_category
)
SELECT
  credit_score_category,tot,
  round(tot * 100.0 / SUM(tot) OVER (),2) AS per
FROM churn_data
ORDER BY tot DESC;
Screenshot 2024-03-14 102142
  • INSIGHT
    • The distribution of churned customers by credit score category indicates that a significant proportion of churned customers fall into the 'Fair', 'Poor', and 'Good' credit score categories.
    • Customers with lower credit scores ('Fair' and 'Poor') contribute to a larger portion of churn compared to those with higher credit scores ('Very Good' and 'Excellent').

PREDICTION

  • Out of the total 7963 customers, approximately 31% of them, who are categorized under the 'Fair', 'Poor', and 'Good' credit score categories and are currently inactive, are at risk of churning.

RECOMMENDATIONS

  • Focus on Customer Engagement: Encourage inactive members to become more engaged with the bank's services by offering personalized incentives , targeted promotions, and improved customer support. Actively communicate with customers to understand their needs and preferences better.

  • Improve Product Offerings: Investigate the reasons behind the high churn rates observed in product categories 3 and 4. Conduct market research to understand customer expectations, competitors' offerings, and areas for improvement. Consider adjusting product pricing, enhancing customer service quality, or introducing new features to increase customer satisfaction and retention.

  • Targeted Marketing and Retention Strategies: Develop targeted marketing campaigns and retention strategies tailored to different customer segments based on factors such as credit score categories, age groups, and gender. Offer customized products, services, and incentives to address the specific needs and preferences of each segment.

  • Enhance Customer Service Quality: Invest in training and development programs to improve the quality of customer service provided by bank staff. Implement systems for collecting and analyzing customer feedback to identify areas for improvement and ensure timely resolution of customer issues.

  • Monitor and Address Churn Contributors: Continuously monitor key factors contributing to churn, such as credit score categories, age groups, and gender. Implement proactive measures to address these contributors, such as targeted interventions, loyalty programs, and product enhancements.Conduct focus groups or surveys with customers from 'Fair', 'Poor', and 'Good' credit score segments to understand their pain points and unmet needs.

  • Expand Market Reach: While France currently has the highest number of total customers, consider strategies to expand market reach in other regions, such as Germany and Spain. Develop localized marketing campaigns and product offerings to attract and retain customers in these regions.

About

This project focuses on analyzing bank customer churn, also known as customer attrition, using SQL and Power BI. Customer churn refers to the phenomenon where customers cease doing business with a bank or switch to another bank, impacting the bank's customer base and revenue.