I want to increment in mysql by 2 i.e. 1,3,5 but by just using autoincrement its incremented by 1. Can anyone tell me how can i increment by 2 in mysql table?
Hi, Try: ALTER TABLE TableName AUTO_INCREMENT=2; Code (markup): Create table example: CREATE TABLE `TableName` ( `id` int(11) NOT NULL AUTO_INCREMENT, field1 TEXT, PRIMARY KEY (`id`) ) AUTO_INCREMENT=2; Code (markup): Regards
When you change AUTO_INCREMENT you are just setting the start point for all future increments. It doesn't change the increment offset. Try doing this before you create the table: SET @@auto_increment_offset=5; Code (markup):