Python MySQL Create Table

Create Table

Steps for creating MySQL tables in Python

  • To create a table in MySQL, use the "CREATE TABLE" statement.
  • Make sure you have defined the name of the database while you create the connection.

Syntax:

  
 CREATE  TABLE student (id INT, name VARCHAR(255)) 
 

Example:



Creating Table using Primary Key

Example: