CREATE TABLE t1 (id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT )
The above command increases id from 0 ,but i want to increase it from a specific no. say like 1234567890 ..
how can i do that??
How can开发者_高级运维 i set auto increment from a specific no.??
I tried something like this but it did not work
CREATE TABLE t1 AUTO_INCREMENT = 1234567890, (id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT)
If the question is not clear pllzz comment..
CREATE TABLE t1 (
`id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT
)
ENGINE = MyISAM
AUTO_INCREMENT = 1234567890;
Edit: A quick note with regards to storage engine support for setting the AUTO_INCREMENT value, which will depend on the version of MySQL you're running.
From MySQL 5.0 Manual,
In MySQL 5.0, this works for MyISAM and MEMORY tables. It is also supported for InnoDB as of MySQL 5.0.3.
From MySQL 5.1 Manual,
In MySQL 5.1, this works for MyISAM, MEMORY, and InnoDB tables. It also works for ARCHIVE tables as of MySQL 5.1.6.
After your create table script, use the alter table syntax to update the auto_increment value:
ALTER TABLE t1 AUTO_INCREMENT = 12345
You can alter the table:
ALTER TABLE tbl AUTO_INCREMENT = 100;
Just create your table like your first statement, then add
ALTER TABLE tbl AUTO_INCREMENT = 1234567890;
...where 1234567890 is ofc the value you want the value. More details can be found here: http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html
精彩评论