返回首页

对比阅读

对比阅读:GPT SQL Double-Counts Money: Business Semantics Are the Enterprise AI Bottleneck 与 GPT 写 SQL 也会重复算钱 — 企业部署 AI 的瓶颈在业务口径

AEN
OpenAIGPTSQL·

GPT SQL Double-Counts Money: Business Semantics Are the Enterprise AI Bottleneck

Three orders totaling 400 yuan could become 900 yuan in SQL written by GPT. The syntax raises no errors, but the numbers are wrong. We have noticed that the biggest risk in AI-generated SQL is no longer that it “cannot write SQL,” but that it “looks right without knowing how the business should be calculated.”

What this is

The article uses an orders table and an order-item table to demonstrate a typical error: one order can map to multiple item rows, so a direct join repeats the order amount for every item row. The correct approach is to aggregate item quantities by order ID first, then join the result to the orders table, ensuring each order participates in the amount calculation at most once.

The more valuable method to replicate is not a particular block of code, but first asking GPT to restate the statistical definitions: what one row represents in each table, what one row represents in the report, how order count and item count are defined, and whether orders without items should be retained. GPT’s role here is to translate natural language into queries and expose implicit assumptions; people must still confirm the business rules.

Industry view

Our judgment is that models already generate code fast enough. Enterprises need a reviewable specification of business semantics. Database schemas, sample data, and expected results together form the task context. Asking for a “more professional answer” is nearly useless; specifying granularity and boundaries is what works.

The risks are equally clear: real business operations are usually more complex than examples, and refunds, multiple currencies, duplicate payments, and status changes can all alter the results. If a team cannot explain its definitions but connects the SQL directly to a production system, automation will amplify the errors. The article’s prudent recommendation is to validate with anonymized schemas and fictional sample data, and have business staff check the expected results.

Another objection is that AI-generated SQL does not immediately lower the barrier to professional expertise. Enterprises still need people who understand joins, aggregation logic, and data permissions. Without business-literate data professionals, models may simply produce errors faster and make them harder to diagnose.

Impact on regular people

For enterprise IT: deployment priorities will shift from “getting the model to generate code” to “turning business rules into verifiable context.” Production queries should also retain human review, test data, and result validation.

For individual careers: non-developers can use natural language to perform analysis, but their ability to express a request depends on whether they can define its scope. Rather than simply asking AI for an answer, first define the question, granularity, and acceptance criteria.

For the consumer market: AI reporting tools for merchants will proliferate, but their credibility will depend on whether they expose their definitions, samples, and validation process. Feature demos may look similar while data accuracy still varies substantially.

来源: juejin.cn
BZH
OpenAIGPTSQL·

GPT 写 SQL 也会重复算钱 — 企业部署 AI 的瓶颈在业务口径

三笔订单合计应为 400 元,GPT 写出的 SQL 却可能算出 900 元。语法没有报错,数字却错了:我们注意到,AI 写 SQL 最大的风险已不是“不会写”,而是“写得很像对的,但不知道业务该怎么算”。

这是什么

文章用订单表和商品明细表演示了一个典型错误:一笔订单对应多条商品明细,直接关联后,订单金额会随明细行重复出现。正确做法是先把商品数量按订单号汇总,再与订单表关联,确保每笔订单最多参与一次金额累计。

更值得复制的方法不是某段代码,而是先要求 GPT 复述统计口径:每张表的一行代表什么、报表每行代表什么、订单数与商品件数如何定义、没有明细的订单是否保留。GPT 在这里承担自然语言转查询和暴露隐含假设的工作,最终仍需人来确认业务规则。

行业怎么看

我们的判断是,模型写代码的速度已经足够快,企业更需要一套可审查的业务语义说明。数据库结构、样例数据和预期结果共同构成任务上下文;“请写得专业一点”几乎没有用,明确粒度与边界才有用。

风险也很清楚:真实业务通常比示例复杂,退款、跨币种、重复支付、状态变更都可能改变统计结果。如果团队既说不清口径,又直接把 SQL 接进生产系统,错误会被自动化流程放大。文章给出的稳妥建议是使用脱敏结构和虚构样例验证,并让业务人员核对预期结果。

另一个反对意见是,AI 生成 SQL 并不会立即降低专业门槛。企业仍需有人理解关联关系、聚合逻辑与数据权限;缺少懂业务的数据人员时,模型可能只是更快地产出难以排查的错误。

对普通人的影响

对企业 IT:部署重点将从“让模型生成代码”转向“把业务规则写成可验证的上下文”。生产查询还应保留人工复核、测试数据与结果校验。

对个人职场:非开发人员也能借助自然语言完成分析,但表达能力取决于能否说清口径。与其要求 AI 给答案,不如先定义问题、粒度和验收标准。

对消费市场:面向商家的 AI 报表工具会增多,但可信度将取决于其是否展示口径、样例和校验过程。功能演示看起来相似,数据准确性可能仍有明显差距。

来源: juejin.cn