Skip to content

πŸ“Š End-to-end SQL data analysis project on Bank Transactions & Fraud Detection using PostgreSQL. πŸ› οΈ SQL | PostgreSQL | Data Cleaning | Joins | Aggregations | CTEs | Window Functions | Fraud Detection | Business Insights.

Notifications You must be signed in to change notification settings

Harsh-Belekar/Bank-Transactions-Fraud-Detection-SQL-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏦 Bank Transactions SQL Analysis

A real-world inspired SQL case study showcasing my ability to analyze financial data, detect fraud, and generate business insights β€” directly relevant to Data Analyst roles.

πŸ”Ή Designed & implemented a banking database (8 tables, 80K+ records)
πŸ”Ή Solved 25+ advanced SQL problems (ETL, reporting, fraud detection, optimization)
πŸ”Ή Delivered business insights on customer segmentation, fraud %, branch performance, and channel usage


🎯 Project Objectives

  • Design a normalized relational database simulating a bank’s core operations.
  • Import and clean large datasets (80K+ rows) into PostgreSQL.
  • Solve 25+ advanced SQL problems covering:
  • Customer segmentation & high-value client analysis
  • Transaction trend reporting (volume, value, growth)
  • Fraud detection & anomaly tracking
  • Branch & employee performance evaluation
  • ATM vs. Online vs. Cash channel usage
  • Apply advanced SQL concepts: joins, window functions, CTEs, indexing, optimization.

πŸ—οΈ Database Design

  • Core Tables: Customers, Accounts, Transactions, Cards, Employees, Branches, ATMs, ATM_Transactions
  • ERD:
    Database Schema

πŸ“‚ Project Structure

β”œβ”€β”€ create_table_query.sql    # Database schema
β”œβ”€β”€ problems.txt              # 25 advanced business questions
β”œβ”€β”€ solutions.txt             # SQL solutions + explanations
β”œβ”€β”€ Bank_data.zip             # Contains 8 CSV datasets (80K+ records)
β”œβ”€β”€ images/
β”‚ β”œβ”€β”€ ER_Diagram.png          # Schema diagram
β”‚ └── output.png              # Query + output example
└── README.md                 # Project documentation

πŸ“Š Example Business Problems Solved

Some of the 25 SQL challenges I solved:

  1. Top 10 customers by balance β†’ Identify high-value clients.
  2. Monthly transaction volume & value β†’ Track business growth trends.
  3. Fraud detection per branch β†’ Branch-wise anomaly detection.
  4. Channel usage breakdown (ATM vs Online vs Cash) β†’ Customer preference analysis.
  5. Employee performance via managed accounts β†’ Data-driven HR insights.

πŸ‘‰ Full problems list β†’ problems.txt
πŸ‘‰ SQL solutions + explanations β†’ solutions.txt


πŸ“ Query Showcase (Example)

Problem: Detect customers who withdraw more than they deposit in the last year.

SELECT c.customer_id, c.first_name, c.last_name,
    SUM(CASE WHEN t.transaction_type='Deposit' THEN t.amount ELSE 0 END) AS total_deposit,
    SUM(CASE WHEN t.transaction_type='Withdrawal' THEN t.amount ELSE 0 END) AS total_withdrawal
FROM customers c
JOIN accounts a ON a.customer_id = c.customer_id
JOIN transactions t ON t.account_id = a.account_id
WHERE t.transaction_date >= CURRENT_DATE - INTERVAL '1 year'
GROUP BY c.customer_id
HAVING SUM(CASE WHEN t.transaction_type='Withdrawal' THEN t.amount ELSE 0 END) >
       SUM(CASE WHEN t.transaction_type='Deposit' THEN t.amount ELSE 0 END);

Output :

Output Screenshot


βš™οΈ How to Run

  1. Create a new PostgreSQL database:
    CREATE DATABASE bank_db;
  2. Run schema file to create tables:
    psql -d bank_db -f create_table_query.sql
  3. Import CSVs from Bank_data.zip into respective tables.
  4. Run queries from solutions.txt to reproduce analysis.

πŸ› οΈ Tools & Technologies

  • SQL (PostgreSQL) β†’ Core analysis & queries
  • CSV Data Import β†’ Simulated real-world datasets
  • ERD Tools β†’ Schema design (dbdiagram.io / draw.io)

πŸš€ Key Skills Demonstrated

βœ”οΈ ETL & Data Cleaning – Imported & cleaned 80K+ records from CSVs βœ”οΈ Database Design – Built normalized schema with 8 interrelated tables βœ”οΈ Advanced SQL Queries – Joins, aggregations, window functions, CTEs, indexes βœ”οΈ Fraud & Risk Analysis – Detected anomalies and calculated fraud % per branch βœ”οΈ Business Reporting – Generated trend reports & performance insights


πŸ“Š Project Impact

  • Detected fraudulent transactions with clear branch-wise percentages.
  • Identified top customers and profitable branches for better business strategy.
  • Highlighted customer channel preferences (ATM vs Online vs Cash).
  • Built SQL reports that can directly support decision-making for banking operations.

πŸ“ˆ Project Relevance for Data Analyst Roles

This project mirrors real-world financial data analysis tasks such as:

  • Understanding customer behavior
  • Detecting fraudulent activities
  • Monitoring employee & branch performance
  • Preparing data-driven reports

It demonstrates my ability to turn raw banking data into actionable insights using SQL β€” a key skill for Data Analyst and Business Intelligence roles.


πŸ“§ Contact

πŸ”— LinkedIn – Harsh Belekar

About

πŸ“Š End-to-end SQL data analysis project on Bank Transactions & Fraud Detection using PostgreSQL. πŸ› οΈ SQL | PostgreSQL | Data Cleaning | Joins | Aggregations | CTEs | Window Functions | Fraud Detection | Business Insights.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published