{"id":200949,"date":"2025-05-06T12:10:51","date_gmt":"2025-05-06T04:10:51","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200949\/"},"modified":"2025-05-06T12:10:51","modified_gmt":"2025-05-06T04:10:51","slug":"mysql-where-%e5%ad%90%e5%8f%a5%e5%a4%9a%e5%ad%97%e6%ae%b5%e7%ad%9b%e9%80%89%ef%bc%8c%e9%94%81%e8%a1%a8%e8%bf%98%e6%98%af%e9%94%81%e8%a1%8c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200949\/","title":{"rendered":"MySQL \u201cWHERE\u201d \u5b50\u53e5\u591a\u5b57\u6bb5\u7b5b\u9009\uff0c\u9501\u8868\u8fd8\u662f\u9501\u884c\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>MySQL \u201cWHERE\u201d \u5b50\u53e5\u591a\u5b57\u6bb5\u7b5b\u9009\uff0c\u9501\u8868\u8fd8\u662f\u9501\u884c\uff1f<\/h1>\n<p>\u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762\u4e3b\u673a\u5b9d\u8d1d\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2a\u6570\u636e\u5e93\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300aMySQL \u201cWHERE\u201d \u5b50\u53e5\u591a\u5b57\u6bb5\u7b5b\u9009\uff0c\u9501\u8868\u8fd8\u662f\u9501\u884c\uff1f\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241122\/173227918667407b929cc6e.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>MySQL \u201cWHERE\u201d \u5b50\u53e5\u4e2d\u540c\u65f6\u4f7f\u7528\u591a\u4e2a\u5b57\u6bb5\u7b5b\u9009\uff0c\u9501\u8868\u8fd8\u662f\u9501\u884c\uff1f<\/strong><\/p>\n<p>\u5982\u9898\u6240\u8ff0\uff0cMySQL \u4e2d\u4f7f\u7528 \u201cWHERE\u201d \u5b50\u53e5\u65f6\uff0c\u7ecf\u5e38\u9700\u8981\u6307\u5b9a\u591a\u4e2a\u6761\u4ef6\u6765\u7b5b\u9009\u76ee\u6807\u884c\u3002\u90a3\u4e48\uff0c\u5f53\u8fd9\u4e9b\u6761\u4ef6\u6d89\u53ca\u591a\u4e2a\u5b57\u6bb5\u65f6\uff0cMySQL \u4f1a\u91c7\u7528\u54ea\u79cd\u9501\u673a\u5236\u5462\uff1f<\/p>\n<p>\u4ee5 \u201cUPDATE SET name = &#8216;xxx&#8217; WHERE id = 1 AND is_delete = 0\u201d \u8bed\u53e5\u4e3a\u4f8b\uff0c\u8be5\u8bed\u53e5\u8bd5\u56fe\u66f4\u65b0 id \u4e3a 1 \u4e14 is_delete \u4e3a 0 \u7684\u884c\u3002<\/p>\n<p>\u7531\u4e8e MySQL \u9ed8\u8ba4\u7684\u884c\u9501\u673a\u5236\uff0c\u5f53\u6267\u884c\u6b64\u8bed\u53e5\u65f6\uff0c\u53ea\u4f1a\u9501\u5b9a\u7b26\u5408\u6761\u4ef6\u7684\u884c\uff0c\u4e0d\u4f1a\u9501\u4f4f\u6574\u4e2a\u8868\u3002\u539f\u56e0\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u7b5b\u9009\u6761\u4ef6\u660e\u786e\u6307\u5b9a\u4e86 id \u548c is_delete \u4e24\u4e2a\u5b57\u6bb5\uff0cMySQL \u5c06\u6839\u636e\u8fd9\u4e9b\u5b57\u6bb5\u7684\u7d22\u5f15\u5feb\u901f\u5b9a\u4f4d\u76ee\u6807\u884c\u3002<\/li>\n<li>\u53ea\u6709\u7b26\u5408\u8fd9\u4e24\u4e2a\u6761\u4ef6\u7684\u884c\u624d\u4f1a\u88ab\u9501\u5b9a\uff0c\u4ece\u800c\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\uff0c\u540c\u65f6\u5141\u8bb8\u5176\u4ed6\u4f1a\u8bdd\u540c\u65f6\u8bbf\u95ee\u8868\u4e2d\u7684\u5176\u4ed6\u884c\u3002<\/li>\n<\/ul>\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5c3d\u7ba1 \u201cWHERE\u201d \u5b50\u53e5\u4f7f\u7528\u4e86 id \u548c is_delete \u4e24\u4e2a\u5b57\u6bb5\u8fdb\u884c\u7b5b\u9009\uff0c\u4f46 MySQL \u4f1a\u9488\u5bf9\u7b26\u5408\u6761\u4ef6\u7684\u884c\u8fdb\u884c\u884c\u9501\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u8868\u9501\u3002<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aMySQL \u201cWHERE\u201d \u5b50\u53e5\u591a\u5b57\u6bb5\u7b5b\u9009\uff0c\u9501\u8868\u8fd8\u662f\u9501\u884c\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u201cWHERE\u201d \u5b50\u53e5&#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-200949","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200949","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=200949"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200949\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200949"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}