Home  >  Article  >  Backend Development  >  mysql如何 写小弟我每添加一条数据 ID+1

mysql如何 写小弟我每添加一条数据 ID+1

WBOY
WBOYOriginal
2016-06-13 12:53:49883browse

mysql怎么 写我每添加一条数据 ID+1
mysql怎么 写我每添加一条数据 ID+1   
比方说我有2个字段  一个是ID  一个是内容   如果我添加一条内容  自动会生成 

ID  内容
1   fwefawf

会自动生成ID 1 

如果再添加一条内容 就会自动生成ID2 以此类推

ID  内容

1   fwefawf
2   fwafawddd


------解决方案--------------------
引用:
alter table pic_1 add id int default 0 not null   auto_increment ,add primary key (id);  
我运行了这个SQL语句 没有效果啊  还是不会增加字段  我要在pic_1表添加id自增字段

运行这句,把刚id字段删了,再试下
alter table pic_1 add id int(9) primary key auto_increment
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn