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

      <legend id='Vh8u5'><style id='Vh8u5'><dir id='Vh8u5'><q id='Vh8u5'></q></dir></style></legend>

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

    3. 如何向 MySQL 表添加主键?

      时间:2023-06-25

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

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

              <legend id='kIJZP'><style id='kIJZP'><dir id='kIJZP'><q id='kIJZP'></q></dir></style></legend>

              1. <tfoot id='kIJZP'></tfoot>
                本文介绍了如何向 MySQL 表添加主键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                这是我尝试过但失败的方法:

                This is what I tried but it fails:

                alter table goods add column `id` int(10) unsigned primary AUTO_INCREMENT;
                

                有人给个提示吗?

                推荐答案

                添加列后,可以随时添加主键:

                After adding the column, you can always add the primary key:

                ALTER TABLE 商品ADD PRIMARY KEY(id)

                至于为什么你的脚本不起作用,你需要指定PRIMARY KEY,而不仅仅是PRIMARY这个词:

                As to why your script wasn't working, you need to specify PRIMARY KEY, not just the word PRIMARY:

                alter table goods add column `id` int(10) unsigned primary KEY AUTO_INCREMENT;
                

                这篇关于如何向 MySQL 表添加主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:无法连接到“127.0.0.1"上的 MySQL 服务器 (10061) (2003) 下一篇:什么是默认的 MySQL JOIN 行为,INNER 还是 OUTER?

                相关文章

                <tfoot id='PM0x4'></tfoot>

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

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