+2 votes
in Class 12 by kratos

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.

1 Answer

+6 votes
by kratos
 
Best answer

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()

...