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.