Cs Project 2024

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

INTRODUCTION:

Python MySQL Interface:

A Python MySQL interface refers to a software module or library


that facilitates communication between Python programming
language and MySQL databases. These interfaces allow Python
developers to connect to MySQL servers, execute SQL queries,
and manage database operations seamlessly. Commonly used
libraries for this purpose include mysql-connector-python
and pymysql, which provide a convenient and efficient way to
integrate MySQL database functionality into Python applications.

Python:

Python is a high-level, general-purpose programming language


known for its readability and simplicity. Guido van Rossum
created Python, and it was first released in 1991. Python
emphasizes code readability, and its syntax allows programmers
to express concepts in fewer lines of code than languages like C+
+ or Java. Python supports multiple programming paradigms,
including procedural, object-oriented, and functional
programming. It has a large and active community, extensive
standard libraries, and a vast ecosystem of third-party packages.

MySQL:

MySQL is an open-source relational database management


system (RDBMS). It is one of the most popular databases used for
web development and is known for its reliability, ease of use, and
scalability. MySQL uses a client-server model, where a client
communicates with the server to perform various database
operations such as storing, retrieving, updating, and deleting data.
It supports SQL (Structured Query Language), which is a standard
language for managing and manipulating relational databases.
MySQL is widely used in conjunction with web applications,
content management systems, and various other software
projects.

A Bank Management System:

A Bank Management System refers to a software application or


system designed to streamline and automate various aspects of
banking operations. It is a comprehensive solution that assists
banks in managing their day-to-day activities, customer
interactions, financial transactions, and administrative tasks. The
primary goals of a Bank Management System include improving
efficiency, accuracy, and security in banking operations.

Key features of a Bank Management System may include:

1. Customer Management:
 Managing customer information, accounts, and transactions.

 Handling account openings, closures, and updates.

2. Account Management:
 Tracking and managing various types of accounts (savings,

checking, etc.).
 Handling deposits, withdrawals, and transfers.

3. Transaction Management:
 Recording and processing financial transactions.

 Maintaining a transaction history for auditing and reporting.


4. Loan Management:
 Handling loan applications, approvals, and repayments.

 Managing interest rates and loan terms.

5. Security:
 Ensuring the security and confidentiality of customer data.

 Implementing access controls and authentication

mechanisms.
6. Reporting and Analytics:
 Generating reports on customer accounts, transactions, and

financial health.
 Providing insights through analytics for better decision-

making.
7. User Management:
 Managing roles and permissions for bank employees.

 Ensuring restricted access based on job responsibilities.

8. Online Banking:
 Facilitating online services such as internet banking and

mobile banking.
 Enabling customers to access their accounts and perform

transactions remotely.
9. Integration with Other Systems:
 Integrating with payment gateways, credit bureaus, and

other financial systems.


 Ensuring interoperability with external services and

applications.
10. Compliance and Regulatory Requirements:
 Adhering to legal and regulatory standards in the banking

industry.
 Ensuring compliance with anti-money laundering (AML) and

know your customer (KYC) regulations.


Bank Management Systems are crucial for modern banks to
handle the complexity of their operations efficiently. They
contribute to improved customer service, data accuracy, and
overall operational effectiveness within the banking sector. The
specific features and functionalities may vary based on the size
and nature of the financial institution.

SOURCE CODE
import mysql.connector

# Function to establish a MySQL connection


def create_connection():
return mysql.connector.connect(
host="localhost",
user="Sriram",
password="root",
database="csprojects"
)

# Function to create tables (for first-time setup)


