{"id":85771,"date":"2020-05-15T19:39:58","date_gmt":"2020-05-15T11:39:58","guid":{"rendered":"http:\/\/4563.org\/?p=85771"},"modified":"2020-05-15T19:39:58","modified_gmt":"2020-05-15T11:39:58","slug":"%e4%b8%8b%e9%9d%a2%e7%9a%84-sql-%e6%b1%82%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=85771","title":{"rendered":"\u4e0b\u9762\u7684 SQL \u6c42\u5206\u6790"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e0b\u9762\u7684 SQL \u6c42\u5206\u6790               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wleexi <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u770b\u5230\u8fd9\u6837\u4e00\u6bb5 sql\uff0c\u5927\u6982\u80fd\u770b\u61c2\uff0c\u60f3\u5177\u4f53\u7684\u5b66\u4e0b\uff0c\u4e0d\u77e5\u9053\u8be5\u5982\u4f55\u5728\u641c\u7d22\u5f15\u64ce\u641c\u7d20\uff0c\u6765\u6c42\u70b9\u601d\u8def<\/p>\n<pre><code>insert into table_name(id,md5_1,sn,`gmt_create`,`gmt_modified`)  select id,md5_1,sn ,`gmt_create`,now() from (select 'id','md5_1','sn','gmt_create',now() union all select 1111,null,null,null,null union all select 111,'md5_1','sn3', null, null) as a;  <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1516767\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangsongyan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             insert into select                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1516768\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yeqizhang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             insert into select from\uff0c\u7b2c\u4e00\u6b21\u89c1\u5230\u8fd9\u4e48\u7528\u662f\u7528\u6765\u62f7\u8d1d\u4e00\u4e2a\u8868\u6570\u636e\u5230\u53e6\u4e00\u4e2a\u8868\u2026\u2026                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1516769\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : levelworm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             insert into select from, \u6211\u4e4b\u524d\u5e38\u7528\u4e8e\u5efa\u7acb\u4e34\u65f6\u8868\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1516770\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7528 select \u7684\u7ed3\u679c\u96c6\u66ff\u4ee3 values \u7684\u5185\u5bb9\uff0c\u4e00\u822c\u7528\u4e8e\u5012\u817e\u6570\u636e\u3001\u751f\u6210\u4e34\u65f6\u8868\u8bb0\u5f55\u548c\u4f7f\u7528\u6a21\u677f\u6570\u636e\u6765\u751f\u6210\u8bb0\u5f55\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1516771\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : aitiancai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f1a\u9501\u8868\u5427\uff0c\u5934\u4e24\u5929\u4ece\u65b0\u95fb\u4e0a\u770b\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1516772\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CRVV <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/www.postgresql.org\/docs\/12\/sql-insert.html<\/p>\n<p>\u628a\u4e0d\u5fc5\u8981\u7684\u90e8\u5206\u53bb\u6389\uff0cinsert \u7684\u8bed\u6cd5\u662f<br \/>INSERT INTO table_name { DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, &#8230;] ) [, &#8230;] | query }<\/p>\n<p>\u6700\u5e38\u89c1\u7684\u662f INSERT INTO table_name VALUES (1,2,3);<br \/>\u8fd9\u4e2a\u7b49\u4ef7\u4e8e INSERT INTO table_name SELECT 1,2,3;<br \/>\u5f53\u7136\u8fd9\u4e2a SELECT \u53ef\u4ee5\u662f\u4efb\u610f\u7684\u67e5\u8be2<\/p>\n<p>\u5176\u5b9e SQL \u91cc VALUES \u5c31\u662f\u4e00\u4e2a\u76f4\u63a5\u7ed9\u51fa\u7ed3\u679c\u7684\u67e5\u8be2\uff0c\u6bd4\u5982\u5b50\u67e5\u8be2\u4e5f\u53ef\u4ee5\u5199 VALUES<br \/>SELECT * FROM (VALUES (1, 2, 3)) as foo;<br \/>SELECT * FROM (SELECT 1, 2, 3) as foo;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7684 SQL \u6c42\u5206\u6790 \u8cc7\u6df1\u5927\u4f6c &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85771"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85771"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85771\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85771"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}