Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the code for mysql to set the primary key?
What is the code for mysql to set the primary key?
The code for mysql to set the primary key is the primary key (primary key field).

Such as: CREATE TABLE Customer (SID integer, last _ name varchar (30), first _ name varchar (30), PRIMARY KEY (SID)).

The primary key is a candidate key that is selected as the unique identifier of each row in the table. A table has only one primary key. A primary key can also be called a primary key.

Extended data:

Never update the primary key. In fact, there is no reason to update the primary key because it has no other purpose than uniquely identifying a row. If you need to update the primary key, it has violated the principle that the primary key should be meaningless to the user.

The primary key should be automatically generated by the computer. If people interfere with the creation of the primary key, it will make the primary key have a meaning beyond the unique identification line. Once this boundary is crossed, there may be an incentive to modify the primary key artificially, so that the key means used by this system to link and manage record rows will fall into the hands of people who do not understand database design.