Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Overview

This project applies the CAMELS regulatory framework to evaluate and compare the financial health of India's top 5 private and public sector banks using SQL.

The analysis covers FY2020 to FY2024 — a period that includes the COVID-19 stress cycle, the RBI rate hiking phase, and one of the most dramatic NPA cleanup stories in emerging market banking history.

Banks covered: HDFC Bank, ICICI Bank, SBI, Kotak Mahindra Bank, Axis Bank


The CAMELS Framework

CAMELS is the regulatory framework used by the RBI, Federal Reserve, and global banking supervisors to assess bank health. Each letter represents a dimension of financial strength:

Letter Dimension Metrics Used
C Capital Adequacy Capital Adequacy Ratio (CAR), CASA Ratio
A Asset Quality Net NPA % (preferred over Gross NPA — accounts for provisioning buffer)
M Management Quality Not modelled — operating expense data unavailable in dataset
E Earnings Net Interest Margin (NIM), Return on Assets (ROA)
L Liquidity CASA Ratio (proxy for low-cost stable funding)
S Sensitivity Not modelled — market risk data outside dataset scope

Why ROA over ROE for banks: Banks operate with very thin equity bases relative to total assets — ROE can be inflated by leverage rather than genuine operational strength. ROA strips out leverage effects and shows true asset productivity. This is why banking regulators and analysts prefer ROA as the primary earnings metric.

Why NIM over NII: Net Interest Income (NII) is an absolute number — a larger bank will always have higher NII. NIM normalises for balance sheet size and shows the actual spread efficiency of the lending franchise. Comparing HDFC Bank's NII to Kotak's NII is meaningless; comparing their NIMs is insightful.


Database Schema

CREATE TABLE banks (
  bank_id   INT PRIMARY KEY,
  bank_name VARCHAR(50),
  type      VARCHAR(30)   -- 'Private' or 'Public'
);

CREATE TABLE financials (
  id                   INT AUTO_INCREMENT PRIMARY KEY,
  bank_id              INT,
  fiscal_year          INT,
  net_interest_income  DECIMAL(10,2),  -- ₹ Crores
  nim                  DECIMAL(5,2),   -- Net Interest Margin %
  gross_npa            DECIMAL(5,2),   -- Gross NPA %
  net_npa              DECIMAL(5,2),   -- Net NPA %
  casa_ratio           DECIMAL(5,2),   -- CASA Ratio %
  roe                  DECIMAL(5,2),   -- Return on Equity %
  roa                  DECIMAL(5,2),   -- Return on Assets %
  car                  DECIMAL(5,2),   -- Capital Adequacy Ratio %
  loan_growth          DECIMAL(5,2),   -- YoY Loan Growth %
  pcr                  DECIMAL(5,2),   -- Provision Coverage Ratio %
  FOREIGN KEY (bank_id) REFERENCES banks(bank_id)
);

Data source: Screener.in (consolidated financials), RBI annual reports, BSE filings


Analysis — 10 SQL Queries

Q1: Which bank had the highest average NIM over 5 years?

SELECT b.bank_name,
  ROUND(AVG(f.nim), 2) as avg_nim_pct
FROM financials f
JOIN banks b ON f.bank_id = b.bank_id
GROUP BY b.bank_name
ORDER BY avg_nim_pct DESC;

Result:

Bank Avg NIM %
Kotak Mahindra 4.86
HDFC Bank 4.12
ICICI Bank 3.94
Axis Bank 3.74
SBI 3.22

Insight: Kotak leads with 4.86% NIM — driven by its high CASA ratio of ~57% and focus on retail and premium lending. Low-cost deposits (CASA) directly compress cost of funds, expanding NIM. SBI's lower NIM reflects its mandate to lend to priority sectors at regulated rates — a structural characteristic, not a weakness.


Q2: Which bank improved Gross NPA the most from FY2020 to FY2024?

