Mysql method to set auto-increment ID: execute the [CREATE TABLE empautoinc(ID INT PRIMARY KEY AUTO_INCREMENT) AUTO_INCREMENT = 0;] statement.
The auto-increment column of MYSQL must be an indexed column, and the seed value must be set at the end of the table.
(Recommended tutorial: mysql video tutorial)
--mysql-- 设置自增ID从N开始 CREATE TABLE empautoinc( ID INT PRIMARY KEY AUTO_INCREMENT ) AUTO_INCREMENT = 100 ; --(设置自增ID从100开始)
insert into empautoinc(id) values(null); Query OK, 1 row affected (0.00 sec) mysql> select * from empautoinc; +-----+ | ID | +-----+ | 100 | +-----+ 1 row in set (0.00 sec)
Related recommendations: mysql tutorial
The above is the detailed content of How to set auto-increment ID in mysql. For more information, please follow other related articles on the PHP Chinese website!