On Mon, 4 Oct 1999, Chris W. wrote:
> Hello, I have a little problem, I created a database and I have
> auto_increment on, after a while I removed a lot of entries from the
> database and optimized it to get rid of the empty spaces left after
> the deleted records, but now my question is: Is there a way to do
> some reindexing on the table to get the auto_increment sorted out?
> Like to get the first column in order sorted 1 then next record 2
> and so on until it reaches the end of last record so it is fairly
> sorted out? Thank you.
If you're really sure you want to do this (usually an auto_increment
column is used as the primary key for a table, and if any other tables
are related to this one via that key then you will introduce referential
integrity problems), then you can export all the columns but the
auto_increment key, drop and re-create the table, and import the other
columns. The auto_increment column will be automatically populated.