MySQL: Set Initial Value for AUTO INCREMENT
Question by Guest | Last update on 2021-07-02 | Created on 2015-03-02
In my MySQL database, I have set one column (ID) to AUTO_INCREMENT in order to increase the value of the ID by 1 with each data record that is inserted.
Apparently, MySQL starts counting at 1 by default. However, I would like to define another starting or initial value. Is there any possibility to define an arbitrary value for this?
Related Topics
MySQL: Write current Date or Time into Column
Tutorial | 0 Comments
HTML: Preassign HTML Form with Data
Tutorial | 0 Comments
jQuery: Count characters from multiple input fields
Tip | 0 Comments
PHP: Fill Array with Sequence of Numbers or Characters
Tutorial | 0 Comments
Send Form Input as an Array to PHP Script
Tip | 0 Comments
Color Values: Convert RGB, CMYK, CMY, HSV, TColor and XYZ Values
Tutorial | 0 Comments
MySQL: Change minimum word length for full text search
Tip | 1 Comment
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
First of all, you should create your table containing the AUTO_INCREMENT column. When the table is existing, you can use the following command to adjust the AUTO_INCREMENT value according to your needs:
This sample would ensure, that the next inserted AUTO_INCREMENT-value of the table "tab" will be 1000.
PS: Of course, only in case of that this value has not been assigned yet.
Last update on 2021-07-02 | Created on 2015-03-04