Computer Science
Write a program to increase salary of the employee, whose name is "MANOJ KUMAR", by 3000.
Answer
import mysql.connector
mydb = mysql.connector.connect(host = "localhost", user = "root", passwd = "tiger", database = "School")
mycursor = mydb.cursor()
mycursor.execute("UPDATE employee SET salary = salary + 3000 WHERE Ename = 'MANOJ KUMAR'")
mydb.commit()
print("Number of rows affected:", mycursor.rowcount)
Output
Number of rows affected: 1