100% found this document useful (1 vote)
309 views

Project On Banking System

This document describes a banking system project implemented in Python using MySQL. It includes: 1. Code to create Account and Amount tables in a Bank database to store customer and transaction data. 2. Python functions to insert, view, deposit to, and close customer accounts by interacting with the MySQL tables. 3. A menu-driven system that allows users to choose from account functions and re-run the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
309 views

Project On Banking System

This document describes a banking system project implemented in Python using MySQL. It includes: 1. Code to create Account and Amount tables in a Bank database to store customer and transaction data. 2. Python functions to insert, view, deposit to, and close customer accounts by interacting with the MySQL tables. 3. A menu-driven system that allows users to choose from account functions and re-run the program.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Project On “Banking System”

By:
Dharmendra Kumar Tripathi (PGT CS)
KV RAEBARELI 2ND SHIFT(Lucknow Region)
Vikram Singh Pareva (PGT CS)
KV CHITTORGARH (Jaipur Region)

DBMS: MySQL
Host : localhost
User: root
Pass: root
DataBase: Bank
Table Structure: (Images Bellow)
SQL Commands to create both the tables:
Account table:
mysql> CREATE TABLE ACCOUNT(Accno int(15) NOT NULL Primary Key,Name varchar(25) Not
Null,Age int(5) Not Null,occu varchar(15) not null,Address varchar(50) not null,Mob int(11) not
null,Aadharno int(16),amt double(20,5),AccType varchar(15) not null);
Amt table:
mysql> CREATE TABLE amt(Accno int(15), Amtdeposite double(20,5),month varchar(15) not null);

Python Code:
import os
import platform
import mysql.connector
import pandas as pd

mydb=mysql.connector.connect(host="localhost",\
user="root",\
password="root",\
database="Bank")
mycursor=mydb.cursor()

def AccInsert():
L=[]
Accno=int(input("Enter the Account number : "))
L.append(Accno)
name=input("Enter the Customer Name: ")
L.append(name)
age=int(input("Enter Age of Customer : "))
L.append(age)
occup=input("Enter the Customer Occupation : ")
L.append(occup)
Address=input("Enter the Address of the Customer : ")
L.append(Address)
Mob=int(input("Enter the Mobile number : "))
L.append(Mob)
Aadharno=int(input("Enter the Aadhar number : "))
L.append(Aadharno)
Amt=float(input("Enter the Money Deposited : "))
L.append(Amt)
AccType=input("Enter the Account Type (Saving/RD/PPF/Current) : ")
L.append(AccType)
cust=(L)
sql="Insert into ACCOUNT(Accno ,Name,Age,occu,Address,Mob,Aadharno,amt,AccType)
values(%s,%s,%s, %s,%s,%s, %s,%s,%s)"
mycursor.execute(sql,cust)
mydb.commit()

def AccView():
print("Select the search criteria : ")
print("1. Acc no")
print("2. Name")
print("3. Mobile")
print("4. Adhar")
print("5. View All")
ch=int(input("Enter the choice : "))
if ch==1:
s=int(input("Enter ACC no : "))
rl=(s,)
sql="select * from account where Accno=%s"
mycursor.execute(sql,rl)
elif ch==2:
s=input("Enter Name : ")
rl=(s,)
sql="select * from account where Name=%s"
mycursor.execute(sql,rl)
elif ch==3:
s=int(input("Enter Mobile No : "))
rl=(s,)
sql="select * from account where Mob=%s"
mycursor.execute(sql,rl)
elif ch==4:
s=input("Enter Adhar : ")
rl=(s,)
sql="select * from account where Aadharno=%s"
mycursor.execute(sql,rl)
elif ch==5:
sql="select * from account"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The Customer details are as follows : ")
#print("(Accno ,Name,Age,occu,Address,Mob,Aadharno,amt,AccType)")
#for x in res:
k=pd.DataFrame(res,columns=['AcNo','Name','Age','Occn','Add','Mob','Aadh','Amt','AccTy'])
print(k)
#print(x)

def AccDeposit():
L=[]
Accno=int(input("Enter the Account number : "))
L.append(Accno)
Amtdeposit=eval(input("Enter the Amount to be deposited : "))
L.append(Amtdeposit)
month=input("Enter month of Salary : ")
L.append(month)

cust=(L)
sql="Insert into amt(Accno,Amtdeposit,Month) values(%s,%s,%s)"
mycursor.execute(sql,cust)
mydb.commit()

def accView():
print("Please enter the details to view the Money details :")
Accno=int(input("Enter the Account number of the Customer whose amount is to be viewed : "))
sql="Select Account.Accno, Account.Name,
Account.Age,Account.occu,Account.Address,Account.Mob,Account.Aadharno,Account.Amt,Account.Ac
cType, sum(amt.Amtdeposit), amt.month from Account INNER JOIN amt ON
Account.Accno=amt.Accno and amt.Accno = %s"
rl=(Accno,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
for x in res:
print(x)

def closeAcc():
Accno=int(input("Enter the Account number of the Customer to be closed : "))
rl=(Accno,)
sql="Delete from amt where Accno=%s"
mycursor.execute(sql,rl)
sql="Delete from Account where Accno=%s"

mydb.commit()

def MenuSet(): #Function For The Student Management System


print("Enter 1 : To Add Customer")
print("Enter 2 : To View Customer ")
print("Enter 3 : To Deposit Money ")
print("Enter 4 : To Close Account")
print("Enter 5 : To View All Customer Details")

try: #Using Exceptions For Validation


userInput = int(input("Please Select An Above Option: ")) #Will Take Input From User
except ValueError:
exit("\nHy! That's Not A Number") #Error Message
else:
print("\n") #Print New Line
if(userInput == 1):
AccInsert()
elif (userInput==2):
AccView()
elif (userInput==3):
AccDeposit()
elif (userInput==4):
closeAcc()
elif (userInput==5):
accView()
else:
print("Enter correct choice. . . ")

MenuSet()
def runAgain():
runAgn = input("\nwant To Run Again Y/n: ")
while(runAgn.lower() == 'y'):
if(platform.system() == "Windows"):
print(os.system('cls'))
else:
print(os.system('clear'))
MenuSet()
runAgn = input("\nwant To Run Again Y/n: ")
runAgain()

You might also like