Discovered some fun things in MySQL today..
Set the variable @id to 0:
SET @id = 0;
Update the column id to be id + 1 – this will re-index your id column in one fell swoop. Very nice:
UPDATE tblname SET id = (@id := @id + 1);
Set the first value for an auto_increment column:
ALTER TABLE tblname AUTO_INCREMENT = 196;
(this won’t work if there are rows with a higher value already in the table)
All in all, a few nice bits and pieces for cleaning up your tables.