久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='0SlS9'><style id='0SlS9'><dir id='0SlS9'><q id='0SlS9'></q></dir></style></legend>
      <bdo id='0SlS9'></bdo><ul id='0SlS9'></ul>

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

      <small id='0SlS9'></small><noframes id='0SlS9'>

      1. <tfoot id='0SlS9'></tfoot>
      2. Mysql 錯誤 1452 - 無法添加或更新子行:外鍵約束失

        Mysql error 1452 - Cannot add or update a child row: a foreign key constraint fails(Mysql 錯誤 1452 - 無法添加或更新子行:外鍵約束失敗)

              <tbody id='8q5sC'></tbody>

            <small id='8q5sC'></small><noframes id='8q5sC'>

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

                  <bdo id='8q5sC'></bdo><ul id='8q5sC'></ul>
                  <tfoot id='8q5sC'></tfoot>
                  本文介紹了Mysql 錯誤 1452 - 無法添加或更新子行:外鍵約束失敗的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我遇到了一個奇怪的問題.我正在嘗試向一個引用另一個表的表添加外鍵,但由于某種原因它失敗了.由于我對 MySQL 的了解有限,唯一可能懷疑的是在另一個表上有一個外鍵引用了我試圖引用的表.

                  I'm having a bit of a strange problem. I'm trying to add a foreign key to one table that references another, but it is failing for some reason. With my limited knowledge of MySQL, the only thing that could possibly be suspect is that there is a foreign key on a different table referencing the one I am trying to reference.

                  我對兩個表都做了一個 SHOW CREATE TABLE 查詢,sourcecodes_tags 是帶有外鍵的表,sourcecodes 是被引用的表.

                  I've done a SHOW CREATE TABLE query on both tables, sourcecodes_tags is the table with the foreign key, sourcecodes is the referenced table.

                  CREATE TABLE `sourcecodes` (
                   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                   `user_id` int(11) unsigned NOT NULL,
                   `language_id` int(11) unsigned NOT NULL,
                   `category_id` int(11) unsigned NOT NULL,
                   `title` varchar(40) CHARACTER SET utf8 NOT NULL,
                   `description` text CHARACTER SET utf8 NOT NULL,
                   `views` int(11) unsigned NOT NULL,
                   `downloads` int(11) unsigned NOT NULL,
                   `time_posted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                   PRIMARY KEY (`id`),
                   KEY `user_id` (`user_id`),
                   KEY `language_id` (`language_id`),
                   KEY `category_id` (`category_id`),
                   CONSTRAINT `sourcecodes_ibfk_3` FOREIGN KEY (`language_id`) REFERENCES `languages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
                   CONSTRAINT `sourcecodes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
                   CONSTRAINT `sourcecodes_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
                  ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
                  
                  CREATE TABLE `sourcecodes_tags` (
                   `sourcecode_id` int(11) unsigned NOT NULL,
                   `tag_id` int(11) unsigned NOT NULL,
                   KEY `sourcecode_id` (`sourcecode_id`),
                   KEY `tag_id` (`tag_id`),
                   CONSTRAINT `sourcecodes_tags_ibfk_1` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
                  ) ENGINE=InnoDB DEFAULT CHARSET=latin1
                  

                  這是產生錯誤的代碼:

                  ALTER TABLE sourcecodes_tags ADD FOREIGN KEY (sourcecode_id) REFERENCES sourcecodes (id) ON DELETE CASCADE ON UPDATE CASCADE
                  

                  推薦答案

                  很可能您的 sourcecodes_tags 表包含 sourcecode_id 值,這些值不再存在于您的 sourcecodes表.你必須先擺脫那些.

                  Quite likely your sourcecodes_tags table contains sourcecode_id values that no longer exists in your sourcecodes table. You have to get rid of those first.

                  這是一個可以找到這些 ID 的查詢:

                  Here's a query that can find those IDs:

                  SELECT DISTINCT sourcecode_id FROM 
                     sourcecodes_tags tags LEFT JOIN sourcecodes sc ON tags.sourcecode_id=sc.id 
                  WHERE sc.id IS NULL;
                  

                  這篇關于Mysql 錯誤 1452 - 無法添加或更新子行:外鍵約束失敗的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數根據 N 個先前值來決定接下來的 N 個行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達式的結果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數的 ignore 選項是忽略整個事務還是只是有問題的行?) - IT屋-程序員軟件開發技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時出錯,使用 for 循環數組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調用 o23.load 時發生錯誤 沒有合適的驅動程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數據庫表作為 Spark 數據幀讀取?)
                  <tfoot id='JJJ6n'></tfoot>

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

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

                      • <legend id='JJJ6n'><style id='JJJ6n'><dir id='JJJ6n'><q id='JJJ6n'></q></dir></style></legend>
                          <bdo id='JJJ6n'></bdo><ul id='JJJ6n'></ul>
                            主站蜘蛛池模板: 国产精品第二页 | 中文字幕免费在线看线人动作大片 | 亚洲精品一二三 | 午夜精品视频在线 | 国产成人在线观看免费网站 | 欧美三级成人 | 精品一区二区国产 | 国产精品国产成人国产三级 | 中文字幕二区 | 国产欧美日韩综合 | 日本黄色三级视频 | 日韩精品久久久久久久 | 激情五月激情综合网 | 成人激情视频 | 日本中文字幕一区 | 成人自拍视频在线观看 | 亚洲精品播放 | 欧美午夜精品久久久久免费视 | 日本三级中文字幕 | 国产天堂在线 | 国内福利视频 | 三级福利视频 | 毛片aaa| 欧美日韩在线看 | 精品视频免费在线观看 | 午夜精品视频 | 午夜在线观看免费视频 | 日韩一区二区三 | 男人天堂网在线 | 亚洲欧美日韩一区二区三区四区 | 国产一级18片视频 | 国产精品久久一区二区三区 | 五月天视频 | 成人爽a毛片一区二区免费 亚洲午夜在线观看 | 九色在线视频 | 日日干干| 黄色片网站在线观看 | 国产精品久久久999 成人在线国产 | 青青青操 | 成人三级在线观看 | 国产一区二区福利 |