Skip to content

Tools

AI SQL Helper

Ask for data in plain words, paste a failing query or list your tables. You get formatted SQL for your database, a short explanation and a warning before anything risky.

SQL Helper

The result will show up here

Ask for data in plain words

You know what you want: the ten customers who spent the most this year, the products nobody has ordered since spring, the average order value per country. Turning that into SQL is the slow part. Describe it here, paste your table and column names if you can, and the SQL helper writes the query for your database with a short note on how it works.

It also works the other way round. Paste a query that fails, returns odd results or runs too slowly, and it explains what is wrong and how to fix it. The queries and explanations come from GPT-6 Luna, which is told to use your table names, list any assumptions before the query, and prefer clear SQL over clever SQL.

Tasks and databases

TaskWhat you get
Write a queryA formatted query plus a few lines on how it works
Fix an errorThe cause of the error or wrong result, and the corrected query
Explain a queryEach clause in plain words, including what every join and condition does to the rows
Make it fasterSuggested indexes, rewritten joins or filters, with the reason for each and no invented timings
Design tablesCREATE TABLE statements with primary and foreign keys and a note on each table

The database menu covers PostgreSQL, MySQL or MariaDB, SQLite, SQL Server, Oracle and BigQuery. If you are not sure which one you use, leave it on standard SQL; the answer will mention any step that differs between popular databases, such as how to limit the number of rows.

Example: an aggregate in the wrong place

This is one of the most common SQL errors. We pasted it with the task "Fix an error":

SELECT department, AVG(salary) FROM employees WHERE AVG(salary) > 50000 GROUP BY department;

The answer came back in under two seconds. It explained that AVG(salary) is calculated per group, while WHERE filters single rows before any groups exist, so the condition has to move to HAVING, which filters the groups after the average is known. Then it gave the corrected query, one clause per line: select, from, group by, and HAVING AVG(salary) > 50000. Short, correct, and the explanation teaches the rule so you will not need the tool for that mistake again.

Safety with queries that change data

A missing WHERE on an UPDATE or DELETE can wipe a table. When a query changes or deletes data, the helper says so, shows a SELECT you can run first to preview the affected rows, and recommends a copy of the database or a transaction. Please take that advice even when you are in a hurry.

  • Test on sample data before running anything on production.
  • Do not paste real customer data. Table and column names are enough. Nothing you paste is saved by us on its way to OpenAI's model, yet personal records should stay in your database.
  • Check the results make sense. The helper cannot see your data, so a query can be valid SQL and still answer a slightly different question than you meant.

Spreadsheets, code and harder queries

Many people meet SQL after outgrowing a spreadsheet. If your data still lives in one, our guide to AI for spreadsheets covers formulas and pivot tables, and the Excel prompts are ready to copy. For code around your queries, such as a script that runs them, the code explainer can walk you through it.

For long, multi-step queries with window functions or tricky date logic, move to the chat and press the Think chip. It hands the conversation to GPT-6.1 Terra, the model that reasons briefly before answering.

SQL helper FAQ

Can it connect to my database?

No. It never sees your database or your data. It writes and explains SQL text that you run yourself.

Do I need to share my table structure?

It helps a lot. Paste table names and columns, for example orders(id, customer_id, total, created_at). Without them, the helper invents placeholder names and lists them as assumptions.

Can I ask in a language other than English?

Yes. Explanations follow the language of your words; SQL keywords and your column names stay as they are.

Is it free?

Yes, with no account. Each query uses one of the free messages you get every day. For a guided session, try write and explain a query in the chat.

Your question, answered now

No account, no card, nothing to download. Type what you want to know and the first words of the answer appear in a second or two.

Start a chat