问题描述
我有一个包含 38.000 条记录的表,但没有任何像 ID 这样的自动增量列.
现在我必须添加一个ID列,我想知道会不会有麻烦?
I have a table with 38.000 records, but without any auto increment column like ID.
Now I have to add an ID column, and I'm wondering could there be troubles?
推荐答案
您对任何字段的定义更改的问题是更改是破坏性的".最好将这样的更改视为数据迁移.我没有用 MySQL 这样做过,但不得不为 SQL Server 添加自动编号.基本思路是一样的.
You problem with definition change to any field is the change is "destructive". It is best to treat changes like this as a data migration. I have not done this with MySQL, but have had to add auto numbering to SQL Server. The basic idea is the same.
查看文档,因为 MySQL 可能有一种无需重置字段即可添加自动增量的机制.如果是这样,通过 SQL 执行此操作将解决问题.总的来说,我建议不要使用工具直观地进行这些类型的更改,因为大多数工具的方法学具有很强的破坏性.
Check the documentation, as MySQL may have a mechanism for adding aut increment without resetting the field. If so, doing it via SQL will solve the problem. In general, I recommend against doing these types of changes visually, with a tool, as most tools are very destructive in their methdology.
这篇关于表存在后添加新ID(自动增量)的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)