How to renumber primary index

I agree other methods will work but I’m just giving a different idea. This will do without any temp table creation requirements::

SET @i=0;
UPDATE table_name SET column_name=(@i:=@i+1);

Leave a Comment