In a school, a database named “school” is created in mysql whose password is “cbse”. Smith is trying to add a new record of a student having details(3,’Michelle’,’Agartala’) in a“student”table.
import mysql.connector
mydb = mysql.connector.connect{
host="localhost",
user="root",
passwd="cbse",
database="school"
}
mycursor = mydb.cursor()
mycursor.***("INSERT INTO student values(3,'Michelle', 'Agartala');")
mydb.commit()