How to write mysql to mysql? each time I add a data ID + 1

Source: Internet
Author: User
How to write mysql I add each data ID + 1mysql how & nbsp; write I add each data & nbsp; ID + 1 & nbsp; for example, I have 2 fields & nbsp; one is ID & nbsp; the other is content & nbsp; if I add a mysql entry, how do I add one data ID + 1?
How to write mysql? each time I add a data ID + 1
For example, if I have two fields, one is ID and the other is content, if I add a content, it will automatically generate

ID content
1 fwefawf

ID 1 is automatically generated

If you add another content, ID2 is automatically generated, and so on.

ID content

1 fwefawf
2 fwafawddd
------ Solution --------------------
Reference:
Alter table pic_1 add id int default 0 not null auto_increment, add primary key (id );
I have run this SQL statement, but it still does not add fields. I want to add the id auto-increment field to the pic_1 table.

Run this sentence, delete the id field, and try again.
Alter table pic_1 add id int (9) primary key auto_increment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.