{"id":168359,"date":"2024-11-06T11:43:17","date_gmt":"2024-11-06T03:43:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/168359\/"},"modified":"2024-11-06T11:43:18","modified_gmt":"2024-11-06T03:43:18","slug":"sql-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%ad%a3%e5%9c%a8%e8%a3%9d%e8%bc%89%ef%bc%8c%e5%8d%b3%e5%b0%87%e4%b8%8a%e7%b7%9a%ef%bc%81-sql-%e6%95%b8%e6%93%9a%e5%ba%ab-%e6%ad%a3%e5%9c%a8%e8%a3%9d%e8%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/168359\/","title":{"rendered":"SQL \u6578\u64da\u5eab\u6b63\u5728\u88dd\u8f09\uff0c\u5373\u5c07\u4e0a\u7dda\uff01 (sql \u6578\u64da\u5eab \u6b63\u5728\u88dd\u8f09)"},"content":{"rendered":"<h1 id=\"sql-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%ad%a3%e5%9c%a8%e8%a3%9d%e8%bc%89%ef%bc%8c%e5%8d%b3%e5%b0%87%e4%b8%8a%e7%b7%9a%ef%bc%81-TwhfWHaPQc\">SQL \u6578\u64da\u5eab\u6b63\u5728\u88dd\u8f09\uff0c\u5373\u5c07\u4e0a\u7dda\uff01<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0cSQL\uff08\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\uff09\u6578\u64da\u5eab\u7684\u4f7f\u7528\u8d8a\u4f86\u8d8a\u666e\u904d\u3002\u7121\u8ad6\u662f\u4f01\u696d\u7d1a\u61c9\u7528\u9084\u662f\u500b\u4eba\u9805\u76ee\uff0cSQL \u6578\u64da\u5eab\u90fd\u626e\u6f14\u8457\u81f3\u95dc\u91cd\u8981\u7684\u89d2\u8272\u3002\u672c\u6587\u5c07\u63a2\u8a0e SQL \u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5\u3001\u5176\u88dd\u8f09\u904e\u7a0b\u4ee5\u53ca\u5373\u5c07\u4e0a\u7dda\u7684\u610f\u7fa9\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-sql-%e6%95%b8%e6%93%9a%e5%ba%ab%ef%bc%9f-TwhfWHaPQc\">\u4ec0\u9ebc\u662f SQL \u6578\u64da\u5eab\uff1f<\/h2>\n<p>SQL \u6578\u64da\u5eab\u662f\u4e00\u7a2e\u4f7f\u7528 SQL \u8a9e\u8a00\u4f86\u7ba1\u7406\u548c\u64cd\u4f5c\u6578\u64da\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u3002\u5b83\u5141\u8a31\u7528\u6236\u5275\u5efa\u3001\u8b80\u53d6\u3001\u66f4\u65b0\u548c\u522a\u9664\u6578\u64da\u3002\u5e38\u898b\u7684 SQL \u6578\u64da\u5eab\u7cfb\u7d71\u5305\u62ec MySQL\u3001PostgreSQL\u3001Microsoft SQL Server \u548c Oracle Database \u7b49\u3002<\/p>\n<h2 id=\"sql-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e8%a3%9d%e8%bc%89%e9%81%8e%e7%a8%8b-TwhfWHaPQc\">SQL \u6578\u64da\u5eab\u7684\u88dd\u8f09\u904e\u7a0b<\/h2>\n<p>\u88dd\u8f09 SQL \u6578\u64da\u5eab\u662f\u6307\u5c07\u6578\u64da\u5eab\u7cfb\u7d71\u53ca\u5176\u6578\u64da\u52a0\u8f09\u5230\u4f3a\u670d\u5668\u4e0a\uff0c\u4ee5\u4fbf\u7528\u6236\u53ef\u4ee5\u8a2a\u554f\u548c\u64cd\u4f5c\u6578\u64da\u3002\u9019\u4e00\u904e\u7a0b\u901a\u5e38\u5305\u62ec\u4ee5\u4e0b\u5e7e\u500b\u6b65\u9a5f\uff1a<\/p>\n<ul>\n<li><strong>\u5b89\u88dd\u6578\u64da\u5eab\u8edf\u4ef6\uff1a<\/strong>\u9996\u5148\uff0c\u9700\u8981\u5728\u4f3a\u670d\u5668\u4e0a\u5b89\u88dd\u6240\u9078\u64c7\u7684 SQL \u6578\u64da\u5eab\u8edf\u4ef6\u3002\u9019\u901a\u5e38\u6d89\u53ca\u4e0b\u8f09\u5b89\u88dd\u5305\u4e26\u6309\u7167\u6307\u793a\u9032\u884c\u5b89\u88dd\u3002<\/li>\n<li><strong>\u914d\u7f6e\u6578\u64da\u5eab\uff1a<\/strong>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u9700\u9032\u884c\u57fa\u672c\u914d\u7f6e\uff0c\u5305\u62ec\u8a2d\u7f6e\u7528\u6236\u8cec\u865f\u3001\u5bc6\u78bc\u4ee5\u53ca\u6578\u64da\u5eab\u7684\u5b58\u5132\u4f4d\u7f6e\u7b49\u3002<\/li>\n<li><strong>\u5275\u5efa\u6578\u64da\u5eab\uff1a<\/strong>\u4f7f\u7528 SQL \u8a9e\u8a00\u5275\u5efa\u65b0\u7684\u6578\u64da\u5eab\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5275\u5efa\u4e00\u500b\u540d\u70ba &#8220;my_database&#8221; \u7684\u6578\u64da\u5eab\uff1a<\/strong>\n<pre><code>CREATE DATABASE my_database;<\/code><\/pre>\n<\/li>\n<li><strong>\u5c0e\u5165\u6578\u64da\uff1a<\/strong>\u5982\u679c\u5df2\u6709\u6578\u64da\u9700\u8981\u5c0e\u5165\uff0c\u53ef\u4ee5\u4f7f\u7528 SQL \u7684\u5c0e\u5165\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5f9e CSV \u6587\u4ef6\u5c0e\u5165\u6578\u64da\uff1a<\/strong>\n<pre><code>LOAD DATA INFILE 'data.csv' INTO TABLE my_table;<\/code><\/pre>\n<\/li>\n<li><strong>\u6e2c\u8a66\u9023\u63a5\uff1a<\/strong>\u6700\u5f8c\uff0c\u78ba\u4fdd\u61c9\u7528\u7a0b\u5e8f\u80fd\u5920\u6210\u529f\u9023\u63a5\u5230\u6578\u64da\u5eab\uff0c\u4e26\u9032\u884c\u57fa\u672c\u7684\u67e5\u8a62\u6e2c\u8a66\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%8d%b3%e5%b0%87%e4%b8%8a%e7%b7%9a%e7%9a%84%e6%84%8f%e7%be%a9-TwhfWHaPQc\">\u5373\u5c07\u4e0a\u7dda\u7684\u610f\u7fa9<\/h2>\n<p>\u7576 SQL \u6578\u64da\u5eab\u6b63\u5728\u88dd\u8f09\u4e26\u5373\u5c07\u4e0a\u7dda\u6642\uff0c\u9019\u610f\u5473\u8457\u7528\u6236\u5c07\u80fd\u5920\u958b\u59cb\u4f7f\u7528\u8a72\u6578\u64da\u5eab\u9032\u884c\u6578\u64da\u7ba1\u7406\u548c\u67e5\u8a62\u3002\u9019\u5c0d\u65bc\u958b\u767c\u8005\u548c\u4f01\u696d\u4f86\u8aaa\uff0c\u5177\u6709\u91cd\u8981\u7684\u610f\u7fa9\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u53ef\u7528\u6027\uff1a<\/strong>\u4e00\u65e6\u6578\u64da\u5eab\u4e0a\u7dda\uff0c\u7528\u6236\u53ef\u4ee5\u96a8\u6642\u8a2a\u554f\u548c\u64cd\u4f5c\u6578\u64da\uff0c\u9019\u5c0d\u65bc\u5be6\u6642\u6578\u64da\u5206\u6790\u548c\u5831\u544a\u81f3\u95dc\u91cd\u8981\u3002<\/li>\n<li><strong>\u696d\u52d9\u904b\u71df\uff1a<\/strong>\u5c0d\u65bc\u4f9d\u8cf4\u6578\u64da\u7684\u696d\u52d9\u4f86\u8aaa\uff0c\u6578\u64da\u5eab\u7684\u4e0a\u7dda\u610f\u5473\u8457\u696d\u52d9\u6d41\u7a0b\u7684\u9806\u5229\u904b\u884c\uff0c\u80fd\u5920\u66f4\u5feb\u5730\u505a\u51fa\u6c7a\u7b56\u3002<\/li>\n<li><strong>\u958b\u767c\u9032\u5ea6\uff1a<\/strong>\u5c0d\u65bc\u958b\u767c\u5718\u968a\u4f86\u8aaa\uff0c\u6578\u64da\u5eab\u7684\u4e0a\u7dda\u6a19\u8a8c\u8457\u9805\u76ee\u9032\u5165\u4e0b\u4e00\u968e\u6bb5\uff0c\u80fd\u5920\u9032\u884c\u66f4\u591a\u7684\u529f\u80fd\u958b\u767c\u548c\u6e2c\u8a66\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-TwhfWHaPQc\">\u7d50\u8ad6<\/h2>\n<p>SQL \u6578\u64da\u5eab\u7684\u88dd\u8f09\u904e\u7a0b\u662f\u6578\u64da\u7ba1\u7406\u7684\u91cd\u8981\u4e00\u6b65\uff0c\u96a8\u8457\u6578\u64da\u5eab\u7684\u4e0a\u7dda\uff0c\u7528\u6236\u5c07\u80fd\u5920\u5145\u5206\u5229\u7528\u5176\u5f37\u5927\u7684\u6578\u64da\u8655\u7406\u80fd\u529b\u3002\u7121\u8ad6\u662f\u4f01\u696d\u9084\u662f\u500b\u4eba\u9805\u76ee\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\u90fd\u662f\u6210\u529f\u7684\u95dc\u9375\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\u4f86\u652f\u6301\u60a8\u7684 SQL \u6578\u64da\u5eab\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\u3002\u7121\u8ad6\u662f\u6027\u80fd\u3001\u7a69\u5b9a\u6027\u9084\u662f\u5b89\u5168\u6027\uff0c\u6211\u5011\u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u6700\u4f73\u7684\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL \u6578\u64da\u5eab\u6b63\u5728\u88dd\u8f09\uff0c\u5373\u5c07\u4e0a\u7dda\uff01\u6e96\u5099\u597d\u9ad4\u9a57\u9ad8\u6548\u6578\u64da\u7ba1\u7406\uff0c\u63d0\u5347\u696d\u52d9\u904b\u71df\u6548\u7387\uff0c\u656c\u8acb\u671f\u5f85\uff01<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-168359","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168359","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"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=168359"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168359\/revisions"}],"predecessor-version":[{"id":168360,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/168359\/revisions\/168360"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=168359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=168359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=168359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}