This document provides technical documentation for the database of the "Bank A" Banking System. It contains information about the database schema, data structures, and other technical details to assist developers, database-administrators, and other technical stakeholders in understanding and maintaining the database.
Provide a high-level description of the "Bank A" Banking System database, its purpose, and its role within the organization.
Explain the structure and organization of the database schema, including its components and relationships between them.
- Description: Self-explanatory.
- Values:
Male
: 0Female
: 1
- Description: Types of users in the system.
- Values:
Customer
: 0Employee
: 1Manager
: 2Admin
: 3
- Description: Types of customers in the system.
- Values:
Individual
: 0Organization
: 1
- Description: Types of bank accounts.
- Values:
Current
: 0Savings
: 1
- Description: Types of transactions.
- Values:
Deposit
: 0Withdrawal
: 1Interest
: 2Fee
: 3Other
: 4
- Description: Status of a loan application.
- Values:
Pending
: 0Approved
: 1Rejected
: 2
- Description: Status of a bank account.
- Values:
Active
: 0Inactive
: 1Frozen
: 3Closed
: 2
- Description: Description of Table 1.
- Columns:
Column1
: Description of Column1.Column2
: Description of Column2.- ...
(Repeat this section for each table)
- Purpose: This view provides a minimal representation of bank accounts, including account number, branch ID, customer ID, balance, opening date, account status, and account type.
- Purpose: This view combines child and guardian information, including individual ID, customer ID, first name, last name, date of birth, guardian's NIC, guardian's first name, and guardian's date of birth.
- Purpose: This view combines child, guardian, and bank account information, including customer ID, individual ID, guardian's NIC, first name, last name, date of birth, account number, balance, opening date, account status, and account type.
- Purpose: This view represents individual children with limited information, including individual ID, customer ID, NIC, first name, last name, and date of birth. It filters individuals under 18 years old.
- Purpose: This view combines individual and bank account information, including customer ID, individual ID, NIC, first name, last name, date of birth, account number, balance, opening date, account status, and account type.
- Purpose: This view represents individual customers who are not organization members and are over 18 years old. It includes individual ID, customer ID, NIC, first name, last name, and date of birth.
- Purpose: This view provides an overview of organizations, including registration number, name, customer ID, type, address, company email, individual ID, position, first name, last name, and NIC of employees within the organization.
- Adds a new individual to the system.
- Adds an individual to an organization.
- Creates a new savings account, considering initial deposit requirements.
- Authenticates a user and retrieves user type and ID.
- Calculates and records interest for active savings accounts.
- Calculates and records interest for active fixed deposit accounts.
- Checks if an individual with a specific NIC exists.
- Checks if an organization with a specific registration number exists.
- Creates a new organization with an associated individual.
- Checks if a user has a specified user type.
- Registers an individual user and associates them with a user account.
- Registers a banker user by adding a record to the user table and updating the employee table with the associated user ID. It allows the creation of user accounts for employees who are designated as bankers(employees/managers).
- Purpose: This index is created on the
user_name
column in theuser
table of thebank_management_system
database. It is used to optimize and speed up queries that involve searching for users by their usernames.
- Purpose: This trigger is designed to ensure the uniqueness of the
user_name
in theuser
table of thebank_management_system
database. It runs before an insert operation and checks if a user with the same username already exists. If a duplicateuser_name
is detected, it raises an error. - Trigger Type: Before Insert
- Affected Table:
user
- Event: For Each Row
- Error Handling: If a duplicate
user_name
is found, the trigger signals a SQLSTATE '45000' error with the message 'user_name must be unique.'
- Purpose: This trigger checks for the existence of a bank account before inserting a new record into the
bank_account
table. It ensures that a bank account with the samecustomer_id
,branch_id
, andaccount_type
does not already exist. If a duplicate is detected, it raises an error. - Trigger Type: Before Insert
- Affected Table:
bank_account
- Event: For Each Row
- Error Handling: If a duplicate bank account is found, the trigger signals a SQLSTATE '45000' error with the message 'Bank account already exists.'
- Purpose: This trigger is designed to prevent the insertion of duplicate individual records in the
individual
table. It checks for the existence of an individual with the samecustomer_id
andis_organization_member
set to false. If a duplicate is detected, it raises an error. - Trigger Type: Before Insert
- Affected Table:
individual
- Event: For Each Row
- Error Handling: If a duplicate individual is found, the trigger signals a SQLSTATE '45000' error with the message 'Individual already exists.'
- Purpose: This event is scheduled to run every day to calculate and record interest for active savings accounts. It calls the
calculate_savings_interest()
stored procedure, which performs interest calculations and inserts them into the transactions table. - Schedule: The event is scheduled to run every day (
every 1 DAY
) and starts one day from the current date (starts CURDATE() + INTERVAL 1 DAY
). - Enabled: The event is enabled, meaning it will execute according to the defined schedule.
This event automates the process of calculating savings account interest on a daily basis, ensuring timely and accurate interest calculations for active accounts.
- Purpose: This event is scheduled to run every day to calculate and record interest for active fixed deposit accounts. It calls the
calculate_fd_interests()
stored procedure, which performs interest calculations and inserts them into the transactions table. - Schedule: The event is scheduled to run every day (
every 1 DAY
) and starts one day from the current date (starts CURDATE() + INTERVAL 1 DAY
). - Enabled: The event is enabled, meaning it will execute according to the defined schedule.