{"id":200299,"date":"2025-05-06T10:34:22","date_gmt":"2025-05-06T02:34:22","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200299\/"},"modified":"2025-05-06T10:34:22","modified_gmt":"2025-05-06T02:34:22","slug":"sql-%e4%b8%ad%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-update-ignore-%e8%af%ad%e6%b3%95%e6%9d%a5%e5%bf%bd%e7%95%a5%e5%86%b2%e7%aa%81%e7%9a%84%e6%9b%b4%e6%96%b0%e6%93%8d%e4%bd%9c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200299\/","title":{"rendered":"SQL \u4e2d\u5982\u4f55\u4f7f\u7528 UPDATE IGNORE \u8bed\u6cd5\u6765\u5ffd\u7565\u51b2\u7a81\u7684\u66f4\u65b0\u64cd\u4f5c\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>SQL \u4e2d\u5982\u4f55\u4f7f\u7528 UPDATE IGNORE \u8bed\u6cd5\u6765\u5ffd\u7565\u51b2\u7a81\u7684\u66f4\u65b0\u64cd\u4f5c\uff1f<\/h1>\n<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230\uff0c\u5982\u679c\u4f60\u5bf9\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241031\/173038252767238abff3da2.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u907f\u514d\u66f4\u65b0\u51b2\u7a81\uff1asql \u4e2d\u7684 update ignore \u8bed\u6cd5<\/strong><\/p>\n<p>\u5728 sql \u4e2d\u6267\u884c\u66f4\u65b0\u64cd\u4f5c\u65f6\uff0c\u6709\u65f6\u6211\u4eec\u5e0c\u671b\u5ffd\u7565\u5bfc\u81f4\u9519\u8bef\u7684\u66f4\u65b0\uff0c\u800c\u53ea\u5bf9\u6ca1\u6709\u51b2\u7a81\u7684\u6570\u636e\u8fdb\u884c\u66f4\u65b0\u3002\u6b64\u65f6\uff0cupdate ignore \u8bed\u6cd5\u53ef\u4ee5\u53d1\u6325\u4f5c\u7528\u3002<\/p>\n<p>update ignore \u8bed\u6cd5\u4e0e update \u8bed\u6cd5\u7c7b\u4f3c\uff0c\u4f46\u901a\u8fc7\u6dfb\u52a0 ignore \u5173\u952e\u5b57\uff0c\u5b83\u5141\u8bb8\u5728\u4ee5\u4e0b\u60c5\u51b5\u4e0b\u9632\u6b62\u9519\u8bef\u4e2d\u6b62\u66f4\u65b0\uff1a<\/p>\n<ul>\n<li>\u5bf9\u4e8e\u4e0e\u552f\u4e00\u952e\u51b2\u7a81\u7684\u884c\uff0c\u4e0d\u4f1a\u6267\u884c\u66f4\u65b0\u3002<\/li>\n<li>\u5f53\u66f4\u65b0\u4f1a\u5bfc\u81f4\u6570\u636e\u8f6c\u6362\u9519\u8bef\u65f6\uff0c\u4f1a\u5c06\u884c\u66f4\u65b0\u4e3a\u6700\u63a5\u8fd1\u7684\u6709\u6548\u503c\u3002<\/li>\n<\/ul>\n<p>update ignore \u8bed\u6cd5\u7684\u5b8c\u6574\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>update [low_priority] [ignore] table_reference\n    set assignment_list\n    [where where_condition]\n    [order by ...]\n    [limit row_count]<\/pre>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u5047\u8bbe\u6211\u4eec\u6709\u4e00\u4e2a people \u8868\uff0c\u5176\u4e2d name \u5217\u662f\u552f\u4e00\u952e\u3002\u5982\u679c\u6211\u4eec\u5c1d\u8bd5\u4f7f\u7528\u4ee5\u4e0b\u66f4\u65b0\u8bed\u53e5\u63d2\u5165\u4e00\u4e2a\u91cd\u590d\u7684\u540d\u79f0\uff1a<\/p>\n<pre>update people\nset name = 'john doe'\nwhere id = 1;<\/pre>\n<p>\u5982\u679c\u6ca1\u6709 ignore \u5173\u952e\u5b57\uff0c\u6b64\u8bed\u53e5\u5c06\u5931\u8d25\u5e76\u663e\u793a\u9519\u8bef\u3002\u4f46\u662f\uff0c\u5982\u679c\u60a8\u6539\u7528\uff1a<\/p>\n<pre>UPDATE IGNORE people\nSET name = 'John Doe'\nWHERE id = 1;<\/pre>\n<p>\u66f4\u65b0\u5c06\u6210\u529f\u6267\u884c\uff0c\u800c\u5bf9\u4e8e\u91cd\u590d\u7684\u540d\u79f0\u884c\uff0c\u66f4\u65b0\u5c06\u88ab\u5ffd\u7565\u3002<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300aSQL \u4e2d\u5982\u4f55\u4f7f\u7528 UPDATE IGNORE \u8bed\u6cd5\u6765\u5ffd\u7565\u51b2\u7a81\u7684\u66f4\u65b0\u64cd\u4f5c\uff1f\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6570\u636e\u5e93\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>SQL \u4e2d\u5982\u4f55\u4f7f\u7528 UPDATE&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200299","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200299"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200299\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}