Professional Documents
Culture Documents
SCHOOL
SESSION: 2023-24
PROJECT REPORT
ON
"BANKING
SYSTEM"
Submitted By: Submitted to:
Mahir Bhat Ms. Nidha Suri Khanna
CLASS - XII-A
Roll No:
K C INTERNATIONAL SCHOOL
CERTIFICATE
D E C L A R AT I O N
STUDENT’S NAME
Class XII
ACKNOWLEDGEMENT
CONTENTS
___________________________
1. PROJECT ANALYSIS
2. FUNCTIONS AND MODULES
3. DESCRIPTION
4. SOURCE CODE
5. OUTPUTS AND TABLES
6. BIBLIOGRAPHY
FUNCTIONS AND MODULES
MODULES:
1. import mysql.connector:
2.cursor():
It is a special control structure that facilitates
the row by row processing of records in the
result set.
Syntax:
<cursor object>=<connection object>.cursor()
3.execute():
This function is used to execute the SQL query
and retrieve records using python.
<cursor object>.execute(<sql query string>)
4.def():
Used to define a function
5.fetchall():
This function will return all the rows from the
result set in the form of tuple containing the
records.
6.commit():
This function provides changes in databases
physically
DESCRIPTION
import mysql.connector
import sys
def menu():
loop='y'
while(loop=='y' or loop=='Y'):
print("........MENU.......")
print()
print()
choice=int(input("Enter the choice (1-9) : "))
if(choice==1):
create_database()
elif(choice==2):
show_databases()
elif(choice==3):
create_table()
elif(choice==4):
show_tables()
elif(choice==5):
insert_record()
elif(choice==6):
update_record()
elif(choice==7):
delete_record()
elif(choice==8):
search_record()
elif(choice==9):
display_record()
else:
print("Wrong Choice.")
else:
sys.exit()
def create_database():
con=mysql.connector.connect(host='localhost',user='root', passwd='1234')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
print()
print("Database Created")
con.close()
def show_databases():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
cur.execute('show databases')
for i in cur:
print(i)
con.close()
def create_table():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
print()
cur.execute('DESC emp')
print("+-------------|--------------|-----------+")
print("+-------------|--------------|-----------+")
for i in cur:
print("+-------------|--------------|-----------+")
con.close()
def show_tables():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
cur.execute('show tables')
for i in cur:
print(i)
con.close()
def insert_record():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
if con.is_connected():
#print("Successfully Connected")
cur=con.cursor()
cur.execute(query1)
con.commit()
print('Record Inserted')
con.close()
else:
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
cur=con.cursor()
cur.execute(query1)
con.commit()
print("Record Updated")
con.close()
def delete_record():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
cur=con.cursor()
cur.execute(query1)
con.commit()
print("Record Deleted")
con.close()
def search_record():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
cur=con.cursor()
print()
if choice==1:
elif choice==2:
elif choice==3:
else:
print("Wrong Choice")
cur.execute(query1)
rec=cur.fetchall()
count=cur.rowcount
for i in rec:
print(i)
print("Record Searched")
con.close()
def display_record():
con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')
if con.is_connected():
#print("Successfully Connected")
cur=con.cursor()
rec=cur.fetchall()
count=cur.rowcount
print("+----------|--------------|-----------+")
print("+ Emp ID | Emp Name | Salary |")
print("+----------|--------------|-----------+")
for i in rec:
print("+----------|--------------|-----------+")
print("+-------------------------------------+")
#for i in rec:
# print(i)
con.close()
else:
menu()
OUTPUTS
SQL TABLES