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.
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. π
The system supports two types of users β each with their own menu and set of operations:
| # | 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 |
| # | 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 |
- 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
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
);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
- Python 3.x installed
- MySQL Server installed and running
mysql-connector-pythonlibrary
pip install mysql-connector-pythonOpen 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
);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"
)python bank_management.py===============================
|| β 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 #
# # # # # # # # # # # # # # # #
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
Bank-Management-System/
β
βββ bank_management.py # π Main Python file β all logic lives here
βββ README.md
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.
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. π