TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2589 2.1K
๐Ÿš€ SQL Project Series #6: Banking Transaction Analysis ๐Ÿฆ

Learn how banks use SQL to analyze customer transactions, monitor account activity, detect fraud, and generate business insights.

๐ŸŽฏ Business Objectives

โœ… Analyze customer transactions

โœ… Calculate account balances

โœ… Identify high-value customers

โœ… Detect suspicious transactions

โœ… Monitor transaction trends

โœ… Analyze deposits vs withdrawals

โœ… Measure customer activity

โœ… Identify dormant accounts

โœ… Generate banking KPIs

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE banking_db;

USE banking_db;

๐Ÿ“‚ Step 2: Create Customers Table

CREATE TABLE customers (

customer_id INT PRIMARY KEY,

customer_name VARCHAR(100),

gender VARCHAR(10),

city VARCHAR(50),

account_open_date DATE

);

๐Ÿ“‚ Step 3: Create Accounts Table

CREATE TABLE accounts (

account_id INT PRIMARY KEY,

customer_id INT,

account_type VARCHAR(30),

branch_name VARCHAR(100),

opening_balance DECIMAL(12,2),

FOREIGN KEY (customer_id)

REFERENCES customers(customer_id)

);

๐Ÿ“‚ Step 4: Create Transactions Table

CREATE TABLE transactions (

transaction_id INT PRIMARY KEY,

account_id INT,

transaction_date TIMESTAMP,

transaction_type VARCHAR(20),

amount DECIMAL(12,2),

FOREIGN KEY (account_id)

REFERENCES accounts(account_id)

);

๐Ÿ“‚ Step 5: Insert Sample Customers

INSERT INTO customers VALUES

(1,'Rahul Sharma','Male','Mumbai','2023-01-10'),

(2,'Priya Verma','Female','Delhi','2023-02-18'),

(3,'Amit Patel','Male','Pune','2023-04-12'),

(4,'Sneha Joshi','Female','Bangalore','2023-05-22'),

(5,'Rohan Gupta','Male','Hyderabad','2023-08-01');

๐Ÿ“‚ Step 6: Insert Sample Accounts

INSERT INTO accounts VALUES

(101,1,'Savings','Mumbai',50000),

(102,2,'Savings','Delhi',35000),

(103,3,'Current','Pune',100000),

(104,4,'Savings','Bangalore',45000),

(105,5,'Current','Hyderabad',75000);

๐Ÿ“‚ Step 7: Insert Sample Transactions

INSERT INTO transactions VALUES

(1001,101,'2025-01-05 10:15:00','Deposit',15000),

(1002,101,'2025-01-06 12:30:00','Withdrawal',5000),

(1003,102,'2025-01-07 14:20:00','Deposit',25000),

(1004,103,'2025-01-08 16:10:00','Withdrawal',30000),

(1005,104,'2025-01-09 09:45:00','Deposit',12000),

(1006,105,'2025-01-10 11:00:00','Withdrawal',10000);

๐Ÿง  SQL Concepts You'll Practice

โœ” DDL Commands

โœ” DML Commands

โœ” Primary & Foreign Keys

โœ” Joins

โœ” Aggregate Functions

โœ” CASE WHEN

โœ” GROUP BY

โœ” HAVING

โœ” Window Functions

โœ” CTEs

โœ” Date & Time Functions

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Total Transaction Amount

๐Ÿ“ˆ Total Deposits

๐Ÿ“ˆ Total Withdrawals

๐Ÿ“ˆ Net Cash Flow

๐Ÿ“ˆ Current Account Balance

๐Ÿ“ˆ Average Transaction Amount

๐Ÿ“ˆ Daily Transaction Volume

๐Ÿ“ˆ Monthly Transaction Trend

๐Ÿ“ˆ Branch-wise Transactions

๐Ÿ“ˆ Account Type Analysis

๐Ÿ“ˆ Top Customers by Transaction Value

๐Ÿ“ˆ Most Active Customers

๐Ÿ“ˆ Dormant Accounts

๐Ÿ“ˆ High-Value Transactions

๐Ÿ“ˆ Deposit vs Withdrawal Ratio

๐Ÿ“ˆ Fraud Detection Alerts

๐Ÿ“ˆ Average Balance by Branch

๐Ÿ“ˆ Customer Growth

๐Ÿ“ˆ Transaction Success Rate

๐Ÿ“ˆ Peak Transaction Hours

๐Ÿ’ก Double Tap โค๏ธ For More
  • โค 4
  • ๐Ÿ‘ 1
More from @sqlanalyst
  1. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  2. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  3. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  4. Oct 7, 2026SQL Interview Series โ€” Part 4 ๐Ÿ“Œ Question 4: Find the Highest Salary in Each Department Suโ€ฆ
  5. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  6. Sep 29, 2026SQL Interview Series โ€” Part 2 ๐Ÿ“Œ Question 2: Find Duplicate Records Suppose you have an Emโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’