如下:
mysql> create table tbx(
-> id int unsigned not null auto_increment,
-> score int not null
-> );
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
mysql>
什么意思呢? 自增列只能有1列, 且这列必须为key, 如下便OK:
mysql> create table tbx(
-> id int unsigned not null auto_increment primary key,
-> score int not null
-> );
Query OK, 0 rows affected (0.01 sec)
mysql>
good