mysql delete,autoincrement

后端 未结 4 1572
攒了一身酷
攒了一身酷 2020-12-11 07:25

I have a table in MySQL using InnoDB and a column is there with the name \"id\".

So my problem is that whenever I delete the last row from the table and then insert

4条回答
  •  萌比男神i
    2020-12-11 07:54

    I suppose you mean "Whenever I delete the last row from the table", isn't it?

    Anyway this is how autoincrement works. It's made to keep correct data relations. If in another table you use an id of a record that has been deleted it's more correct to get an error instead of get another record when querying that id.

    Anyway here you can see how to get the first free id in a field.

提交回复
热议问题