Alter table to set the primary key start
mysql>
mysql> CREATE TABLE t
-> (t INT UNSIGNED NOT NULL)
-> TYPE = InnoDB;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql>
mysql> ALTER TABLE t
-> ADD id INT NOT NULL AUTO_INCREMENT FIRST,
-> ADD PRIMARY KEY (id),
-> AUTO_INCREMENT = 100;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>
mysql> SELECT * FROM t ORDER BY id;
Empty set (0.00 sec)
mysql>
mysql> drop table t;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category