PRIMARY KEY definition in MySQL CREATE TABLE statement

后端 未结 5 1869
梦如初夏
梦如初夏 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:41

    The way I see it is.. The first method is used to create composite keys. While the second method (more readable to me) is primarily used if there is only primary key in the table.

    The second method cannot be used if you want to implement composite key

提交回复
热议问题