Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
You’ll be able to create a Major Key in your MySQL database in Python as follows.
First, you must know if the Major Key already exists.
import mysql.connector
mydb = mysql.connector.join(
host = "localhost",
consumer = "username",
password = "YoUrPaSsWoRd",
database = "your_database"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE TABLE clients (id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255), handle VARCHAR(255))")
import mysql.connector
mydb = mysql.connector.join(
host = "localhost",
consumer = "username",
password = "YoUrPaSsWoRd",
database = "your_database"
)
mycursor = mydb.cursor()
mycursor.execute("ALTER TABLE clients ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY")