• <legend id='qTjAa'><style id='qTjAa'><dir id='qTjAa'><q id='qTjAa'></q></dir></style></legend>

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

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

        <tfoot id='qTjAa'></tfoot>

        <i id='qTjAa'><tr id='qTjAa'><dt id='qTjAa'><q id='qTjAa'><span id='qTjAa'><b id='qTjAa'><form id='qTjAa'><ins id='qTjAa'></ins><ul id='qTjAa'></ul><sub id='qTjAa'></sub></form><legend id='qTjAa'></legend><bdo id='qTjAa'><pre id='qTjAa'><center id='qTjAa'></center></pre></bdo></b><th id='qTjAa'></th></span></q></dt></tr></i><div id='qTjAa'><tfoot id='qTjAa'></tfoot><dl id='qTjAa'><fieldset id='qTjAa'></fieldset></dl></div>
      1. MySQL:ALTER IGNORE TABLE 给出“完整性约束违规";

        MySQL: ALTER IGNORE TABLE gives quot;Integrity constraint violationquot;(MySQL:ALTER IGNORE TABLE 给出“完整性约束违规;)

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

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

        <tfoot id='zhZMz'></tfoot>
      3. <legend id='zhZMz'><style id='zhZMz'><dir id='zhZMz'><q id='zhZMz'></q></dir></style></legend>

              <bdo id='zhZMz'></bdo><ul id='zhZMz'></ul>
                <tbody id='zhZMz'></tbody>

                1. 本文介绍了MySQL:ALTER IGNORE TABLE 给出“完整性约束违规";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试使用 ALTER IGNORE TABLE + 一个唯一键从 MySQL 表中删除重复项.MySQL 文档说:

                  I'm trying to remove duplicates from a MySQL table using ALTER IGNORE TABLE + an UNIQUE KEY. The MySQL documentation says:

                  IGNORE 是标准 SQL 的 MySQL 扩展.如果新表中的唯一键存在重复项,或者在启用严格模式时出现警告,它会控制 ALTER TABLE 的工作方式.如果未指定 IGNORE,则复制将中止并在出现重复键错误时回滚.如果指定了 IGNORE,则只有第一行用于在唯一键上具有重复项的行.其他冲突行被删除.不正确的值被截断为最接近匹配的可接受值.

                  IGNORE is a MySQL extension to standard SQL. It controls how ALTER TABLE works if there are duplicates on unique keys in the new table or if warnings occur when strict mode is enabled. If IGNORE is not specified, the copy is aborted and rolled back if duplicate-key errors occur. If IGNORE is specified, only the first row is used of rows with duplicates on a unique key. The other conflicting rows are deleted. Incorrect values are truncated to the closest matching acceptable value.

                  当我运行查询时......

                  When I run the query ...

                  ALTER IGNORE TABLE table ADD UNIQUE INDEX dupidx (field)
                  

                  ...我仍然收到错误 #1062 - 键 'dupidx' 的重复条目 'blabla'.

                  ... I still get the error #1062 - Duplicate entry 'blabla' for key 'dupidx'.

                  推荐答案

                  IGNORE 关键字扩展到 MySQL 似乎有一个 某些版本的 MySQL 上的 InnoDB 版本中的错误.

                  The IGNORE keyword extension to MySQL seems to have a bug in the InnoDB version on some version of MySQL.

                  您总是可以转换为 MyISAM,忽略添加索引,然后转换回 InnoDB

                  You could always, convert to MyISAM, IGNORE-ADD the index and then convert back to InnoDB

                  ALTER TABLE table ENGINE MyISAM;
                  ALTER IGNORE TABLE table ADD UNIQUE INDEX dupidx (field);
                  ALTER TABLE table ENGINE InnoDB;
                  

                  请注意,如果您有外键约束,这将不起作用,您必须先删除它们,然后再重新添加.

                  Note, if you have Foreign Key constraints this will not work, you will have to remove those first, and add them back later.

                  这篇关于MySQL:ALTER IGNORE TABLE 给出“完整性约束违规";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)
                2. <small id='N59k2'></small><noframes id='N59k2'>

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

                        <tbody id='N59k2'></tbody>
                          • <bdo id='N59k2'></bdo><ul id='N59k2'></ul>
                            <legend id='N59k2'><style id='N59k2'><dir id='N59k2'><q id='N59k2'></q></dir></style></legend>