You are on page 1of 35

This is to certify that ANAMIKA,PRINCE,AMOL and SANDEEP

of Class XII, has successfully completed the investigatory


project on the topic Employee Management under the
guidance of Mr.HIMAYET HUSSAIN (PGT, Computer Science)
during the academic year 2022-2023.
I hereby declare that the project work entitled "Employee
Management" submitted to Department of Computer
Science, AIR FORCE School MANAURI, is prepared by us. All
the coding is result of my personal efforts.
I would like to express a deep sense of thanks and gratitude to my
project guide Mr.HIMAYET HUSSAIN Sir for guiding me immensely through
the course of the project lie always evinced keen interest in my work.
His constructive advice and constant motivation have been responsible
for the successful completion of this project
My sincere thanks goes to MRS.SHEFALI HIRA our Principal Madam, for her
coordination in extending every possible support for completion of this
project.
1 also thanks to my parents for their motivation and support I must
thanks to my classmates for their timely help and support for
compilation of this project.
Last but not least I would like to those who had helped directly or
indirectly towards the completion of this project.
The project is designed to keep records of Employee in specific
department and specific post who arc working in these companies. A
table named crcd in MySQLS.O to store information about user login
ids and passwords.

One more table named department in MySQL5,0 to store


information about department code, name and their packages.

One more table named post in MySQLS.O to store information about


post code and name.

One more table named staff in \1ySQL5.0 to store information about


employee (staff) name, address, phone number, salary and post.

Administrator of the project can enter new record, display all


specific passenger record; he can modify ami delete records in any
tabic.
Functions E. sed in Project

1. connect()- For Database and tables creation


2. cursor()- To execute MySQL queries.
3. fetchall 0* To fetch all the rows.
4. commit()- To execute (commit) current transaction.
5. fetchone ()- To fetch row according to query.
import mysql.connector as my

yu="n"

while vu=="r»": print(“—1-

FQR LOGIN-”) prtnt{”—2-

FOft SIGNUP—") print(‘ —

O'EX IT—") a6=input[

"ENTER:-"} if a6=="l”;

uname=input(" ENTER USERNAME:-*’)

pswd=input(” ENTER PASSWORD:-”}

con=my,connect{host=’!ocalhost">user=',root",passwd="manager”Pdatabase="empmana
ge "}

«jr-con.cufsor(}

ctr.execute! “select passwd,user_n from cred where user_n="‘+uname+.....}

row=cur.fetchall(

) for r in row:

If rfO]=pswd: pri nt{”Sucessf

u lly Login!"] curxlose{)


!! Idepartment's employee management functions!!!

fO="n”

while fD=”n": printf'""

-1-Employee Details—

—2-Department functions—

-3-Post Details—

—4 - Update Or Delete LoginlD And Password—

-O-LOGOUT-.......j

a^nputl,4ENTER:-,‘)

If a=="l":

(f !1 lemployee details functions! I!

fls"n"

while fl«V;

printr")

printr—l-All Staff Details—") printr™ 2-

Search Employee By E JD—*') print("—3-

Change Employee Details—"} printr—4-

Add New Employee—"I printf’*—5-Delete

Employee Details—") printr—OrExitStaff

Functions—“) al=input("ENTER:-")
# mail details!!!

if al='T':

con=mv.cormect(host= "Iocalhost",u5er=riroot'\pas5wdi"managerM,dalabase^"empmartage
")

cur=con.cursor()

cur.executel'setett • from

staff'1) for i in cur: print{i)

con.doseO

ti l!!seareher!!!

If al*"2":

y="y"

while Y="Y11:

eid=inputf"Enter Employee ID;-”)

can=my.connect(host="localhast",user=nroot”rpa5swd="nianager"Idatabase=:''empmanage
")

cur=con,cursor()

cur.executef'select * from staff where s_id=“,,+eid+.....)

x=cur.fetchone(

) if x=None:

print{"lnvaiidld!"J

else:
Gur.eK€cut€("select * from staff where

sJds,"'+eid+,,",) for i incur: printCi) con.dosej)

V=inputj "Search Another ld(y/n);-")

# HIchangerH!
if ai="3":

can=my<ronnect(hast=“iocalhost‘1,user~,,root'1(pas5wd="manager",datab3se=,'empma
nage

cur=con.cursor(J

eid=input(“Enter Employee ID:*")

cur„e*eaJte("setect * from staff where s Jd-

"'+eld+,m") x=cur,fetchoneO

if x==None; prirrt("lnvaiid Id!”)

else:
prlntC"'

—1-Change name —
—2-Change Contact—

-3 Change Address -—

4-Change Salary—

......)
alCMnputf'ENTlR:-")

tfalO="l":

aq=input("Enter New Name:*”)

con=my.connect(host=
"localhost"J(user^l'r£>ot'1Jpasswcf='‘manager,‘,database=,lempmanage
1
cur=con.cursor()

cur. execute^ "update staff set s_name= M+aq+"' where


sjd“'"+eid+.....)

con.commit()

con.close{)

print ("Record Updated!") if alO—’2"j

aq=input("EnterNewContact:-")

con=my.connect(host="localho5t”#U5er=i,root'1,passwd="nrianager”,database=i,empmanage
")

cur-con.cursor(}

Curvexecute(“update staff set s_phone=”,+aq+”‘where

s_id='"+eid+1""|

eon.eornm>t() con.closed

printC’Record Updated!"! if alQ™"3":

aq=input("Enter New Address:-")


CGn=mY>connect(host= lacalhost",user=HreK>t",passwcf=Mmanager",database-
"empmanage
1

cuf=con.cursor(}

cur.execute! 'update staff set s_addr=’"+aq+"’ where

sjd='"+eid+.....)

con.commrt()

con.close()

prmt{"Reeard

Updated!") if al0=="4":

aq-ifiput("Enter New Salary:-")

con=my.connect(host="localhost",user="root"J1passwd="managcr",database="empmana
ge
")

cur^con.cursor!)

cur.exeaJteC'update staff set s_sa!ary=",+aq+'" where


sJd=",+eid+IM")

con.commit()

con.closeO

printf'Record Updated!")

n !! ladder!!!

if al=*="4":

md=input(‘Enter ID:-")

nna=input("£nter name:-")

nad=input('E nter address:-

")
napdnputC" Enter Contact:-"} nsa=input ('Enter

Salary:-") npo=input("Enter post:-")

con=myiconnect(host="!ocalhost'<user=',root',fpasswd-
!'managerM,database=‘'empman;age

cur=con,cursor()

cur.executef select s Jd from staff where

sjd="’+nid+4,",j x=eur.fetchoneO if x~None and

len(nap}<=ll: cur.executerinsert into staff

vaIues(’"+str(iiiid)+’,V"+nna+",/,'+nad+,M,"'+nap+'"/"+r>sa+"V"+npo+'")")

con.commit()

con.doseO

print("DetaiIs Sawed!")

else:

printf’ID Already Exists Or Invalid Contact!")

8 !!!remover!!l

if al="5":

aw=input("£nter Employee ID:-")

eon=my.comtect(hosi="localhost’‘.user="root",passwd="manager"idatabase="empmana
ge
%
cur=con.cursor(|

cur.execute("setect * from staff where sJd=,*,+aw+"VM)


x=cur.fetchone{} if x—None:

print("!nvalitHd!")

else:

cur.executerdelete from staff where 5_ld=,"+aw+

"")

con.commitO

eon.close(J

priatC’Record Removedr)

fl*V

printfStaff Functions Closed!'')

# IIIDepartment Functionslll

if a=="2N:

while fl==,,n": print(,,n'‘

—1-See Department--—2-

Search Department—

—3-Add Department---4-

Remove Department—

—5-Upadate Department—

-0-Exit Department Functions—


a2=ftiput("£NTER:-"]

B !!!see Department!!!

ifa2=,,lM:

con-my.conneet{hQst=' localhost"(user="root"„passwd="manager'
»database=’'empmanage
1

cur=con.cursor()

cur.executer’setect * from

department") for i in cur: print)!)

## ! "search item!!!

if a2="2": ad="y"

while ad==’Y’ or ad=‘'Y'':

con=my.connect(host="localhost',user="root,'rpasswd=’'manager"/daiabase="empmana
ge
1

cur=con. cursor))

a=input{'Enter Department Code>“)

cur.execute("select * from department where

deptcode=t,,+a+‘,M,| xscur.fetchoneO if x==None:

printpnvalid Id!")

else:
cur.execute("select * from department where deptcode=r"+a+M"r)

fori incur; print{i)

ad^inputf "Search Other Oepartment(y/n);-")

d HfAdd Department!!!

if a2«n3": ad=V
whilead==Y' orad=="Y":

ico=input("Enter Department code;*")

ina=input("Enter Department Name:-")

ipa=int{input("Enter Department package:*”})

can=mv.connect(host="localhost",u5.er="root",passwd=“manager",d3tab3se="emipmanage
1

cur=con.cursor()

cur.executef’seleet * from department where deptcode=",+ieo+.....)

x=cur.fetchall{) if x==None: printfTry Again!")

else:
cur.execute("insert into department
vafues{’"+ico+,',/"+ina+"V,,+str(ipa)r-"')")
print{"SucessfuMy Added!")
con. commit <) con.dosef)

ad=input("Add Other Depart mentfY/o}:"'1)

printCDepartmentcode Already Exists T]

fl l!!remover!!1

If a2="4": ad="Y"
while ad==Y' or ad^'T’:

con=mY.connect(host=“localhost ,Juser="root",passwc(="managerM,database="empmanage

cur-con.cursor()

asjnputf 'Enter Department Code:-")

cur.executerselect* from department where deptcode-‘"+a+n'")

x=cur.fetchone() if x—None: printpnvaHdld!"}

else:

cur.executerdelete from department where deptcode=,,‘+a+N"'J

con.commrt()

con.dosef}

ad=input|"Remove Other Departmentfy/n):-") printf Deleted

Successfully f")
ilSupdaterl!!

if a2="5":

ad=V

while ad«Y’ orad="Y":

pnnt("""

—1-Change Department Name---2-Change

Department Package—"'")

Hnpmt("ENTER:-")

if i=—"1":
e="y“

while e""v“ ore*="YM: a=inputi("Enter

Department Code;-")

na"input(”Enter New Name:-")

con=mY,connect(host^ localhost fusers'root,’,passwcf="manager"<database="empmanage ")

cur=con .cursor Q

cur.executef'selecT * from department where deptcode=’”+a+,,,"1

x=eijr.fetchone(J if x—None: print! "Invalid tdl") else:


cur.executef'update department set deptnames=""+na+"'r
where
deptcode="'+a+.....)

con.commitO

con.closeQ

e=idput[MChange Any Other Name(y/n)>")

if i="2": e='Y'

while e*-'y" or e«"V": a=fnput(“Enter

Department Code:-")

na~int(lnputfEnter New package:-

"))

con=myxonnect{host="iocalhost',user="root"rpasswd="manager"rdatabase='fempmanag
e
"I

cur=con.cursor()

cur.execute("select * from department where

deptcode=’"+a+'"") x=ciir.fetchone() if x=~None: prirvt|"lnvalid

Id!") else:

cur.executeTupdate department set depttiame='+na+m

where

deptcode=",+a+""’)

con.commitf)

comclose()
cur.executef'update department set deptnames=""+na+"'r where
deptcode="'+a+.....)

con.commitO

con.closeQ

e=idput[MChange Any Other Name(y/n)>")

if i="2": e='Y'

while e*-'y" or e«"V": a=fnput(“Enter

Department Code:-")

na~int(lnputfEnter New package:-"))

con=myxonnect{host="iocalhost',user="root"rpasswd="manager"rdatabase='fempmanage
"I

cur=con.cursor()

cur.execute("select * from department where deptcode=’"+a+'"")

x=ciir.fetchone() if x=~None: prirvt|"lnvalid Id!") else:

cur.executeTupdate department set depttiame='+na+m where

deptcode=",+a+""’)

con.commitf)

comclose()
e^inputf’Change Any Other Package(y/n):-")

printf'Record Updated?*') ad=input( "Change

Any Other Record(y/n):-") if a2=*"0": fl-"y"

print(uDepartment Closed!'1)

» I Hpost functions!!!

If a*Mr:

qp= n

while qp—

"n":

print(......

— 1-See list Of Post—

—2-Update Post—

-3-Remove Or Add Post—

—0 Exit Post Functions—1""")

a3=input{"

ENTER:*"') ft tHfor list seeing!!!

con-my.cfinnect(host= localhost ruser="root“ipasswd-"manager’,,database-'’empmanage,,


i
cuf=con,cursor()
cur.executef'setect •from post")

for i in cur: print(i)

con.close()

# i!'Updater!!!

If a3**M2":

er=V*
while ef"V or «r»nr:

con=mvxonnect{host=1ocalhost',user=,"root,,Jpasswcl="managef",database=Hempmanage"
)

cur=eon.cursor() ic^inpift("EnterPost Code:-")

cur.executef'seleet * from post where pos! .code="'+ic+”"‘)

x=cur.fetchone()

if x==None;

prlntOnvalid Code!”) else:

upq=int(input( EnterNewNoJM Employees:-"))


cur, execute! 'update post set no_of_empioyees='"+str(upq)+'" where
post_code~m+ic+,,,,‘)

con.commitO
con.dose{)

print {’Post Updated!'') er=input("Change

Any Other Postfy/n):- ’)

# H!re mover and adder!!!

If a3=="3":

uf='v"

while ui^y” or ul*T: prirttf —1-

Add New Post—

- 2 -Remove Post—""")

rty=mput(HENTER:-H)
if

df="y"

whiledf="y" ordf""Y":

con=my.cormect(hosl=,localhost,,user="root"Jpasswd5:"mianager"#database-Merrfpm3n3gew
)

cur=con.£ursor{) itc=input("Enter Post Code:-"}

itn=input{HEr>ter Post Name:*"}

itq=input{"Erster No Of Employees:-")

cor.execute("select post_code from post where


post_code='"+itc+‘"H]

x=cur.fetchall()
if x=None:

cur.exeeute("msert into post values("N-itc+^"’+itnVV,+ft£t+'T')

con.commit{) con.ctose() printC'Post Added!") else:

print|"Post Code Already Exists!") df=input("Add Any Other Postly/n):-”}

IfrtY^'T':

op-'y"

while op~uy" or op-="Yc’:

itc=input("Enter Post Code:-

")

con=mv.connect(host='localhost,,user="root,,1passwd=,,mandger,’,database-"empmanaKe*’
)

cordon.cursarO

cur.execute("select postcode from post where

post _code=1 "+it c+”' *')

x=eur.fetchone() if x==None:

print(‘invalidPost Code!") else:

cur.execute{Mdelete from post where post_code=""+jtc+"'r')


con.commit{)

con.ciose()
print("Post Removed!")

op=input(‘’Remove Any Dther Post{y/n)i-“)

uMnput{”Add Or Remove Any Other Po.stfy/n}:-'")

Ifa3==,,0u:
QP-"v"

prlntf'Posts Closed!")

tt IHIoginJdor Password update or delete programme!!!

If a~="4": lk»"n"
while lki=="n" or lk="N":

printr*"

—1-For Updating Loginld Or Password—

— Z For Remove An ID —

—O-For Exit—"""}

jfcMnputf'ENTER:-

*1) jf jkl="lM;
ty-'V"

while ty=V; print("""


—1-Update LoginID—

—2-Update Password—""")

rt=input("ENTER:-”J

if rt—

Hl w :

nm='Y'
while nms»*Y" ornm»T!

con=mv.connect(host=rlocalhost',user=”rool",passwd=‘’manager'',database=',empmanage'1

eur=con.cursor{)

oid=input( “Enter Old LoginID:-")

nicN nput( “Enter New Log ini D:-")

cur.execute("select * from cred where user ji=t”+oid+‘,m)

x=cur,fetchone()

if x—None:

printf'ld Does not Exists!") else:

cur.executef'update cred set user_n='“+md+*" where

user_ns‘”+oid+w"'}

con.commitO

con.dosef)

printriaginlD Updated!") nm-input("Change Any Other

Login!D(y/n):-"J
if

rts="2":

nm='Y'
while nm=2'y' or nms='V:

con=my.cormeet{host=Iocaihost',user="root'',passwd="nnianager,'1database="empmianage''
)

cur=con.cursor()

oid=input(''Enter LoginlD:-’’}

nid=inpul(“Enter New Password:-")

eur.executef'seleet • from cred where user_n="’+oid+"'")

x=tur.fetchone()

if x—None:

print("Id Does not Exists!"} else:

cur.exeeute{"update cred set passwd=""+nid+<''where

user_n='"+oid+.....)

con.commit{)

con.dose()

print( "Password Updated!'1} nm-inputf'Change Any

Other Passwordfy/n}:-")

tv=input|"Change Any Other Login Or Password(y/n}:-")

if jkl==h2":
nm^'y"

while nm="v" or nm=="Y":

ean=my,cormect(hosts'localhast',user=‘'root"rpasswds''managef,',database="empmanage"
)

cur=oon,cursor() aid=Snput{“Enter LogSnID:-")

cur.exeouteC'select "fromcred where user_n=,"+oid+'""J

x=cur.fetchone()

if x=None:

printpdDaes not Exists!") else:

cur.execute!“delete from ered where user_n='"+oid+"'")

con.commit!)

eon.tloseO

print("LoginlD Removed!")

nm^input("Change Any Other Credential(y/n):-1

if

lk="yw

priMfSucessfuliv Exit!")

If

«J=V
printC'SucessfuJty LOGOUT]"}

else:

print("Invalid Login Id or Password!"}

prirvtrTry Again!!")

# IMSIgnup Function!!!

If a6*-"2":

y_«'y"

while ¥“V' or Y==*Y’:

us=input(HEnter New Username:-

"} ps=input{'Enter New Password:-

")

con =mv xonnectfhosl-'localhosf^user^'root", pass wd="manager",database="empmanage

Cur=cOnxursOr()

curexecutef'seiect * fromcred where user_n=t”+us+.....}

K=cur.fe«hone

O If XjraNone:

air*executepnsert into cred values{'"+t<s+‘''/"*ps+",r]

print("Sucessfullv Saved!") con.commiti) con.closeQ else:


printCUserlD Already Exists!")

y=mput(rrCreate Other New idtv/n):-’')

n 11 fProgramme Close rill

if a6-="0"i yu="v"
j>rint(‘'Programme Closed!")
1. NCERT COMPUTER SCIENCE WITH PYTHON
BY SUMITA ARORA CLASS XII
2. WWW.WIKIPEDIA.COM
3. WWW.YOUTUBE.COM
4. WWW.KVS.NIC.IN
5. WWW.CBSE.GOV.IN

You might also like