{"id":187182,"date":"2024-11-11T12:08:17","date_gmt":"2024-11-11T04:08:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/187182\/"},"modified":"2024-11-11T12:08:18","modified_gmt":"2024-11-11T04:08:18","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%a6%e9%a9%97%e6%88%90%e6%9e%9c%e7%b8%bd%e7%b5%90%e5%a0%b1%e5%91%8a-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%87%89%e7%94%a8%e5%af%a6%e9%a9%97%e7%b8%bd%e7%b5%90%e5%a0%b1%e5%91%8a","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/187182\/","title":{"rendered":"\u6578\u64da\u5eab\u5be6\u9a57\u6210\u679c\u7e3d\u7d50\u5831\u544a (\u6578\u64da\u5eab\u61c9\u7528\u5be6\u9a57\u7e3d\u7d50\u5831\u544a)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e5%af%a6%e9%a9%97%e6%88%90%e6%9e%9c%e7%b8%bd%e7%b5%90%e5%a0%b1%e5%91%8a-lfZzTPqKZt\">\u6578\u64da\u5eab\u5be6\u9a57\u6210\u679c\u7e3d\u7d50\u5831\u544a<\/h1>\n<p>\u5728\u7576\u4eca\u6578\u64da\u9a45\u52d5\u7684\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u61c9\u7528\u5df2\u6210\u70ba\u5404\u884c\u5404\u696d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002\u7121\u8ad6\u662f\u4f01\u696d\u7ba1\u7406\u3001\u96fb\u5b50\u5546\u52d9\u9084\u662f\u793e\u4ea4\u5a92\u9ad4\uff0c\u6578\u64da\u5eab\u90fd\u5728\u80cc\u5f8c\u652f\u6301\u8457\u5404\u7a2e\u61c9\u7528\u7684\u904b\u884c\u3002\u672c\u6587\u5c07\u5c0d\u6578\u64da\u5eab\u61c9\u7528\u5be6\u9a57\u7684\u6210\u679c\u9032\u884c\u7e3d\u7d50\uff0c\u63a2\u8a0e\u5176\u5728\u5be6\u969b\u61c9\u7528\u4e2d\u7684\u8868\u73fe\u53ca\u672a\u4f86\u7684\u767c\u5c55\u65b9\u5411\u3002<\/p>\n<h2 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%a6%82%e5%bf%b5-lfZzTPqKZt\">\u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5<\/h2>\n<p>\u6578\u64da\u5eab\u662f\u4e00\u7a2e\u6709\u7d44\u7e54\u7684\u6578\u64da\u96c6\u5408\uff0c\u901a\u5e38\u4ee5\u96fb\u5b50\u65b9\u5f0f\u5b58\u5132\u548c\u7ba1\u7406\u3002\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff08DBMS\uff09\u662f\u7528\u65bc\u5275\u5efa\u3001\u7ba1\u7406\u548c\u64cd\u4f5c\u6578\u64da\u5eab\u7684\u8edf\u4ef6\u3002\u5e38\u898b\u7684\u6578\u64da\u5eab\u985e\u578b\u5305\u62ec\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MySQL\u3001PostgreSQL\uff09\u548c\u975e\u95dc\u4fc2\u578b\u6578\u64da\u5eab\uff08\u5982MongoDB\u3001Cassandra\uff09\u3002<\/p>\n<h2 id=\"%e5%af%a6%e9%a9%97%e7%9b%ae%e7%9a%84-lfZzTPqKZt\">\u5be6\u9a57\u76ee\u7684<\/h2>\n<p>\u672c\u6b21\u6578\u64da\u5eab\u61c9\u7528\u5be6\u9a57\u7684\u4e3b\u8981\u76ee\u7684\u662f\u8a55\u4f30\u4e0d\u540c\u6578\u64da\u5eab\u7cfb\u7d71\u5728\u8655\u7406\u5927\u6578\u64da\u91cf\u6642\u7684\u6027\u80fd\uff0c\u4e26\u6bd4\u8f03\u5176\u5728\u67e5\u8a62\u901f\u5ea6\u3001\u6578\u64da\u4e00\u81f4\u6027\u548c\u64f4\u5c55\u6027\u7b49\u65b9\u9762\u7684\u8868\u73fe\u3002<\/p>\n<h2 id=\"%e5%af%a6%e9%a9%97%e8%a8%ad%e7%bd%ae-lfZzTPqKZt\">\u5be6\u9a57\u8a2d\u7f6e<\/h2>\n<p>\u5be6\u9a57\u4e2d\u9078\u53d6\u4e86\u4e09\u7a2e\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7cfb\u7d71\uff1aMySQL\u3001PostgreSQL\u548cMongoDB\u3002\u6bcf\u500b\u6578\u64da\u5eab\u90fd\u5728\u76f8\u540c\u7684\u786c\u4ef6\u74b0\u5883\u4e0b\u904b\u884c\uff0c\u4e26\u4f7f\u7528\u76f8\u540c\u7684\u6578\u64da\u96c6\u9032\u884c\u6e2c\u8a66\u3002\u6578\u64da\u96c6\u5305\u542b100\u842c\u689d\u8a18\u9304\uff0c\u4e26\u8a2d\u8a08\u4e86\u591a\u7a2e\u67e5\u8a62\u4ee5\u6e2c\u8a66\u5404\u7cfb\u7d71\u7684\u6027\u80fd\u3002<\/p>\n<h3 id=\"%e6%b8%ac%e8%a9%a6%e6%9f%a5%e8%a9%a2%e7%a4%ba%e4%be%8b-lfZzTPqKZt\">\u6e2c\u8a66\u67e5\u8a62\u793a\u4f8b<\/h3>\n<pre><code>-- \u67e5\u8a62\u793a\u4f8b\uff1a\u9078\u64c7\u6240\u6709\u7528\u6236\u7684\u59d3\u540d\u548c\u96fb\u5b50\u90f5\u4ef6\nSELECT name, email FROM users WHERE active = 1;\n\n-- \u67e5\u8a62\u793a\u4f8b\uff1a\u8a08\u7b97\u6bcf\u500b\u7528\u6236\u7684\u8a02\u55ae\u6578\u91cf\nSELECT user_id, COUNT(*) FROM orders GROUP BY user_id;\n<\/code><\/pre>\n<h2 id=\"%e5%af%a6%e9%a9%97%e7%b5%90%e6%9e%9c-lfZzTPqKZt\">\u5be6\u9a57\u7d50\u679c<\/h2>\n<p>\u7d93\u904e\u591a\u6b21\u6e2c\u8a66\uff0c\u7d50\u679c\u986f\u793a\uff1a<\/p>\n<ul>\n<li><strong>\u67e5\u8a62\u901f\u5ea6\uff1a<\/strong>\u5728\u67e5\u8a62\u901f\u5ea6\u65b9\u9762\uff0cMongoDB\u8868\u73fe\u6700\u4f73\uff0c\u7279\u5225\u662f\u5728\u8655\u7406\u975e\u7d50\u69cb\u5316\u6578\u64da\u6642\uff0c\u5176\u67e5\u8a62\u901f\u5ea6\u660e\u986f\u5feb\u65bcMySQL\u548cPostgreSQL\u3002<\/li>\n<li><strong>\u6578\u64da\u4e00\u81f4\u6027\uff1a<\/strong>PostgreSQL\u5728\u6578\u64da\u4e00\u81f4\u6027\u65b9\u9762\u8868\u73fe\u512a\u7570\uff0c\u80fd\u5920\u6709\u6548\u8655\u7406\u4e26\u767c\u4e8b\u52d9\uff0c\u78ba\u4fdd\u6578\u64da\u7684\u5b8c\u6574\u6027\u3002<\/li>\n<li><strong>\u64f4\u5c55\u6027\uff1a<\/strong>\u5728\u64f4\u5c55\u6027\u65b9\u9762\uff0cMongoDB\u7684\u6c34\u5e73\u64f4\u5c55\u80fd\u529b\u4f7f\u5176\u80fd\u5920\u8f15\u9b06\u61c9\u5c0d\u5927\u898f\u6a21\u6578\u64da\u7684\u9700\u6c42\uff0c\u800cMySQL\u5247\u5728\u5782\u76f4\u64f4\u5c55\u4e0a\u8868\u73fe\u8f03\u597d\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96%e8%88%87%e6%9c%aa%e4%be%86%e5%b1%95%e6%9c%9b-lfZzTPqKZt\">\u7d50\u8ad6\u8207\u672a\u4f86\u5c55\u671b<\/h2>\n<p>\u672c\u6b21\u6578\u64da\u5eab\u61c9\u7528\u5be6\u9a57\u7684\u7d50\u679c\u986f\u793a\uff0c\u4e0d\u540c\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u5728\u6027\u80fd\u548c\u7279\u6027\u4e0a\u5404\u6709\u512a\u52a3\u3002\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u61c9\u6839\u64da\u5177\u9ad4\u7684\u61c9\u7528\u9700\u6c42\u4f86\u6c7a\u5b9a\u3002\u96a8\u8457\u6578\u64da\u91cf\u7684\u6301\u7e8c\u589e\u9577\uff0c\u672a\u4f86\u6578\u64da\u5eab\u6280\u8853\u5c07\u671d\u8457\u66f4\u9ad8\u6548\u3001\u66f4\u9748\u6d3b\u7684\u65b9\u5411\u767c\u5c55\uff0c\u7279\u5225\u662f\u5728\u96f2\u8a08\u7b97\u548c\u5927\u6578\u64da\u5206\u6790\u7684\u80cc\u666f\u4e0b\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-lfZzTPqKZt\">\u7e3d\u7d50<\/h2>\n<p>\u6578\u64da\u5eab\u7684\u61c9\u7528\u5be6\u9a57\u70ba\u6211\u5011\u63d0\u4f9b\u4e86\u5bf6\u8cb4\u7684\u898b\u89e3\uff0c\u5e6b\u52a9\u6211\u5011\u7406\u89e3\u4e0d\u540c\u6578\u64da\u5eab\u7cfb\u7d71\u7684\u7279\u6027\u53ca\u5176\u5728\u5be6\u969b\u61c9\u7528\u4e2d\u7684\u8868\u73fe\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u6578\u64da\u8655\u7406\u7684\u4f01\u696d\u4f86\u8aaa\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u81f3\u95dc\u91cd\u8981\u3002\u82e5\u60a8\u5c0d\u65bc\u5982\u4f55\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u652f\u6301\u60a8\u7684\u6578\u64da\u5eab\u61c9\u7528\u6709\u8208\u8da3\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6578\u64da\u5eab\u5be6\u9a57\u6210\u679c\u7e3d\u7d50\u5831\u544a\uff0c\u5168\u9762\u5206\u6790\u6578\u64da\u5eab\u61c9\u7528\u5be6\u9a57\u7684\u7d50\u679c\u8207\u767c\u73fe\uff0c\u63d0\u4f9b\u5be6\u7528\u898b\u89e3\u8207\u672a\u4f86\u5efa\u8b70\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-187182","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187182","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=187182"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187182\/revisions"}],"predecessor-version":[{"id":187183,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187182\/revisions\/187183"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=187182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=187182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=187182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}