SELECT b.bank_name,
  MAX(CASE WHEN f.fiscal_year = 2020 THEN f.gross_npa END) as npa_2020,
  MAX(CASE WHEN f.fiscal_year = 2024 THEN f.gross_npa END) as npa_2024,
  ROUND(
    MAX(CASE WHEN f.fiscal_year = 2020 THEN f.gross_npa END) -
    MAX(CASE WHEN f.fiscal_year = 2024 THEN f.gross_npa END)
  , 2) as improvement
FROM financials f
JOIN banks b ON f.bank_id = b.bank_id
GROUP BY b.bank_name
ORDER BY improvement DESC;

Result:

Bank NPA 2020 NPA 2024 Improvement
ICICI Bank 5.53% 2.16% 2.80pp
SBI 6.15% 2.24% 2.74pp
Axis Bank 4.86% 1.43% 2.27pp
Kotak Mahindra 2.26% 1.39% 1.88pp
HDFC Bank 1.26% 1.24% 0.08pp

Insight: ICICI Bank showed the most dramatic turnaround — from 5.53% in FY2020 to 2.16% in FY2024, reflecting a fundamental shift in credit strategy under new management. HDFC barely moved because it never had a significant NPA problem — consistently the cleanest book in Indian banking.


Q3: Rank banks by ROE for each year using window functions

SELECT
  DENSE_RANK() OVER(PARTITION BY f.fiscal_year ORDER BY f.roe DESC) as roe_rank,
  f.fiscal_year,
  b.bank_name,
  f.roe
FROM financials f
JOIN banks b ON f.bank_id = b.bank_id
ORDER BY f.fiscal_year, roe_rank;

Key finding: HDFC Bank ranked #1 consistently from FY2020–2022. SBI dramatically overtook all banks in FY2023–24 (ROE 19.7% → 20.3%), reflecting the payoff from years of NPA cleanup and government recapitalisation. ICICI's rise from rank 3 (7.9% ROE) in FY2020 to rank 2 (18.5%) in FY2024 is the standout turnaround story.


Q4: Which bank consistently maintained CASA ratio above 40%?

SELECT b.bank_name,
  COUNT(*) as years_above_40
FROM financials f
JOIN banks b ON f.bank_id = b.bank_id
WHERE f.casa_ratio > 40
GROUP BY b.bank_name
ORDER BY years_above_40 DESC;

Result: All 5 banks maintained CASA above 40% for nearly all 5 years — indicating strong low-cost deposit franchises across Indian banking. Kotak's achievement is most impressive — maintaining 46–58% CASA entirely through organic customer acquisition with no government backing.


Q5: Year-on-Year NII growth for each bank (using LAG window function)

WITH CTE_YOY_Growth AS (
  SELECT b.bank_name, f.fiscal_year, f.net_interest_income,
    LAG(f.net_interest_income) OVER
      (PARTITION BY b.bank_name ORDER BY f.fiscal_year) AS prev_year_nii,
    (f.net_interest_income -
      LAG(f.net_interest_income) OVER
      (PARTITION BY b.bank_name ORDER BY f.fiscal_year)) /
      LAG(f.net_interest_income) OVER
      (PARTITION BY b.bank_name ORDER BY f.fiscal_year) * 100
    AS yoy_growth
  FROM financials f JOIN banks b ON f.bank_id = b.bank_id
)
SELECT bank_name, fiscal_year, net_interest_income,
  CASE WHEN prev_year_nii IS NULL THEN 'No Previous Data'
       ELSE CAST(prev_year_nii AS CHAR) END AS previous_year_nii,
  CASE WHEN yoy_growth IS NULL THEN 'No Previous Data'
       ELSE CAST(yoy_growth AS CHAR) END AS yoy_growth_pct
FROM CTE_YOY_Growth;

