Add auto_increment unique id to my sql?
I have already created table in MySQL and want to add a column i.e, 'myid'
to table i.e, 'mytable'.
There is already primary key defined.
I use follwing query to add auto increment:
ALTER TABLE mytable ADD myid INT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE;
But I want that the auto increment should start from 30 rather than 1.
What modification to query required? Any other way to add this?
Secondly if i use following procedure,
First i run query: ALTER TABLE mytable AUTO_INCREMENT = 30;
Then run ALTER TABLE mytable ADD myid INT UNSIGNED NOT NULL AUTO_INCREMENT
UNIQUE;
will it be okay? yes or no?
No comments:
Post a Comment