Skip to content

DimitriosDiakoloukas/Bank-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BankDB — Database System for a Banking Application

BankDB is a relational database designed to support the core operations of a modern bank.
It manages customers, accounts (checking & savings), cards, loans, transactions, employees, and bank branches.
The system enables efficient data storage, retrieval, updates, integrity constraints, and relational querying.


Features

  • Customer, account, loan, card & transaction management
  • Many-to-many relationships (customers ↔ accounts, accounts ↔ cards)
  • Branch & employee hierarchy
  • Useful SQL views (customer account summary, employee branch summary)
  • ER model & relational schema included

Tech Stack

  • SQL-based relational DBMS (MySQL)
  • Normalized database schema with constraints
  • ER & relational diagrams
  • Backend: Python (Flask)
  • Frontend: Bootstrap 5, Jinja2

Bank Management Web Application

User Manual & Technical Guide


1. Project Overview

This is a full-stack web application developed using Python (Flask) and MySQL.
It provides a secure interface for customers to:

  • View bank accounts
  • Perform money transfers
  • Pay loans and credit cards
  • Manage personal details
  • Locate bank branches

2. Prerequisites

Before running the application, ensure you have the following installed:

  • Python 3.x
  • MySQL Server (must be running properly)
  • Python libraries:
    • flask
    • mysql-connector-python

Install Dependencies

pip install flask mysql-connector-python

3. Database Setup (CRITICAL STEP)

The application relies on a MySQL database named BankDB.
You must set this up manually because the provided SQL dump file may not create the database automatically.

Setup Steps

  1. Open your terminal / command prompt
  2. Log in to MySQL:
    mysql -u root -p
  3. Create the database:
    CREATE DATABASE IF NOT EXISTS BankDB;
    EXIT;
  4. Import the SQL dump (from the project directory):
    mysql -u root -p BankDB < Dump20251219.sql

4. Configuration

The application connects to the database using credentials defined in app.py.

Locate the db_config dictionary (approximately line 11):

db_config = {
    'host': 'localhost',
    'user': 'root',
    'password': 'YOUR_MYSQL_PASSWORD',
    'database': 'BankDB'
}

Important:
The current code uses password 1234.
Change this to match your local MySQL root password.


5. How to Launch the Application

  1. Navigate to the project directory:

    cd path/to/project_folder
  2. Run the Flask application:

    Windows (recommended):

    python app.py

    Linux / macOS:

    python3 app.py
  3. If successful, you will see:

    Running on http://127.0.0.1:5000
    
  4. Open your web browser and go to:

    http://127.0.0.1:5000
    

6. How to Use the Application

A. Login

  • No separate users table is used
  • Authentication is performed using Customer TIN
  • Any password is accepted

Example valid TIN:

123456789
(User: Maria Papadopoulou)

B. Dashboard

After login, the dashboard displays:

  • All customer accounts
  • Account Number
  • Currency
  • Status
  • Current Balance

Notes:

  • Balances are calculated dynamically using the accounts_balance SQL view
  • Total Net Worth includes balances from all accounts, active or inactive

C. Money Transfer

  1. Click Transfer
  2. Select the source account
  3. Enter the destination account number
    Example:
    GR1311891434567890123456789
    
  4. Enter a positive amount
  5. Click Confirm Transfer

Validation Includes:

  • Sufficient funds
  • Valid destination account

D. Branch Locator

  • Click Branches
  • View all bank branches with:
    • Address
    • Operating hours
    • Contact details

E. Pay Loan

  • View active loan details:
    • Loan amount
    • Expiration date
    • Current debt
  • Select an account to pay from
  • Enter payment amount
  • System prevents overpayment and insufficient balance

F. Pay Credit Card

  • Displays credit cards with outstanding debt
  • Select:
    • Credit card
    • Source account
  • Enter payment amount
  • Credit card available balance is updated accordingly

G. Settings

From the Settings page, users can:

  • View personal details (Name, TIN, phone numbers)
  • Update physical address
  • Manage email addresses:
    • Add
    • Update
    • Delete

7. Technical Implementation Details

Frameworks

  • Backend: Python Flask
  • Frontend: Bootstrap 5, Jinja2
  • Database: MySQL

Security

  • Prepared statements for all queries (SQL Injection protection)
  • Flask session management for authentication

Transactions & Consistency

  • ACID-compliant database transactions:
    • conn.start_transaction()
    • commit()
    • rollback()
  • Guarantees no partial or lost money transfers

Application Logic

  • Transaction IDs generated manually (MAX(TransactionID) + 1)
  • Extensive use of SQL Views:
    • customer_accounts
    • accounts_balance
    • Summary and reporting views

8. Notes

  • MySQL server must be running before starting the app
  • Database must be created before importing the dump
  • Always verify database credentials
  • Intended for academic and educational use

End of README

About

This repository includes all assignments implemented for the Databases Course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors