MySQL中设置自增字段
alter table album change ALBUM_ID ALBUM_ID bigint not null auto_increment;
alter table album auto_increment=1;
创建:
mysql>create table cc(id int auto_increment,name varchar(20),primary key(id));
修改:
mysql> alter table cc change id id int primary key auto_increment;
注:只有int类型且为primary key 才可以使用auto_increment.
如果用hibernate作为持久层,那么主键ID处用identity类型.

3 Comments
请问站长的技术是学校学的还是怎么样?
如果像我这样一点基础都没有如何学习?
自己学习的,本身是机械专业,不过在大学的时候就开始自学php了!
我觉得从解决问题入手,有想法自己动手解决,进步会很快的!
谢谢…
一直关注着您的博客.
内容很实在.
Post a Comment