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

K C International School

The document is a project report submitted by Mahir Bhat for their class on the banking system. It contains sections on project analysis, functions and modules used, a description of the project which involves a MySQL table to store employee data, the source code to perform CRUD operations on the table, and outputs and tables. The code allows users to create a database and table, insert, update, delete, search and display records from the employees table.

Uploaded by

mannat.swarnim
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 views28 pages

K C International School

The document is a project report submitted by Mahir Bhat for their class on the banking system. It contains sections on project analysis, functions and modules used, a description of the project which involves a MySQL table to store employee data, the source code to perform CRUD operations on the table, and outputs and tables. The code allows users to create a database and table, insert, update, delete, search and display records from the employees table.

Uploaded by

mannat.swarnim
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
You are on page 1/ 28

K C INTERNATIONAL

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

The project report entitled


“BANKING SYSTEM”
Submitted by Mahir Bhat of class XII A for the CBSE
Senior Secondary Examination 2019-20 Class XII for
Computer Science at K C International School , Jammu
has been examined.
SIGNATURE OF EXAMINER

D E C L A R AT I O N

I hereby declare that the project work entitled


“BANKING SYSTEM”, submitted to Department
of Computer Science, K C International School ,
Jammu is prepared by me.

STUDENT’S NAME
Class XII
ACKNOWLEDGEMENT

I would like to express a deep sense of thanks & gratitude to my


Project guide Mrs. Nidha Suri Khanna for guiding me
immensely through the course of the project. He always
evinced keen interest in my work. His constructive advice &
constant motivation have been responsible for the successful
completion of this project.
I also thanks to my parents for their motivation &
support. I must thanks to my class mates for their timely help &
support for completion of this project.
Last but not the least I would like to thanks all those who
had helped directly and indirectly towards the completion of
this project.
STUDENT’S NAME
Class XII

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:

By importing this package we are able to


establish a connection between MySQL and
python.
FUNCTIONS
1.connect():
Establishes connection between MySQL and
python.

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

Our project has one MySQL table


named:
EMP

The table EMP contains the following


columns:
1. id
2. ename
3. salary
SOURCE CODE:
# Project on Employee Management System

import mysql.connector

import sys

def menu():

loop='y'

while(loop=='y' or loop=='Y'):

print("........MENU.......")

print("1. CREATE DATABASE")

print("2. SHOW DATABASES")

print("3. CREATE TABLE")

print("4. SHOW TABLES")

print("5. INSERT RECORD")

print("6. UPDATE RECORD")

print("7. DELETE RECORD")

print("8. SEARCH RECORD")

print("9. DISPLAY RECORD")

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

loop=input("Do you want more try? Press 'y' to continue...")

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

cur.execute('create database if not exists employee')

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

cur.execute('create table if not exists emp(id integer primary key, ename


varchar(15), salary float)')

print()

print("Table Created -> EMP")

cur.execute('DESC emp')

print("+-------------|--------------|-----------+")

print("+Column Name |DataType(Size)|NULL |")

print("+-------------|--------------|-----------+")

for i in cur:

print('|{0:12} | {1:12} | {2:10}|')

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

ID=int(input("ENTER EMPLOYEE ID : "))

NAME=input("ENTER NAME OF EMPLOYEE : ")

SALARY=float(input("ENTER EMPLOYEE SALARY : "))

query1="INSERT INTO emp(id,ename,salary) VALUES({},'{}',


{})".format(ID,NAME,SALARY)

cur.execute(query1)

con.commit()

print('Record Inserted')

con.close()

else:

print("Error : Not Connected")


def update_record():

con=mysql.connector.connect(host='localhost',user='root',passwd='1234',database=
'employee')

cur=con.cursor()

d=int(input("Enter Employee ID for update record : "))

ID=int(input("ENTER NEW EMPLOYEE ID : "))

name=input("ENTER NEW NAME OF EMPLOYEE : ")

salary=float(input("ENTER NEW SALARY FOR EMPLOYEE : "))

query1="update emp set id=%s, ename='%s', salary=%s where id=%s" %


(ID,name,salary,d)

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

d=int(input("Enter Employee ID for deleting record : "))

query1="delete from emp where id={0}".format(d)

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("ENTER THE CHOICE ACCORDING TO YOU WANT TO SEARCH


RECORD: ")

print("1. ACCORDING TO ID")

print("2. ACCORDING TO NAME")

print("3. ACCORDING TO SALARY")

print()

choice=int(input("ENTER THE CHOICE (1-3) : "))

if choice==1:

d=int(input("Enter Employee ID which you want to search : "))

query1="select * from emp where id=%s" %(d)

elif choice==2:

name=input("Enter Employee Name which you want to search : ")

query1="select * from emp where ename='%s'" %(name)

elif choice==3:

sal=float(input("Enter Employee Salary which you want to search : "))


query1="select * from emp where salary=%s" %(sal)

else:

print("Wrong Choice")

cur.execute(query1)

rec=cur.fetchall()

count=cur.rowcount

print("Total no. of records found : ",count)

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

cur.execute('select * from emp')

rec=cur.fetchall()

count=cur.rowcount

print("+----------|--------------|-----------+")
print("+ Emp ID | Emp Name | Salary |")

print("+----------|--------------|-----------+")

for i in rec:

print('|{0:^9} | {1:12} | {2:10}|'.format(i[0],i[1],i[2]))

print("+----------|--------------|-----------+")

print("+ Total no. of records are : ",count," |")

print("+-------------------------------------+")

#for i in rec:

# print(i)

con.close()

else:

print("Error : Database Connection is not success" )

menu()
OUTPUTS
SQL TABLES

You might also like