def create_tables(conn):
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS account_holders (
id INT AUTO_INCREMENT PRIMARY KEY,
account_number VARCHAR(255) NOT NULL,
account_name VARCHAR(255) NOT NULL,
aadhar_no VARCHAR(255) NOT NULL,
pan_no VARCHAR(255) NOT NULL,
dob DATE NOT NULL,
ifsc_code VARCHAR(255) NOT NULL,
balance DECIMAL(10, 2) NOT NULL
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
account_number VARCHAR(255) NOT NULL,
transaction_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
description VARCHAR(255),
amount DECIMAL(10, 2) NOT NULL
)
''')
conn.commit()

# Function to add an account to the account_holders table


def add_account_holder(conn, account_holder_data):
cursor = conn.cursor()
query = "INSERT INTO account_holders (account_number,
account_name, aadhar_no, pan_no, dob, ifsc_code, balance) VALUES
(%s, %s, %s, %s, %s, %s, %s)"
cursor.execute(query, account_holder_data)
conn.commit()
print("Account created successfully!")

# Function to delete an account from the account_holders table


def delete_account_holder(conn, account_number):
cursor = conn.cursor()
query = "DELETE FROM account_holders WHERE account_number =
%s"
cursor.execute(query, (account_number,))
conn.commit()
print("Account deleted successfully!")
# Function to modify account details
def modify_account_holder(conn, account_number):
cursor = conn.cursor()
print("\nModify Account Details:")
print("1. Modify Account Name")
print("2. Modify Aadhar Number")
print("3. Modify PAN Number")
print("4. Modify Date of Birth")
print("5. Modify IFSC Code")
choice = input("Enter your choice (1/2/3/4/5): ")

if choice == '1':
new_account_name = input("Enter New Account Name: ")
query = "UPDATE account_holders SET account_name = %s
WHERE account_number = %s"
elif choice == '2':
new_aadhar_no = input("Enter New Aadhar Number: ")
query = "UPDATE account_holders SET aadhar_no = %s WHERE
account_number = %s"
elif choice == '3':
new_pan_no = input("Enter New PAN Number: ")
query = "UPDATE account_holders SET pan_no = %s WHERE
account_number = %s"
elif choice == '4':
new_dob = input("Enter New Date of Birth (YYYY-MM-DD): ")
query = "UPDATE account_holders SET dob = %s WHERE
account_number = %s"
elif choice == '5':
new_ifsc_code = input("Enter New IFSC Code: ")
query = "UPDATE account_holders SET ifsc_code = %s WHERE
account_number = %s"
else:
print("Invalid choice.")
return

cursor.execute(query, (new_account_name, new_aadhar_no,


new_pan_no, new_dob, new_ifsc_code, account_number))
conn.commit()
print("Account details modified successfully!")

# Function to show recent transactions


def show_recent_transactions(conn, account_number):
cursor = conn.cursor()
query = "SELECT * FROM transactions WHERE account_number = %s
ORDER BY transaction_date DESC LIMIT 10"
cursor.execute(query, (account_number,))
transactions = cursor.fetchall()
return transactions

# Function to check balance


def check_balance(conn, account_number):
cursor = conn.cursor()
query = "SELECT balance FROM account_holders WHERE
account_number = %s"
cursor.execute(query, (account_number,))
balance = cursor.fetchone()
return balance[0] if balance else None
# Main menu
def main():
conn = create_connection()
create_tables(conn)

while True:
print("\nMenu:")
print("1. Add Account")
print("2. Delete Account")
print("3. Modify Account Details")
print("4. Show Recent Transactions")
print("5. Check Balance")
print("6. Exit")

choice = input("Enter your choice: ")

if choice == '1':
account_number = input("Enter Account Number: ")
account_name = input("Enter Account Name: ")
aadhar_no = input("Enter Aadhar Number: ")
pan_no = input("Enter PAN Number: ")
dob = input("Enter Date of Birth (YYYY-MM-DD): ")
ifsc_code = input("Enter IFSC Code: ")
initial_balance = float(input("Enter Initial Balance: "))

account_data = (account_number, account_name, aadhar_no,


pan_no, dob, ifsc_code, initial_balance)
add_account_holder(conn, account_data)

elif choice == '2':


account_number = input("Enter Account Number to Delete: ")
delete_account_holder(conn, account_number)
elif choice == '3':
account_number = input("Enter Account Number: ")
new_account_name = input("Enter New Account Name: ")
modify_account_holder(conn, account_number,
new_account_name)

elif choice == '4':


account_number = input("Enter Account Number: ")
transactions=show_recent_transactions(conn,account_number)
for transaction in transactions:
print(transaction)

elif choice == '5':


account_number = input("Enter Account Number: ")
balance = check_balance(conn, account_number)
print(balance)

conn=create_connection()
create_tables(conn)
main()

Output table:
References:
 Wikipedia
 Python4csip
 google

You might also like