From 1a1f2c0eea4c4643278f8ee7733b6b4077750426 Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 22 Oct 2025 15:57:07 +0800 Subject: [PATCH] feat: improve generate sql template --- backend/templates/sql_examples/AWS_Redshift.yaml | 2 +- backend/templates/sql_examples/ClickHouse.yaml | 2 +- backend/templates/sql_examples/DM.yaml | 2 +- backend/templates/sql_examples/Doris.yaml | 2 +- backend/templates/sql_examples/Elasticsearch.yaml | 2 +- backend/templates/sql_examples/Kingbase.yaml | 2 +- backend/templates/sql_examples/Microsoft_SQL_Server.yaml | 2 +- backend/templates/sql_examples/MySQL.yaml | 2 +- backend/templates/sql_examples/Oracle.yaml | 4 +++- backend/templates/sql_examples/PostgreSQL.yaml | 2 +- backend/templates/sql_examples/StarRocks.yaml | 2 +- 11 files changed, 13 insertions(+), 11 deletions(-) diff --git a/backend/templates/sql_examples/AWS_Redshift.yaml b/backend/templates/sql_examples/AWS_Redshift.yaml index de72b3b3..5036941e 100644 --- a/backend/templates/sql_examples/AWS_Redshift.yaml +++ b/backend/templates/sql_examples/AWS_Redshift.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 使用 LIMIT 或 FETCH FIRST 限制行数(Redshift 兼容 PostgreSQL) + 当需要限制行数时,必须使用 LIMIT 或 FETCH FIRST 来限制行数(Redshift 兼容 PostgreSQL) 1. 标准写法:LIMIT 100 2. 可选写法:FETCH FIRST 100 ROWS ONLY diff --git a/backend/templates/sql_examples/ClickHouse.yaml b/backend/templates/sql_examples/ClickHouse.yaml index 0b2b9bc2..f278b62b 100644 --- a/backend/templates/sql_examples/ClickHouse.yaml +++ b/backend/templates/sql_examples/ClickHouse.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准SQL语法: + 当需要限制行数时,必须使用标准的LIMIT语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [count] OFFSET [start] diff --git a/backend/templates/sql_examples/DM.yaml b/backend/templates/sql_examples/DM.yaml index 4f5314ad..bb04396d 100644 --- a/backend/templates/sql_examples/DM.yaml +++ b/backend/templates/sql_examples/DM.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用达梦兼容语法: + 当需要限制行数时,必须使用达梦兼容的语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [offset], [count] 或 LIMIT [count] OFFSET [start] diff --git a/backend/templates/sql_examples/Doris.yaml b/backend/templates/sql_examples/Doris.yaml index 1849dd53..5b2ea360 100644 --- a/backend/templates/sql_examples/Doris.yaml +++ b/backend/templates/sql_examples/Doris.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准SQL语法: + 当需要限制行数时,必须使用标准的LIMIT语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [count] OFFSET [start] diff --git a/backend/templates/sql_examples/Elasticsearch.yaml b/backend/templates/sql_examples/Elasticsearch.yaml index e14e67a0..cddc4577 100644 --- a/backend/templates/sql_examples/Elasticsearch.yaml +++ b/backend/templates/sql_examples/Elasticsearch.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制必须使用标准SQL语法: + 当需要限制行数时,必须使用标准的LIMIT语法 1. 首选:`LIMIT [count]` 2. 分页:`LIMIT [count] OFFSET [start]` diff --git a/backend/templates/sql_examples/Kingbase.yaml b/backend/templates/sql_examples/Kingbase.yaml index cc3e4e33..568b4201 100644 --- a/backend/templates/sql_examples/Kingbase.yaml +++ b/backend/templates/sql_examples/Kingbase.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准语法: + 当需要限制行数时,必须使用兼容Kingbase的语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [count] OFFSET [start] diff --git a/backend/templates/sql_examples/Microsoft_SQL_Server.yaml b/backend/templates/sql_examples/Microsoft_SQL_Server.yaml index 63d2e289..83f560e2 100644 --- a/backend/templates/sql_examples/Microsoft_SQL_Server.yaml +++ b/backend/templates/sql_examples/Microsoft_SQL_Server.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准SQL语法: + 当需要限制行数时,必须使用 Microsoft SQL Server 的SQL语法: 1. 标准写法:TOP [count] 2. 分页写法:OFFSET [start] ROWS FETCH NEXT [count] ROWS ONLY diff --git a/backend/templates/sql_examples/MySQL.yaml b/backend/templates/sql_examples/MySQL.yaml index e2b9e965..1cbfca44 100644 --- a/backend/templates/sql_examples/MySQL.yaml +++ b/backend/templates/sql_examples/MySQL.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准SQL语法: + 当需要限制行数时,必须使用标准的LIMIT语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [offset], [count] 或 LIMIT [count] OFFSET [start] diff --git a/backend/templates/sql_examples/Oracle.yaml b/backend/templates/sql_examples/Oracle.yaml index 49218969..f50fde50 100644 --- a/backend/templates/sql_examples/Oracle.yaml +++ b/backend/templates/sql_examples/Oracle.yaml @@ -11,7 +11,9 @@ template: limit_rule: | - 使用 ROWNUM 或 FETCH FIRST 限制行数(Oracle 12c+) + 当需要限制行数时: + 1. 12c以下版本必须使用ROWNUM语法 + 2. 12c+版本推荐使用FETCH FIRST语法 1. 传统写法:WHERE ROWNUM <= 100 2. 现代写法:FETCH FIRST 100 ROWS ONLY diff --git a/backend/templates/sql_examples/PostgreSQL.yaml b/backend/templates/sql_examples/PostgreSQL.yaml index cf7ef595..ca3bcd89 100644 --- a/backend/templates/sql_examples/PostgreSQL.yaml +++ b/backend/templates/sql_examples/PostgreSQL.yaml @@ -10,7 +10,7 @@ template: limit_rule: | - 使用 LIMIT 来限制行数 + 当需要限制行数时,必须使用标准的LIMIT语法 other_rule: | diff --git a/backend/templates/sql_examples/StarRocks.yaml b/backend/templates/sql_examples/StarRocks.yaml index f49ac0e2..d0dc10fe 100644 --- a/backend/templates/sql_examples/StarRocks.yaml +++ b/backend/templates/sql_examples/StarRocks.yaml @@ -11,7 +11,7 @@ template: limit_rule: | - 行数限制使用标准SQL语法: + 当需要限制行数时,必须使用标准的LIMIT语法 1. 标准写法:LIMIT [count] 2. 分页写法:LIMIT [count] OFFSET [start]