Categories:
Cloud (204)
Entertainment (11)
Facebook (43)
General (50)
Life (31)
Programming (64)
Technology (430)
Testing (4)
Tools (488)
Twitter (5)
Wearable (26)
Web Design (44)
Collections:
Other Resources:
MySQL auto_increment - start value and increment value
How to set column to be AUTO_INCREMENT in MySQL? And how to set its start value and increment value?
✍: FYIcenter.com
1. If you want to create a table with a primary key column in MySQL and want to have it automatically increase it's value, you follow the following example CREATE TABLE statement:
CREATE TABLE MyTable ( ID INT PRIMARY KEY AUTO_INCREMENT, DATA TEXT );
By default, the ID column will automatically increase by 1 and starting from 1. So next auto-increment values are 1, 2, 3, ...
2. If you want change the starting value of the auto_increment column, you can use the following ALTER TABLE statement:
ALTER TABLE MyTable AUTO_INCREMENT = 1000000;
From now on, next auto-increment values are 1000000, 1000001, 1000002, ...
3. If you want to change the increment interval, you can use the following
SET @auto_increment_increment = 5;
From now on, next auto-increment values are 1000000, 1000005, 1000010, ...
2016-08-30, 4407🔥, 1💬
Popular Posts:
How to see the key exchange process in an SFTP connection with FileZilla FTP Client? If you are conn...
How to open a Web Archive (.mht or .mhtml) file correctly in Firefox browser? I converted a word doc...
How to download Mozilla Firefox 2.0? If you want to try Mozilla Firefox 2.0, you can follow this tut...
How to save a presentation with macros in the PowerPoint Macro-Enabled Presentation (*.pptm) file fo...
How to install Mozilla Firefox 2.0 add-on: FireFTP? FireFTP is a Mozilla Firefox 2 add-on that provi...