Inserting multiple rows using executemany command in mysql
While creating a table in a database, a row marked as “AUTO_INCREMENT” is necessary for multiple inserting:
1 | CREATE TABLE university ( |
Then, create an array of the tuples you want to insert:
1 | data = [("abc",'四川大学','口腔医学'), |
And use executemany command to insert:
1 | try: |
lines about connecting to database and ceating cursor instance is ignored
Inserting multiple rows using executemany command in mysql