{"id":123689,"date":"2026-11-08T02:32:59","date_gmt":"2026-11-07T18:32:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/123689.html"},"modified":"2026-11-08T02:32:59","modified_gmt":"2026-11-07T18:32:59","slug":"%e6%b7%b1%e5%85%a5%e8%a7%a3%e6%9e%90-sql-%e5%9c%a8%e7%ba%bf%e6%a0%bc%e5%bc%8f%e5%8c%96%e4%b8%8e-ast-%e8%af%ad%e6%b3%95%e6%a0%91%e7%be%8e%e5%8c%96%ef%bc%9a%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d%e6%85%a2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/123689.html","title":{"rendered":"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<h2>\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316&#xff1a;\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631&#xff1f;<\/h2>\n<p>\u4f5c\u8005&#xff1a;MiniToolDesk \u6280\u672f\u56e2\u961f \u6807\u7b7e&#xff1a;SQL\u3001\u6570\u636e\u5e93\u3001\u540e\u7aef\u3001\u7f51\u7edc\u5b89\u5168\u3001\u5f00\u53d1\u8005\u5de5\u5177 \u9002\u7528\u4eba\u7fa4&#xff1a;\u540e\u7aef\u5f00\u53d1\u5de5\u7a0b\u5e08\u3001DBA\u3001DevOps\u3001\u6570\u636e\u5206\u6790\u5e08<\/p>\n<hr \/>\n<h3>\u524d\u8a00&#xff1a;\u4e00\u6b21\u6162\u67e5\u8be2\u6392\u969c\u5f15\u53d1\u7684\u201c\u5b89\u5168\u8b66\u62a5\u201d<\/h3>\n<p>\u4f5c\u4e3a\u540e\u7aef\u5f00\u53d1\u6216 DBA&#xff0c;\u4e0b\u9762\u7684\u573a\u666f\u4f60\u4e00\u5b9a\u4e0d\u4f1a\u964c\u751f&#xff1a;<\/p>\n<p>\u5468\u4e94\u4e0b\u5348&#xff0c;\u76d1\u63a7\u544a\u8b66\u7fa4\u7a81\u7136\u70b8\u9505&#xff0c;\u7ebf\u4e0a\u6838\u5fc3\u8ba2\u5355\u670d\u52a1\u54cd\u5e94\u8017\u65f6&#xff08;P99&#xff09;\u98d9\u5347\u81f3 3 \u79d2\u4ee5\u4e0a\u3002\u4f60\u7d27\u6025\u767b\u5f55\u8df3\u677f\u673a\u62c9\u53d6\u6162\u67e5\u8be2\u65e5\u5fd7&#xff0c;\u8fce\u9762\u6251\u6765\u7684\u662f\u4e00\u6761\u8db3\u8db3 150 \u591a\u884c\u3001\u5d4c\u5957\u4e86 5 \u5c42\u5b50\u67e5\u8be2\u3001\u5173\u8054\u4e86 8 \u5f20\u4e1a\u52a1\u8868 \u7684\u201c\u9762\u6761\u5f0f\u201d SQL\u3002<\/p>\n<p>\u6240\u6709\u7684\u6362\u884c\u7b26\u548c\u7f29\u8fdb\u5728\u65e5\u5fd7\u91cc\u88ab\u538b\u7f29\u6210\u4e86\u4e00\u884c\u5bc6\u5bc6\u9ebb\u9ebb\u7684\u6587\u672c\u3002\u4e3a\u4e86\u7406\u6e05 JOIN \u903b\u8f91\u548c WHERE \u8fc7\u6ee4\u6761\u4ef6&#xff0c;\u8bb8\u591a\u5f00\u53d1\u8005\u7684\u672c\u80fd\u64cd\u4f5c\u662f&#xff1a;<\/p>\n<li>Ctrl &#043; A \u5168\u9009\u590d\u5236\u8fd9\u6761\u51e0\u5343\u5b57\u7b26\u7684 SQL&#xff1b;<\/li>\n<li>\u6253\u5f00\u641c\u7d22\u201cSQL \u5728\u7ebf\u683c\u5f0f\u5316\u201d\u6216\u201cSQL \u7f8e\u5316\u5de5\u5177\u201d&#xff1b;<\/li>\n<li>\u968f\u610f\u70b9\u5f00\u6392\u5728\u524d\u9762\u7684\u7b2c\u4e09\u65b9\u5728\u7ebf\u5de5\u5177\u7f51\u7ad9&#xff0c;\u5c06 SQL \u7c98\u8d34\u8fdb\u53bb\u70b9\u51fb\u683c\u5f0f\u5316\u3002<\/li>\n<p>\u6392\u7248\u77ac\u95f4\u6e05\u6670\u4e86&#xff0c;\u95ee\u9898\u4e5f\u5b9a\u4f4d\u5230\u4e86\u3002\u4f46\u5728\u5f88\u591a\u5b89\u5168\u4e25\u82db\u7684\u5927\u5382\u6216\u91d1\u878d\u7ea7\u4f01\u4e1a&#xff0c;\u8fd9\u4e2a\u4e0d\u7ecf\u610f\u7684\u52a8\u4f5c&#xff0c;\u53ef\u80fd\u5df2\u7ecf\u89e6\u53d1\u4e86\u4e25\u91cd\u7684\u6570\u636e\u5b89\u5168\u8fdd\u89c4\u544a\u8b66&#xff01;<\/p>\n<p>\u4eca\u5929\u6211\u4eec\u6df1\u5165\u804a\u804a&#xff1a;\u4e3a\u4ec0\u4e48\u7edd\u5927\u591a\u6570\u5728\u7ebf SQL \u683c\u5f0f\u5316\u5de5\u5177\u5b58\u5728\u4e25\u91cd\u7684\u6570\u636e\u6cc4\u9732\u98ce\u9669&#xff1f;\u73b0\u4ee3 SQL \u8bed\u6cd5\u6811&#xff08;AST&#xff09;\u7f8e\u5316\u7684\u6280\u672f\u539f\u7406\u662f\u4ec0\u4e48&#xff1f;\u4ee5\u53ca\u5982\u4f55\u501f\u52a9 100% \u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u8ba1\u7b97\u5b9e\u73b0\u201c\u96f6\u4e0a\u4f20\u3001\u96f6\u6cc4\u9732\u201d\u7684\u9ad8\u6548\u5f00\u53d1\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001 \u5e02\u9762\u4e0a\u7684\u5728\u7ebf SQL \u5de5\u5177&#xff0c;\u6697\u85cf\u54ea\u4e9b\u6cc4\u5bc6\u6f0f\u6d1e&#xff1f;<\/h3>\n<p>\u7edd\u5927\u591a\u6570\u5f00\u53d1\u8005\u8bef\u4ee5\u4e3a\u201c\u5728\u7ebf\u683c\u5f0f\u5316\u201d\u53ea\u662f\u7b80\u5355\u7684\u6587\u672c\u6392\u7248&#xff0c;\u6d4f\u89c8\u5668\u81ea\u5df1\u5728\u672c\u5730\u53d8\u4e2a\u6392\u7248\u800c\u5df2\u3002<\/p>\n<h4>1. \u7edd\u5927\u591a\u6570\u7f51\u7ad9\u672c\u8d28\u4e0a\u662f\u201c\u670d\u52a1\u7aef\u4ee3\u7406\u201d<\/h4>\n<p>\u6253\u5f00\u6d4f\u89c8\u5668\u7684 F12 \u5f00\u53d1\u8005\u5de5\u5177&#xff0c;\u5207\u6362\u5230 Network&#xff08;\u7f51\u7edc&#xff09;\u9009\u9879\u5361&#xff0c;\u4f60\u4f1a\u60ca\u8bb6\u5730\u53d1\u73b0&#xff1a; \u5f53\u4f60\u5728\u8bb8\u591a\u7b2c\u4e09\u65b9\u7f51\u7ad9\u70b9\u51fb\u201c\u683c\u5f0f\u5316\u201d\u6309\u94ae\u65f6&#xff0c;\u6d4f\u89c8\u5668\u5b9e\u9645\u4e0a\u53d1\u51fa\u4e86\u4e00\u4e2a POST \/api\/sql\/format \u7684 HTTP \u8bf7\u6c42&#xff01;<\/p>\n<p>\u8fd9\u610f\u5473\u7740&#xff1a;<\/p>\n<ul>\n<li>\u6838\u5fc3\u4e1a\u52a1\u8868\u7ed3\u6784\u88ab\u5b8c\u6574\u7a83\u53d6&#xff1a;\u4f60\u7684\u6838\u5fc3\u8868\u540d&#xff08;\u5982 t_order_payment_flow\u3001user_credentials&#xff09;\u3001\u81ea\u589e\u4e3b\u952e\u3001\u654f\u611f\u7d22\u5f15\u5b57\u6bb5\u5168\u90e8\u88ab\u4e0a\u4f20\u5230\u4e86\u7b2c\u4e09\u65b9\u670d\u52a1\u5668&#xff1b;<\/li>\n<li>\u771f\u5b9e\u4e1a\u52a1\u6570\u636e\u660e\u6587\u66b4\u9732&#xff1a;\u6162\u67e5\u8be2\u65e5\u5fd7\u7684 WHERE \u6761\u4ef6\u4e2d\u5f80\u5f80\u5e26\u7740\u771f\u5b9e\u7684\u53c2\u6570\u503c&#xff08;\u4f8b\u5982\u771f\u5b9e\u7528\u6237\u7684\u8eab\u4efd\u8bc1\u53f7\u3001\u624b\u673a\u53f7\u3001\u94f6\u884c\u5361\u5c3e\u53f7\u3001\u5546\u6237 Token&#xff09;&#xff1b;<\/li>\n<li>\u670d\u52a1\u7aef\u65e5\u5fd7\u4e0e\u7f13\u5b58\u6301\u4e45\u5316&#xff1a;\u5373\u4f7f\u8be5\u7f51\u7ad9\u58f0\u79f0\u201c\u4e0d\u4fdd\u5b58\u6570\u636e\u201d&#xff0c;\u5176\u80cc\u540e\u7684 Nginx Access Log\u3001\u4e91\u5382\u5546 WAF \u9632\u706b\u5899\u65e5\u5fd7\u3001\u6216\u8005 API \u5f02\u5e38\u6293\u53d6\u76d1\u63a7\u4e5f\u4f1a\u5c06\u4f60\u7684\u6574\u4e2a POST Body \u539f\u539f\u672c\u672c\u5730\u6301\u4e45\u5316\u5230\u78c1\u76d8\u4e0a&#xff0c;\u751a\u81f3\u6210\u4e3a\u9ed1\u5ba2\u8131\u5e93\u7684\u653b\u51fb\u9762\u3002<\/li>\n<\/ul>\n<p>[\u5f00\u53d1\u8005\u672c\u5730\u6d4f\u89c8\u5668]<br \/>\n      \u2502<br \/>\n      \u2502  \u26a0\ufe0f \u53d1\u9001\u5305\u542b\u5185\u7f51\u8868\u540d\u4e0e\u771f\u5b9e\u53c2\u6570\u7684 SQL (POST \u8bf7\u6c42)<br \/>\n      \u25bc<br \/>\n[\u7b2c\u4e09\u65b9\u7ad9\u957f\u670d\u52a1\u5668] \u2500\u2500\u25b6 Nginx \u8bbf\u95ee\u65e5\u5fd7\u660e\u6587\u7559\u5b58<br \/>\n      \u2502             \u2500\u2500\u25b6 \u4e91\u5382\u5546 WAF \u955c\u50cf\u6d41\u91cf<br \/>\n      \u2502             \u2500\u2500\u25b6 \u540e\u7aef AST \u89e3\u6790\u5f15\u64ce<br \/>\n      \u25bc<br \/>\n[\u8fd4\u56de\u6392\u7248\u540e\u7684 SQL]<\/p>\n<h4>2. \u4f01\u4e1a\u5408\u89c4\u7ea2\u7ebf\u4e0e\u5ba1\u8ba1\u98ce\u9669<\/h4>\n<p>\u968f\u7740\u300a\u6570\u636e\u5b89\u5168\u6cd5\u300b\u4e0e\u4f01\u4e1a\u5185\u7f51 DLP&#xff08;\u6570\u636e\u9632\u6cc4\u6f0f\u7cfb\u7edf&#xff09;\u7684\u666e\u53ca&#xff0c;\u5c06\u5e26\u6709\u4e1a\u52a1\u542b\u4e49\u7684 SQL \u811a\u672c\u4e0a\u4f20\u81f3\u975e\u53d7\u63a7\u516c\u7f51 IP&#xff0c;\u5728\u5408\u89c4\u5ba1\u67e5\u4e2d\u5c5e\u4e8e\u660e\u786e\u7684\u4e8c\u7ea7\u4ee5\u4e0a\u8fdd\u89c4\u4e8b\u4ef6\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u5de5\u5177\u7684\u201c\u6267\u884c\u5bbf\u4e3b\u73af\u5883\u201d\u624d\u662f\u51b3\u5b9a\u5b89\u5168\u6027\u7684\u6839\u672c\u8fb9\u754c\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001 \u73b0\u4ee3 SQL \u683c\u5f0f\u5316\u6838\u5fc3\u6280\u672f\u539f\u7406&#xff1a;\u6b63\u5219 vs \u8bcd\u6cd5 AST \u5f15\u64ce<\/h3>\n<p>\u8981\u628a\u6df7\u4e71\u7684 SQL \u6392\u7248\u597d&#xff0c;\u5230\u5e95\u9700\u8981\u7ecf\u5386\u54ea\u4e9b\u8ba1\u7b97\u6b65\u9aa4&#xff1f;\u4e3a\u4ec0\u4e48\u7528\u7b80\u5355\u7684\u201c\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u201d\u5f80\u5f80\u4f1a\u641e\u574f\u590d\u6742\u7684 SQL&#xff1f;<\/p>\n<h4>1. \u4f20\u7edf\u6b63\u5219\u66ff\u6362\u7684\u5c40\u9650\u6027<\/h4>\n<p>\u65e9\u671f\u7684\u7b80\u6613\u683c\u5f0f\u5316\u5de5\u5177\u4e3b\u8981\u4f9d\u8d56\u5168\u5c40\u6b63\u5219\u5339\u914d\u5173\u952e\u5b57&#xff08;\u5982\u5c06 SELECT\u3001FROM\u3001WHERE \u66ff\u6362\u4e3a \\\\nSELECT\u3001\\\\nFROM&#xff09;\u3002\u8fd9\u79cd\u505a\u6cd5\u5728\u9047\u5230\u7a0d\u5fae\u590d\u6742\u7684\u573a\u666f\u65f6\u5c31\u4f1a\u7ffb\u8f66&#xff1a;<\/p>\n<ul>\n<li>\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u8bef\u4f24&#xff1a;\u4f8b\u5982 SELECT * FROM article WHERE content LIKE &#039;%FROM zero TO hero%&#039;&#xff0c;\u6b63\u5219\u4f1a\u9519\u8bef\u5730\u628a\u53cc\u5f15\u53f7\/\u5355\u5f15\u53f7\u5185\u90e8\u7684 FROM \u4e5f\u6362\u884c&#xff1b;<\/li>\n<li>\u6ce8\u91ca\u6df7\u6dc6&#xff1a;SQL \u5305\u542b &#8212; line comment \u6216 \/* block comment *\/ \u65f6&#xff0c;\u6b63\u5219\u5f88\u96be\u7cbe\u51c6\u754c\u5b9a\u6ce8\u91ca\u8fb9\u754c&#xff1b;<\/li>\n<li>\u5d4c\u5957\u62ec\u53f7\u5bf9\u9f50&#xff1a;\u5bf9\u4e8e COUNT(DISTINCT CASE WHEN &#8230; THEN &#8230; ELSE &#8230; END) \u8fd9\u79cd\u6df1\u5ea6\u5d4c\u5957&#xff0c;\u6b63\u5219\u65e0\u6cd5\u7ef4\u62a4\u7f29\u8fdb\u5c42\u7ea7\u6808\u3002<\/li>\n<\/ul>\n<h4>2. \u73b0\u4ee3 AST \u8bed\u6cd5\u8bcd\u6cd5\u5206\u6790&#xff08;Lexer &amp; Parser&#xff09;\u6d41\u7a0b<\/h4>\n<p>\u9ad8\u53ef\u9760\u7684 SQL \u683c\u5f0f\u5316\u5de5\u5177\u5fc5\u987b\u4f9d\u8d56\u5b8c\u6574\u7684\u7f16\u8bd1\u539f\u7406\u6d41\u7a0b&#xff1a;<\/p>\n<p>[\u539f\u59cb\u6df7\u4e71 SQL \u5b57\u7b26\u4e32]<br \/>\n         \u2502<br \/>\n         \u25bc<br \/>\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502 Tokenizer \u8bcd\u6cd5\u5206\u8bcd\u5668  \u2502 \u2500\u2500\u25b6 \u8bc6\u522b Keyword\u3001Identifier\u3001Literal\u3001Operator\u3001Comment<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n         \u2502<br \/>\n         \u25bc<br \/>\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502 Parser \u8bed\u6cd5\u89e3\u6790\u5668     \u2502 \u2500\u2500\u25b6 \u6784\u5efa\u62bd\u8c61\u8bed\u6cd5\u6811 (AST)&#xff0c;\u7ef4\u62a4 Scope \u6808\u4e0e\u62ec\u53f7\u6df1\u5ea6 (Indent Depth)<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n         \u2502<br \/>\n         \u25bc<br \/>\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n \u2502 Code Generator \u7f8e\u5316\u8f93\u51fa\u2502 \u2500\u2500\u25b6 \u6839\u636e\u65b9\u8a00\u89c4\u5219&#xff08;Dialect&#xff09;\u4e0e\u7f29\u8fdb\u914d\u7f6e\u91cd\u65b0\u751f\u6210\u6392\u7248\u4ee3\u7801<br \/>\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h5>\u5173\u952e\u6b65\u9aa4\u62c6\u89e3&#xff1a;<\/h5>\n<ul>\n<li>\u8bcd\u6cd5\u5206\u8bcd&#xff08;Tokenization&#xff09;&#xff1a;\u904d\u5386\u5b57\u7b26\u6d41&#xff0c;\u8f93\u51fa\u5e26\u6709\u8bed\u4e49\u6807\u7b7e\u7684 Token \u5e8f\u5217&#xff0c;\u4f8b\u5982 [SELECT(Keyword), &#039;user_id&#039;(Identifier), &#039;,&#039;(Symbol), &#8230;]&#xff1b;<\/li>\n<li>\u65b9\u8a00\u5224\u5b9a&#xff08;Dialects&#xff09;&#xff1a;\u6807\u51c6 ANSI SQL \u4e0e MySQL \u7684\u53cd\u5f15\u53f7 &#096;name&#096;\u3001PostgreSQL \u7684 ::text \u7c7b\u578b\u8f6c\u6362\u3001SQL Server \u7684 [column] \u65b9\u62ec\u53f7\u8bed\u6cd5\u5404\u4e0d\u76f8\u540c&#xff0c;\u5206\u8bcd\u5668\u5fc5\u987b\u5177\u5907\u65b9\u8a00\u5207\u6362\u80fd\u529b&#xff1b;<\/li>\n<li>\u667a\u80fd\u7f29\u8fdb\u51b3\u7b56\u6811&#xff1a;\n<ul>\n<li>Clause Level&#xff1a;\u4e3b\u5b50\u53e5&#xff08;SELECT \/ FROM \/ JOIN \/ WHERE \/ GROUP BY \/ ORDER BY&#xff09;\u9876\u683c\u5bf9\u9f50\u6216\u56fa\u5b9a\u6362\u884c&#xff1b;<\/li>\n<li>Expression Level&#xff1a;AND \/ OR \u8fde\u63a5\u7b26\u53f3\u5bf9\u9f50\u6216\u81ea\u52a8\u6298\u884c&#xff1b;<\/li>\n<li>Subquery Level&#xff1a;\u5b50\u67e5\u8be2\u9047\u5230\u5706\u62ec\u53f7 ( \u65f6&#xff0c;\u5185\u90e8\u5c42\u7ea7\u6df1\u5ea6 depth &#043;&#061; 1&#xff0c;\u5168\u90e8\u5185\u5bb9\u589e\u52a0 2 \u6216 4 \u4e2a\u7a7a\u683c\u7f29\u8fdb&#xff0c;\u95ed\u5408 ) \u65f6\u8fd8\u539f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e09\u3001 \u5b9e\u6218\u6f14\u7ec3&#xff1a;\u683c\u5f0f\u5316\u524d\u540e\u7684\u76f4\u89c2\u5bf9\u6bd4<\/h3>\n<p>\u4ee5\u4e0b\u9762\u4e00\u6bb5\u751f\u4ea7\u5e38\u89c1\u7684 PostgreSQL \u805a\u5408\u62a5\u8868\u6162 SQL \u4e3a\u4f8b&#xff1a;<\/p>\n<h4>\u539f\u59cb\u8f93\u5165&#xff08;\u538b\u7f29\u4e71\u8c61&#xff09;&#xff1a;<\/h4>\n<p><span class=\"token keyword\">select<\/span> u<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">,<\/span>u<span class=\"token punctuation\">.<\/span>username<span class=\"token punctuation\">,<\/span><span class=\"token keyword\">coalesce<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">sum<\/span><span class=\"token punctuation\">(<\/span>o<span class=\"token punctuation\">.<\/span>amount<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> total_spent<span class=\"token punctuation\">,<\/span><span class=\"token function\">count<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">distinct<\/span> o<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">as<\/span> order_count <span class=\"token keyword\">from<\/span> users u <span class=\"token keyword\">left<\/span> <span class=\"token keyword\">join<\/span> orders o <span class=\"token keyword\">on<\/span> u<span class=\"token punctuation\">.<\/span>id<span class=\"token operator\">&#061;<\/span>o<span class=\"token punctuation\">.<\/span>user_id <span class=\"token operator\">and<\/span> o<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">status<\/span> <span class=\"token operator\">in<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;PAID&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;COMPLETED&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">where<\/span> u<span class=\"token punctuation\">.<\/span>created_at <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token string\">&#039;2026-01-01&#039;<\/span> <span class=\"token operator\">and<\/span> u<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">status<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span> <span class=\"token keyword\">group<\/span> <span class=\"token keyword\">by<\/span> u<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">,<\/span>u<span class=\"token punctuation\">.<\/span>username <span class=\"token keyword\">having<\/span> <span class=\"token function\">count<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">distinct<\/span> o<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">5<\/span> <span class=\"token keyword\">order<\/span> <span class=\"token keyword\">by<\/span> total_spent <span class=\"token keyword\">desc<\/span> <span class=\"token keyword\">limit<\/span> <span class=\"token number\">50<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>\u7ecf\u8fc7\u73b0\u4ee3\u5316 AST \u8bed\u6cd5\u5f15\u64ce\u7f8e\u5316\u540e&#xff1a;<\/h4>\n<p><span class=\"token keyword\">SELECT<\/span><br \/>\n  u<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">,<\/span><br \/>\n  u<span class=\"token punctuation\">.<\/span>username<span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token keyword\">COALESCE<\/span><span class=\"token punctuation\">(<\/span><span class=\"token function\">SUM<\/span><span class=\"token punctuation\">(<\/span>o<span class=\"token punctuation\">.<\/span>amount<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">AS<\/span> total_spent<span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token function\">COUNT<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">DISTINCT<\/span> o<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">AS<\/span> order_count<br \/>\n<span class=\"token keyword\">FROM<\/span><br \/>\n  users u<br \/>\n  <span class=\"token keyword\">LEFT<\/span> <span class=\"token keyword\">JOIN<\/span> orders o <span class=\"token keyword\">ON<\/span> u<span class=\"token punctuation\">.<\/span>id <span class=\"token operator\">&#061;<\/span> o<span class=\"token punctuation\">.<\/span>user_id<br \/>\n  <span class=\"token operator\">AND<\/span> o<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">status<\/span> <span class=\"token operator\">IN<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;PAID&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;COMPLETED&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">WHERE<\/span><br \/>\n  u<span class=\"token punctuation\">.<\/span>created_at <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token string\">&#039;2026-01-01&#039;<\/span><br \/>\n  <span class=\"token operator\">AND<\/span> u<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">status<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><br \/>\n<span class=\"token keyword\">GROUP<\/span> <span class=\"token keyword\">BY<\/span><br \/>\n  u<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">,<\/span><br \/>\n  u<span class=\"token punctuation\">.<\/span>username<br \/>\n<span class=\"token keyword\">HAVING<\/span><br \/>\n  <span class=\"token function\">COUNT<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">DISTINCT<\/span> o<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">5<\/span><br \/>\n<span class=\"token keyword\">ORDER<\/span> <span class=\"token keyword\">BY<\/span><br \/>\n  total_spent <span class=\"token keyword\">DESC<\/span><br \/>\n<span class=\"token keyword\">LIMIT<\/span><br \/>\n  <span class=\"token number\">50<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6392\u7248\u6536\u76ca&#xff1a;\u4e1a\u52a1\u5173\u8054\u6761\u4ef6&#xff08;LEFT JOIN &#8230; AND &#8230;&#xff09;\u5c42\u7ea7\u5206\u660e&#xff0c;\u805a\u5408\u51fd\u6570\u4e0e\u522b\u540d\u4e00\u76ee\u4e86\u7136&#xff0c;\u6392\u67e5\u6162\u67e5\u8be2\u6216 EXPLAIN ANALYZE \u6548\u7387\u63d0\u5347 80% \u4ee5\u4e0a\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001 \u7a0b\u5e8f\u5458\u9ad8\u6548\u4e0e\u5b89\u5168\u5e76\u5b58\u65b9\u6848&#xff1a;\u7eaf\u524d\u7aef 100% \u672c\u5730\u8fd0\u7b97<\/h3>\n<p>\u5982\u4f55\u5728\u4eab\u53d7\u5728\u7ebf\u5de5\u5177\u201c\u5373\u5f00\u5373\u7528\u3001\u65e0\u9700\u5b89\u88c5\u684c\u9762\u81c3\u80bf\u8f6f\u4ef6\u201d\u4fbf\u5229\u7684\u540c\u65f6&#xff0c;\u5f7b\u5e95\u675c\u7edd\u6570\u636e\u4e0a\u4f20&#xff1f;<\/p>\n<p>\u7b54\u6848\u662f&#xff1a;\u628a AST \u89e3\u6790\u4e0e\u683c\u5f0f\u5316\u5f15\u64ce\u5b8c\u5168\u642c\u8fdb\u73b0\u4ee3\u6d4f\u89c8\u5668\u7684 V8 \u5f15\u64ce\u672c\u5730\u5185\u5b58\u4e2d\u3002<\/p>\n<p>\u6211\u4eec\u5728\u5f00\u6e90\u4e0e\u6548\u7387\u5de5\u5177\u77e9\u9635 MiniToolDesk \u4e2d\u4e13\u95e8\u5b9e\u73b0\u4e86\u5168\u65b0\u7684\u5728\u7ebf\u5de5\u5177\u6a21\u5757&#xff1a;<\/p>\n<p>&#x1f449; MiniToolDesk \u5728\u7ebf SQL \u683c\u5f0f\u5316\u4e0e\u7f8e\u5316\u5de5\u5177<\/p>\n<h4>\u8be5\u5de5\u5177\u7684\u6838\u5fc3\u6280\u672f\u4eae\u70b9&#xff1a;<\/h4>\n<li>0 \u5b57\u8282\u670d\u52a1\u7aef\u4e0a\u62a5&#xff08;Zero Server Uploads&#xff09;&#xff1a;\n<ul>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\u63a7\u5236\u53f0 F12 \u76d1\u63a7&#xff0c;\u8f93\u5165\u4efb\u4f55 SQL\u3001\u70b9\u51fb\u4efb\u4f55\u6309\u94ae&#xff0c;\u7f51\u7edc\u9762\u677f\u65e0\u4efb\u4f55 API \u8bf7\u6c42&#xff1b;<\/li>\n<li>\u54ea\u6015\u4f60\u76f4\u63a5\u65ad\u7f51\u3001\u62d4\u6389\u7f51\u7ebf&#xff0c;\u683c\u5f0f\u5316\u4e0e\u538b\u7f29\u529f\u80fd\u4f9d\u7136\u6beb\u79d2\u7ea7\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u591a\u65b9\u8a00\u65e0\u7f1d\u652f\u6301&#xff1a;\n<ul>\n<li>\u5185\u7f6e Standard SQL\u3001MySQL\u3001PostgreSQL\u3001MariaDB\u3001SQLite \u7b49\u65b9\u8a00\u652f\u6301&#xff1b;<\/li>\n<\/ul>\n<\/li>\n<li>\u53cc\u5411\u6a21\u5f0f\u4e00\u952e\u5207\u6362&#xff1a;\n<ul>\n<li>Beautify&#xff08;\u7f8e\u5316&#xff09;&#xff1a;\u89c4\u8303\u7f29\u8fdb\u4e0e\u6362\u884c&#xff0c;\u9002\u5408\u4ee3\u7801\u5ba1\u67e5\u4e0e\u6162\u65e5\u5fd7\u6392\u67e5&#xff1b;<\/li>\n<li>Minify&#xff08;\u5355\u884c\u538b\u7f29&#xff09;&#xff1a;\u4e00\u952e\u53bb\u9664\u5197\u4f59\u6ce8\u91ca\u4e0e\u7a7a\u767d\u7b26&#xff0c;\u76f4\u63a5\u7528\u4e8e\u4ee3\u7801\u914d\u7f6e\u6216\u62fc\u63a5\u5d4c\u5165\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5168\u7ad9\u7eaf\u51c0\u65e0\u5e7f\u544a&#xff1a;\n<ul>\n<li>\u754c\u9762\u53c2\u8003 Linear \/ Raycast \u6781\u5ba2\u6697\u8272\u8c03&#xff0c;\u652f\u6301\u5168\u5c40 Ctrl &#043; K \u79d2\u7ea7\u5524\u51fa\u3002<\/li>\n<\/ul>\n<\/li>\n<hr \/>\n<h3>\u4e94\u3001 \u5ef6\u4f38\u63a8\u8350&#xff1a;\u65e5\u5e38\u6392\u969c\u4e0d\u53ef\u6216\u7f3a\u7684\u9ad8\u9891\u6781\u5ba2\u5de5\u5177\u7bb1<\/h3>\n<p>\u9664\u4e86 SQL \u683c\u5f0f\u5316\u4e4b\u5916&#xff0c;\u540e\u7aef\u65e5\u5e38\u8c03\u8bd5\u4e2d\u8fd8\u6709\u51e0\u4e2a\u9ad8\u9891\u4f46\u5bb9\u6613\u5f15\u53d1\u6570\u636e\u6cc4\u6f0f\u7684\u201c\u91cd\u707e\u533a\u201d&#xff0c;\u6211\u4eec\u4e5f\u4e00\u5e76\u505a\u6210\u4e86\u7eaf\u6d4f\u89c8\u5668\u7aef\u79bb\u7ebf\u7248\u672c&#xff1a;<\/p>\n<li>\n<p>JWT \u79bb\u7ebf\u5b89\u5168\u89e3\u5bc6\u4e0e\u8c03\u8bd5\u5de5\u5177 (JWT Debugger)<\/p>\n<ul>\n<li>\u4f20\u7edf\u7684 jwt.io \u5b58\u5728\u5c06 Token \u53d1\u5f80\u4e91\u7aef\u7684\u987e\u8651&#xff1b;<\/li>\n<li>\u672c\u5de5\u5177\u57fa\u4e8e\u6d4f\u89c8\u5668\u539f\u751f Web Crypto API&#xff0c;\u5728\u672c\u5730\u5b8c\u6210 Base64URL \u9006\u5411\u89e3\u7801\u3001\u8fc7\u671f\u65f6\u95f4\u5012\u8ba1\u65f6\u8ba1\u7b97\u4e0e HS256 \u7b7e\u540d\u6821\u9a8c&#xff0c;\u654f\u611f Token \u7edd\u4e0d\u79bb\u673a\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Cron \u8868\u8fbe\u5f0f\u53ef\u89c6\u5316\u751f\u6210\u4e0e\u65f6\u95f4\u9884\u89c8\u5668<\/p>\n<ul>\n<li>\u540e\u7aef\u914d\u7f6e Linux Crontab \u6216 Spring &#064;Scheduled \u5b9a\u65f6\u4efb\u52a1\u65f6&#xff0c;\u5e38\u56e0 5 \u6bb5\u5f0f\u4e0e 6 \u6bb5\u5f0f\u6df7\u6dc6\u9020\u6210\u4e8b\u6545&#xff1b;<\/li>\n<li>\u63d0\u4f9b\u53ef\u89c6\u5316\u70b9\u51fb\u9009\u62e9\u5668&#xff0c;\u5e76\u76f4\u63a5\u5c55\u793a\u672a\u6765 5 \u6b21\u7684\u7cbe\u786e\u6267\u884c\u65f6\u95f4\u6233\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>cURL \u4e00\u952e\u8f6c Python \/ Go \/ Axios \u591a\u8bed\u8a00\u4ee3\u7801<\/p>\n<ul>\n<li>\u6d4f\u89c8\u5668\u7f51\u7edc\u6293\u5305\u590d\u5236\u7684 cURL \u547d\u4ee4&#xff0c;\u4e00\u952e\u65e0\u635f\u8f6c\u6362\u4e3a\u5e26 Headers\u3001Cookies\u3001Body \u7684\u539f\u751f\u4ee3\u7801\u811a\u672c&#xff0c;\u63a5\u53e3\u8054\u8c03\u6548\u7387\u7ffb\u500d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7eaf\u524d\u7aef\u65e0\u635f\u56fe\u7247\u538b\u7f29\u5de5\u5177<\/p>\n<ul>\n<li>\u67b6\u6784\u6587\u6863\u6216\u539f\u578b\u622a\u56fe\u592a\u5927&#xff1f;\u4f7f\u7528\u6d4f\u89c8\u5668\u672c\u5730 Canvas &#043; WebP \u5f15\u64ce\u76f4\u63a5\u5728\u672c\u5730\u5b8c\u6210\u538b\u5236&#xff0c;\u65e0\u9700\u4e0a\u4f20\u5230\u4e91\u7aef\u538b\u7f29\u670d\u52a1\u3002<\/li>\n<\/ul>\n<\/li>\n<hr \/>\n<h3>\u516d\u3001 \u603b\u7ed3\u4e0e\u5de5\u7a0b\u5e08\u6700\u4f73\u5b9e\u8df5<\/h3>\n<p>\u5728\u6570\u636e\u8d44\u4ea7\u8d8a\u6765\u8d8a\u654f\u611f\u7684\u4eca\u5929&#xff0c;\u4f5c\u4e3a\u7814\u53d1\u4eba\u5458\u5e94\u5f53\u5efa\u7acb\u8d77\u4e25\u5bc6\u7684\u6570\u636e\u5b89\u5168\u7ea2\u7ebf\u4e60\u60ef&#xff1a;<\/p>\n<ul>\n<li>\u62d2\u7edd\u88f8\u5954&#xff1a;\u6d89\u53ca\u4f01\u4e1a\u751f\u4ea7\u73af\u5883\u7684 SQL\u3001\u65e5\u5fd7\u3001Token\u3001\u73af\u5883\u53d8\u91cf&#xff0c;\u5207\u52ff\u8f7b\u6613\u8f93\u5165\u672a\u7ecf\u5ba1\u8ba1\u7684\u7b2c\u4e09\u65b9\u516c\u5171\u5de5\u5177\u4e2d&#xff1b;<\/li>\n<li>\u8ba4\u51c6\u7eaf\u5ba2\u6237\u7aef\u6267\u884c&#xff1a;\u4f18\u5148\u9009\u62e9\u7ecf\u8fc7\u5f00\u6e90\u9a8c\u8bc1\u6216\u660e\u786e\u58f0\u660e\u201c100% In-Browser Execution \/ Zero Telemetry\u201d\u7684\u7eaf\u524d\u7aef\u5de5\u5177&#xff1b;<\/li>\n<li>\u89c4\u8303\u6392\u7248\u4e0e\u5ba1\u67e5&#xff1a;\u517b\u6210\u5728\u63d0\u4ea4 PR \u6216\u6267\u884c DDL\/DML \u53d8\u66f4\u524d\u7edf\u4e00\u683c\u5f0f\u5316\u7684\u4e60\u60ef&#xff0c;\u51cf\u5c11\u56e0\u8bed\u6cd5\u683c\u5f0f\u4e0d\u89c4\u8303\u9020\u6210\u7684\u7ebf\u4e0a\u4f4e\u7ea7\u6545\u969c\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[768,100],"topic":[],"class_list":["post-123689","post","type-post","status-publish","format-standard","hentry","category-server","tag-sql","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/123689.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/123689.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-07T18:32:59+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123689.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/123689.html\",\"name\":\"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-07T18:32:59+00:00\",\"dateModified\":\"2026-11-07T18:32:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/123689.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/123689.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123689.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/123689.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/123689.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-07T18:32:59+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/123689.html","url":"https:\/\/www.wsisp.com\/helps\/123689.html","name":"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-07T18:32:59+00:00","dateModified":"2026-11-07T18:32:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/123689.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/123689.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/123689.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165\u89e3\u6790 SQL \u5728\u7ebf\u683c\u5f0f\u5316\u4e0e AST \u8bed\u6cd5\u6811\u7f8e\u5316\uff1a\u5982\u4f55\u907f\u514d\u6162\u67e5\u8be2\u6392\u67e5\u4e2d\u7684\u6570\u636e\u6cc4\u9732\u9677\u9631\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=123689"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123689\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=123689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=123689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=123689"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=123689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}