Update keyword is used to Update the records from the table.
import mysql.connector as mysql
db = mysql.connect(
host ="localhost",
username= "root",
password = "root@123",
database = "realprogrammers"
)
cursor = db.cursor()
# defining the query
query = "UPDATE user SET user_name = 'Saurabhshukla018' WHERE name ='Saurabh'"
cursor.execute(query)
db.commit()
print(cursor.rowcount, "record(s) affected")