Python MySQL

MySQL Insert

Inserting data

MySQL Insert

To insert a record, or row as it is called in MySQL, into a table, use the "INSERT INTO" statement.

Insert Record

sql = "INSERT INTO customers (name, address) VALUES (%s, %s)"
val = ("John", "Highway 21")
mycursor.execute(sql, val)
mydb.commit()