{"id":6511,"date":"2024-11-14T09:40:27","date_gmt":"2024-11-14T01:40:27","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6511\/"},"modified":"2024-11-14T09:40:27","modified_gmt":"2024-11-14T01:40:27","slug":"mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%88%a0%e9%99%a4%e8%af%ad%e5%8f%a5%e6%80%8e%e4%b9%88%e5%86%99","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6511\/","title":{"rendered":"mysql\u6570\u636e\u5e93\u5220\u9664\u8bed\u53e5\u600e\u4e48\u5199"},"content":{"rendered":"<blockquote><p>\n  mysql \u5220\u9664\u8bed\u53e5\uff08delete\uff09\u7528\u4e8e\u5220\u9664\u8868\u4e2d\u7684\u6570\u636e\uff0c\u683c\u5f0f\u4e3a\uff1adelete from table_name where condition\u30021. \u5220\u9664\u6240\u6709\u6570\u636e\uff1adelete from table_name; 2. \u5220\u9664\u6307\u5b9a\u6761\u4ef6\u7684\u6570\u636e\uff1adelete from table_name where column_name = value; 3. \u5220\u9664\u591a\u4e2a\u6761\u4ef6\u7684\u6570\u636e\uff1adelete from table_name where column_name1 = value1 and\/or column_name\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080519315270668.jpg\" class=\"aligncenter\" title=\"mysql\u6570\u636e\u5e93\u5220\u9664\u8bed\u53e5\u600e\u4e48\u5199\u63d2\u56fe\" alt=\"mysql\u6570\u636e\u5e93\u5220\u9664\u8bed\u53e5\u600e\u4e48\u5199\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u5220\u9664\u8bed\u53e5\uff1aDELETE<\/strong><\/p>\n<p><strong>DELETE \u8bed\u53e5\u683c\u5f0f\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name\nWHERE condition;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8bed\u6cd5\u89e3\u91ca\uff1a<\/strong><\/p>\n<ul>\n<li> <strong>DELETE FROM table_name\uff1a<\/strong>\u6307\u5b9a\u8981\u5220\u9664\u6570\u636e\u7684\u8868\u540d\u3002<\/li>\n<li> <strong>WHERE condition\uff1a<\/strong>\u6307\u5b9a\u5220\u9664\u6570\u636e\u7684\u6761\u4ef6\uff0c\u53ef\u9009\u3002\u5982\u679c\u7701\u7565\uff0c\u5219\u5220\u9664\u8868\u4e2d\u6240\u6709\u6570\u636e\u3002<\/li>\n<\/ul>\n<p><strong>\u5220\u9664\u6240\u6709\u6570\u636e\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5220\u9664\u6307\u5b9a\u6761\u4ef6\u7684\u6570\u636e\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name\nWHERE column_name = value;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff0ccolumn_name \u662f\u8868\u4e2d\u7684\u5217\u540d\uff0cvalue \u662f\u8981\u5339\u914d\u7684\u6761\u4ef6\u503c\u3002<\/p>\n<p><strong>\u5220\u9664\u591a\u4e2a\u6761\u4ef6\u7684\u6570\u636e\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name\nWHERE column_name1 = value1\nAND\/OR column_name2 = value2;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5220\u9664 BETWEEN \u8303\u56f4\u5185\u7684\u503c\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name\nWHERE column_name BETWEEN start_value AND end_value;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5220\u9664 IN \u5217\u8868\u4e2d\u7684\u503c\uff1a<\/strong><\/p>\n<pre>DELETE FROM table_name\nWHERE column_name IN (value1, value2, ...);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>DELETE \u8bed\u53e5\u662f\u4e0d\u53ef\u64a4\u9500\u7684\uff0c\u5728\u6267\u884c\u4e4b\u524d\u8bf7\u786e\u4fdd\u6b63\u786e\u3002<\/li>\n<li>\u5982\u679c\u4f7f\u7528\u4e86 WHERE \u6761\u4ef6\uff0c\u786e\u4fdd\u6761\u4ef6\u662f\u6b63\u786e\u7684\uff0c\u5426\u5219\u53ef\u80fd\u5220\u9664\u610f\u5916\u6570\u636e\u3002<\/li>\n<li>\u5728\u5220\u9664\u5927\u91cf\u6570\u636e\u4e4b\u524d\uff0c\u8bf7\u8003\u8651\u4f7f\u7528\u5907\u4efd\u6216\u4e8b\u52a1\u4ee5\u786e\u4fdd\u6570\u636e\u5b89\u5168\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6570\u636e\u5e93\u5220\u9664\u8bed\u53e5\u600e\u4e48\u5199\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql \u5220\u9664\u8bed\u53e5\uff08delete\uff09\u7528\u4e8e\u5220\u9664\u8868\u4e2d\u7684\u6570\u636e\uff0c\u683c\u5f0f\u4e3a\uff1adelete from table_name where condition\u30021. \u5220\u9664\u6240\u6709\u6570\u636e\uff1adelete from table_name; 2. \u5220\u9664\u6307\u5b9a\u6761\u4ef6\u7684\u6570\u636e\uff1adelete from table_name where column_name = value; 3. \u5220\u9664\u591a\u4e2a\u6761\u4ef6\u7684\u6570\u636e\uff1adelete from table_name where column_name1 = value1 and\/or column_name MySQL \u5220\u9664\u8bed\u53e5\uff1aDELETE DELETE \u8bed\u53e5\u683c\u5f0f\uff1a DELETE FROM table_name WHERE condition; \u767b\u5f55\u540e\u590d\u5236 \u8bed\u6cd5\u89e3\u91ca\uff1a DELETE FROM table_name\uff1a\u6307\u5b9a\u8981\u5220\u9664\u6570\u636e\u7684\u8868\u540d\u3002 WHERE condition\uff1a\u6307\u5b9a\u5220\u9664\u6570\u636e\u7684\u6761\u4ef6\uff0c\u53ef\u9009\u3002\u5982\u679c\u7701\u7565\uff0c\u5219\u5220\u9664\u8868\u4e2d\u6240\u6709\u6570\u636e\u3002 \u5220\u9664\u6240\u6709\u6570\u636e\uff1a DELETE FROM table_name; \u767b\u5f55\u540e\u590d\u5236 \u5220\u9664\u6307\u5b9a\u6761\u4ef6\u7684\u6570\u636e\uff1a DELETE FROM table_name WHERE column_name = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6511","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=6511"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6511\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}