Defining MySQL PRIMARY KEY constraints using CREATE TABLE statement
MySQL allows you to create the primary key when you create the table using the CREATE TABLE statement. To create a PRIMARY KEY constraint for the table, you specify the PRIMARY KEY in the primary key column’s definition.
The following example creates users table whose primary key is user_id column: