Skip to content

PRERITARYA/BankManagement_Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation


My first real project β€” built in Class 12 as part of my Computer Science coursework. It taught me how databases actually work, how to connect Python to MySQL, and how to think about real-world systems like banking.


πŸ’‘ About This Project

This is a terminal-based Bank Management System built using Python and MySQL, developed during my Class 12 Computer Science project. It simulates a real banking environment where both Admins and Customers can log in and perform their respective operations β€” all powered by a live MySQL database running in the background.

No fancy UI. No frameworks. Just pure Python logic, SQL queries, and a lot of learning. πŸš€


πŸ‘₯ Two-Role System

The system supports two types of users β€” each with their own menu and set of operations:

πŸ” Admin Panel (Password Protected)

# Operation
1 Create new customer records (with loop to add multiple)
2 Display all customer records in a formatted table
3 Search a specific customer by account number
4 Update customer details (name, balance, address, phone)
5 Delete a customer account
6 View all transactions across all accounts

πŸ‘€ Customer Panel

# Operation
1 View personal account details
2 Open a new bank account
3 Deposit money
4 Withdraw money
5 Transfer money to another account
6 View personal transaction history

✨ Features

  • Dual Role Login β€” Admin (password protected) and Customer modes
  • Admin brute-force protection β€” locks out after 3 wrong password attempts
  • Full CRUD operations on bank records via MySQL
  • Live transaction logging β€” every deposit, withdrawal, transfer, creation, and deletion is recorded with date
  • Money Transfer between two accounts with real-time balance update
  • Input validation β€” account numbers, phone numbers, and amounts are all validated before processing
  • Formatted terminal tables for displaying records and transactions
  • Account types β€” supports both Current and Savings accounts

πŸ—„οΈ Database Schema

Two tables power this entire system:

-- Stores all customer/account information
CREATE TABLE bank_record (
    SR_NO        INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    ACCOUNT_NO   BIGINT,
    CUSTOMER_NAME VARCHAR(20),
    BALANCE      REAL,
    ACCOUNT_TYPE VARCHAR(10),
    ADDRESS      VARCHAR(50),
    PHONE_NO     VARCHAR(10)
);

-- Logs every transaction with a foreign key to bank_record
CREATE TABLE transaction (
    ID         INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    SR         INT,
    TRANS_TYPE VARCHAR(35),
    AMOUNT     INT,
    TRANS_DATE DATE,
    FOREIGN KEY (SR) REFERENCES bank_record(SR_NO)
        ON DELETE CASCADE
        ON UPDATE CASCADE
);

πŸ—οΈ How It Works

Program Starts
      β”‚
      β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ ADMIN / C  β”‚  ← User selects role
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β”œβ”€β”€β”€β”€ ADMIN ──── Password Check (3 attempts max)
      β”‚                     β”‚
      β”‚              β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚              β”‚  Admin Menu (6 options)  β”‚
      β”‚              β”‚  Create / Read / Search  β”‚
      β”‚              β”‚  Update / Delete / Txns  β”‚
      β”‚              └─────────────────────────-β”˜
      β”‚
      └──── CUSTOMER ──── No password needed
                               β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  Customer Menu (6 options)   β”‚
                        β”‚  View / Open / Deposit /     β”‚
                        β”‚  Withdraw / Transfer / Txns  β”‚
                        └─────────────────────────────-β”˜

All operations β†’ MySQL (bank_db) β†’ Commits & Closes connection

βš™οΈ Setup & Installation

Prerequisites

  • Python 3.x installed
  • MySQL Server installed and running
  • mysql-connector-python library

1. Install the required library

pip install mysql-connector-python

2. Set up the MySQL database

Open MySQL and run:

CREATE DATABASE bank_db;
USE bank_db;

CREATE TABLE bank_record (
    SR_NO INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    ACCOUNT_NO BIGINT,
    CUSTOMER_NAME VARCHAR(20),
    BALANCE REAL,
    ACCOUNT_TYPE VARCHAR(10),
    ADDRESS VARCHAR(50),
    PHONE_NO VARCHAR(10)
);

CREATE TABLE transaction (
    ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    SR INT,
    TRANS_TYPE VARCHAR(35),
    AMOUNT INT,
    TRANS_DATE DATE,
    FOREIGN KEY (SR) REFERENCES bank_record(SR_NO)
    ON DELETE CASCADE ON UPDATE CASCADE
);

3. Update your MySQL credentials

Open bank_management.py and update these lines with your MySQL username and password:

connection = mysql.connect(
    host="localhost",
    user="root",       # ← your MySQL username
    passwd="****",     # ← your MySQL password
    database="bank_db"
)

4. Run the program

python bank_management.py

πŸ–₯️ Sample Terminal Output

===============================
|| ● Are you ADMIN/CUSTOMER ● ||
|| press A:for ADMIN           ||
|| press C:for CUSTOMER        ||
===============================
Press A/C:- A

Enter your password: ****

# # # # # # # # # # # # # # # #
#         'WELCOME'            #
# ● Press 1: Create record     #
# ● Press 2: Display all       #
# ● Press 3: Search record     #
# ● Press 4: Update record     #
# ● Press 5: Delete record     #
# ● Press 6: All transactions  #
# ● Press 0: Exit              #
# # # # # # # # # # # # # # # #

🧠 What I Learned

This project was my first real hands-on experience with:

  • Connecting Python to a live MySQL database using mysql-connector
  • Writing raw SQL queries (INSERT, SELECT, UPDATE, DELETE) from Python
  • Designing a relational database with foreign keys and cascading rules
  • Building input validation and error handling from scratch
  • Thinking about real-world systems β€” roles, permissions, transaction logs
  • Structuring a large Python program with multiple functions

πŸ“ Project Structure

Bank-Management-System/
β”‚
β”œβ”€β”€ bank_management.py     # 🐍 Main Python file β€” all logic lives here
└── README.md

⚠️ Note

This project was built for educational purposes as a Class 12 CS project. The admin password is hardcoded for simplicity β€” in a real-world system, passwords would be hashed and stored securely in a database.


πŸ‘¨β€πŸ’» Author

Prerit Arya B.Tech Computer Science & Engineering

This project was built when I was in Class 12 β€” one of my first steps into the world of real programming. It may not be perfect, but it started everything. πŸ™Œ

GitHub


⭐ If this helped you understand Python + MySQL projects, drop a star!

Built with curiosity, Stack Overflow, and a lot of trial & error. πŸ˜„

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages