mysql - Reorder / reset auto increment primary key -


i have mysql table auto increment primary key. deleted rows in middle of table. have, example, in id column: 12, 13, 14, 19, 20. deleted 15, 16, 17 , 18 rows.

i want reassign / reset / reorder primary key have continuity, i.e. make 19 15, 20 16, , on.

how can it?

you drop primary key column , re-create it. ids should reassigned in order.

however bad idea in situations. if have other tables have foreign keys table not work.


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -