CBSE Class 12 Computer Science
Question 35 of 47
Interface Python with SQL — Question 13
Back to all questionsimport mysql.connector
mydb = mysql.connector.connect(host = "localhost",
user = "root",
passwd = "tiger",
database = "School")
mycursor = mydb.cursor()
employee_name = input("Enter the name of the employee to delete: ")
mycursor.execute("DELETE FROM employee WHERE ENAME = %s", (employee_name,))
print(mycursor.rowcount, "Record Deleted")Enter the name of the employee to delete: RAJESH
1 Record Deleted