SET new_id 0; UPDATE building_hobby SET id (new_id : new_id 1) ORDER BY id; ALTER TABLE building_hobby AUTO_INCREMENT 1;