0% found this document useful (0 votes)
76 views10 pages

Code and Outputs

The document contains source code for creating a banking system database and application. It defines tables for users, customers, and transactions. It then includes Python code for a menu-driven banking application that allows users to register, login, create accounts, view customer details, make deposits and withdrawals, and delete accounts. The code connects to MySQL to execute SQL statements to interact with and populate the database tables.

Uploaded by

Rohit Rangaraju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views10 pages

Code and Outputs

The document contains source code for creating a banking system database and application. It defines tables for users, customers, and transactions. It then includes Python code for a menu-driven banking application that allows users to register, login, create accounts, view customer details, make deposits and withdrawals, and delete accounts. The code connects to MySQL to execute SQL statements to interact with and populate the database tables.

Uploaded by

Rohit Rangaraju
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SOURCE CODE

User Table:
import [Link] as sql
conn=[Link](host='localhost',user='root',passwd='rohit@2005',database='bank')
cur = [Link]()
[Link]('create table user_table(username varchar(25) primary key,passwrd varchar(25) not
null )')
print("User_table Successfully created")

Customer Table:
import [Link] as sql
conn=[Link](host='localhost',user='root',passwd='rohit@2005',database='bank')
if conn.is_connected():
print('connected succesfully')
cur = [Link]()
[Link]('create table customer_details(acct_no int primary key,acct_name
varchar(25) ,phone_no bigint(11),address varchar(25),cr_amt float )')
print("Customer_table Successfully created")
Transaction Table:
import [Link] as sql
conn=[Link](host='localhost',user='root',passwd='rohit@2005',database='bank')
cur = [Link]()
[Link]('create table transactions(acct_no int,date date ,withdrawal_amt int,amount_added
int)')
print("Transaction_table Successfully created")

[Link]
import datetime as dt
import [Link] as sql
conn=[Link](host='localhost',user='root',passwd='rohit@2005',database='bank')
cur = [Link]()
[Link] = True
c = 'y'
while c == 'y':
print()
print('[Link] BANK ACCOUNT')
print()
print('[Link]')
print()
print('[Link] DETAILS')
print()
print('[Link] DETAILS')
print()
print('[Link] ACCOUNT')
print()
print('[Link]')
print()
n=int(input('Enter your CHOICE='))
print()
if n == 1:
acc_no=int(input('Enter your ACCOUNT NUMBER='))
print()
acc_name=input('Enter your ACCOUNT NAME=')
print()
ph_no=int(input('Enter your PHONE NUMBER='))
print()
add=(input('Enter your place='))
print()
cr_amt=int(input('Enter your credit amount='))
V_SQLInsert="INSERT INTO customer_details values (" + str (acc_no) + ",' " + \
acc_name + " ',"+str(ph_no) + ",' " +add + " ',"+ str (cr_amt) + " ) "
[Link](V_SQLInsert)
print()
print('Account Created Succesfully!!!!!')
[Link]()
if n == 2:
acct_no=int(input('Enter Your Account Number='))
[Link]('select * from customer_details where acct_no='+str (acct_no) )
data=[Link]()
count=[Link]
[Link]()
if count == 0:
print()
print('Account Number Invalid Sorry Try Again Later')
print()
else:
while True:
print()
print('[Link] AMOUNT')
print()
print('[Link] AMOUNT')
print()
print()
x=int(input('Enter your CHOICE='))
print()
if x == 1:
amt=int(input('Enter withdrawl amount='))
cr_amt=0
[Link]('update customer_details set cr_amt=cr_amt-'+str(amt) + ' \
where acct_no=' +str(acct_no) )
V_SQLInsert="INSERT INTO transactions values ({} , '{}' , {} , {})".format( \
acct_no,[Link](),amt,cr_amt)
[Link]( V_SQLInsert)
[Link]()
print()
print('Account Updated Succesfully!!!!!')
elif x==2:
amt=int(input('Enter amount to be added='))
cr_amt=0
[Link]('update customer_details set cr_amt=cr_amt+'+str(amt) + ' \
where acct_no=' +str(acct_no) )
V_SQLInsert="INSERT INTO transactions values ({} , '{}' , {} , {})".format( \
acct_no,[Link](),cr_amt,amt)
[Link]( V_SQLInsert)
[Link]()
print()
print('Account Updated Succesfully!!!!!')
else:
break
if n == 3:
acct_no=int(input('Enter your account number='))
print()
[Link]('select * from customer_details where acct_no='+str(acct_no) )
if [Link]() is None:
print()
print('Invalid Account number')
else:
[Link]('select * from customer_details where acct_no='+str(acct_no) )
data=[Link]()
for row in data:
print('ACCOUNT NO=',acct_no)
print()
print('ACCOUNT NAME=',row[1])
print()
print('PHONE NUMBER=',row[2])
print()
print('ADDRESS=',row[3])
print()
print('cr_amt=',row[4])
if n == 4:
acct_no=int(input('Enter your account number='))
print()
[Link]('select * from customer_details where acct_no='+str(acct_no) )
if [Link]() is None:
print()
print('Invalid Account number')
else:
[Link]('select * from transactions where acct_no='+str(acct_no) )
data=[Link]()
for row in data:
print('ACCOUNT NO=',acct_no)
print()
print('DATE=',row[1])
print()
print(' WITHDRAWAL AMOUNT=',row[2])
print()
print('AMOUNT ADDED=',row[3])
print()

if n == 5:
print('DELETE YOUR ACCOUNT')
acct_no=int(input('Enter your account number='))
[Link]('delete from customer_details where acct_no='+str(acct_no) )
print('ACCOUNT DELETED SUCCESFULLY')
if n == 6:
break
c=input('enter your choice=')
else:
print('THANK YOU PLEASE VISIT AGAIN')
quit()

Main_bank.py
import [Link] as sql
conn=[Link](host='localhost',user='root',passwd='rohit@2005',database='bank')
cur = [Link]()
print('==========================================WELCOME TO RRR
BANK=========================================================')
import datetime as dt
print([Link]())
print('[Link]')
print()
print('[Link]')
print()
n=int(input('enter your choice='))
print()
if n== 1:
name=input('Enter a Username=')
print()
passwd=int(input('Enter a 4 DIGIT Password='))
print()
V_SQLInsert="INSERT INTO user_table (passwrd,username) values (" + str (passwd) + ",' " + \
name + " ') "
[Link](V_SQLInsert)
[Link]()
print()
print('USER created succesfully')
import menu
if n==2 :
name=input('Enter your Username=')
print()
passwd=int(input('Enter your 4 DIGIT Password='))
V_Sql_Sel="select * from user_table where passwrd='"+str (passwd)+"' and username= ' " \
+name+ " ' "
[Link](V_Sql_Sel)
if [Link]() is None:
print()
print('Invalid username or password')
else:
print()
import menu
OUTPUTS

Creating Tables :
[Link] and Creating an Account:

2. Login and Transaction details:


3. Customer details
[Link] Details:

DATA BASE:
5. Deleting Account:

You might also like