pymysql update dynamic

Estimated reading: 1 minute 311 views

Python update Dynamic Operation

The Below Example is for Delete Dynamic operation.

				
					import pymysql
conn = pymysql.connect(
        host='localhost',
        user='root',
        password="12345",
        db='sakila',
)

cur = conn.cursor()


get_name = input("enter the name ")
get_id = int(input("enter the id"))

sql_update_query = "update student SET name= %s WHERE id=%s"
cur.execute(sql_update_query,(get_name, get_id))
conn.commit()
print("updated suucessfully")
				
			

Leave a Comment

CONTENTS