How to update the id column starting from 1 again

前端 未结 4 1328
执念已碎
执念已碎 2021-01-28 04:25

I am having problem to update the list of id number again starting from 1,2,3,4,5. Since I have deleted few records as I was testing the sql commands. Can you please help on how

4条回答
  •  一个人的身影
    2021-01-28 05:26

    The easiest (and sometimest fastest) way is to remove column and add it back. Updating column may screw up indexes or make a mess with values. Droping whole table got no sense. But remember that if other columns refer to that ids you can damage your app.

提交回复
热议问题