Sie sind auf Seite 1von 20

A PROJECT OF PYTHON ON

EMPLOYEES DATA MANAGEMENT SYSTEM

SUBMITTED BY
Pawan Kumar
CLASS: XII-A
BOARD ROLL NO- 13629101

UNDER THE GUIDANCE OF


Mrs. PAYAL SHARMA(PGT)
COMPUTER SCIENCE
CERTIFICATE
This is to certify that Pawan Kumar of
class XII-A has prepared the report on the
project entitled “EMPLOYEES DATA
MANAGEMENT SYSTEM”.

The report is the result of his efforts and


endeavours. The report is found worthy
of acceptance as final project report for
the Computer Science of Class XII. He has
prepared the report under my guidance.

Mrs. PAYAL SHARMA


PGT (Computer Science)
DEPARTMENT OF COMPUTER SCIENCE
ACKNOWLEDGEMENT
I would like to express a deep sense of thanks &
gratitude to my project guide Mrs. Payal Sharma
for guiding me immensely through the course of
project. She always evinced keen interest in my
work. Her constructive advice & constant
motivation has been responsible for the
successful completion of this project. I also thank
to my parents for their motivation and support. I
must thank to my classmates as well. Last but
not least; I would like to thank all those who
had supported me directly and indirectly in any
manner for completion of this project.

PAWAN KUMAR XII-A


ABOUT THE PROJECT
This project is designed to add a new
employees, update salary or details of
existing employees, delete details; it is
also capable of searching an employee
details and the most useful thing is that it
will also enter the data in Microsoft excel.

This project is made by SQL DBMS and


Python connectivity using
“mysql.connector” module and excel
connectivity. The module “sys” is used to
provide access to some variables used or
maintained by the interpreter and to
functions that interact strongly with
interpreter.
CODING
print('----------------------------------------------------
\nWELCOME TO MANAGEMENT SYSTEM OF ABC
COMPANY\n----------------------------------------------\n ')
print('
*******************************************\
nFROME HEAR YOU CAN MANAGE YOUR EMPLOYEES
DATA\n*************************************
*******\n')
defmoh():
importmysql.connector as cont
mydb=
cont.connect(host="localhost",user="root",passwd="
root",database="business")
mycur=mydb.cursor()
print("\n")
print ('YOUR CURRENT TABLE IS :\n ')
iv="SELECT* FROM EMPLOYES"
mycur.execute(iv)
et=mycur.fetchall()
for K in et:
print(K)
print("\n WHAT YOU WANT TO DO\n ")
print(' A: ADMISSION OF NEW EMPLOYEE : ')
print(' B: UPDATE EMPLOYEES AMOUNT OF
SALARY')
print(' C: DELETE EMPLOYEES DETAILS')
print(' D: DO YOU WANT TO EXIT')
print(' E: SEARCH FOR EMPLOYEE')
print('\n ')
c=input("Enter Your Choice (A-E) : ")
if c=='A' or c=='a':
print('=============================\nGIVE
DETAILS OF NEW
EMPLOYEE\n=============================')
q= int(input("ENTER EMPLOYEE 4 DIGIT CODE : "
))
x= input("ENTER THE NAME OF NEW EMPLOYEE
:" )
y= input("ENTER THE GENDER OF EMPLOYEE
MALE(M) , FEMALE (F) : " )
z= input("ENTER SALARY OF EMPLOYEE : " )
sql="insert into employes (ecode, ename, sex, salary)
values(%s,%s,%s,%s)"
val=(q,x,y,z)
mycur.execute(sql,val)
print('*************************\nNEW
EMPLOYEE ADDED \n*************************')
hiv="SELECT* FROM EMPLOYES"
mycur.execute(hiv)
ret=mycur.fetchall()
for l in ret:
print(l)
mydb.commit()
elif c=='B' or c=='b':
n=input("WRITE UPDATED SALARY : ")
o=input("WHAT IS THE CODE OF EMPLOYEE : ")
ql="UPDATE employes SET salary=%s WHERE ecode
=%s"\
%(n,o)
mycur.execute(ql)
hiv="SELECT* FROM EMPLOYES"
mycur.execute(hiv)
ret=mycur.fetchall()
for l in ret:
print(l)
mydb.commit()
elif c=='C' or c=='c':
zzx= input(' NAME THE EMPLOYEE CODE WHOSE
DATA YOU WANT TO DELETE : ')
zx="DELETE FROM EMPLOYES WHERE ecode =
%s"%(zzx)
mycur.execute(zx)
hiv="SELECT* FROM EMPLOYES"
mycur.execute(hiv)
ret=mycur.fetchall()
for l in ret:
print(l)
mydb.commit()
elif c== 'd' or c== 'D':
exit()
elif c=='E'or c=='e':
print(" 1: TO SERACH BY EMPLOYEE CODE
NUMBER")
print(" 2: TO SEARCH BY EMPLOYEE NAME")
c=int(input("ENTER YOUR CHOICE : "))
if c==1:
try:
roll=int(input("ENTER EMPLOYEE CODE NUMBER TO
SEARCH : "))
qry="select * from employes where ecode=%d"%roll
mycur.execute(qry)
data=mycur.fetchall()
iflen(data)==0:
print('\n')
print("EMPLOYEE NOT FOUND")
print('\n')
fori in data:
j=str(i).split()
for k in j:
print(k,end=" ")
print()
except:
print("SORRY NO EMPLOYEE IS FOUND RELATED TO
THIS NAME")
if c==2:
try:
name=input("ENTER EMPLOYEE NAME TO SEARCH :
")
qry="select * from employes where
ename='%s'"%name
mycur.execute(qry)
data=mycur.fetchall()
iflen(data)==0:
print('\n')
print("EMPLOYEE NOT FOUND")
print('\n')

fori in data:
j=str(i).split()
for k in j:
print(k,end=" ")
print()
except:
print("SORRY NO EMPLOYEE IS FOUND RELATED TO
THIS NAME")

else:
print('-------------------------------\nPLEASE ENTER FROM
ABOVE OPTIONS\n-------------------------------')
ra = input("DO YOU WANT TO CONTINU IF YES(Y) ,
NO(N): ")
ifra== 'y' or ra== 'Y':
moh()
else:
exit()

moh()
OUTPUT
BIBLIOGRAPHY
 Computer Science with
Sumita Arora
 Computer Science with Preeti
Arora
 www.wikipedia.org

Das könnte Ihnen auch gefallen