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; MySQL complains: You have an error in your SQL syntax … near 'SELEC broken'. I pressed Fix with AI. The model explained the typo, fixed it, and returned a script that still referenced a column that doesn't exist.
In a normal chat, that answer would look perfectly fine. In sqlize, it came with the database's verdict attached:
✗ Failed on MySQL 8.0: Unknown column 'broken'
The typo is fixed, but the script still fails, and you see it before you copy anything.
When the fix works, you get ✓ Ran on MySQL 8.0 and a preview of the first rows instead. Either way, the server decides, not the model.
Converting between dialects, checked on the target
Porting SQL between engines is where AI help is most tempting and most dangerous. The output looks plausible and breaks on the first dialect detail.
With Convert to, the assistant rewrites the script for the target engine, and sqlize runs it on the target server. If that run fails, the error goes back to the model for one more attempt, so most answers arrive already corrected.
Converting this MySQL script to PostgreSQL 18:
CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)); INSERT INTO t (name) VALUES ('a'), (NULL); SELECT id, IFNULL(name, '-') AS name FROM t; gives SERIAL instead of AUTO_INCREMENT and COALESCE instead of IFNULL, a note on anything that had no direct equivalent, ✓ Ran on PostgreSQL 18 and the rows it returned. Open in PostgreSQL 18 loads the converted code into the editor on that server.
The other two buttons
- Explain walks through the query in plain language: what each part does, what's specific to this engine, where performance may suffer. Select part of the query to explain only that part.
- Generate SQL turns a request like "top 3 actors by number of films" into a query against your actual schema: the
CREATE TABLEstatements in the editor or, if there are none, the database's own tables. It works well with the preloaded sample databases (Sakila, AdventureWorks, Bookings, HR and others), so you can practise on realistic data without writing any DDL.
You rarely need to type a prompt: the assistant already sees the current query, the selected server and the last error. For everything else there's a chat that keeps context. Every SQL block in an answer has Replace, Insert, Run and Copy buttons, and you can reopen or delete past conversations from History.
How the self-check works
The loop is deliberately simple:
- The prompt asks the model to put runnable SQL in a fenced
sqlblock. The server takes the first such block. - That block goes through the same sandbox that runs user queries: store the script, execute it on the chosen server, get the result as JSON.
- If a conversion fails, the error goes back to the model in the same conversation, with a request for a complete corrected script. That's one retry, never an open-ended loop, so cost and latency stay predictable.
- The answer carries the outcome: success with up to five preview rows, or the database's own error message.
A few engineering decisions that mattered:
- Sanitized output. The model's Markdown is converted to HTML on the server and filtered through a strict allow-list: no scripts, no event handlers, no
javascript:links. Treat model output as untrusted input, always. - Model routing with fallback. Explanations and chat use a fast Google Gemini model. Fixes, conversions and generation use a stronger one. If a model is overloaded, the request falls back to a lighter model and then to OpenAI, so it fails over instead of failing.
- Honest token accounting. The estimated cost is reserved before the request. Afterwards the user is charged the real token count the provider reported, and the rest is returned. Failed requests cost nothing, and every answer shows its cost.
A refreshed editor, too
While building the assistant, I also reworked the editor: one toolbar (server, Run with Ctrl+Enter, Save, a new Share button that copies a short link, plus compact tools for upload, format, ER diagram and so on), a server list grouped by engine family with sample databases in their own group, new light and dark themes, and Run on the first screen on phones.
Try it
The editor is still free and open to everyone, no sign-up. The AI assistant needs a sign-in (Google, GitHub, LinkedIn or Stack Exchange), and new users get 10,000 free AI tokens, enough for a handful of fixes and conversions on real queries.
On privacy: the assistant sends your query, the error and the conversation to the AI provider (Google, with OpenAI as a fallback). Conversations are kept for 12 months so you can come back to them, you can delete them at any time, and they are not used for training. As with any online tool, keep passwords and personal data out of your queries.
The quickest test: open sqlize.online, write a query with a mistake, run it and press Fix with AI. Then try Convert to on something you've been meaning to port.
I'd love to hear where it gets things wrong. Leave a comment below. And if you want to practise SQL with tasks that are checked automatically, take a look at the sister project, SQLtest.online.



