Python MySQL Update
The UPDATE-SET statement is used to update any column inside the table. The following SQL query is used to update a column in the MySQL.
update Employee set name = 'alex' where id = 110
The same query can be used to perform update directly in the MySQL also
Python MySQL Update Example
import mysql.connector myconn = mysql.connector.connect(host = "localhost", user = "root",password = "naveen",database = "PythonDB") cur = myconn.cursor() try: #updating the name of the employee whose id is 110 cur.execute("update Employee set name = 'Alex' where id = 110") myconn.commit() except: myconn.rollback() myconn.close()