{"id":6245,"date":"2024-11-14T08:33:56","date_gmt":"2024-11-14T00:33:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6245\/"},"modified":"2024-11-14T08:33:56","modified_gmt":"2024-11-14T00:33:56","slug":"mysql%e5%a6%82%e4%bd%95%e6%8f%92%e5%85%a5set","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6245\/","title":{"rendered":"mysql\u5982\u4f55\u63d2\u5165set"},"content":{"rendered":"<blockquote><p>\n  \u5728 mysql \u4e2d\uff0c\u5411 set \u5217\u63d2\u5165\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1ainsert into table_name (column_name) values (value1, value2, &#8230;, valuen);\u3002\u503c\u7684\u683c\u5f0f\u5fc5\u987b\u662f value1, value2, &#8230;, valuen\uff0c\u503c\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/15\/2024061516212783600.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u63d2\u5165set\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u63d2\u5165set\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u4e2d\u5982\u4f55\u63d2\u5165 SET<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\uff0cSET \u6570\u636e\u7c7b\u578b\u7528\u4e8e\u5b58\u50a8\u4e00\u7ec4\u552f\u4e00\u4e14\u65e0\u5e8f\u7684\u503c\u3002\u8981\u5411 SET \u5217\u4e2d\u63d2\u5165\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>INSERT INTO table_name (column_name) VALUES (value1, value2, ..., valueN);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>table_name \u662f\u8981\u63d2\u5165\u6570\u636e\u7684\u8868\u540d\u3002<\/li>\n<li>column_name \u662f SET \u5217\u7684\u540d\u79f0\u3002<\/li>\n<li>value1, value2, &#8230;, valueN \u662f\u8981\u63d2\u5165\u5230 SET \u5217\u4e2d\u7684\u503c\u3002\u503c\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694\u3002<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>SET \u4e2d\u7684\u503c\u5fc5\u987b\u90fd\u662f\u552f\u4e00\u4e14\u65e0\u5e8f\u7684\u3002<\/li>\n<li>\u5982\u679c\u5c1d\u8bd5\u63d2\u5165\u91cd\u590d\u7684\u503c\uff0cMySQL \u4f1a\u5ffd\u7565\u91cd\u590d\u503c\u3002<\/li>\n<li>\u5982\u679c\u8981\u63d2\u5165 NULL \u503c\uff0c\u8bf7\u4f7f\u7528 NULL \u800c\u4e0d\u662f\u7a7a\u5b57\u7b26\u4e32\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u5047\u8bbe\u6709\u4e00\u4e2a\u540d\u4e3a tags \u7684\u8868\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u4e2a\u540d\u4e3a interests \u7684 SET \u5217\u3002\u8981\u5411\u6b64\u5217\u4e2d\u63d2\u5165\u4e09\u4e2a\u7231\u597d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre>INSERT INTO tags (interests) VALUES ('music', 'reading', 'painting');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6267\u884c\u6b64\u67e5\u8be2\u540e\uff0ctags \u8868\u4e2d\u5c06\u63d2\u5165\u4e00\u6761\u65b0\u8bb0\u5f55\uff0c\u5176\u4e2d interests \u5217\u7684\u503c\u4e3a {&#8216;music&#8217;, &#8216;reading&#8217;, &#8216;painting&#8217;}\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u63d2\u5165set\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>\u5728 mysql \u4e2d\uff0c\u5411 set \u5217\u63d2\u5165\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1ainsert into table_name (column_name) values (value1, value2, &#8230;, valuen);\u3002\u503c\u7684\u683c\u5f0f\u5fc5\u987b\u662f value1, value2, &#8230;, valuen\uff0c\u503c\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694\u3002 MySQL \u4e2d\u5982\u4f55\u63d2\u5165 SET \u5728 MySQL \u4e2d\uff0cSET \u6570\u636e\u7c7b\u578b\u7528\u4e8e\u5b58\u50a8\u4e00\u7ec4\u552f\u4e00\u4e14\u65e0\u5e8f\u7684\u503c\u3002\u8981\u5411 SET \u5217\u4e2d\u63d2\u5165\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a INSERT INTO table_name (column_name) VALUES (value1, value2, &#8230;, valueN); \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff1a table_name \u662f\u8981\u63d2\u5165\u6570\u636e\u7684\u8868\u540d\u3002 column_name \u662f SET \u5217\u7684\u540d\u79f0\u3002 value1, value2, &#8230;, valueN \u662f\u8981\u63d2\u5165\u5230 SET \u5217\u4e2d\u7684\u503c\u3002\u503c\u4e4b\u95f4\u7528\u9017\u53f7\u5206\u9694\u3002 \u6ce8\u610f\u4e8b\u9879\uff1a SET \u4e2d\u7684\u503c\u5fc5\u987b\u90fd\u662f\u552f\u4e00\u4e14\u65e0\u5e8f\u7684\u3002 \u5982\u679c\u5c1d\u8bd5\u63d2\u5165\u91cd\u590d\u7684\u503c\uff0cMySQL \u4f1a\u5ffd\u7565\u91cd\u590d\u503c\u3002 [&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-6245","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6245","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=6245"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6245\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}