自动编号(十三)

   不多说,直接上干货!

(1)自动编号AUTO_INCREMENT

(2)自动编号,且必须和主键组合使用

(3)默认情况下,起始值为1,每次增量为1

 create table tb3(
 id smallint unsigned auto_increment,
 username varchar(30) not null
 );

  由于自动编号的字段必须设置为主键(primary key),所以这个表在设计的时候就是有问题的,所以会报以上错误。

 

原文地址:https://www.cnblogs.com/zlslch/p/6534431.html