<legend id='3LM5Q'><style id='3LM5Q'><dir id='3LM5Q'><q id='3LM5Q'></q></dir></style></legend>

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

        <small id='3LM5Q'></small><noframes id='3LM5Q'>

      1. ALTER TABLE 添加复合主键

        ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)

        <tfoot id='ErD0n'></tfoot>

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

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

                  <bdo id='ErD0n'></bdo><ul id='ErD0n'></ul>
                  本文介绍了ALTER TABLE 添加复合主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个名为 provider 的表.我有三列名为personplacething.可以有重复的人、重复的地点和重复的事物,但永远不可能有重复的人地物组合.

                  I have a table called provider. I have three columns called person, place, thing. There can be duplicate persons, duplicate places, and duplicate things, but there can never be a dupicate person-place-thing combination.

                  如何使用这三列在 MySQL 中为该表添加复合主键?

                  How would I ALTER TABLE to add a composite primary key for this table in MySQL with the these three columns?

                  推荐答案

                  ALTER TABLE provider ADD PRIMARY KEY(person,place,thing);
                  

                  如果主键已经存在,那么你想这样做

                  If a primary key already exists then you want to do this

                  ALTER TABLE provider DROP PRIMARY KEY, ADD PRIMARY KEY(person, place, thing);
                  

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bogus foreign key constraint fail(虚假外键约束失败)
                  how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                  Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                  How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                  Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                  Access mysql remote database from command line(从命令行访问mysql远程数据库)
                    <bdo id='BmxMm'></bdo><ul id='BmxMm'></ul>

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

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

                    <tfoot id='BmxMm'></tfoot>

                            <legend id='BmxMm'><style id='BmxMm'><dir id='BmxMm'><q id='BmxMm'></q></dir></style></legend>
                              <tbody id='BmxMm'></tbody>