{"id":2275,"date":"2020-03-20T18:47:12","date_gmt":"2020-03-20T10:47:12","guid":{"rendered":"http:\/\/47.101.202.111\/?p=2275"},"modified":"2023-04-04T10:21:52","modified_gmt":"2023-04-04T02:21:52","slug":"sql%e4%bc%98%e5%8c%96-sql%e8%af%ad%e5%8f%a5%e6%9f%a5%e8%af%a2%e6%80%a7%e8%83%bd%e6%8f%90%e5%8d%87%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/139.196.114.170\/?p=2275","title":{"rendered":"SQL\u4f18\u5316 &#8211; \u5206\u9875\u67e5\u8be2\u6027\u80fd\u63d0\u5347\u65b9\u6cd5"},"content":{"rendered":"<h3>LIMIT\u5206\u9875\u4f18\u5316<\/h3>\n<pre lang=\"SQL\">\nSELECT * FROM t\nORDER BY index_col\nLIMIT 2010, 10;\n<\/pre>\n<p>MySQL\u9ed8\u8ba4\u5168\u8868\u626b\u63cf\uff1a\u626b\u63cf2010\u884c\u540e\u5e76\u4e22\u5f03\u524d2000\u884c\uff0c\u6027\u80fd\u8f83\u5dee<\/p>\n<h4>\u4e1a\u52a1\u5c42\u9762<\/h4>\n<p>1\uff09\u5206\u9875\u5c3d\u91cf\u53ea\u67e5\u8be2\u6240\u9700\u5217<br \/>\n2\uff09\u5ffd\u7565\u8bb0\u5f55\u4e2d\u7684\u5927\u5b57\u6bb5\uff1a\u5355\u9875\u4e2d\u5e94\u907f\u514d\u663e\u793a\u6bcf\u6761\u8bb0\u5f55\u7684CLOB\u3001BLOB\uff0c\u5e94\u5c06\u5927\u5b57\u6bb5\u663e\u793a\u653e\u5165\u67e5\u770b\u5355\u6761\u8be6\u60c5\u65f6\u8f83\u5408\u7406<br \/>\n3\uff09\u5206\u9875\u6570\u7279\u522b\u591a\u65f6\uff0c\u9650\u5236\u6700\u5927\u504f\u79fb\u91cf<\/p>\n<h4>\u7d22\u5f15\u5c42\u9762<\/h4>\n<p>1\uff09\u4e3a\u67e5\u8be2\u5217\u5efa\u7acb\u8986\u76d6\u7d22\u5f15\uff0c\u53ef\u5229\u7528\u7d22\u5f15\u52a0\u5feb\u67e5\u8be2\u901f\u5ea6<\/p>\n<pre lang=\"SQL\">\nSELECT index_col FROM t\nORDER BY index_col\nLIMIT 2010, 10;\n<\/pre>\n<p>2\uff09\u4e1a\u52a1\u8981\u6c42\u5217\u4e0d\u4ec5\u4e3a\u8986\u76d6\u7d22\u5f15\u65f6\uff0c\u53ef\u5229\u7528\u8986\u76d6\u7d22\u5f15\u52a0\u5feb\u5b9a\u4f4d\uff1a\u7531\u5b50\u67e5\u8be2\u5b9a\u4f4d\u7d22\u5f15\u8303\u56f4\uff0c\u4e3b\u67e5\u8be2\u6839\u636e\u8303\u56f4\u8fc7\u6ee4<\/p>\n<pre lang=\"SQL\">\nSELECT * FROM t\nINNER JOIN (SELECT index_col FROM t ORDER BY index_col LIMIT 2010, 10)\nUSING (index_col);\n<\/pre>\n<pre lang=\"SQL\">\nSELECT * FROM t\nWHERE index_col >= (SELECT index_col FROM t ORDER BY index_col LIMIT 2010, 1)\nLIMIT 10;\n<\/pre>\n<h4>\u4f7f\u7528\u8f85\u52a9\u4fe1\u606f<\/h4>\n<p>1\uff09\u4f7f\u7528\u76f8\u90bb\u9875\u67e5\u8be2\u7ed3\u679c\u63a8\u5bfc\u4e0b\u4e00\u9875\u7684\u67e5\u8be2\u7ed3\u679c<\/p>\n<pre lang=\"SQL\">\nSELECT * FROM t\nORDER BY index_col\nLIMIT 2010, 10;\n# \u6b64\u65f6\u83b7\u53d6\u4e0a\u9875\u4e2d\u672b\u6761\u6570\u636e\u7684index_col\u503c\uff0c\u5047\u8bbe\u4e3a6\nSELECT * FROM t\nWHERE index_col > 6\nORDER BY index_col 10;\n<\/pre>\n<p>2\uff09\u5df2\u77e5\u7d22\u5f15\u8303\u56f4\u7684\uff0c\u7528BETWEEN AND\u5feb\u901f\u5b9a\u4f4d<\/p>\n<pre lang=\"SQL\">\nSELECT * FROM t\nWHERE index_col BETWEEN 6 AND 8\nORDER BY index_col;\n<\/pre>\n<h3>\u53c2\u8003\u8d44\u6599<\/h3>\n<p>Botros S, Tinley J. High Performance MySQL[M]. 4th Edition. O&#8217;Reilly, 2022.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LIMIT\u5206\u9875\u4f18\u5316 SELECT * FROM t ORDER BY index_col LIMIT 2010 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/139.196.114.170\/?p=2275\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cSQL\u4f18\u5316 &#8211; \u5206\u9875\u67e5\u8be2\u6027\u80fd\u63d0\u5347\u65b9\u6cd5\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/2275"}],"collection":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2275"}],"version-history":[{"count":2,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions"}],"predecessor-version":[{"id":2717,"href":"http:\/\/139.196.114.170\/index.php?rest_route=\/wp\/v2\/posts\/2275\/revisions\/2717"}],"wp:attachment":[{"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2275"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.196.114.170\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}