如何在MySQL中重置表的自动增量列 [英] How to reset auto increment column of a table in MySQL

查看:70
本文介绍了如何在MySQL中重置表的自动增量列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,它的第一列sl是自动递增的.填充表格后,我删除了前两行,并且第一项具有sl1.是否可以将其重置为1来维持AI?我正在使用PHP MyAdmin.

解决方案

我不确定是否收到您的问题,但是如果您希望对列sl重新编号,请先执行ALTER TABLE your_table DROP sl,然后再执行ALTER TABLE your_table ADD sl your_definitions

I have a table and it's first column sl is auto incrementing. After populating my table, I removed first two rows, and the first entry is having sl 1. Is it possible to reset it to 1 maintaining AI? I am using PHP MyAdmin.

解决方案

I'm not sure if i got your question but if you want your column sl to be renumbered do ALTER TABLE your_table DROP sl and then ALTER TABLE your_table ADD sl your_definitions

这篇关于如何在MySQL中重置表的自动增量列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