Mysql主键删除和重新插入
手动插入主键曾经存在但已被删除的记录是否有任何已知的后果?该主键只存在于一张表中,没有被其他表引用。
Are there any known ramifications to manually inserting a record with a primary key that once existed but was deleted. Said primary key existed only in one table, and is not referenced in any other tables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并不真地。
但一般来说,由于历史表的原因,这将是一个坏主意。在某些时候,它确实存在并将记录在大多数系统中。
您还可能有外部跟踪:备份、数据库副本、链接服务器上的一些数据。
如果您只是填补自动编号或身份中的空白,那么这不是一个有效的理由。
Not really.
But generally it would be a bad idea because of history tables. At some point, it did exist and will be logged in most systems.
You may also have an external trace: a backup, a copy of the database, some data on a linked server.
If you are just filling gaps in an autonumber or identity, then this is not a valid reason.
您使用简单的 insert 语句来提供主键值,用于例子:
you use simple insert statement with providing your primary key value, for example: