0% found this document useful (0 votes)
2 views2 pages

Update Employee Information Script

Uploaded by

hridyapuri7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Update Employee Information Script

Uploaded by

hridyapuri7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

# UPDATE INFORAMTION

#WAP TO UPDATE INFORMATION OF THE EMPLYEE WHOSE ID IS ENTERED BY USER.

import [Link]

mycon=[Link](
host="localhost",
user="root",
passwd="aps",
database="smsdb2"
)

mycursor=[Link]()

ID=input("Enter Empid of the Employee")

query="SELECT * FROM EMP WHERE EID ='" + ID + "'"

[Link](query)

myresult= [Link]()

if len(myresult)>0:
print("Id Exisits")
for x in myresult:
print("The existinge name is ", x[1])

ans=input("Do you wish to change Name (Y/N)")


if ans in 'yY':
NAME=input("Enter Empname to update")

query=" UPDATE EMP SET EMPNAME='"+NAME+"' WHERE EID='"+ID+"' ''

[Link](query)

[Link]()

print("Information of Empid",ID," has been Updated,")


print("Information after Update is as follows:\n")

query="SELECT * FROM EMP"

[Link](query)

myresult= [Link]()

sp=" "

if len(myresult)>0:
print("*"*60)
print("EMPID",sp*(20-len(str("EMPID"))),"EMPNAME",sp*(20-
len(str("EMPNAME"))),"DEPTNAME")
print("*"*60)
for x in myresult:
print(x[0],sp*(20-len(str(x[0]))),x[1],sp*(20-len(str(x[1]))),x[3])
print("*"*60)
else:
print("No record found to dispaly")
else:
print("Update operation Cancelled by user")
else:
print("No such Id, Can't Update")

You might also like