mysql - How to reset all ID AUTO Increment to sequencial value on each INSERT Or DELETE Query Execution..! -
mysql - How to reset all ID AUTO Increment to sequencial value on each INSERT Or DELETE Query Execution..! -
i have table name listings , within there have column namely when rows deleted auto incrmementation columns namely "id" goes soemthing bad values..like missing values in between don't , don't suit professional way..so hence want please if people can guide me how reset id columns values in rows on each insert or delete query exeution please..!
if want find lowest unused key value, don't utilize auto_increment
@ all, , manage keys manually. however, not recommended practice.
as explained @ mysql - auto increment after delete
primary autoincrement keys in database used uniquely identify given row , shouldn't given business meaning. leave primary key , add together column called illustration courseorder. when delete record database may want send additional update statement in order decrement courseorder column of rows have courseorder greater 1 deleting.
as side note should never modify value of primary key in relational database because there other tables reference foreign key , modifying might violate referential constraints.
well not recommended insisted , utilize re order using like:
alter table table_name auto_increment = 1;
mysql sql
Comments
Post a Comment