This article describes how to create an auto-incrementing field in a MySQL database and how to describe the actual application code, the following describes how to create an auto-incrementing field in the MySQL database. We hope this will help you in this regard.
- create table article
Create a table first.
- (
Id int Prima (the most comprehensive VM management system) ry key auto_increment, // you can specify this field as an auto-incrementing field.
- title varchar(255)
- );
- insert into article values (null,'a');
Insert data to the MySQL database.
- select * from article;
The result is as follows:
- Id
- Title
- 1
- a
- insert into article values (null,’b’);
- insert into article values (null,'c');
- insert into article (title) values ('d');
Select * from article; the result is as follows:
- Id
- Title
- 1
- a
- 2
- b
- 3
- c
- 4
- d
The above content is an introduction to creating an auto-incrementing field in the MySQL database.