• <tfoot id='TC7zN'></tfoot>

    1. <small id='TC7zN'></small><noframes id='TC7zN'>

        • <bdo id='TC7zN'></bdo><ul id='TC7zN'></ul>

      1. <i id='TC7zN'><tr id='TC7zN'><dt id='TC7zN'><q id='TC7zN'><span id='TC7zN'><b id='TC7zN'><form id='TC7zN'><ins id='TC7zN'></ins><ul id='TC7zN'></ul><sub id='TC7zN'></sub></form><legend id='TC7zN'></legend><bdo id='TC7zN'><pre id='TC7zN'><center id='TC7zN'></center></pre></bdo></b><th id='TC7zN'></th></span></q></dt></tr></i><div id='TC7zN'><tfoot id='TC7zN'></tfoot><dl id='TC7zN'><fieldset id='TC7zN'></fieldset></dl></div>
        <legend id='TC7zN'><style id='TC7zN'><dir id='TC7zN'><q id='TC7zN'></q></dir></style></legend>

        重新排序/重置自动增量主键

        时间:2023-08-18
          <tbody id='UDZ1e'></tbody>
            <bdo id='UDZ1e'></bdo><ul id='UDZ1e'></ul>
            1. <i id='UDZ1e'><tr id='UDZ1e'><dt id='UDZ1e'><q id='UDZ1e'><span id='UDZ1e'><b id='UDZ1e'><form id='UDZ1e'><ins id='UDZ1e'></ins><ul id='UDZ1e'></ul><sub id='UDZ1e'></sub></form><legend id='UDZ1e'></legend><bdo id='UDZ1e'><pre id='UDZ1e'><center id='UDZ1e'></center></pre></bdo></b><th id='UDZ1e'></th></span></q></dt></tr></i><div id='UDZ1e'><tfoot id='UDZ1e'></tfoot><dl id='UDZ1e'><fieldset id='UDZ1e'></fieldset></dl></div>

              <small id='UDZ1e'></small><noframes id='UDZ1e'>

                • <legend id='UDZ1e'><style id='UDZ1e'><dir id='UDZ1e'><q id='UDZ1e'></q></dir></style></legend>
                  <tfoot id='UDZ1e'></tfoot>
                  本文介绍了重新排序/重置自动增量主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个带有自动递增主键的 MySQL 表.我删除了表格中间的一些行.例如,现在我在 ID 列中有这样的内容:12、13、14、19、20.我删除了 15、16、17 和 18 行.

                  I have a MySQL table with an auto increment primary key. I deleted some rows in the middle of the table. Now I have, for example, something like this in the ID column: 12, 13, 14, 19, 20. I deleted the 15, 16, 17 and 18 rows.

                  我想重新分配/重置/重新排序主键,以便保持连续性,即使 19 变为 15,使 20 变为 16,依此类推.

                  I want to reassign / reset / reorder the primary key so that I have continuity, i.e. make the 19 a 15, the 20 a 16, and so on.

                  我该怎么做?

                  推荐答案

                  您可以删除主键列并重新创建它.然后应按顺序重新分配所有 ID.

                  You could drop the primary key column and re-create it. All the ids should then be reassigned in order.

                  然而,在大多数情况下这可能是一个坏主意.如果您有其他表具有该表的外键,那么它肯定不起作用.

                  However this is probably a bad idea in most situations. If you have other tables that have foreign keys to this table then it will definitely not work.

                  这篇关于重新排序/重置自动增量主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 MySQL 中将字符串转换为日期? 下一篇:在 MySQL 数据库的每个表的字段中搜索文本

                  相关文章

                  最新文章

                      <bdo id='HIS54'></bdo><ul id='HIS54'></ul>

                    <small id='HIS54'></small><noframes id='HIS54'>

                      <tfoot id='HIS54'></tfoot>

                      <i id='HIS54'><tr id='HIS54'><dt id='HIS54'><q id='HIS54'><span id='HIS54'><b id='HIS54'><form id='HIS54'><ins id='HIS54'></ins><ul id='HIS54'></ul><sub id='HIS54'></sub></form><legend id='HIS54'></legend><bdo id='HIS54'><pre id='HIS54'><center id='HIS54'></center></pre></bdo></b><th id='HIS54'></th></span></q></dt></tr></i><div id='HIS54'><tfoot id='HIS54'></tfoot><dl id='HIS54'><fieldset id='HIS54'></fieldset></dl></div>

                    1. <legend id='HIS54'><style id='HIS54'><dir id='HIS54'><q id='HIS54'></q></dir></style></legend>