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
- 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.
- Core Tables: Customers, Accounts, Transactions, Cards, Employees, Branches, ATMs, ATM_Transactions
- ERD:
βββ 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
Some of the 25 SQL challenges I solved:
- Top 10 customers by balance β Identify high-value clients.
- Monthly transaction volume & value β Track business growth trends.
- Fraud detection per branch β Branch-wise anomaly detection.
- Channel usage breakdown (ATM vs Online vs Cash) β Customer preference analysis.
- Employee performance via managed accounts β Data-driven HR insights.
π Full problems list β problems.txt
π SQL solutions + explanations β solutions.txt
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);
- Create a new PostgreSQL database:
CREATE DATABASE bank_db;
- Run schema file to create tables:
psql -d bank_db -f create_table_query.sql
- Import CSVs from
Bank_data.zip
into respective tables. - Run queries from
solutions.txt
to reproduce analysis.
- SQL (PostgreSQL) β Core analysis & queries
- CSV Data Import β Simulated real-world datasets
- ERD Tools β Schema design (dbdiagram.io / draw.io)
βοΈ 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
- 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.
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.