skwap Posted August 6, 2011 Share Posted August 6, 2011 why the mysql auto increment value start from the last added row ? means suppose i delete the 4th id user & next new user id value will be 5 not 4. Demo table id user 1 A 2 B 3 C 5 D Quote Link to comment https://forums.phpfreaks.com/topic/244043-mysql-auot-increment/ Share on other sites More sharing options...
@ Posted August 6, 2011 Share Posted August 6, 2011 thats because auto increment will never reuse the same increment twice - it enforces referential integrity. you can reset it by using truncate but that will remove ALL of the data from the table. Quote Link to comment https://forums.phpfreaks.com/topic/244043-mysql-auot-increment/#findComment-1253268 Share on other sites More sharing options...
MasterACE14 Posted August 6, 2011 Share Posted August 6, 2011 thats because auto increment will never reuse the same increment twice - it enforces referential integrity. you can reset it by using truncate but that will remove ALL of the data from the table. this is true, you can however manually set a records ID to one that doesn't exist. Quote Link to comment https://forums.phpfreaks.com/topic/244043-mysql-auot-increment/#findComment-1253271 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.