各位好:
使用mysql,其中一张表是部门表,有字段id,deptId,deptName.
我想把id设为自增长,deptId设为主键,为什么总是报错?#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
怎么解决?各位
使用mysql,其中一张表是部门表,有字段id,deptId,deptName.
我想把id设为自增长,deptId设为主键,为什么总是报错?#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
怎么解决?各位
mysql> create table dep(id int auto_increment unique, deptid int primary key, deptname varchar(128)
not null);
Query OK, 0 rows affected (0.05 sec)
版主,这个问题只能这样做吗?还有别的解决办法吗?使用unique会影响数据库的性能吗?