-1

http://tinypic.com/view.php?pic=2hd2ush&s=8#.U7vlf_mSzNg

I created the table which have auto_increment in id field, when i delete some row & insert another row it having a gaps between them. For example id is 1,2,3,4,5. Deleted 3,5 and insert another row, the id will be 1,2,4,6, it should be 1,2,3,4,5. Please help.

SonDang
  • 1,468
  • 1
  • 15
  • 21
  • Is this a one time thing or you always want it with 'no gaps'? – BeaverusIV Jul 08 '14 at 12:38
  • 6
    That behaviour is normal **and desired**. You don't want to "reset" auto_increment counter, its job is not to provide you with nice, sequential numbers. – N.B. Jul 08 '14 at 12:38
  • Possible [dublicate](http://stackoverflow.com/questions/1895110/row-number-in-mysql/) – ostapische Jul 08 '14 at 12:51
  • I would have to agree with N.B. but if you tell us why this is what you want, we might be able to give a pointer in the right direction – nvanesch Jul 08 '14 at 12:59

1 Answers1

0

That behaviour is normal and desired. You don't want to "reset" auto_increment counter, its job is not to provide you with nice, sequential numbers.

Thanks for the clarify N.B

SonDang
  • 1,468
  • 1
  • 15
  • 21