Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Navneet Project

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

1.

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='jhajjar@123',database='navneet')

if conn.is_connected():

print('connected succesfully')

cur = conn.cursor()

cur.execute('create table customer_details(acct_no int primary key,acct_name


varchar(25) ,phone_no bigint(25) check(phone_no>11),address varchar(25),cr_amt float )')

2.

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='jhajjar@123',database='navneet')

cur = conn.cursor()

cur.execute('create table transactions(acct_no int(11),date date ,withdrawal_amt


bigint(20),amount_added bigint(20) )')

3.

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='jhajjar@123',database='navneet')

cur = conn.cursor()
cur.execute('create table user_table(username varchar(25) primary key,passwrd varchar(25) not null
)')

4.

import datetime as dt

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='jhajjar@123',database='navneet')

cur = conn.cursor()

conn.autocommit = True

c = 'y'

while c == 'y':

print()

print('1.CREATE BANK ACCOUNT')

print()

print('2.TRANSACTION')

print()

print('3.CUSTOMER DETAILS')
print()

print('4.TRANSACTION DETAILS')

print()

print('5.DELETE ACCOUNT')

print()

print('6.QUIT')

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) + " ) "

cur.execute(V_SQLInsert)

print()

print('Account Created Succesfully!!!!!')

conn.commit()
if n == 2:

acct_no=int(input('Enter Your Account Number='))

cur.execute('select * from customer_details where acct_no='+str (acct_no) )

data=cur.fetchall()

count=cur.rowcount

conn.commit()

if count == 0:

print()

print('Account Number Invalid Sorry Try Again Later')

print()

else:

print()

print('1.WITHDRAW AMOUNT')

print()

print('2.ADD AMOUNT')

print()

print()

x=int(input('Enter your CHOICE='))

print()

if x == 1:

amt=int(input('Enter withdrawl amount='))

cr_amt=0

cur.execute('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,dt.datetime.today(),amt,cr_amt)
cur.execute( V_SQLInsert)

conn.commit()

print()

print('Account Updated Successfully’)

if x== 2:

amt=int(input('Enter amount to be added='))

cr_amt=0

cur.execute('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,dt.datetime.today(),cr_amt,amt)

cur.execute( V_SQLInsert)

conn.commit()

print()

print('Account Updated Succesfully!!!!!')

if n == 3:

acct_no=int(input('Enter your account number='))

print()

cur.execute('select * from customer_details where acct_no='+str(acct_no) )

if cur.fetchone() is None:

print()

print('Invalid Account number')

else:

cur.execute('select * from customer_details where acct_no='+str(acct_no) )

data=cur.fetchall()

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()

cur.execute('select * from customer_details where acct_no='+str(acct_no) )

if cur.fetchone() is None:

print()

print('Invalid Account number')

else:

cur.execute('select * from transactions where acct_no='+str(acct_no) )

data=cur.fetchall()

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='))

cur.execute('delete from customer_details where acct_no='+str(acct_no) )

print('ACCOUNT DELETED SUCCESFULLY')

if n == 6:

print('DO YO WANT TO EXIT(y/n)')

c=input ('enter your choice=')

else:

print('THANK YOU PLEASE VISIT AGAIN')

quit()

5.

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='jhajjar@123',database='navneet')

cur = conn.cursor()

#cur.execute('create table user_table(username varchar(25) primary key,passwrd varchar(25) not


null )')
print('=========================WELCOME TO STARK
BANK============================================================')

import datetime as dt

print(dt.datetime.now())

print('1.REGISTER')

print()

print('2.LOGIN')

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
+ " ') "

cur.execute(V_SQLInsert)

conn.commit()

print()

print('USER created succesfully')

import project4

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+ " ' "

cur.execute(V_Sql_Sel)

if cur.fetchone() is None:

print()

print('Invalid username or password')

else:

print()

import project4

You might also like