Home >Database >Mysql Tutorial >What are the characteristics of mysql identity columns?
1. The identification column does not have to be matched with the primary key, but it is required to be a key.
2. A table has at most one identity column.
3. The type of the identification column can only be numeric.
By SET auto_increment_increment=3, the identity column can set the step size.
4. The starting value can be set by manual insertion.
Example
DROP TABLE IF EXISTS tab_id; CREATE TABLE tab_id( id INT PRIMARY KEY AUTO_INCREMENT, NAME VARCHAR(20) ); INSERT INTO tab_id VALUES(NULL,'john');#可重复执行插入 INSERT INTO tab_id(NAME) VALUES('lucy'); SELECT * FROM tab_id; #自增步长 SET auto_increment_increment=3;
The above is the detailed content of What are the characteristics of mysql identity columns?. For more information, please follow other related articles on the PHP Chinese website!