{"id":170085,"date":"2024-11-06T21:01:24","date_gmt":"2024-11-06T13:01:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/170085\/"},"modified":"2024-11-06T21:01:25","modified_gmt":"2024-11-06T13:01:25","slug":"%e4%bd%a0%e6%87%89%e8%a9%b2%e4%bd%bf%e7%94%a8nosql%e6%95%b8%e6%93%9a%e5%ba%ab%e3%80%81sql%e6%95%b8%e6%93%9a%e5%ba%ab%e9%82%84%e6%98%af%e5%85%a9%e8%80%85%e9%83%bd%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/170085\/","title":{"rendered":"\u4f60\u61c9\u8a72\u4f7f\u7528NoSQL\u6578\u64da\u5eab\u3001SQL\u6578\u64da\u5eab\u9084\u662f\u5169\u8005\u90fd\u7528\uff1f"},"content":{"rendered":"<h1 id=\"%e4%bd%a0%e6%87%89%e8%a9%b2%e4%bd%bf%e7%94%a8nosql%e6%95%b8%e6%93%9a%e5%ba%ab%e3%80%81sql%e6%95%b8%e6%93%9a%e5%ba%ab%e9%82%84%e6%98%af%e5%85%a9%e8%80%85%e9%83%bd%e7%94%a8%ef%bc%9f-wClPvihhig\">\u4f60\u61c9\u8a72\u4f7f\u7528NoSQL\u6578\u64da\u5eab\u3001SQL\u6578\u64da\u5eab\u9084\u662f\u5169\u8005\u90fd\u7528\uff1f<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u6642\u4ee3\uff0c\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u985e\u578b\u5c0d\u65bc\u61c9\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u64f4\u5c55\u6027\u81f3\u95dc\u91cd\u8981\u3002SQL\uff08\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\uff09\u6578\u64da\u5eab\u548cNoSQL\uff08\u975e\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\uff09\u6578\u64da\u5eab\u5404\u6709\u5176\u512a\u7f3a\u9ede\uff0c\u6839\u64da\u5177\u9ad4\u9700\u6c42\u9078\u64c7\u5408\u9069\u7684\u6578\u64da\u5eab\u985e\u578b\u5c07\u6709\u52a9\u65bc\u63d0\u5347\u7cfb\u7d71\u7684\u6548\u7387\u548c\u9748\u6d3b\u6027\u3002<\/p>\n<h2 id=\"sql%e6%95%b8%e6%93%9a%e5%ba%ab%e6%a6%82%e8%bf%b0-wClPvihhig\">SQL\u6578\u64da\u5eab\u6982\u8ff0<\/h2>\n<p>SQL\u6578\u64da\u5eab\u662f\u57fa\u65bc\u95dc\u4fc2\u6a21\u578b\u7684\u6578\u64da\u5eab\uff0c\u4f7f\u7528\u7d50\u69cb\u5316\u67e5\u8a62\u8a9e\u8a00\u9032\u884c\u6578\u64da\u64cd\u4f5c\u3002\u9019\u985e\u6578\u64da\u5eab\u7684\u7279\u9ede\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u7d50\u69cb\u5316\u6578\u64da\uff1a<\/strong>\u6578\u64da\u4ee5\u8868\u683c\u5f62\u5f0f\u5b58\u5132\uff0c\u4e26\u4e14\u6bcf\u500b\u8868\u90fd\u6709\u660e\u78ba\u7684\u7d50\u69cb\uff08\u5982\u884c\u548c\u5217\uff09\u3002<\/li>\n<li><strong>ACID\u5c6c\u6027\uff1a<\/strong>SQL\u6578\u64da\u5eab\u901a\u5e38\u9075\u5faaACID\uff08\u539f\u5b50\u6027\u3001\u4e00\u81f4\u6027\u3001\u9694\u96e2\u6027\u3001\u6301\u4e45\u6027\uff09\u539f\u5247\uff0c\u78ba\u4fdd\u6578\u64da\u7684\u53ef\u9760\u6027\u548c\u4e00\u81f4\u6027\u3002<\/li>\n<li><strong>\u8907\u96dc\u67e5\u8a62\uff1a<\/strong>\u652f\u6301\u8907\u96dc\u7684\u67e5\u8a62\u64cd\u4f5c\uff0c\u9069\u5408\u9700\u8981\u9032\u884c\u591a\u8868\u806f\u63a5\u7684\u61c9\u7528\u3002<\/li>\n<\/ul>\n<p>\u5e38\u898b\u7684SQL\u6578\u64da\u5eab\u5305\u62ecMySQL\u3001PostgreSQL\u548cMicrosoft SQL Server\u7b49\u3002\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=\"nosql%e6%95%b8%e6%93%9a%e5%ba%ab%e6%a6%82%e8%bf%b0-wClPvihhig\">NoSQL\u6578\u64da\u5eab\u6982\u8ff0<\/h2>\n<p>NoSQL\u6578\u64da\u5eab\u5247\u662f\u70ba\u4e86\u61c9\u5c0d\u5927\u6578\u64da\u548c\u9ad8\u4e26\u767c\u9700\u6c42\u800c\u8a2d\u8a08\u7684\uff0c\u901a\u5e38\u4e0d\u4f7f\u7528\u56fa\u5b9a\u7684\u8868\u683c\u7d50\u69cb\u3002\u5176\u7279\u9ede\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u9748\u6d3b\u7684\u6578\u64da\u6a21\u578b\uff1a<\/strong>NoSQL\u6578\u64da\u5eab\u652f\u6301\u591a\u7a2e\u6578\u64da\u6a21\u578b\uff0c\u5982\u6587\u6a94\u578b\u3001\u9375\u503c\u578b\u3001\u5217\u65cf\u578b\u548c\u5716\u5f62\u578b\uff0c\u80fd\u5920\u9748\u6d3b\u5730\u8655\u7406\u4e0d\u540c\u985e\u578b\u7684\u6578\u64da\u3002<\/li>\n<li><strong>\u53ef\u64f4\u5c55\u6027\uff1a<\/strong>NoSQL\u6578\u64da\u5eab\u901a\u5e38\u8a2d\u8a08\u70ba\u5206\u4f48\u5f0f\u67b6\u69cb\uff0c\u80fd\u5920\u8f15\u9b06\u5730\u6a6b\u5411\u64f4\u5c55\u4ee5\u61c9\u5c0d\u5927\u91cf\u6578\u64da\u548c\u9ad8\u6d41\u91cf\u3002<\/li>\n<li><strong>\u9ad8\u6027\u80fd\uff1a<\/strong>\u5728\u8655\u7406\u5927\u91cf\u8b80\u5beb\u8acb\u6c42\u6642\uff0cNoSQL\u6578\u64da\u5eab\u901a\u5e38\u8868\u73fe\u51fa\u66f4\u9ad8\u7684\u6027\u80fd\u3002<\/li>\n<\/ul>\n<p>\u5e38\u898b\u7684NoSQL\u6578\u64da\u5eab\u5305\u62ecMongoDB\u3001Cassandra\u548cRedis\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684MongoDB\u67e5\u8a62\u793a\u4f8b\uff1a<\/p>\n<pre><code>db.users.find({ age: { $gt: 18 } });<\/code><\/pre>\n<h2 id=\"sql%e8%88%87nosql%e7%9a%84%e6%af%94%e8%bc%83-wClPvihhig\">SQL\u8207NoSQL\u7684\u6bd4\u8f03<\/h2>\n<p>\u5728\u9078\u64c7SQL\u6216NoSQL\u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u9700\u8981\u8003\u616e\u4ee5\u4e0b\u5e7e\u500b\u65b9\u9762\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u7d50\u69cb\uff1a<\/strong>\u5982\u679c\u6578\u64da\u7d50\u69cb\u56fa\u5b9a\u4e14\u95dc\u806f\u6027\u5f37\uff0cSQL\u6578\u64da\u5eab\u53ef\u80fd\u662f\u66f4\u597d\u7684\u9078\u64c7\uff1b\u5982\u679c\u6578\u64da\u7d50\u69cb\u9748\u6d3b\u4e14\u591a\u8b8a\uff0c\u5247NoSQL\u6578\u64da\u5eab\u66f4\u70ba\u5408\u9069\u3002<\/li>\n<li><strong>\u67e5\u8a62\u9700\u6c42\uff1a<\/strong>\u5c0d\u65bc\u9700\u8981\u8907\u96dc\u67e5\u8a62\u7684\u61c9\u7528\uff0cSQL\u6578\u64da\u5eab\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u67e5\u8a62\u80fd\u529b\uff1b\u800c\u5c0d\u65bc\u7c21\u55ae\u67e5\u8a62\u6216\u9ad8\u983b\u8b80\u5beb\u64cd\u4f5c\uff0cNoSQL\u6578\u64da\u5eab\u5247\u80fd\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd\u3002<\/li>\n<li><strong>\u64f4\u5c55\u6027\uff1a<\/strong>\u5982\u679c\u9810\u671f\u6578\u64da\u91cf\u6703\u8fc5\u901f\u589e\u9577\uff0cNoSQL\u6578\u64da\u5eab\u7684\u6a6b\u5411\u64f4\u5c55\u80fd\u529b\u5c07\u662f\u5176\u4e00\u5927\u512a\u52e2\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-wClPvihhig\">\u7d50\u8ad6<\/h2>\n<p>\u6700\u7d42\uff0c\u9078\u64c7\u4f7f\u7528SQL\u6578\u64da\u5eab\u3001NoSQL\u6578\u64da\u5eab\u9084\u662f\u5169\u8005\u7d50\u5408\uff0c\u53d6\u6c7a\u65bc\u5177\u9ad4\u7684\u61c9\u7528\u9700\u6c42\u548c\u696d\u52d9\u5834\u666f\u3002\u5c0d\u65bc\u4e00\u4e9b\u9700\u8981\u9ad8\u6027\u80fd\u548c\u9748\u6d3b\u6027\u7684\u61c9\u7528\uff0cNoSQL\u6578\u64da\u5eab\u53ef\u80fd\u662f\u6700\u4f73\u9078\u64c7\uff1b\u800c\u5c0d\u65bc\u9700\u8981\u5f37\u4e00\u81f4\u6027\u548c\u8907\u96dc\u67e5\u8a62\u7684\u61c9\u7528\uff0cSQL\u6578\u64da\u5eab\u5247\u66f4\u70ba\u5408\u9069\u3002\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u5c07\u5169\u8005\u7d50\u5408\u4f7f\u7528\u4e5f\u80fd\u767c\u63ee\u5404\u81ea\u7684\u512a\u52e2\uff0c\u5be6\u73fe\u6700\u4f73\u7684\u6027\u80fd\u548c\u9748\u6d3b\u6027\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u6709\u95dc\u6578\u64da\u5eab\u7684\u9078\u64c7\u548c\u914d\u7f6e\uff0c\u60a8\u53ef\u4ee5\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\uff0c\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002\u7121\u8ad6\u662f\u9078\u64c7<a href=\"https:\/\/server.hk\">VPS<\/a>\u9084\u662f\u5176\u4ed6\u670d\u52d9\uff0c\u6211\u5011\u90fd\u80fd\u63d0\u4f9b\u5c08\u696d\u7684\u652f\u6301\u548c\u5efa\u8b70\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22NoSQL\u8207SQL\u6578\u64da\u5eab\u7684\u512a\u7f3a\u9ede\uff0c\u5e6b\u52a9\u60a8\u6c7a\u5b9a\u5728\u9805\u76ee\u4e2d\u4f7f\u7528\u54ea\u7a2e\u6578\u64da\u5eab\u6216\u5169\u8005\u7d50\u5408\u7684\u6700\u4f73\u65b9\u6848\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-170085","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170085","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=170085"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170085\/revisions"}],"predecessor-version":[{"id":170086,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/170085\/revisions\/170086"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=170085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=170085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=170085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}