Insight: FY2023 was exceptional for all banks — NII growth ranged from 22% (SBI) to 35% (Axis Bank). Driven by RBI's aggressive rate hiking cycle from 4% to 6.5%, which widened NIMs as lending rates repriced faster than deposit costs.


Q6: Banks where loan growth exceeded 15% AND NPA improved simultaneously

SELECT b.bank_name, f.fiscal_year, f.loan_growth, f.gross_npa,
  (SELECT f2.gross_npa FROM financials f2
   WHERE f2.bank_id = f.bank_id AND f2.fiscal_year = f.fiscal_year - 1) as prev_npa
FROM financials f JOIN banks b ON f.bank_id = b.bank_id
WHERE f.loan_growth > 15
AND f.gross_npa < (
  SELECT f2.gross_npa FROM financials f2
  WHERE f2.bank_id = f.bank_id AND f2.fiscal_year = f.fiscal_year - 1
)
ORDER BY b.bank_name, f.fiscal_year;

Insight: Both ICICI Bank and Kotak Mahindra achieved this rare combination for 3 consecutive years. Kotak's FY2022 stands out — 29% loan growth while NPA simultaneously improved, demonstrating exceptional credit discipline during aggressive expansion.


Q7: Is each bank's average ROA above or below sector average?

WITH sector_avg AS (
  SELECT ROUND(AVG(roa), 2) as avg_roa FROM financials
),
bank_avg AS (
  SELECT b.bank_name, ROUND(AVG(f.roa), 2) as bank_avg_roa
  FROM financials f JOIN banks b ON f.bank_id = b.bank_id
  GROUP BY b.bank_name
)
SELECT ba.bank_name, ba.bank_avg_roa, sa.avg_roa as sector_avg,
  CASE WHEN ba.bank_avg_roa > sa.avg_roa
    THEN 'Above Sector Average' ELSE 'Below Sector Average' END as vs_sector
FROM bank_avg ba CROSS JOIN sector_avg sa
ORDER BY ba.bank_avg_roa DESC;

Result: HDFC (1.90%), Kotak (1.86%), ICICI (1.68%) are above sector average. Axis (1.18%) and SBI (0.72%) are below. SBI's low ROA reflects priority sector obligations, not mismanagement.


Q8: Which year saw the worst NPA across all banks?

SELECT fiscal_year,
  ROUND(AVG(gross_npa), 2) as sector_avg_npa,
  ROUND(MAX(gross_npa), 2) as worst_individual_npa,
  ROUND(MIN(gross_npa), 2) as best_individual_npa
FROM financials
GROUP BY fiscal_year
ORDER BY sector_avg_npa DESC;

Result: FY2020 was peak stress — sector average NPA of 4.01%, SBI at 6.15%. The recovery to 1.69% by FY2024 (a 58% reduction) is one of the most dramatic banking sector cleanups in emerging market history, driven by the Insolvency and Bankruptcy Code (IBC).


Q9: CASA and NIM relationship — does higher CASA lead to higher NIM?

SELECT b.bank_name,
  AVG(f.casa_ratio) as avg_casa,
  CASE WHEN AVG(f.casa_ratio) > 45 THEN 'High' ELSE 'Low' END as casa_category,
  AVG(f.nim) as avg_nim,
  CASE WHEN AVG(f.nim) > 4 THEN 'High'
       WHEN AVG(f.nim) BETWEEN 2.5 AND 4 THEN 'Medium'
       ELSE 'Low' END as nim_category
FROM financials f JOIN banks b ON f.bank_id = b.bank_id
GROUP BY b.bank_name
ORDER BY avg_casa DESC;

Insight: Strong positive relationship confirmed. Banks above 46% CASA (Kotak, HDFC) consistently generate NIMs above 4%. ICICI is the outlier — medium CASA of 43.6% but near-high NIM of 3.94%, compensating through higher-yielding retail asset mix.


Q10: CAMELS Composite Health Score

