Hi All,

I have a table space in which i have eight columns. The first column is Index which i kept as Auto_Increment starting from 1 so that i can see the number of rows of data anytime.

The problem is, for example i have one row of data and when i add second row, index changes to 2 automatically. But when i delete the second row and add a new second row, the index value becomes 3. It should be two right? since i have only two rows.

Please advise how to make the index show the row Number like if it is the second row , then the index should be 2. if i delete the second row ad add a new second row, the index should automatically be 2 and not 3.

Thanks in advance !

This is the expected behaviour of autoincrement.Because ,if you delete any row from between,then do you want that all row id must be changed and correspondingly there mapping tables.No right.

If you want to add data to id just greater that the maximum value.In that case,instead of using auto_increment,use query to get max(id) from table and then insert record with id greater that the one you got.