Computer Science

Write a program to increase salary of the employee, whose name is "MANOJ KUMAR", by 3000.

Python MySQL

1 Like

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

Answered By

1 Like


Related Questions