⁉️ SQL Queries & First Insights

After expanding the dataset to 100,000 customers, it was time to dig deeper and run real queries on the data; I needed to understand who these customers are, what their behaviors look like, and how they interact with the bank’s products and services.

⚽ Main Goals

Write SQL queries for customer segmentation, loan analysis, and credit card health
Investigate key metrics like loan default risk and credit card utilization
Identify high-value customers for retention and upsell: first drawn for the call to action


πŸ“‹ Step by Step

πŸ“ Step 1: Wrote the customer segmentation query to analyze customer types (age, account type, balance, risk profile)
πŸ“ Step 2: Created a loan analysis query to identify credit risks of the bank
πŸ“ Step 3: Built a credit card usage query to spot high-risk users
πŸ“ Step 4: Validated first query results

πŸ”‘ Key Insights

The queries provided a glimpse into the bank’s risk exposure and allowed me to start thinking strategically about customer retention.
For example, the loan analysis revealed a higher-than-expected rejection rate in the personal loan segment, which needs immediate attention.

βš™οΈ Code Snippet: SQL Queries

SELECT 
    loan_status,
    loan_type,
    COUNT(*) as num_loans,
    ROUND(AVG(loan_amount)::numeric, 2) as avg_loan_amount,
    ROUND(SUM(loan_amount)::numeric, 2) as total_loan_portfolio,
    ROUND(AVG(interest_rate)::numeric, 2) as avg_interest_rate
FROM customer_data

πŸ“Š Bar Chart: Credit Type and Status

Credits Analysis Table The Barplot shows the credit segmentation, splitted between loans, personal and auto and the status (accepets, closed or rejected). All generated by tableau, uploading the Query output.

🎯 Next Steps

Running the last SQL queries on the expanded dataset, focusing on customer demographics, default risk and picking high-value customers Starting the Tableau Dashboard design for the Data Visualization