How to add column to existing table in MySQL database with AUTO_INCREMENT primary key in Python

1 Answer

0 votes
# c:\Users\user_nm\AppData\Local\Programs\Python\Python35-32\Scripts\pip install mysql-connector
  
import mysql.connector
  
db = mysql.connector.connect(
    host="localhost",
    user="root",
    passwd="",
    database="python_database"
)
 
db_cursor = db.cursor()
 
db_cursor.execute("ALTER TABLE workers ADD COLUMN id bigint(20) AUTO_INCREMENT PRIMARY KEY")

 
'''
run:
  
 
'''

 



answered Nov 29, 2018 by avibootz

Related questions

...