Skip to content

MySQL中设置自增字段

转载本站文章请注明:
转载来至:[记录与PHP的PK经历]
本文链接: MySQL中设置自增字段

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类型.

http://www.pkphp.com/(1)mysql设置自增id(1)mysql自增类型(1)MYSQL中关键字作为字段(1)auto mysql id(1)无聊 site:pkphp.com(3)mysql alert auto =1(1)mysql 自增字段(6)mysql设置自增(1)mysql字段自增1(1)mysql 自增id(2)mysql 字段 自增设置(1)mysql id(3)mysql自增字段(1)mysql修改自增字段(1)

中文关键字:auto_increment mysql auto pr 字段 increment album table primary alter id 类型 change int key

One Comment

  1. 请问站长的技术是学校学的还是怎么样?
    如果像我这样一点基础都没有如何学习?

    askie Reply:

    自己学习的,本身是机械专业,不过在大学的时候就开始自学php了!
    我觉得从解决问题入手,有想法自己动手解决,进步会很快的!

    Chris.Ro Reply:

    谢谢…
    一直关注着您的博客.
    内容很实在.

    Posted on 16-Aug-08 at 5:47 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).