SELECT b.bank_name,
  AVG(f.casa_ratio) as avg_casa,
  AVG(f.net_npa) as avg_net_npa,
  AVG(f.nim) as avg_nim,
  AVG(f.roa) as avg_roa,
  AVG(f.car) as avg_car,
  ROUND(
    CASE WHEN AVG(f.casa_ratio) > 45 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.net_npa) <= 0.5 THEN 3
         WHEN AVG(f.net_npa) <= 1 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.nim) > 4 THEN 3
         WHEN AVG(f.nim) >= 2.5 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.roa) > 1.5 THEN 3
         WHEN AVG(f.roa) >= 1 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.car) >= 18 THEN 3
         WHEN AVG(f.car) >= 14 THEN 2 ELSE 1 END
  , 0) as camels_score,
  RANK() OVER (ORDER BY (
    CASE WHEN AVG(f.casa_ratio) > 45 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.net_npa) <= 0.5 THEN 3
         WHEN AVG(f.net_npa) <= 1 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.nim) > 4 THEN 3
         WHEN AVG(f.nim) >= 2.5 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.roa) > 1.5 THEN 3
         WHEN AVG(f.roa) >= 1 THEN 2 ELSE 1 END +
    CASE WHEN AVG(f.car) >= 18 THEN 3
         WHEN AVG(f.car) >= 14 THEN 2 ELSE 1 END
  ) DESC) as camels_rank
FROM financials f JOIN banks b ON f.bank_id = b.bank_id
GROUP BY b.bank_name
ORDER BY camels_score DESC;

Final Rankings:

Rank Bank CAMELS Score Strengths
1 Kotak Mahindra 14/14 High CASA, High NIM, Strong ROA, Safe CAR
2 HDFC Bank 13/14 Lowest NPA, Strong ROA, Safe CAR
3 ICICI Bank 11/14 Strong ROA, improving trajectory across all metrics
4 Axis Bank 9/14 Medium across all dimensions, improving
5 SBI 7/14 Scale advantage, priority sector obligations compress metrics

Key Takeaways

  1. Kotak Mahindra and HDFC Bank are the healthiest banks across all CAMELS dimensions — strong capital, clean books, superior margins, and high ROA.

  2. ICICI Bank is the best turnaround story — from rank 3 with 7.9% ROE and 5.53% NPA in FY2020 to rank 2 with 18.5% ROE and 2.16% NPA in FY2024. Driven by a fundamental shift in credit culture under new management.

  3. FY2020 was peak stress — sector average NPA of 4.01%. The subsequent recovery to 1.69% by FY2024 represents a 58% improvement, driven by IBC implementation and aggressive provisioning.

  4. FY2023 was the best NII growth year for all banks simultaneously — RBI's rate hiking cycle widened margins across the board.

  5. SBI's metrics reflect mandate, not mismanagement — as India's banker to 500 million+ customers, priority sector obligations structurally compress ROA and NIM.


SQL Concepts Used

Concept Used in
JOIN All queries
GROUP BY + Aggregations Q1, Q2, Q4, Q7, Q8, Q9, Q10
CASE WHEN (conditional aggregation) Q2, Q7, Q9, Q10
Window functions — DENSE_RANK Q3
Window functions — LAG Q5
CTE (Common Table Expression) Q5, Q7
Correlated subquery Q6
CROSS JOIN Q7
RANK() OVER Q10

About This Project

Built as part of a self-directed financial analysis portfolio targeting Financial Analyst roles in Bengaluru's GCC ecosystem.

Tools: MySQL, MySQL Workbench Framework: CAMELS (regulatory bank health assessment) Data source: Screener.in, RBI reports, BSE filings Time to build: ~12 hours


This project is for educational and portfolio purposes only and does not constitute investment advice.

About

CAMELS framework analysis of 5 Indian banks using SQL — HDFC, ICICI, SBI, Kotak, Axis (FY2020-2024)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors