2. 2. ManishSuryakantJain
3. Mohit Chandel
PGT (Computer Science)
CERTIFICATE
This is to certify that Kratika Mittal, Manish Suryakant Jain and Mohit Chandel of
Class XII A, has successfully completed the investigatory project on the topic Employee
Management under the guidanceof Mr. Sunil Nehra (PGT, Computer Science) during
the academic year 2019-20 in the partial fulfillment of AISSCE Practical Examination
conducted by CBSE.
Signature of
Internal Examiner
Signature of
External Examiner
Signature of
Candidate
3. DECLARATION
I hereby declare that the project work entitled “Employee Management” submitted to
Departmentof Computer Science, Subodh Public School, Jaipur is prepared by us. All the
coding is result of my personal efforts.
1. Kratika Mittal – XII A
2. Manish Suryakant Jain – XII A
3. Mohit Chandel – XII A
4. ACKNOWLEDGEMENT
I would like to express a deep sense of thanks and gratitude to my projectguide Mr. Sunil
Nehra Sir for guidingme immensely throughthe course of the project. He alwaysevinced
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 Dr Bela Joshi, our Principal Madam, for her coordination in
extending every possible support for completion of this project.
I 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.
1. Kratika Mittal – XII A
2. Manish Suryakant Jain – XII A
3. Mohit Chandel – XII A
5. CONTENTS
1. Introduction
2. Imported files and used functions in Python
3. Table Created in MySQL
4. Coding
5. Output Scenes
6. Limitations and Enhancement
7. Bibliography
6. INTRODUCTION
The project is designed to keep records of Employee in specific department and
specific post who are working in these companies. A table named cred in
MySQL5.0 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 MySQL5.0 to store information about post code
and name.
One more table named staff in MySQL5.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 and delete records in any table.
7. Files Imported in Project
1. Import MYSQL for database connectivity
Functions Used in Project
1. connect()- For Database and tables creation
2. cursor()- To execute MySQL queries.
3. fetchall ()- To fetch all the rows.
4. commit()- To execute (commit) current transaction.
5. fetchone ()- To fetch row according to query.
8. Tables Created in MySQL
Table: cred
Table: staff
Table: department
Table: post
9. CODING
import mysql.connector as my
yu="n"
while yu=="n":
print("---1-FOR LOGIN---")
print("---2-FOR SIGNUP---")
print("---0-EXIT---")
a6=input("ENTER:-")
if a6=="1":
uname=input(" ENTER USERNAME:-")
pswd=input(" ENTER PASSWORD:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select passwd,user_n fromcredwhere user_n='"+uname+"'")
row=cur.fetchall()
for r in row:
if r[0]==pswd:
print("Sucessfully Login!")
cur.close()
10. # !!!department's employee management functions!!!
f0="n"
while f0=="n":
print("""
---1-Employee Details---
---2-Department Functions---
---3-Post Details---
---4-Update Or Delete LoginID AndPassword---
---0-LOGOUT---""")
a=input("ENTER:-")
if a=="1":
# !!!employee details functions!!!
f1="n"
while f1=="n":
print("")
print("---1-All Staff Details---")
print("---2-SearchEmployee By E_ID---")
print("---3-Change Employee Details---")
print("---4-AddNewEmployee---")
print("---5-Delete EmployeeDetails---")
print("---0-ExitStaff Functions---")
a1=input("ENTER:-")
11. # !!!all details!!!
if a1=="1":
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *from staff")
for i in cur:
print(i)
con.close()
# !!!searcher!!!
if a1=="2":
y="y"
while y=="y":
eid=input("Enter Employee ID:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *fromstaff where s_id='"+eid+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
12. cur.execute("select *fromstaff where s_id='"+eid+"'")
for i incur:
print(i)
con.close()
y=input("SearchAnother Id(y/n):-")
# !!!changer!!!
if a1=="3":
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
eid=input("Enter Employee ID:-")
cur.execute("select *from staff where s_id='"+eid+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
print("""
---1-Change name---
---2-Change Contact---
---3-Change Address---
---4-Change Salary---""")
14. con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("update staff set s_addr='"+aq+"' where s_id='"+eid+"'")
con.commit()
con.close()
print("RecordUpdated!")
if a10=="4":
aq=input("Enter NewSalary:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("update staff set s_salary='"+aq+"' where
s_id='"+eid+"'")
con.commit()
con.close()
print("RecordUpdated!")
# !!!adder!!!
if a1=="4":
nid=input("Enter ID:-")
nna=input("Enter name:-")
nad=input("Enter address:-")
15. nap=input("Enter Contact:-")
nsa=input("Enter Salary:-")
npo=input("Enter post:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select s_idfromstaff where s_id='"+nid+"'")
x=cur.fetchone()
if x==None and len(nap)<=11:
cur.execute("insertintostaff
values('"+str(nid)+"','"+nna+"','"+nad+"','"+nap+"','"+nsa+"','"+npo+"')")
con.commit()
con.close()
print("DetailsSaved!")
else:
print("ID Already Exists Or InvalidContact!")
# !!!remover!!!
if a1=="5":
aw=input("Enter Employee ID:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *from staff where s_id='"+aw+"'")
16. x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
cur.execute("delete fromstaff where s_id='"+aw+"'")
con.commit()
con.close()
print("RecordRemoved!")
if a1=="0":
f1="y"
print("Staff Functions Closed!")
# !!!Department Functions!!!
if a=="2":
f1="n"
while f1=="n":
print("""
---1-See Department---
---2-SearchDepartment---
---3-AddDepartment---
---4-Remove Department---
---5-Upadate Department---
---0-Exit Department Functions---""")
17. a2=input("ENTER:-")
# !!!see Department!!!
if a2=="1":
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *from department")
for i in cur:
print(i)
# !!!searchitem!!!
if a2=="2":
ad="y"
while ad=="y" or ad=="Y":
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
a=input("Enter Department Code:-")
cur.execute("select *fromdepartment where deptcode='"+a+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
18. cur.execute("select *fromdepartment where deptcode='"+a+"'")
for i incur:
print(i)
ad=input("SearchOther Department(y/n):-")
# !!!AddDepartment!!!
if a2=="3":
ad="y"
while ad=="y" or ad=="Y":
ico=input("Enter Department code:-")
ina=input("Enter Department Name:-")
ipa=int(input("Enter Department package:-"))
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *fromdepartment where deptcode='"+ico+"'")
x=cur.fetchall()
if x==None:
print("Try Again!")
else:
cur.execute("insertintodepartment
values('"+ico+"','"+ina+"','"+str(ipa)+"')")
print("Sucessfully Added!")
19. con.commit()
con.close()
ad=input("AddOther Department(y/n):-")
print("Departmentcode Already Exists!")
# !!!remover!!!
if a2=="4":
ad="y"
while ad=="y" or ad=="Y":
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
a=input("Enter Department Code:-")
cur.execute("select *fromdepartment where deptcode='"+a+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
cur.execute("delete fromdepartment where deptcode='"+a+"'")
con.commit()
con.close()
ad=input("Remove Other Department(y/n):-")
print("DeletedSucessfully!")
20. # !!!updater!!!
if a2=="5":
ad="y"
while ad=="y" or ad=="Y":
print("""
---1-Change Department Name---
---2-Change Department Package---""")
i=input("ENTER:-")
if i=="1":
e="y"
while e=="y" or e=="Y":
a=input("Enter Department Code:-")
na=input("Enter NewName:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select * fromdepartment where deptcode='"+a+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
21. cur.execute("update department setdeptname='"+na+"'where
deptcode='"+a+"'")
con.commit()
con.close()
e=input("Change Any Other Name(y/n):-")
if i=="2":
e="y"
while e=="y" or e=="Y":
a=input("Enter Department Code:-")
na=int(input("Enter Newpackage:-"))
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *fromdepartment where deptcode='"+a+"'")
x=cur.fetchone()
if x==None:
print("InvalidId!")
else:
cur.execute("update department setdeptname='"+na+"'where
deptcode='"+a+"'")
con.commit()
con.close()
22. e=input("Change Any Other Package(y/n):-")
print("RecordUpdated!")
ad=input("Change Any Other Record(y/n):-")
if a2=="0":
f1="y"
print("Department Closed!")
# !!!post functions!!!
if a=="3":
qp="n"
while qp=="n":
print("""
---1-See List Of Post---
---2-Update Post---
---3-Remove Or AddPost---
---0-Exit Post Functions---""")
a3=input("ENTER:-")
# !!!For list seeing!!!
if a3=="1":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
23. cur.execute("select *from post")
for i in cur:
print(i)
con.close()
# !!!Updater!!!
if a3=="2":
er="y"
while er=="y" or er=="Y":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
ic=input("Enter Post Code:-")
cur.execute("select *frompost where post_code='"+ic+"'")
x=cur.fetchone()
if x==None:
print("InvalidCode!")
else:
upq=int(input("Enter NewNo_Of_Employees:-"))
cur.execute("update post set no_of_employees='"+str(upq)+"'where
post_code='"+ic+"'")
con.commit()
24. con.close()
print("Post Updated!")
er=input("Change Any Other Post(y/n):-")
# !!!remover and adder!!!
if a3=="3":
ui="y"
while ui=="y" or ui=="Y":
print("""---1-AddNewPost---
---2-Remove Post---""")
rty=input("ENTER:-")
if rty=="1":
df="y"
while df=="y" or df=="Y":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
itc=input("Enter Post Code:-")
itn=input("Enter Post Name:-")
itq=input("Enter No_Of_Employees:-")
cur.execute("select post_codefrompost where
post_code='"+itc+"'")
x=cur.fetchall()
25. if x==None:
cur.execute("insert intopost values('"+itc+"','"+itn+"','"+itq+"')")
con.commit()
con.close()
print("Post Added!")
else:
print("Post Code Already Exists!")
df=input("AddAny Other Post(y/n):-")
if rty=="2":
op="y"
while op=="y" or op=="Y":
itc=input("Enter Post Code:-")
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
cur.execute("select post_codefrompost where
post_code='"+itc+"'")
x=cur.fetchone()
if x==None:
print("InvalidPost Code!")
else:
cur.execute("delete frompost where post_code='"+itc+"'")
26. con.commit()
con.close()
print("Post Removed!")
op=input("Remove Any Other Post(y/n):-")
ui=input("AddOr Remove Any Other Post(y/n):-")
if a3=="0":
qp="y"
print("Posts Closed!")
# !!!loginIdor Passwordupdate or delete programme!!!
if a=="4":
lk="n"
while lk=="n" or lk=="N":
print("""
---1-For Updating LoginIdOr Password---
---2-For Remove AnID---
---0-For Exit---""")
jkl=input("ENTER:-")
if jkl=="1":
ty="y"
while ty=="y":
print("""
27. ---1-Update LoginID---
---2-Update Password---""")
rt=input("ENTER:-")
if rt=="1":
nm="y"
while nm=="y" or nm=="Y":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
oid=input("Enter OldLoginID:-")
nid=input("Enter NewLoginID:-")
cur.execute("select *fromcredwhere user_n='"+oid+"'")
x=cur.fetchone()
if x==None:
print("IdDoes not Exists!")
else:
cur.execute("update credset user_n='"+nid+"'where
user_n='"+oid+"'")
con.commit()
con.close()
print("LoginID Updated!")
nm=input("Change Any Other LoginID(y/n):-")
28. if rt=="2":
nm="y"
while nm=="y" or nm=="Y":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
oid=input("Enter LoginID:-")
nid=input("Enter NewPassword:-")
cur.execute("select *fromcredwhere user_n='"+oid+"'")
x=cur.fetchone()
if x==None:
print("IdDoes not Exists!")
else:
cur.execute("update credset passwd='"+nid+"'where
user_n='"+oid+"'")
con.commit()
con.close()
print("PasswordUpdated!")
nm=input("Change Any Other Password(y/n):-")
ty=input("Change Any Other LoginOr Password(y/n):-")
if jkl=="2":
29. nm="y"
while nm=="y" or nm=="Y":
con=my.connect(host='localhost',user="root",passwd="manager",database="empmanage"
)
cur=con.cursor()
oid=input("Enter LoginID:-")
cur.execute("select *fromcred where user_n='"+oid+"'")
x=cur.fetchone()
if x==None:
print("IdDoes not Exists!")
else:
cur.execute("delete fromcredwhere user_n='"+oid+"'")
con.commit()
con.close()
print("LoginID Removed!")
nm=input("Change Any Other Credential(y/n):-")
if jkl=="0":
lk="y"
print("Sucessfully Exit!")
if a=="0":
f0="y"
30. print("Sucessfully LOGOUT!")
else:
print("InvalidLoginId or Password!")
print("Try Again!!")
# !!!Signup Function!!!
if a6=="2":
y="y"
while y=="y" or y=="Y":
us=input("Enter NewUsername:-")
ps=input("Enter NewPassword:-")
con=my.connect(host="localhost",user="root",passwd="manager",database="empmanage
")
cur=con.cursor()
cur.execute("select *fromcredwhere user_n='"+us+"'")
x=cur.fetchone()
if x==None:
cur.execute("insert intocredvalues('"+us+"','"+ps+"')")
print("Sucessfully Saved!")
con.commit()
con.close()
else: