{"id":120859,"date":"2026-11-01T16:17:08","date_gmt":"2026-11-01T08:17:08","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/120859.html"},"modified":"2026-11-01T16:17:08","modified_gmt":"2026-11-01T08:17:08","slug":"%e4%b8%8d%e4%bc%9a-sql-%e4%b9%9f%e8%83%bd%e6%9f%a5%e4%b8%9a%e5%8a%a1%e6%95%b0%e6%8d%ae%ef%bc%9a4-%e6%ae%b5%e6%8f%90%e7%a4%ba%e8%af%8d%e6%8b%bc%e5%87%ba%e4%b8%80%e6%9d%a1-ai-%e5%8f%96%e6%95%b0%e6%b5%81","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/120859.html","title":{"rendered":"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09"},"content":{"rendered":"<p>\u4f01\u4e1a\u60f3\u8ba9 AI \u67e5\u81ea\u5df1\u7684\u6570\u636e&#xff0c;\u7b2c\u4e00\u4e2a\u649e\u4e0a\u7684\u5899\u4e0d\u662f\u6a21\u578b\u80fd\u529b&#xff0c;\u662f\u5b83\u4e0d\u77e5\u9053\u4f60\u7684\u8868\u957f\u4ec0\u4e48\u6837\u3002<\/p>\n<p>\u4f60\u628a&#034;\u4e0a\u5b63\u5ea6\u534e\u4e1c\u533a\u6bdb\u5229\u6700\u4f4e\u7684 10 \u4e2a\u5ba2\u6237&#034;\u6254\u7ed9 ChatGPT&#xff0c;\u5b83\u53ea\u80fd\u7f16\u4e00\u4e2a\u770b\u8d77\u6765\u50cf SQL \u7684\u4e1c\u897f\u2014\u2014\u8868\u540d\u662f\u731c\u7684\u3001\u5b57\u6bb5\u662f\u731c\u7684\u3001\u8fde\u6570\u636e\u5e93\u7c7b\u578b\u90fd\u4e0d\u77e5\u9053\u3002<\/p>\n<p>\u8fd9\u7bc7\u8bb2\u600e\u4e48\u628a\u8fd9\u4ef6\u4e8b\u505a\u5bf9&#xff1a;\u56db\u6bb5\u63d0\u793a\u8bcd &#043; \u4e00\u9053\u5b89\u5168\u95f8&#xff0c;\u62fc\u6210\u4e00\u6761\u4ece&#034;\u4eba\u8bdd&#034;\u5230&#034;\u53ef\u7528\u6570\u636e&#034;\u7684\u5b8c\u6574\u6d41\u6c34\u7ebf\u3002\u4ee3\u7801\u6211\u7528 SQLite \u5efa\u4e86\u771f\u5b9e\u4e1a\u52a1\u5e93\u8dd1\u901a&#xff0c;\u4e0d\u662f\u4f2a\u4ee3\u7801\u3002<\/p>\n<h3>\u4e00\u3001\u5148\u770b\u8fd9\u6761\u6d41\u6c34\u7ebf\u7684\u5168\u8c8c<\/h3>\n<table>\n<tr>\u7ad9\u5e72\u4ec0\u4e48\u8c01\u5728\u7528\u5bf9\u5e94\u63d0\u793a\u8bcd<\/tr>\n<tbody>\n<tr>\n<td>\u2460 \u751f\u6210<\/td>\n<td>\u4eba\u8bdd \u2192 SQL<\/td>\n<td>\u4e1a\u52a1\/\u5206\u6790\u5e08<\/td>\n<td>id&#061;5011 AI2SQL \u67e5\u8be2\u751f\u6210\u5668<\/td>\n<\/tr>\n<tr>\n<td>\u2461 \u8bb2\u89e3<\/td>\n<td>SQL \u2192 \u4eba\u8bdd &#043; \u98ce\u9669\u63d0\u793a<\/td>\n<td>\u4e1a\u52a1\u65b9\u786e\u8ba4\u3001DBA \u5ba1\u6838<\/td>\n<td>id&#061;2299 \u9762\u5411\u975e\u5de5\u7a0b\u5e08\u7684 SQL \u67e5\u8be2\u8bb2\u89e3<\/td>\n<\/tr>\n<tr>\n<td>\u2462 \u5b89\u5168\u6267\u884c<\/td>\n<td>\u53ea\u8bfb\u95f8 &#043; \u5f3a\u5236 LIMIT &#043; \u8d85\u65f6<\/td>\n<td>\u5de5\u7a0b\u4fa7<\/td>\n<td>\u672c\u6587\u4ee3\u7801&#xff08;\u7b2c\u4e09\u8282&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u2463 \u53cd\u5411\u5165\u5e93<\/td>\n<td>\u7eb8\u8d28\/PDF\/\u622a\u56fe\u8868\u683c \u2192 \u7ed3\u6784\u5316\u6570\u636e<\/td>\n<td>\u6570\u636e\u8fd8\u6ca1\u8fdb\u7cfb\u7edf\u65f6<\/td>\n<td>id&#061;1193 PDF \u8868\u683c\u8f6c CSV\u3001id&#061;4765 Excel \u8868\u683c\u52a9\u624b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e3a\u4ec0\u4e48\u5fc5\u987b\u6709\u2461\u2462\u4e24\u7ad9&#xff1a;\u591a\u6570&#034;AI \u67e5\u6570\u636e\u5e93&#034;\u7684\u6559\u7a0b\u53ea\u8bb2\u2460&#xff0c;\u7136\u540e\u76f4\u63a5\u6267\u884c\u3002\u8fd9\u5728\u751f\u4ea7\u73af\u5883\u662f\u4e8b\u6545\u2014\u2014AI \u53ef\u80fd\u751f\u6210\u4e00\u4e2a\u6ca1\u6709 WHERE \u7684\u5168\u8868\u66f4\u65b0&#xff0c;\u6216\u8005\u628a\u542b\u624b\u673a\u53f7\u7684\u8868\u6574\u5f20\u5bfc\u51fa\u53bb\u3002\u2461\u662f\u8ba9\u4eba\u770b\u61c2\u98ce\u9669&#xff0c;\u2462\u662f\u8ba9\u673a\u5668\u62e6\u4f4f\u98ce\u9669&#xff0c;\u4e24\u7ad9\u90fd\u4e0d\u80fd\u7701\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;AI \u53d6\u6570\u7684\u96be\u70b9\u4e0d\u5728\u751f\u6210 SQL&#xff0c;\u5728&#034;\u751f\u6210\u4e4b\u540e\u8c01\u4e3a\u5b83\u8d1f\u8d23&#034;\u3002<\/p>\n<h3>\u4e8c\u3001\u7ad9\u2460 \u751f\u6210 SQL&#xff1a;\u63d0\u793a\u8bcd\u8981\u7ed9\u4e09\u6837\u4e1c\u897f<\/h3>\n<p>\u63d0\u793a\u5c9b\u7ad9\u5185\u6761\u76ee id&#061;5011\u300cAI2SQL \u67e5\u8be2\u751f\u6210\u5668\u300d&#xff08;CC0-1.0&#xff0c;1123 \u5b57&#xff09;&#xff0c;\u5168\u6587&#xff1a;<\/p>\n<p>Context:<br \/>\nThis prompt is used by AI2sql to generate SQL queries from natural language.<br \/>\nAI2sql focuses on correctness, clarity, and real-world database usage.<\/p>\n<p>Purpose:<br \/>\nThis prompt converts plain English database requests into clean,<br \/>\nreadable, and production-ready SQL queries.<\/p>\n<p>Database:<br \/>\n${db:PostgreSQL | MySQL | SQL Server}<\/p>\n<p>Schema:<br \/>\n${schema:Optional \u2014 tables, columns, relationships}<\/p>\n<p>User request:<br \/>\n${prompt:Describe the data you want in plain English}<\/p>\n<p>Output:<br \/>\n&#8211; A single SQL query that answers the request<\/p>\n<p>Behavior:<br \/>\n&#8211; Focus exclusively on SQL generation<br \/>\n&#8211; Prioritize correctness and clarity<br \/>\n&#8211; Use explicit column selection<br \/>\n&#8211; Use clear and consistent table aliases<br \/>\n&#8211; Avoid unnecessary complexity<\/p>\n<p>Rules:<br \/>\n&#8211; Output ONLY SQL<br \/>\n&#8211; No explanations<br \/>\n&#8211; No comments<br \/>\n&#8211; No markdown<br \/>\n&#8211; Avoid SELECT *<br \/>\n&#8211; Use standard SQL unless the selected database requires otherwise<\/p>\n<p>Ambiguity handling:<br \/>\n&#8211; If schema details are missing, infer reasonable relationships<br \/>\n&#8211; Make the query work on a typical schema of that kind<\/p>\n<p>\u4e09\u4e2a\u5173\u952e\u8bbe\u8ba1&#xff0c;\u503c\u5f97\u6284\u8fdb\u4f60\u81ea\u5df1\u7684\u63d0\u793a\u8bcd&#xff1a;<\/p>\n<li>${db:&#8230;} \u548c ${schema:&#8230;} \u53d8\u91cf\u69fd\u2014\u2014\u5148\u58f0\u660e\u6570\u636e\u5e93\u7c7b\u578b\u548c\u8868\u7ed3\u6784&#xff0c;\u518d\u63d0\u95ee\u3002\u8fd9\u662f Text2SQL \u7684\u547d\u95e8&#xff1a;\u4e0d\u7ed9 schema&#xff0c;AI \u53ea\u80fd\u731c\u8868\u540d\u3002\u7ad9\u5185\u8fd9\u7c7b\u5e26\u9ed8\u8ba4\u503c\u7684\u53d8\u91cf\u5199\u6cd5&#xff08;\u5192\u53f7\u540e\u662f\u7f3a\u7701\u503c&#xff09;\u5728\u591a\u6761\u63d0\u793a\u8bcd\u91cc\u90fd\u80fd\u770b\u5230&#xff0c;\u662f\u4e2a\u901a\u7528\u597d\u6a21\u5f0f\u3002<\/li>\n<li>Avoid SELECT *\u2014\u2014\u5f3a\u5236\u663e\u5f0f\u5217\u540d\u3002\u65e2\u7701\u6d41\u91cf&#xff0c;\u4e5f\u907f\u514d\u628a PII \u5b57\u6bb5\u987a\u624b\u5e26\u51fa\u6765&#xff08;SELECT * \u4ece\u5ba2\u6237\u8868\u91cc\u4f1a\u8fde\u624b\u673a\u53f7\u4e00\u8d77\u635e\u8d70&#xff09;\u3002<\/li>\n<li>Output ONLY SQL \/ No markdown\u2014\u2014\u751f\u4ea7\u73af\u5883\u8981\u628a\u8fd4\u56de\u76f4\u63a5\u5582\u7ed9\u6570\u636e\u5e93\u6267\u884c&#xff0c;\u591a\u4e00\u53e5&#034;\u597d\u7684&#xff0c;\u8fd9\u662f\u60a8\u7684 SQL&#xff1a;&#034;\u5c31\u4f1a\u62a5\u8bed\u6cd5\u9519\u3002<\/li>\n<p>\u26a0\ufe0f \u5b83\u7684 Ambiguity handling \u5199\u4e86&#034;schema \u7f3a\u5931\u65f6\u63a8\u65ad\u5408\u7406\u5173\u7cfb&#034;\u2014\u2014\u8fd9\u5728\u751f\u4ea7\u4e0a\u662f\u5371\u9669\u7684\u3002\u5b81\u53ef\u8ba9\u5b83\u62a5\u9519&#xff0c;\u4e5f\u522b\u8ba9\u5b83\u731c\u8868\u7ed3\u6784\u3002\u5efa\u8bae\u628a\u8fd9\u6761\u6539\u6210&#xff1a;\u201cIf schema is missing, ask for it; do not invent table or column names.\u201d<\/p>\n<p>\u7ed3\u8bba&#xff1a;Text2SQL \u63d0\u793a\u8bcd\u7684\u6838\u5fc3\u4e0d\u662f&#034;\u5e2e\u6211\u5199 SQL&#034;&#xff0c;\u662f&#034;\u5148\u7ed9\u4f60 schema&#xff0c;\u518d\u8ba9\u4f60\u53ea\u8f93\u51fa SQL&#034;\u3002<\/p>\n<h3>\u4e09\u3001\u7ad9\u2461 \u8bb2\u89e3 SQL&#xff1a;\u8ba9\u4e1a\u52a1\u65b9\u770b\u61c2&#xff0c;\u4e5f\u770b\u51fa\u98ce\u9669<\/h3>\n<p>\u751f\u6210\u7684 SQL \u4e0d\u80fd\u76f4\u63a5\u8dd1&#xff0c;\u5f97\u6709\u4eba\u786e\u8ba4&#034;\u8fd9\u662f\u4e0d\u662f\u6211\u8981\u7684&#034;\u3002\u4f46\u4e1a\u52a1\u540c\u4e8b\u770b\u4e0d\u61c2 SQL\u2014\u2014\u8fd9\u4e00\u7ad9\u5c31\u662f\u7ed9\u4ed6\u7ffb\u8bd1\u7684\u3002<\/p>\n<p>\u63d0\u793a\u5c9b\u7ad9\u5185\u6761\u76ee id&#061;2299\u300c\u9762\u5411\u975e\u5de5\u7a0b\u5e08\u7684 SQL \u67e5\u8be2\u8bb2\u89e3\u300d&#xff08;351 \u5b57&#xff09;&#xff0c;\u5168\u6587&#xff1a;<\/p>\n<p>Explain this SQL for a non-engineer stakeholder.<\/p>\n<p>SQL:<br \/>\n${sql}<\/p>\n<p>Also provide:<br \/>\n&#8211; What business question it answers<br \/>\n&#8211; Tables\/joins in plain words<br \/>\n&#8211; Filters and date ranges<br \/>\n&#8211; Risks (cartesian joins, missing filters, PII exposure)<br \/>\n&#8211; A one-paragraph executive summary<\/p>\n<p>Assume the reader knows spreadsheets but not SQL. Do not rewrite the query unless asked.<\/p>\n<p>\u8fd9\u6bb5\u77ed&#xff0c;\u4f46\u8bbe\u8ba1\u5bc6\u5ea6\u5f88\u9ad8&#xff1a;<\/p>\n<ul>\n<li>Assume the reader knows spreadsheets but not SQL\u2014\u2014\u951a\u5b9a\u8bfb\u8005\u8ba4\u77e5\u6c34\u5e73&#xff0c;AI \u5c31\u4e0d\u4f1a\u7528&#034;\u5916\u8fde\u63a5\u57fa\u6570&#034;\u8fd9\u79cd\u8bcd&#xff0c;\u800c\u4f1a\u8bf4&#034;\u50cf VLOOKUP \u90a3\u6837\u5339\u914d&#034;<\/li>\n<li>Risks (cartesian joins, missing filters, PII exposure)\u2014\u2014\u663e\u5f0f\u70b9\u540d\u4e09\u7c7b\u98ce\u9669&#xff1a;\u7b1b\u5361\u5c14\u79ef&#xff08;join \u6761\u4ef6\u6f0f\u4e86\u5bfc\u81f4\u6570\u636e\u7206\u70b8&#xff09;\u3001\u7f3a\u8fc7\u6ee4\u6761\u4ef6&#xff08;\u5168\u8868\u626b\u63cf&#xff09;\u3001PII \u6cc4\u9732\u3002\u8fd9\u4e09\u4e2a\u6b63\u662f AI \u751f\u6210 SQL \u6700\u5e38\u72af\u7684\u9519<\/li>\n<li>Do not rewrite the query unless asked\u2014\u2014\u9632\u6b62 AI \u81ea\u4f5c\u4e3b\u5f20\u6539 SQL&#xff0c;\u6539\u4e86\u5c31\u548c\u5b9e\u9645\u8981\u6267\u884c\u7684\u4e0d\u4e00\u81f4\u4e86<\/li>\n<\/ul>\n<p>\u5728\u4f01\u4e1a\u91cc\u7684\u5b9e\u9645\u7528\u6cd5&#xff1a;\u628a\u5b83\u505a\u6210\u4e00\u4e2a\u56fa\u5b9a\u73af\u8282\u2014\u2014AI \u751f\u6210 SQL \u540e&#xff0c;\u81ea\u52a8\u518d\u8c03\u4e00\u6b21\u8fd9\u4e2a\u63d0\u793a\u8bcd&#xff0c;\u628a&#034;\u8fd9\u6bb5\u67e5\u8be2\u5728\u505a\u4ec0\u4e48 &#043; \u6709\u4ec0\u4e48\u98ce\u9669&#034;\u4e00\u8d77\u53d1\u7ed9\u4e1a\u52a1\u65b9\u786e\u8ba4\u3002\u4e1a\u52a1\u65b9\u70b9\u786e\u8ba4\u4e86\u624d\u6267\u884c\u3002\u591a\u4e00\u6b21\u8c03\u7528&#xff0c;\u5c11\u4e00\u6b21\u4e8b\u6545\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;AI \u5199\u7684 SQL \u8981 AI \u81ea\u5df1\u89e3\u91ca\u4e00\u904d\u7ed9\u4e1a\u52a1\u65b9\u770b&#xff0c;\u786e\u8ba4\u73af\u8282\u4e0d\u80fd\u7701\u2014\u2014\u8fd9\u662f\u8d23\u4efb\u5212\u5206&#xff0c;\u4e0d\u662f\u6548\u7387\u95ee\u9898\u3002<\/p>\n<h3>\u56db\u3001\u7ad9\u2462 \u6267\u884c\u524d\u7684\u5b89\u5168\u95f8&#xff08;\u5b8c\u6574\u4ee3\u7801&#xff0c;SQLite \u5b9e\u6d4b\u8dd1\u901a&#xff09;<\/h3>\n<p>\u4e09\u9053\u95f8&#xff1a;\u53ea\u8bfb\u8d26\u53f7&#xff08;\u6743\u9650\u5c42&#xff0c;\u6700\u6839\u672c&#xff09;\u3001\u8bed\u53e5\u767d\u540d\u5355&#xff08;\u53ea\u653e\u884c SELECT&#xff09;\u3001\u5f3a\u5236 LIMIT &#043; \u8d85\u65f6\u3002<\/p>\n<p><span class=\"token triple-quoted-string string\">&#034;&#034;&#034;AI \u53d6\u6570\u6d41\u6c34\u7ebf&#xff1a;schema \u63d0\u53d6 \u2192 \u751f\u6210 SQL \u2192 \u8bb2\u89e3 \u2192 \u5b89\u5168\u6267\u884c\u3002SQLite \u7248&#xff0c;\u53ef\u76f4\u63a5\u8dd1\u3002&#034;&#034;&#034;<\/span><br \/>\n<span class=\"token keyword\">import<\/span> re<br \/>\n<span class=\"token keyword\">import<\/span> sqlite3<\/p>\n<p>DB_PATH <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;business.db&#034;<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">build_demo_db<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token operator\">&#061;<\/span>DB_PATH<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u5efa\u4e00\u4e2a\u6f14\u793a\u4e1a\u52a1\u5e93&#xff08;\u771f\u5b9e\u573a\u666f\u66ff\u6362\u4e3a\u4f60\u7684\u5e93\u8fde\u63a5&#xff09;\u3002&#034;&#034;&#034;<\/span><br \/>\n    con <span class=\"token operator\">&#061;<\/span> sqlite3<span class=\"token punctuation\">.<\/span>connect<span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span><br \/>\n    con<span class=\"token punctuation\">.<\/span>executescript<span class=\"token punctuation\">(<\/span><span class=\"token triple-quoted-string string\">&#034;&#034;&#034;<br \/>\n    DROP TABLE IF EXISTS orders;<br \/>\n    DROP TABLE IF EXISTS customers;<br \/>\n    CREATE TABLE customers(<br \/>\n        id INTEGER PRIMARY KEY, name TEXT, region TEXT, phone TEXT<br \/>\n    );<br \/>\n    CREATE TABLE orders(<br \/>\n        id INTEGER PRIMARY KEY, customer_id INTEGER,<br \/>\n        amount REAL, cost REAL, order_date TEXT<br \/>\n    );<br \/>\n    INSERT INTO customers VALUES<br \/>\n      (1,&#039;\u7532\u516c\u53f8&#039;,&#039;\u534e\u4e1c&#039;,&#039;13800000001&#039;),<br \/>\n      (2,&#039;\u4e59\u516c\u53f8&#039;,&#039;\u534e\u4e1c&#039;,&#039;13800000002&#039;),<br \/>\n      (3,&#039;\u4e19\u516c\u53f8&#039;,&#039;\u534e\u5357&#039;,&#039;13800000003&#039;);<br \/>\n    INSERT INTO orders VALUES<br \/>\n      (1,1,10000,7000,&#039;2026-07-05&#039;),<br \/>\n      (2,1,20000,18000,&#039;2026-08-11&#039;),<br \/>\n      (3,2,15000,9000,&#039;2026-09-02&#039;),<br \/>\n      (4,3,8000,3000,&#039;2026-09-20&#039;);<br \/>\n    &#034;&#034;&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    con<span class=\"token punctuation\">.<\/span>commit<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    con<span class=\"token punctuation\">.<\/span>close<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">get_schema<\/span><span class=\"token punctuation\">(<\/span>con<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u95f80&#xff1a;\u53ea\u628a\u8868\u7ed3\u6784\u5582\u7ed9 AI&#xff0c;\u7edd\u4e0d\u628a\u6570\u636e\u5582\u7ed9\u5b83&#xff08;\u9632 PII \u5916\u6cc4&#xff09;\u3002&#034;&#034;&#034;<\/span><br \/>\n    rows <span class=\"token operator\">&#061;<\/span> con<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><br \/>\n        <span class=\"token string\">&#034;SELECT name, sql FROM sqlite_master WHERE type&#061;&#039;table&#039; AND name NOT LIKE &#039;sqlite_%&#039;&#034;<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>fetchall<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>sql <span class=\"token keyword\">for<\/span> _<span class=\"token punctuation\">,<\/span> sql <span class=\"token keyword\">in<\/span> rows <span class=\"token keyword\">if<\/span> sql<span class=\"token punctuation\">)<\/span><\/p>\n<p>FORBIDDEN <span class=\"token operator\">&#061;<\/span> re<span class=\"token punctuation\">.<\/span><span class=\"token builtin\">compile<\/span><span class=\"token punctuation\">(<\/span><br \/>\n    <span class=\"token string\">r&#034;\\\\b(insert|update|delete|drop|alter|create|truncate|replace|attach|pragma|vacuum)\\\\b&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    re<span class=\"token punctuation\">.<\/span>I<span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">assert_read_only<\/span><span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token boolean\">None<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u95f81&#xff1a;\u8bed\u53e5\u767d\u540d\u5355\u2014\u2014\u53ea\u653e\u884c\u5355\u6761 SELECT\/WITH\u3002&#034;&#034;&#034;<\/span><br \/>\n    s <span class=\"token operator\">&#061;<\/span> sql<span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>rstrip<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token string\">&#034;;&#034;<\/span> <span class=\"token keyword\">in<\/span> s<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> PermissionError<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4e0d\u5141\u8bb8\u591a\u8bed\u53e5&#xff08;\u9632 SQL \u6ce8\u5165\u62fc\u63a5&#xff09;&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token keyword\">not<\/span> re<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">match<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">r&#034;^(select|with)\\\\b&#034;<\/span><span class=\"token punctuation\">,<\/span> s<span class=\"token punctuation\">,<\/span> re<span class=\"token punctuation\">.<\/span>I<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> PermissionError<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u53ea\u5141\u8bb8 SELECT\/WITH \u67e5\u8be2&#xff0c;\u6536\u5230&#xff1a;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>s<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">40]<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">\u2026&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    m <span class=\"token operator\">&#061;<\/span> FORBIDDEN<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> m<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">raise<\/span> PermissionError<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u67e5\u8be2\u4e2d\u542b\u5199\u64cd\u4f5c\u5173\u952e\u5b57 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>m<span class=\"token punctuation\">.<\/span>group<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>upper<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#xff0c;\u5df2\u62e6\u622a&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">ensure_limit<\/span><span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> max_rows<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u95f82&#xff1a;\u5f3a\u5236 LIMIT&#xff0c;\u9632\u5168\u8868\u62c9\u53d6\u3002&#034;&#034;&#034;<\/span><br \/>\n    s <span class=\"token operator\">&#061;<\/span> sql<span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>rstrip<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> re<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span><span class=\"token string\">r&#034;\\\\blimit\\\\b&#034;<\/span><span class=\"token punctuation\">,<\/span> s<span class=\"token punctuation\">,<\/span> re<span class=\"token punctuation\">.<\/span>I<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> s<br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>s<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> LIMIT <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>max_rows<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">run_query<\/span><span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> max_rows<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">,<\/span> timeout_ms<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">int<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">3000<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u6267\u884c&#xff1a;\u53ea\u8bfb\u8fde\u63a5 &#043; \u8d85\u65f6 &#043; LIMIT\u3002\u8fd4\u56de (\u5217\u540d, \u884c)\u3002&#034;&#034;&#034;<\/span><br \/>\n    assert_read_only<span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">)<\/span><br \/>\n    safe_sql <span class=\"token operator\">&#061;<\/span> ensure_limit<span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">,<\/span> max_rows<span class=\"token punctuation\">)<\/span><br \/>\n    con <span class=\"token operator\">&#061;<\/span> sqlite3<span class=\"token punctuation\">.<\/span>connect<span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;file:<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>DB_PATH<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">?mode&#061;ro&#034;<\/span><\/span><span class=\"token punctuation\">,<\/span> uri<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00<\/span><br \/>\n    <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        con<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;PRAGMA busy_timeout &#061; %d&#034;<\/span> <span class=\"token operator\">%<\/span> timeout_ms<span class=\"token punctuation\">)<\/span><br \/>\n        cur <span class=\"token operator\">&#061;<\/span> con<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span>safe_sql<span class=\"token punctuation\">)<\/span><br \/>\n        cols <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>d<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> d <span class=\"token keyword\">in<\/span> cur<span class=\"token punctuation\">.<\/span>description<span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">if<\/span> cur<span class=\"token punctuation\">.<\/span>description <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> cols<span class=\"token punctuation\">,<\/span> cur<span class=\"token punctuation\">.<\/span>fetchall<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">finally<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        con<span class=\"token punctuation\">.<\/span>close<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">build_prompt<\/span><span class=\"token punctuation\">(<\/span>question<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">,<\/span> schema<span class=\"token punctuation\">:<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u7ec4\u88c5\u7ad9\u2460\u7684\u63d0\u793a\u8bcd&#xff08;id&#061;5011 \u7684\u7ed3\u6784&#xff1a;db &#043; schema &#043; request&#xff09;\u3002&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;&#034;&#034;Database: SQLite<\/p>\n<p>Schema:<br \/>\n<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>schema<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><\/p>\n<p>User request: <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>question<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"><\/p>\n<p>Output ONLY SQL. No explanations, no comments, no markdown.<br \/>\nAvoid SELECT *. Do not invent table or column names not in the schema.<br \/>\nIf the schema is insufficient, reply exactly: NEED_MORE_SCHEMA<br \/>\n&#034;&#034;&#034;<\/span><\/span><\/p>\n<p><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;__main__&#034;<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    build_demo_db<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    con <span class=\"token operator\">&#061;<\/span> sqlite3<span class=\"token punctuation\">.<\/span>connect<span class=\"token punctuation\">(<\/span>DB_PATH<span class=\"token punctuation\">)<\/span><br \/>\n    schema <span class=\"token operator\">&#061;<\/span> get_schema<span class=\"token punctuation\">(<\/span>con<span class=\"token punctuation\">)<\/span><br \/>\n    con<span class=\"token punctuation\">.<\/span>close<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    q <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\u5404\u533a\u57df\u6309\u6bdb\u5229&#xff08;amount-cost&#xff09;\u4ece\u9ad8\u5230\u4f4e\u5217\u51fa\u5ba2\u6237\u540d\u4e0e\u6bdb\u5229&#034;<\/span><br \/>\n    prompt <span class=\"token operator\">&#061;<\/span> build_prompt<span class=\"token punctuation\">(<\/span>q<span class=\"token punctuation\">,<\/span> schema<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&#061;&#061;&#061; \u53d1\u7ed9\u5927\u6a21\u578b\u7684\u63d0\u793a\u8bcd&#xff08;\u524d 400 \u5b57&#xff09;&#061;&#061;&#061;\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> prompt<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span><span class=\"token number\">400<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\\\\n&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u8fd9\u91cc\u66ff\u6362\u6210\u771f\u5b9e\u5927\u6a21\u578b\u8c03\u7528&#xff1b;\u6f14\u793a\u7528\u56fa\u5b9a SQL \u9a8c\u8bc1\u540e\u7eed\u4e09\u9053\u95f8<\/span><br \/>\n    fake_llm_sql <span class=\"token operator\">&#061;<\/span> <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;<br \/>\n    SELECT c.name, c.region, SUM(o.amount &#8211; o.cost) AS gross_profit<br \/>\n    FROM orders o JOIN customers c ON c.id &#061; o.customer_id<br \/>\n    GROUP BY c.name, c.region ORDER BY gross_profit DESC<br \/>\n    &#034;&#034;&#034;<\/span><br \/>\n    cols<span class=\"token punctuation\">,<\/span> rows <span class=\"token operator\">&#061;<\/span> run_query<span class=\"token punctuation\">(<\/span>fake_llm_sql<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&#061;&#061;&#061; \u67e5\u8be2\u7ed3\u679c &#061;&#061;&#061;&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034; | &#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>cols<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> r <span class=\"token keyword\">in<\/span> rows<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034; | &#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span><span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>x<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">for<\/span> x <span class=\"token keyword\">in<\/span> r<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token comment\"># \u4e09\u9053\u95f8\u7684\u62e6\u622a\u6f14\u793a<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\\\\n&#061;&#061;&#061; \u5b89\u5168\u95f8\u62e6\u622a\u6d4b\u8bd5 &#061;&#061;&#061;&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> bad<span class=\"token punctuation\">,<\/span> why <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n        <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;DELETE FROM orders&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u5199\u64cd\u4f5c&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;SELECT * FROM customers; DROP TABLE orders&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u591a\u8bed\u53e5\u62fc\u63a5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;SELECT name, phone FROM customers&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;\u65e0 LIMIT&#xff08;\u5e94\u81ea\u52a8\u8865&#xff09;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">try<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            c2<span class=\"token punctuation\">,<\/span> r2 <span class=\"token operator\">&#061;<\/span> run_query<span class=\"token punctuation\">(<\/span>bad<span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;  [\u653e\u884c] <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>why<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u2192 \u8fd4\u56de <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>r2<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u884c&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">except<\/span> PermissionError <span class=\"token keyword\">as<\/span> e<span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;  [\u62e6\u622a] <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>why<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> \u2192 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>e<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u7684\u4e09\u9053\u95f8\u5206\u522b\u62e6\u4ec0\u4e48&#xff08;\u6211\u5b9e\u6d4b\u8dd1\u8fc7&#xff0c;\u62e6\u622a\u7ed3\u679c\u89c1\u4e0b&#xff09;&#xff1a;<\/p>\n<table>\n<tr>\u95f8\u4ee3\u7801\u62e6\u4f4f\u7684\u771f\u5b9e\u98ce\u9669<\/tr>\n<tbody>\n<tr>\n<td>\u53ea\u8bfb\u8fde\u63a5<\/td>\n<td>sqlite3.connect(&#034;file:&#8230;?mode&#061;ro&#034;, uri&#061;True)<\/td>\n<td>AI \u751f\u6210\u7684\u5199\u8bed\u53e5\u5728\u6570\u636e\u5e93\u5c42\u5c31\u6ca1\u6743\u9650&#xff08;\u6700\u6839\u672c\u7684\u4e00\u9053&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u8bed\u53e5\u767d\u540d\u5355<\/td>\n<td>assert_read_only()<\/td>\n<td>DELETE FROM orders\u3001\u591a\u8bed\u53e5\u62fc\u63a5 SELECT \u2026; DROP TABLE \u2026<\/td>\n<\/tr>\n<tr>\n<td>\u5f3a\u5236 LIMIT<\/td>\n<td>ensure_limit()<\/td>\n<td>AI \u5fd8\u4e86\u52a0 LIMIT \u5bfc\u81f4\u5168\u8868\u62c9\u53d6\u3001\u628a\u542b\u624b\u673a\u53f7\u7684\u5ba2\u6237\u8868\u6574\u5f20\u5bfc\u51fa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f \u8fd8\u6709\u4e00\u9053\u6700\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u95f8\u5728 get_schema()&#xff1a;\u5582\u7ed9\u5927\u6a21\u578b\u7684\u53ea\u6709\u8868\u7ed3\u6784&#xff0c;\u6ca1\u6709\u6570\u636e\u3002\u5f88\u591a\u4f01\u4e1a\u5b9e\u73b0\u76f4\u63a5\u628a SELECT * FROM customers LIMIT 10 \u7684\u7ed3\u679c\u8d34\u8fdb\u63d0\u793a\u8bcd\u5f53&#034;\u793a\u4f8b\u6570\u636e&#034;\u2014\u2014\u90a3\u7b49\u4e8e\u628a\u5ba2\u6237\u624b\u673a\u53f7\u53d1\u7ed9\u7b2c\u4e09\u65b9\u6a21\u578b API\u3002\u8981\u793a\u4f8b\u5c31\u7528\u5047\u6570\u636e\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;AI \u53d6\u6570\u7684\u5b89\u5168\u8fb9\u754c\u9760\u56db\u5c42\u2014\u2014\u53ea\u8bfb\u8d26\u53f7\u3001\u8bed\u53e5\u767d\u540d\u5355\u3001\u5f3a\u5236 LIMIT\u3001\u53ea\u7ed9 schema \u4e0d\u7ed9\u6570\u636e\u3002\u5c11\u4e00\u5c42\u90fd\u53ef\u80fd\u51fa\u4e8b\u6545\u3002<\/p>\n<h3>\u4e94\u3001\u7ad9\u2463 \u53cd\u5411&#xff1a;\u6570\u636e\u8fd8\u6ca1\u8fdb\u7cfb\u7edf\u65f6\u600e\u4e48\u529e<\/h3>\n<p>\u4e0a\u9762\u4e09\u7ad9\u7684\u524d\u63d0\u662f\u6570\u636e\u5df2\u7ecf\u5728\u6570\u636e\u5e93\u91cc\u3002\u4f46\u4f01\u4e1a\u5e38\u89c1\u7684\u60c5\u51b5\u662f&#xff1a;\u6570\u636e\u5728 PDF\u3001\u7eb8\u8d28\u8868\u683c\u3001\u622a\u56fe\u91cc\u2014\u2014\u8fd9\u65f6\u5019\u8981\u5148\u628a\u5b83\u7ed3\u6784\u5316&#xff0c;AI \u624d\u5904\u7406\u5f97\u4e86\u3002<\/p>\n<p>\u2460 PDF\/\u56fe\u7247\u8868\u683c\u8f6c CSV\u2014\u2014\u63d0\u793a\u5c9b id&#061;1193&#xff08;635 \u5b57&#xff09;&#xff0c;\u5168\u6587&#xff1a;<\/p>\n<p>&#034;Attached is an image of a table listing the model parameters for the ${insert_model_name} model (from [Insert Author\/Paper Name]).<br \/>\nPlease extract the data and convert it into a CSV code block that I can copy and save directly.<br \/>\nRequirements:<br \/>\nUse the first row as the header.<br \/>\nIf cells are merged, repeat the value for each row to ensure the CSV is flat and processable.<br \/>\nDo not include units in the numeric columns (e.g., remove &#039;ms&#039; or &#039;%&#039;), or keep them consistent in a separate column.<br \/>\nIf any text is unclear due to image quality, mark it as &#039;${unclear}&#039; rather than guessing.<br \/>\nEnsure all fields containing commas are properly quoted.&#034;<\/p>\n<p>\u4e24\u6761\u8bbe\u8ba1\u7279\u522b\u503c\u5f97\u5b66&#xff1a;<\/p>\n<ul>\n<li>If cells are merged, repeat the value for each row to ensure the CSV is flat\u2014\u2014\u5408\u5e76\u5355\u5143\u683c\u644a\u5e73\u3002\u8fd9\u662f\u8868\u683c\u63d0\u53d6\u6700\u5e38\u89c1\u7684\u5751&#xff1a;\u5408\u5e76\u5355\u5143\u683c\u76f4\u63a5\u8f6c CSV \u4f1a\u51fa\u73b0\u7a7a\u503c&#xff0c;\u540e\u7eed\u6ca1\u6cd5\u5904\u7406<\/li>\n<li>If any text is unclear, mark it as &#039;${unclear}&#039; rather than guessing\u2014\u2014\u770b\u4e0d\u6e05\u5c31\u6807\u8bb0&#xff0c;\u4e0d\u8bb8\u731c\u3002\u8d22\u52a1\/\u4e1a\u52a1\u6570\u636e\u91cc\u731c\u9519\u4e00\u4e2a\u6570\u5b57\u6bd4\u7559\u7a7a\u4e25\u91cd\u5f97\u591a<\/li>\n<\/ul>\n<p>\u2461 \u8ba9 AI \u5f53 Excel \u7528\u2014\u2014\u63d0\u793a\u5c9b id&#061;4765&#xff08;CC0-1.0&#xff0c;499 \u5b57&#xff09;&#xff1a;<\/p>\n<p>I want you to act as a text based excel. you&#039;ll only reply me the text-based 10 rows excel sheet with row numbers and cell letters as columns (A to L). First column header should be empty to reference row number. I will tell you what to write into cells and you&#039;ll reply only the result of excel table as text, and nothing else. Do not write explanations. i will write you formulas and you&#039;ll execute formulas and you&#039;ll only reply the result of excel table as text. First, reply me the empty sheet.<\/p>\n<p>\u7528\u6cd5&#xff1a;\u628a CSV \u6570\u636e\u8d34\u8fdb\u53bb&#xff0c;\u8ba9 AI \u6309 Excel \u8bed\u4e49\u7b97&#xff08;\u5199\u516c\u5f0f\u5b83\u6267\u884c&#xff09;\u3002\u9002\u5408\u5c0f\u6570\u636e\u91cf\u7684\u5feb\u901f\u9a8c\u7b97\u2014\u2014\u6bd4\u5982\u7ad9\u2462\u67e5\u51fa\u6765\u7684\u6bdb\u5229&#xff0c;\u60f3\u518d\u7b97\u4e2a\u5360\u6bd4\u3001\u6392\u4e2a\u5e8f&#xff0c;\u4e0d\u7528\u5199\u7b2c\u4e8c\u6bb5 SQL\u3002\u26a0\ufe0f \u4f46\u5b83\u53ea\u6709 10 \u884c \u00d7 A-L \u5217&#xff0c;\u5927\u6570\u636e\u91cf\u522b\u7528&#xff0c;\u4f1a\u622a\u65ad\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;\u6570\u636e\u6ca1\u8fdb\u7cfb\u7edf\u65f6&#xff0c;\u5148\u7528&#034;\u8868\u683c\u63d0\u53d6&#034;\u63d0\u793a\u8bcd\u628a\u5b83\u53d8\u6210 CSV&#xff1b;\u8bb0\u4f4f\u4e24\u6761\u94c1\u5f8b\u2014\u2014\u5408\u5e76\u5355\u5143\u683c\u8981\u644a\u5e73\u3001\u770b\u4e0d\u6e05\u8981\u6807\u8bb0\u4e0d\u8bb8\u731c\u3002<\/p>\n<h3>\u516d\u3001\u4f01\u4e1a\u843d\u5730\u6700\u5bb9\u6613\u7ffb\u8f66\u7684\u4e09\u4e2a\u5730\u65b9<\/h3>\n<p>\u7ffb\u8f66\u70b9 1&#xff1a;\u628a&#034;\u80fd\u751f\u6210 SQL&#034;\u5f53\u6210&#034;\u80fd\u4e0a\u751f\u4ea7&#034;<\/p>\n<p>\u6f14\u793a\u73af\u5883\u8dd1\u901a\u4e0d\u7b49\u4e8e\u80fd\u4e0a\u751f\u4ea7\u3002\u4e0a\u751f\u4ea7\u524d\u5fc5\u987b\u8865\u9f50&#xff1a;\u53ea\u8bfb\u8d26\u53f7&#xff08;DBA \u5f00\u6743\u9650&#xff0c;\u4e0d\u662f\u5e94\u7528\u5c42\u9650\u5236&#xff09;\u3001\u67e5\u8be2\u8d85\u65f6\u4e0e\u5e76\u53d1\u4e0a\u9650&#xff08;AI \u751f\u6210\u7684\u70c2 SQL \u53ef\u80fd\u62d6\u6b7b\u5e93&#xff09;\u3001\u5ba1\u8ba1\u65e5\u5fd7&#xff08;\u8c01\u95ee\u4e86\u4ec0\u4e48\u3001\u751f\u6210\u4e86\u4ec0\u4e48 SQL\u3001\u67e5\u51fa\u591a\u5c11\u884c\u2014\u2014\u51fa\u95ee\u9898\u8981\u80fd\u8ffd\u6eaf&#xff09;\u3002<\/p>\n<p>\u7ffb\u8f66\u70b9 2&#xff1a;schema \u4e00\u53d8&#xff0c;\u63d0\u793a\u8bcd\u5c31\u6084\u6084\u5931\u6548<\/p>\n<p>\u6570\u636e\u5e93\u52a0\u4e86\u5b57\u6bb5\u3001\u6539\u4e86\u8868\u540d&#xff0c;AI \u8fd8\u5728\u7528\u65e7 schema \u751f\u6210 SQL\u2014\u2014\u5b83\u4e0d\u4f1a\u62a5\u9519&#xff0c;\u4f1a\u751f\u6210\u4e00\u4e2a\u8bed\u6cd5\u6b63\u786e\u4f46\u7ed3\u679c\u9519\u8bef\u7684\u67e5\u8be2\u3002\u5bf9\u7b56&#xff1a;schema \u4ece\u6570\u636e\u5e93\u5b9e\u65f6\u62c9\u53d6&#xff08;\u50cf\u4ee3\u7801\u91cc\u7684 get_schema()&#xff09;&#xff0c;\u4e0d\u8981\u786c\u7f16\u7801\u5728\u63d0\u793a\u8bcd\u91cc&#xff1b;\u5173\u952e\u62a5\u8868\u7684 SQL \u751f\u6210\u540e\u56fa\u5316\u6210\u89c6\u56fe&#xff0c;\u522b\u6bcf\u6b21\u90fd\u8ba9 AI \u91cd\u5199\u3002<\/p>\n<p>\u7ffb\u8f66\u70b9 3&#xff1a;PII \u4ece\u4e24\u4e2a\u53e3\u5b50\u6f0f\u51fa\u53bb<\/p>\n<ul>\n<li>\u53e3\u5b50\u4e00&#xff1a;\u5582 schema \u65f6\u987a\u624b\u5e26\u4e86\u793a\u4f8b\u6570\u636e&#xff08;\u542b\u771f\u5b9e\u624b\u673a\u53f7&#xff09;\u2192 \u53ea\u7ed9\u7ed3\u6784\u4e0d\u7ed9\u6570\u636e<\/li>\n<li>\u53e3\u5b50\u4e8c&#xff1a;AI \u751f\u6210 SELECT * \u628a\u654f\u611f\u5217\u5168\u67e5\u51fa\u6765 \u2192 \u63d0\u793a\u8bcd\u91cc Avoid SELECT *&#xff0c;\u6267\u884c\u5c42\u518d\u6309\u5217\u767d\u540d\u5355\u8fc7\u6ee4<\/li>\n<\/ul>\n<p>id&#061;2299 \u90a3\u6bb5\u63d0\u793a\u8bcd\u628a PII exposure \u660e\u5199\u8fdb Risks \u6e05\u5355&#xff0c;\u5c31\u662f\u56e0\u4e3a\u5b83\u771f\u7684\u662f\u9ad8\u9891\u4e8b\u6545\u70b9\u3002<\/p>\n<p>\u7ed3\u8bba&#xff1a;AI \u53d6\u6570\u4e0a\u751f\u4ea7\u7684\u4e09\u9053\u95e8\u69db\u662f\u6743\u9650\u3001\u5ba1\u8ba1\u3001schema \u65f6\u6548\u6027\u2014\u2014\u6280\u672f\u9a8c\u8bc1\u53ea\u5360\u6574\u4ef6\u4e8b\u7684\u4e09\u5206\u4e4b\u4e00\u3002<\/p>\n<h3>\u4e03\u3001\u8fd9\u56db\u6bb5\u63d0\u793a\u8bcd\u53bb\u54ea\u627e<\/h3>\n<p>\u56db\u6bb5\u90fd\u6765\u81ea\u63d0\u793a\u5c9b&#xff08;prompts.ssjintaitong.com&#xff09;&#xff0c;\u7ad9\u5185\u8fd9\u4e2a\u65b9\u5411\u7684\u5e93\u5b58\u5b9e\u6d4b\u5f88\u539a&#xff1a;SQL \u7c7b\u6587\u5b57\u63d0\u793a\u8bcd 114 \u6761\u3001Excel \u7c7b 112 \u6761&#xff08;\u62bd\u6837\u786e\u8ba4\u540d\u5b9e\u76f8\u7b26&#xff09;&#xff0c;\u53e6\u6709\u6570\u636e\u5206\u6790\u7c7b 12 \u6761\u3001\u6570\u636e\u5e93\u7c7b\u82e5\u5e72\u3002<\/p>\n<p>\u8fd9\u4e2a\u7ad9\u7684\u5b9a\u4f4d\u662f AI \u63d0\u793a\u8bcd\u4e0e Skill \u5e93&#xff0c;\u6536\u5f55\u8d85\u4e07\u6761\u5185\u5bb9&#xff0c;\u5176\u4e2d\u6587\u5b57\u63d0\u793a\u8bcd 3485 \u6761&#xff08;\u5b8c\u6574\u5168\u6587\u3001\u4e00\u952e\u590d\u5236&#xff09;\u300275% \u7684\u6761\u76ee\u6807\u6ce8\u4e86\u539f\u59cb\u6765\u6e90\u94fe\u63a5\u300168% \u6807\u6ce8\u4e86\u5f00\u6e90\u8bb8\u53ef\u8bc1&#xff08;\u4ee5 MIT\u3001CC0\u3001CC-BY-4.0 \u4e3a\u4e3b&#xff09;&#xff0c;\u91c7\u96c6\u6761\u76ee\u9644 GitHub \u51fa\u5904\u53ef\u6eaf\u6e90\u2014\u2014\u672c\u6587 4 \u6bb5\u90fd\u6807\u4e86\u6761\u76ee id&#xff08;\u5176\u4e2d 2 \u6bb5\u7ad9\u5185\u6807\u6ce8 CC0-1.0&#xff09;&#xff0c;\u53ef\u81ea\u884c\u6838\u5bf9\u3002\u514d\u767b\u5f55\u3001\u514d\u6ce8\u518c\u3002<\/p>\n<p>\u5b9e\u7528\u5165\u53e3&#xff1a;<\/p>\n<ul>\n<li>\u672c\u6587 4 \u6bb5\u539f\u6587&#xff1a;prompts.ssjintaitong.com\/prompts\/5011\u3001\/prompts\/2299\u3001\/prompts\/1193\u3001\/prompts\/4765<\/li>\n<li>SQL \u7c7b\u63d0\u793a\u8bcd&#xff1a;\u7ad9\u5185\u641c\u300cSQL\u300d&#xff08;114 \u6761&#xff09;&#xff1b;Excel \u7c7b\u641c\u300cExcel\u300d&#xff08;112 \u6761&#xff09;<\/li>\n<li>\u6587\u5b57\u63d0\u793a\u8bcd\u603b\u5e93&#xff1a;prompts.ssjintaitong.com\/prompts?type&#061;text<\/li>\n<li>\u4f01\u4e1a AI \u96c6\u6210\u4e13\u9898&#xff08;\u542b\u98de\u4e66 API \u5bf9\u63a5 7 \u7bc7\u6559\u7a0b&#xff09;&#xff1a;prompts.ssjintaitong.com\/topic\/enterprise-ai-integration<\/li>\n<li>\u98de\u4e66 AI \u81ea\u52a8\u5316\u4e13\u9898&#xff08;148 \u6761&#xff09;&#xff1a;prompts.ssjintaitong.com\/topic\/feishu<\/li>\n<li>Skill \u8d28\u91cf\u8bc4\u5206\u62a5\u544a&#xff1a;prompts.ssjintaitong.com\/quality-report<\/li>\n<\/ul>\n<p>\u641c\u7d22\u6280\u5de7&#xff1a;\u7528\u80fd\u529b\u8bcd\u641c&#xff0c;\u522b\u7528\u7cfb\u7edf\u540d\u3002\u641c\u300cERP\u300d\u547d\u4e2d\u7684\u591a\u662f\u65e0\u5173\u5185\u5bb9&#xff0c;\u641c\u300cSQL\u300d\u300c\u6570\u636e\u5206\u6790\u300d\u300c\u8868\u683c\u300d\u76f4\u63a5\u547d\u4e2d\u53ef\u7528\u7684\u63d0\u793a\u8bcd\u3002<\/p>\n<hr \/>\n<h3>\u4e0b\u4e00\u7bc7\u9884\u544a<\/h3>\n<p>\u4f01\u4e1a AI \u96c6\u6210\u7cfb\u5217\u4e0b\u4e00\u7bc7\u5199\u8d22\u52a1\u573a\u666f&#xff1a;\u53d1\u7968\u6838\u5bf9 \u2192 \u51ed\u8bc1 \u2192 \u62a5\u8868\u5206\u6790\u3002\u8bf4\u53e5\u5b9e\u8bdd\u2014\u2014\u8d22\u52a1\u8fd9\u5757\u6211\u4f1a\u5199\u5f97\u6162\u4e00\u4e9b&#xff0c;\u56e0\u4e3a\u7ad9\u5185\u771f\u6b63\u5bf9\u53e3\u7684\u8d22\u52a1\u63d0\u793a\u8bcd\u4e0d\u591a&#xff08;\u591a\u6570&#034;\u8d22\u52a1\u62a5\u8868&#034;&#034;\u5ba1\u8ba1&#034;\u7c7b\u6761\u76ee\u5b9e\u9645\u662f\u7f8e\u80a1 K \u7ebf\u56fe\u6216 SEO \u5ba1\u8ba1&#xff0c;\u540d\u5b9e\u4e0d\u7b26&#xff09;&#xff0c;\u6211\u4e0d\u60f3\u51d1\u6570\u786c\u5199\u3002\u5b81\u53ef\u665a\u4e00\u70b9&#xff0c;\u4e5f\u8981\u6bcf\u6bb5\u63d0\u793a\u8bcd\u90fd\u80fd\u771f\u7528\u4e0a\u3002<\/p>\n<hr \/>\n<p>\u672c\u6587 4 \u6bb5\u63d0\u793a\u8bcd\u5168\u6587\u6458\u81ea\u63d0\u793a\u5c9b\u7ad9\u5185\u6761\u76ee&#xff08;id&#061;5011 \/ 2299 \/ 1193 \/ 4765&#xff09;&#xff0c;\u672a\u505a\u4fee\u6539&#xff0c;\u5747\u901a\u8fc7 prompt \u6ce8\u5165\u5185\u5bb9\u68c0\u6d4b&#xff1b;SQL \u5b89\u5168\u95f8\u4ee3\u7801\u7528 SQLite \u5efa\u771f\u5b9e\u4e1a\u52a1\u5e93\u5b9e\u6d4b\u8dd1\u901a&#xff08;\u542b\u4e09\u9053\u95f8\u62e6\u622a\u9a8c\u8bc1&#xff09;&#xff1b;\u6761\u76ee\u6570\u4e0e\u7ad9\u70b9\u89c4\u6a21\u4e3a 2026-10-31 \u5b9e\u6d4b&#xff1b;\u4f01\u4e1a\u843d\u5730\u5efa\u8bae\u4e3a\u7b14\u8005\u5b9e\u52a1\u5224\u65ad&#xff0c;\u5177\u4f53\u6743\u9650\u4e0e\u5ba1\u8ba1\u65b9\u6848\u8bf7\u54a8\u8be2\u4f60\u7684 DBA\u3002<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u4f01\u4e1a\u60f3\u8ba9 AI \u67e5\u81ea\u5df1\u7684\u6570\u636e&#xff0c;\u7b2c\u4e00\u4e2a\u649e\u4e0a\u7684\u5899\u4e0d\u662f\u6a21\u578b\u80fd\u529b&#xff0c;\u662f\u5b83\u4e0d\u77e5\u9053\u4f60\u7684\u8868\u957f\u4ec0\u4e48\u6837\u3002<br \/>\n\u4f60\u628a\\&#8221;\u4e0a\u5b63\u5ea6\u534e\u4e1c\u533a\u6bdb\u5229\u6700\u4f4e\u7684 10 \u4e2a\u5ba2\u6237\\&#8221;\u6254\u7ed9 ChatGPT&#xff0c;\u5b83\u53ea\u80fd\u7f16\u4e00\u4e2a\u770b\u8d77\u6765\u50cf SQL \u7684\u4e1c\u897f\u2014\u2014\u8868\u540d\u662f\u731c\u7684\u3001\u5b57\u6bb5\u662f\u731c\u7684\u3001\u8fde\u6570\u636e\u5e93\u7c7b\u578b\u90fd\u4e0d\u77e5\u9053\u3002<br \/>\n\u8fd9\u7bc7\u8bb2\u600e\u4e48\u628a\u8fd9\u4ef6\u4e8b\u505a\u5bf9&#xff1a;\u56db\u6bb5\u63d0\u793a\u8bcd  \u4e00\u9053\u5b89\u5168\u95f8&#xff0c;\u62fc\u6210\u4e00\u6761\u4ece\\&#8221;\u4eba\u8bdd\\&#8221;\u5230\\&#8221;\u53ef\u7528\u6570\u636e\\&#8221;\u7684\u5b8c\u6574\u6d41\u6c34\u7ebf\u3002\u4ee3\u7801\u6211\u7528 SQLite \u5efa\u4e86\u771f\u5b9e\u4e1a\u52a1\u5e93\u8dd1\u901a&#xff0c;\u4e0d\u662f\u4f2a\u4ee3\u7801\u3002<br \/>\n\u4e00<\/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":[9109,768,50,100],"topic":[],"class_list":["post-120859","post","type-post","status-publish","format-standard","hentry","category-server","tag-9109","tag-sql","tag-50","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \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\/120859.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4f01\u4e1a\u60f3\u8ba9 AI \u67e5\u81ea\u5df1\u7684\u6570\u636e&#xff0c;\u7b2c\u4e00\u4e2a\u649e\u4e0a\u7684\u5899\u4e0d\u662f\u6a21\u578b\u80fd\u529b&#xff0c;\u662f\u5b83\u4e0d\u77e5\u9053\u4f60\u7684\u8868\u957f\u4ec0\u4e48\u6837\u3002 \u4f60\u628a&quot;\u4e0a\u5b63\u5ea6\u534e\u4e1c\u533a\u6bdb\u5229\u6700\u4f4e\u7684 10 \u4e2a\u5ba2\u6237&quot;\u6254\u7ed9 ChatGPT&#xff0c;\u5b83\u53ea\u80fd\u7f16\u4e00\u4e2a\u770b\u8d77\u6765\u50cf SQL \u7684\u4e1c\u897f\u2014\u2014\u8868\u540d\u662f\u731c\u7684\u3001\u5b57\u6bb5\u662f\u731c\u7684\u3001\u8fde\u6570\u636e\u5e93\u7c7b\u578b\u90fd\u4e0d\u77e5\u9053\u3002 \u8fd9\u7bc7\u8bb2\u600e\u4e48\u628a\u8fd9\u4ef6\u4e8b\u505a\u5bf9&#xff1a;\u56db\u6bb5\u63d0\u793a\u8bcd \u4e00\u9053\u5b89\u5168\u95f8&#xff0c;\u62fc\u6210\u4e00\u6761\u4ece&quot;\u4eba\u8bdd&quot;\u5230&quot;\u53ef\u7528\u6570\u636e&quot;\u7684\u5b8c\u6574\u6d41\u6c34\u7ebf\u3002\u4ee3\u7801\u6211\u7528 SQLite \u5efa\u4e86\u771f\u5b9e\u4e1a\u52a1\u5e93\u8dd1\u901a&#xff0c;\u4e0d\u662f\u4f2a\u4ee3\u7801\u3002 \u4e00\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/120859.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-01T08:17:08+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=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120859.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/120859.html\",\"name\":\"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-01T08:17:08+00:00\",\"dateModified\":\"2026-11-01T08:17:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/120859.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/120859.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/120859.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09\"}]},{\"@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":"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \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\/120859.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4f01\u4e1a\u60f3\u8ba9 AI \u67e5\u81ea\u5df1\u7684\u6570\u636e&#xff0c;\u7b2c\u4e00\u4e2a\u649e\u4e0a\u7684\u5899\u4e0d\u662f\u6a21\u578b\u80fd\u529b&#xff0c;\u662f\u5b83\u4e0d\u77e5\u9053\u4f60\u7684\u8868\u957f\u4ec0\u4e48\u6837\u3002 \u4f60\u628a\"\u4e0a\u5b63\u5ea6\u534e\u4e1c\u533a\u6bdb\u5229\u6700\u4f4e\u7684 10 \u4e2a\u5ba2\u6237\"\u6254\u7ed9 ChatGPT&#xff0c;\u5b83\u53ea\u80fd\u7f16\u4e00\u4e2a\u770b\u8d77\u6765\u50cf SQL \u7684\u4e1c\u897f\u2014\u2014\u8868\u540d\u662f\u731c\u7684\u3001\u5b57\u6bb5\u662f\u731c\u7684\u3001\u8fde\u6570\u636e\u5e93\u7c7b\u578b\u90fd\u4e0d\u77e5\u9053\u3002 \u8fd9\u7bc7\u8bb2\u600e\u4e48\u628a\u8fd9\u4ef6\u4e8b\u505a\u5bf9&#xff1a;\u56db\u6bb5\u63d0\u793a\u8bcd \u4e00\u9053\u5b89\u5168\u95f8&#xff0c;\u62fc\u6210\u4e00\u6761\u4ece\"\u4eba\u8bdd\"\u5230\"\u53ef\u7528\u6570\u636e\"\u7684\u5b8c\u6574\u6d41\u6c34\u7ebf\u3002\u4ee3\u7801\u6211\u7528 SQLite \u5efa\u4e86\u771f\u5b9e\u4e1a\u52a1\u5e93\u8dd1\u901a&#xff0c;\u4e0d\u662f\u4f2a\u4ee3\u7801\u3002 \u4e00","og_url":"https:\/\/www.wsisp.com\/helps\/120859.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-01T08:17:08+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/120859.html","url":"https:\/\/www.wsisp.com\/helps\/120859.html","name":"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-01T08:17:08+00:00","dateModified":"2026-11-01T08:17:08+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/120859.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/120859.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/120859.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e0d\u4f1a SQL \u4e5f\u80fd\u67e5\u4e1a\u52a1\u6570\u636e\uff1a4 \u6bb5\u63d0\u793a\u8bcd\u62fc\u51fa\u4e00\u6761 AI \u53d6\u6570\u6d41\u6c34\u7ebf\uff08\u63d0\u793a\u5c9b\u5b9e\u6d4b\uff09"}]},{"@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\/120859","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=120859"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/120859\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=120859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=120859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=120859"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=120859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}