Menu

1 / 2

Review AI-generated SQL before you trust the number: a checklist with a runnable fixture

DEV Community: database·Prachit Parikh·8 days ago
#rNv6afhr
#devtodatabase#devto#dev#query#order_id
Reading 0:00
15s threshold

Photo by Chris Ried on Unsplash (Unsplash License).

A query that runs is not a query that's right. Most of us know this, and few of us act on it when an assistant hands back a query in four seconds and the number looks about right.

This is the review I run on AI-written SQL before its number goes anywhere near a sign-off. Eight checks, each written as a query that returns rows only when something is wrong. It comes with a tiny fictional fixture you can paste into SQLite, where a perfectly plausible revenue query returns 1,820 and the reviewed one returns 825 . Same tables, same question, same month.

Nothing in the bad query is exotic. That's sort of the point.

Why the "it ran" signal got weaker, not stronger

The text-to-SQL benchmarks look great right now, and they're worth reading closely before you lean on them.

On the BIRD leaderboard , the top test execution accuracy as of 22 October 2026 is 83.40% (AskData, from AT&T's CDO team), with GrainSQL at 82.95% and Huawei's DataGallery at 82.39%.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.