{"id":152863,"date":"2024-11-02T02:39:23","date_gmt":"2024-11-01T18:39:23","guid":{"rendered":"https:\/\/server.hk\/cnblog\/152863\/"},"modified":"2024-11-02T02:39:24","modified_gmt":"2024-11-01T18:39:24","slug":"%e7%a8%8b%e5%ba%8f%e5%93%a1%e5%bf%85%e5%ad%b8%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e6%93%8d%e4%bd%9c%e6%8a%80%e8%83%bd-%e7%a8%8b%e5%ba%8f%e5%93%a1%e9%97%9c%e6%96%bc%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/152863\/","title":{"rendered":"\u7a0b\u5e8f\u54e1\u5fc5\u5b78\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u80fd (\u7a0b\u5e8f\u54e1\u95dc\u65bc\u6578\u64da\u5eab\u6709\u4ec0\u9ebc\u64cd\u4f5c)"},"content":{"rendered":"<h1 id=\"%e7%a8%8b%e5%ba%8f%e5%93%a1%e5%bf%85%e5%ad%b8%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e6%93%8d%e4%bd%9c%e6%8a%80%e8%83%bd-ujGNHOAlyg\">\u7a0b\u5e8f\u54e1\u5fc5\u5b78\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u80fd<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6280\u8853\u74b0\u5883\u4e2d\uff0c\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u80fd\u5c0d\u65bc\u7a0b\u5e8f\u54e1\u4f86\u8aaa\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002\u7121\u8ad6\u662f\u958b\u767c\u61c9\u7528\u7a0b\u5e8f\u3001\u7db2\u7ad9\u9084\u662f\u6578\u64da\u5206\u6790\uff0c\u5c0d\u6578\u64da\u5eab\u7684\u7406\u89e3\u548c\u64cd\u4f5c\u80fd\u529b\u90fd\u662f\u6210\u529f\u7684\u95dc\u9375\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u7a0b\u5e8f\u54e1\u5728\u6578\u64da\u5eab\u64cd\u4f5c\u4e2d\u5fc5\u9808\u638c\u63e1\u7684\u5e7e\u9805\u91cd\u8981\u6280\u80fd\u3002<\/p>\n<h2 id=\"1-%e7%90%86%e8%a7%a3%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-ujGNHOAlyg\">1. \u7406\u89e3\u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>\u5728\u958b\u59cb\u9032\u884c\u6578\u64da\u5eab\u64cd\u4f5c\u4e4b\u524d\uff0c\u7a0b\u5e8f\u54e1\u9700\u8981\u5c0d\u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5\u6709\u6e05\u6670\u7684\u7406\u89e3\u3002\u9019\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71 (DBMS)<\/strong>\uff1a\u4e86\u89e3\u4e0d\u540c\u985e\u578b\u7684DBMS\uff0c\u5982\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MySQL\u3001PostgreSQL\uff09\u548c\u975e\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MongoDB\u3001Cassandra\uff09\u3002<\/li>\n<li><strong>\u6578\u64da\u6a21\u578b<\/strong>\uff1a\u719f\u6089\u6578\u64da\u6a21\u578b\u7684\u6982\u5ff5\uff0c\u5305\u62ec\u5be6\u9ad4-\u95dc\u4fc2\u6a21\u578b\uff08ER\u6a21\u578b\uff09\u548c\u95dc\u4fc2\u6a21\u578b\u3002<\/li>\n<li><strong>\u6578\u64da\u5eab\u7d50\u69cb<\/strong>\uff1a\u4e86\u89e3\u8868\u3001\u884c\u3001\u5217\u3001\u7d22\u5f15\u7b49\u57fa\u672c\u7d50\u69cb\u3002<\/li>\n<\/ul>\n<h2 id=\"2-sql%e8%aa%9e%e8%a8%80%e7%9a%84%e6%8e%8c%e6%8f%a1-ujGNHOAlyg\">2. SQL\u8a9e\u8a00\u7684\u638c\u63e1<\/h2>\n<p>\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\uff08SQL\uff09\u662f\u8207\u95dc\u4fc2\u578b\u6578\u64da\u5eab\u9032\u884c\u4ea4\u4e92\u7684\u4e3b\u8981\u8a9e\u8a00\u3002\u7a0b\u5e8f\u54e1\u5fc5\u9808\u719f\u7df4\u638c\u63e1SQL\u7684\u57fa\u672c\u8a9e\u6cd5\u548c\u64cd\u4f5c\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u67e5\u8a62\u6578\u64da<\/strong>\uff1a\u4f7f\u7528SELECT\u8a9e\u53e5\u5f9e\u6578\u64da\u5eab\u4e2d\u6aa2\u7d22\u6578\u64da\u3002<\/li>\n<li><strong>\u63d2\u5165\u6578\u64da<\/strong>\uff1a\u4f7f\u7528INSERT\u8a9e\u53e5\u5c07\u65b0\u6578\u64da\u6dfb\u52a0\u5230\u8868\u4e2d\u3002<\/li>\n<li><strong>\u66f4\u65b0\u6578\u64da<\/strong>\uff1a\u4f7f\u7528UPDATE\u8a9e\u53e5\u4fee\u6539\u73fe\u6709\u6578\u64da\u3002<\/li>\n<li><strong>\u522a\u9664\u6578\u64da<\/strong>\uff1a\u4f7f\u7528DELETE\u8a9e\u53e5\u522a\u9664\u4e0d\u9700\u8981\u7684\u6578\u64da\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684SQL\u67e5\u8a62\u793a\u4f8b\uff1a<\/p>\n<pre><code>SELECT * FROM users WHERE age &gt; 18;<\/code><\/pre>\n<h2 id=\"3-%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a8%ad%e8%a8%88%e8%88%87%e5%bb%ba%e6%a8%a1-ujGNHOAlyg\">3. \u6578\u64da\u5eab\u8a2d\u8a08\u8207\u5efa\u6a21<\/h2>\n<p>\u826f\u597d\u7684\u6578\u64da\u5eab\u8a2d\u8a08\u662f\u78ba\u4fdd\u6578\u64da\u5eab\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u7684\u57fa\u790e\u3002\u7a0b\u5e8f\u54e1\u9700\u8981\u5b78\u6703\u5982\u4f55\u8a2d\u8a08\u6578\u64da\u5eab\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6b63\u898f\u5316<\/strong>\uff1a\u901a\u904e\u6b63\u898f\u5316\u904e\u7a0b\u6d88\u9664\u6578\u64da\u5197\u9918\uff0c\u78ba\u4fdd\u6578\u64da\u7684\u4e00\u81f4\u6027\u3002<\/li>\n<li><strong>\u95dc\u806f\u8a2d\u8a08<\/strong>\uff1a\u8a2d\u8a08\u8868\u4e4b\u9593\u7684\u95dc\u806f\uff0c\u4f7f\u7528\u5916\u9375\u4f86\u7dad\u8b77\u6578\u64da\u5b8c\u6574\u6027\u3002<\/li>\n<li><strong>\u7d22\u5f15\u7684\u4f7f\u7528<\/strong>\uff1a\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\u7d22\u5f15\u4f86\u63d0\u9ad8\u67e5\u8a62\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"4-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%80%a7%e8%83%bd%e5%84%aa%e5%8c%96-ujGNHOAlyg\">4. \u6578\u64da\u5eab\u6027\u80fd\u512a\u5316<\/h2>\n<p>\u96a8\u8457\u6578\u64da\u91cf\u7684\u589e\u9577\uff0c\u6578\u64da\u5eab\u6027\u80fd\u53ef\u80fd\u6703\u53d7\u5230\u5f71\u97ff\u3002\u7a0b\u5e8f\u54e1\u9700\u8981\u638c\u63e1\u4e00\u4e9b\u6027\u80fd\u512a\u5316\u7684\u6280\u5de7\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u67e5\u8a62\u512a\u5316<\/strong>\uff1a\u5206\u6790\u548c\u512a\u5316SQL\u67e5\u8a62\uff0c\u4f7f\u7528EXPLAIN\u8a9e\u53e5\u4f86\u67e5\u770b\u67e5\u8a62\u8a08\u5283\u3002<\/li>\n<li><strong>\u7de9\u5b58\u6280\u8853<\/strong>\uff1a\u4f7f\u7528\u7de9\u5b58\u6280\u8853\uff08\u5982Redis\uff09\u4f86\u6e1b\u5c11\u5c0d\u6578\u64da\u5eab\u7684\u76f4\u63a5\u67e5\u8a62\u3002<\/li>\n<li><strong>\u5206\u5340\u548c\u5206\u7247<\/strong>\uff1a\u5c0d\u5927\u578b\u6578\u64da\u96c6\u9032\u884c\u5206\u5340\u6216\u5206\u7247\uff0c\u4ee5\u63d0\u9ad8\u67e5\u8a62\u6548\u7387\u3002<\/li>\n<\/ul>\n<h2 id=\"5-%e6%95%b8%e6%93%9a%e5%ba%ab%e5%ae%89%e5%85%a8%e6%80%a7-ujGNHOAlyg\">5. \u6578\u64da\u5eab\u5b89\u5168\u6027<\/h2>\n<p>\u6578\u64da\u5eab\u5b89\u5168\u6027\u662f\u4fdd\u8b77\u6578\u64da\u7684\u91cd\u8981\u65b9\u9762\u3002\u7a0b\u5e8f\u54e1\u9700\u8981\u4e86\u89e3\u5982\u4f55\u4fdd\u8b77\u6578\u64da\u5eab\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u7528\u6236\u6b0a\u9650\u7ba1\u7406<\/strong>\uff1a\u8a2d\u7f6e\u9069\u7576\u7684\u7528\u6236\u6b0a\u9650\uff0c\u78ba\u4fdd\u53ea\u6709\u6388\u6b0a\u7528\u6236\u53ef\u4ee5\u8a2a\u554f\u654f\u611f\u6578\u64da\u3002<\/li>\n<li><strong>\u6578\u64da\u52a0\u5bc6<\/strong>\uff1a\u4f7f\u7528\u52a0\u5bc6\u6280\u8853\u4fdd\u8b77\u5b58\u5132\u548c\u50b3\u8f38\u4e2d\u7684\u6578\u64da\u3002<\/li>\n<li><strong>\u5099\u4efd\u8207\u6062\u5fa9<\/strong>\uff1a\u5b9a\u671f\u5099\u4efd\u6578\u64da\u5eab\uff0c\u4ee5\u9632\u6b62\u6578\u64da\u4e1f\u5931\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-ujGNHOAlyg\">\u7e3d\u7d50<\/h2>\n<p>\u638c\u63e1\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u80fd\u5c0d\u65bc\u7a0b\u5e8f\u54e1\u4f86\u8aaa\u81f3\u95dc\u91cd\u8981\u3002\u5f9e\u57fa\u672c\u7684SQL\u8a9e\u8a00\u5230\u6578\u64da\u5eab\u8a2d\u8a08\u3001\u6027\u80fd\u512a\u5316\u548c\u5b89\u5168\u6027\u7ba1\u7406\uff0c\u9019\u4e9b\u6280\u80fd\u5c07\u5e6b\u52a9\u7a0b\u5e8f\u54e1\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\u66f4\u6709\u6548\u5730\u8655\u7406\u6578\u64da\u3002\u96a8\u8457\u6280\u8853\u7684\u767c\u5c55\uff0c\u6301\u7e8c\u5b78\u7fd2\u548c\u66f4\u65b0\u9019\u4e9b\u6280\u80fd\u5c07\u662f\u6bcf\u4f4d\u7a0b\u5e8f\u54e1\u7684\u5fc5\u4fee\u8ab2\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684\u6578\u64da\u5eab\u64cd\u4f5c\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u5ba2\u6236\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u7a0b\u5e8f\u54e1\u5fc5\u5b78\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u6280\u80fd\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\uff0c\u5b78\u7fd2\u67e5\u8a62\u3001\u66f4\u65b0\u3001\u7d22\u5f15\u7b49\u95dc\u9375\u6280\u8853\uff0c\u52a9\u529b\u9805\u76ee\u6210\u529f\u3002<\/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-152863","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152863","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=152863"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152863\/revisions"}],"predecessor-version":[{"id":152864,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/152863\/revisions\/152864"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=152863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=152863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=152863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}