Menu

1 / 4

Don't trust the AI's SQL, run it: an assistant that tests its own answers on a real database

DEV Community: sql·Slava Rozhnev·about 8 hours ago
#rQ0IvrSk
#devtosql#devto#dev#model#server
Long article (1062 words) — no AI summary yet.
Reading 0:00
15s threshold

Here's a pattern every SQL developer knows: a query fails, you paste the error into a chatbot, and it comes back with a confident fix. Is the fix right? The model doesn't know. It has never seen your database engine run anything. You find out only after copying the query back and pressing Run.

I run sqlize.online , an online SQL sandbox with 36 real database servers: MySQL, MariaDB, PostgreSQL, SQL Server, Oracle, SQLite, Firebird, DuckDB, ClickHouse and more. Since the servers are already there, the AI assistant I've just added does the obvious thing a chat window can't: it runs its own answer on the real database before it shows it to you.

The failure that convinced me

Here's a broken MySQL script:

SELECT customer , SUM ( total ) AS spent FROM orders GROUP BY customer ; SELEC broken ;

Enter fullscreen mode

Exit fullscreen mode

MySQL complains: You have an error in your SQL syntax … near 'SELEC broken' . I pressed Fix with AI .…

Continue reading — create a free account

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