35.2 Create Table
Creating a Table To create a table in MySQL, use the “CREATE TABLE” statement. Make sure you define the name of the database when you create the connection Example Create a table named “customers”:import mysql.connectormydb = mysql.connector.connect( host=”localhost”, user=”yourusername“, password=”yourpassword“, database=”mydatabase”)mycursor = mydb.cursor()mycursor.execute(“CREATE TABLE customers (name VARCHAR(255), address VARCHAR(255))”)#If this page is executed with no error, you… Read More »