# Creating the Database and Loading the Data Into it
create database bank;
use bank;
#### Data Exploration
select count(distinct RowNumber) as Total_Customers from bank_churn;
#### Number of Distinct Customer is 10000
select IsActiveMember,count(distinct RowNumber) As Customers from bank_churn
group by IsActiveMember;
#### Number Of Active Customer is 5151 and InActive Customer is 4849
select * from bank_churn;
#### But These Column are are in Numerical So we need to Change it into Text columns
CREATE TABLE bank_data AS
SELECT RowNumber,Surname,Age,Balance,
NumOfProducts,EstimatedSalary,Location,
Gender,CreditCard,Activity,Exited,
Credit_div,`Bank DOJ`
FROM bank.customerinfo b
JOIN (SELECT RowNumber,CustomerId,Age,Tenure,Balance,NumOfProducts,EstimatedSalary,`Bank DOJ`,
CASE
WHEN GeographyID = 1 THEN 'France'
WHEN GeographyID = 2 THEN 'Spain'
WHEN GeographyID = 3 THEN 'Germany'
END AS Location,
CASE
WHEN GenderID = 1 THEN 'Male'
WHEN GenderID = 2 THEN 'Female'
END As Gender,
CASE
WHEN HasCrCard = 1 THEN 'Credit Card Holder'
WHEN HasCrCard = 0 THEN 'Non Credit Card Holder'
END as CreditCard,
CASE
WHEN IsActiveMember = 1 THEN 'Active Member'
WHEN IsActiveMember = 0 THEN 'InActive Member'
END as Activity,
CASE
WHEN Exited = 1 THEN 'Exit'
WHEN Exited = 0 THEN 'Retain'
END as Exited,
CASE
WHEN CreditScore BETWEEN 0 AND 299 THEN 'Horrible'
WHEN CreditScore BETWEEN 300 AND 549 THEN 'Poor'
WHEN CreditScore BETWEEN 550 AND 669 THEN 'Fair'
WHEN CreditScore BETWEEN 670 AND 739 THEN 'Good'
WHEN CreditScore BETWEEN 740 AND 799 THEN 'Very Good'
WHEN CreditScore >= 800 THEN 'Excellent'
END as Credit_div
FROM bank.bank_churn) c
ON b.CustomerId = c.CustomerId
-
Notifications
You must be signed in to change notification settings - Fork 0
roshancharlie/Bank-Churn-Analysis-Power-B.I.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published