PRIMARY KEY definition in MySQL CREATE TABLE statement

后端 未结 5 1868
梦如初夏
梦如初夏 2021-01-30 20:36

What\'s the difference between this code:

CREATE TABLE samples (
  sampleid INT(11) NOT NULL AUTO_INCREMENT,
  sampledate DATE NOT NULL,
  location VARCHAR(25) N         


        
5条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 20:48

    MySQL allows uses the PRIMARY KEY directive to allow you to set the Primary Key dynamically. Supplying PRIMARY KEY as an argument to the constructor can only be called on creating the column. PRIMARY KEY(X), PRIMARY KEY(Y), PRIMARY KEY(Z) allows for changing the primary keys on subsequent queries.

提交回复
热议问题