为此,您需要将AUTO_INCREMENT设置为1000-
alter table yourTableName AUTO_INCREMENT = 1000;
让我们首先创建一个表-
mysql> create table DemoTable639 ( StudentId int PRIMARY KEY, StudentStartId int AUTO_INCREMENT, StudentName VARCHAR(50), INDEX(StudentStartId) );
以下是将值设置为1000的自动增量的查询-
mysql> alter table DemoTable639 AUTO_INCREMENT = 1000; Records: 0 Duplicates: 0 Warnings: 0
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable639(StudentId,StudentName) values(1,'John'); mysql> insert into DemoTable639(StudentId,StudentName) values(2,'Chris'); mysql> insert into DemoTable639(StudentId,StudentName) values(3,'Robert'); mysql> insert into DemoTable639(StudentId,StudentName) values(4,'David');
使用select语句显示表中的所有记录-
mysql> select *from DemoTable639;
这将产生以下输出-
+-----------+----------------+-------------+ | StudentId | StudentStartId | StudentName | +-----------+----------------+-------------+ | 1 | 1000 | John | | 2 | 1001 | Chris | | 3 | 1002 | Robert | | 4 | 1003 | David | +-----------+----------------+-------------+ 4 rows in set (0.00 sec)