About AI SQL generator
Writing correct SQL takes time even when you know the language: table names, joins, and date functions that differ between databases. With this tool you describe what you need the way you would say it to a colleague, such as “top 5 products by sales last month in each branch”, pick your database, and get the query with a short explanation and notes on indexes, NULLs and dialects. Paste your table structure (CREATE TABLE statements or a list of tables and columns) and the tool uses your real names instead of guessing.
In Explain mode you paste an existing query and the tool walks through it step by step in plain language, points out likely bugs and performance problems, and suggests an improved version when it helps. The tool never connects to your database and never runs a query; you review the result and test it yourself. Each run costs 1 credit, and a new account gets 2 free credits once the email is confirmed.
Why use it
- Describe your request in English or Arabic and get a query in your database's dialect, with a short explanation.
- Six dialects: MySQL, PostgreSQL, SQL Server, SQLite, Oracle and BigQuery, each with its own functions and syntax.
- Explain mode breaks any query down step by step and flags bugs and performance problems.
- The tool never connects to your database or runs anything on it; you only get text that you review.
- A fixed price of 1 credit per run, refunded automatically if a run fails.
How to use
Sign in
Press “Sign in and try it free” and type your email to get a one-time sign-in link, or continue with Google. New accounts get 2 credits after confirming the email.
Pick a mode and a dialect
Choose Generate to turn a description into SQL, or Explain to understand an existing query. Then pick the database: MySQL, PostgreSQL, SQL Server, SQLite, Oracle or BigQuery.
Write the request and add the schema
Describe what you need in clear sentences and paste the table structure if you have it: CREATE TABLE statements or a list of tables and columns. The total can be up to 1,500 words, and the price of 1 credit is on the button.
Run it and review
Press the button and wait a few seconds. Copy the query and try it on a copy of the database first, and read any UPDATE or DELETE line by line before running it on real data.
Examples
Top 5 products per branch (PostgreSQL)
Request: “top 5 products by sales last month in each branch”, with orders and order_items tables. The tool sums SUM(oi.quantity * oi.unit_price) per branch and product, filters with o.created_at >= date_trunc('month', CURRENT_DATE) - INTERVAL '1 month' AND o.created_at < date_trunc('month', CURRENT_DATE), ranks with ROW_NUMBER() OVER (PARTITION BY branch_id ORDER BY total DESC) and keeps rows ranked 5 or lower.
Customers who never ordered
Request: “registered customers with no orders”. The tool suggests SELECT c.id, c.name FROM customers c WHERE NOT EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.id); mentions the LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id IS NULL alternative, and warns that NOT IN returns no rows if customer_id contains a NULL.
Monthly sales totals in different dialects
The same request is written per dialect: MySQL uses GROUP BY DATE_FORMAT(created_at, '%Y-%m'), PostgreSQL date_trunc('month', created_at), SQLite strftime('%Y-%m', created_at), BigQuery DATE_TRUNC(DATE(created_at), MONTH), and SQL Server DATEFROMPARTS(YEAR(created_at), MONTH(created_at), 1).
Explaining a window function
You paste a query with SUM(amount) OVER (PARTITION BY customer_id ORDER BY created_at). The tool explains it is a running total per customer, notes that the default RANGE frame adds rows with the same created_at together, and suggests ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW if you want the total to grow one row at a time.
| Task | Syntax in some dialects | Equivalent in others |
|---|---|---|
| Limit the rows | LIMIT 10 in MySQL, PostgreSQL, SQLite and BigQuery | TOP 10 in SQL Server; FETCH FIRST 10 ROWS ONLY in Oracle 12c and later |
| Start of the month | date_trunc('month', d) in PostgreSQL | DATE_FORMAT(d, '%Y-%m-01') in MySQL; TRUNC(d, 'MM') in Oracle; DATE_TRUNC(d, MONTH) in BigQuery |
| Join strings | a || b in PostgreSQL, SQLite and Oracle | CONCAT(a, b) in MySQL; a + b in SQL Server |
| Today's date | CURRENT_DATE in PostgreSQL, MySQL, SQLite and BigQuery | CAST(GETDATE() AS date) in SQL Server; TRUNC(SYSDATE) in Oracle |
| Replace NULL with a value | COALESCE(x, 0) in every dialect | IFNULL in MySQL and SQLite; ISNULL in SQL Server; NVL in Oracle |
Tips
- Paste only the tables involved, not the whole database; you stay under 1,500 words and get a more accurate result.
- State the time range, sort order and row count plainly, such as “last 30 days, highest first, top 10”.
- Try any UPDATE or DELETE on a copy first, or turn it into a SELECT with the same condition to see which rows it would change.
- Do not paste real customer data or passwords; table and column names are enough.
- To tidy a long query before asking for an explanation, use the free SQL formatter at /sql-beautifier/.
Your description, schema and query travel over an encrypted connection to our server and then to the AI model provider for processing, and the result comes straight back to you. We do not keep what you send or the result in our database. We record only the time, the input size, the mode, the credits used and the processing cost. Share table and column names only, and never paste real customer data or passwords.
Frequently asked questions
Is the tool free?
It runs on credits, because every run costs us AI processing. A new account gets 2 free credits after confirming the email, which is enough for two runs.
How much do credits cost, and do they expire?
One credit is $0.05. Pay as you go from $5 (100 credits), or pick a pack: $10 = 220 credits, $15 = 345 credits and $25 = 600 credits, bought once with no subscription. Purchased credits are valid for one year from purchase; trial credits are valid for 30 days.
How many credits does one run use, and what are the limits?
Each run costs 1 credit in either mode. Input can be up to 1,500 words, and the schema counts toward that total. The price is on the button before you press it.
What happens if a run fails?
Credits are taken when the run starts. If it fails for any reason on our side or at the AI provider, they go back to your account automatically and the refund appears in your history on the My credits page.
Does the tool connect to my database?
No. The tool never connects to any database and never runs a query. It only writes or explains the query text, and you decide where and when to run it.
Do I have to paste my schema?
No. Without it, the tool assumes sensible table and column names and says so in the notes. With it, the tool uses your real names and column types, so you have less to fix afterwards.
Are DELETE and UPDATE queries safe?
Always review them before running. The tool flags missing conditions such as a missing WHERE, but it cannot see your data. Try the statement on a copy, run a SELECT with the same condition first, and keep a backup.
Does Explain mode find problems?
Yes, as far as the query text shows them: joins that duplicate rows, comparisons with NULL, conditions that block index use, and wrong grouping. It may suggest an improved version, but measuring real performance needs EXPLAIN on your own database.
Can I write my request in Arabic?
Yes. Open the Arabic page to write in Arabic and get the explanation in Arabic. SQL keywords and table and column names stay in English either way.
Which databases are supported?
MySQL, PostgreSQL, SQL Server, SQLite, Oracle and BigQuery. You pick the dialect before running, and the tool follows its syntax for row limits, date functions and string joining.
Do you keep what I send?
No. We do not keep the description, schema, query or result. We record only the time, input size, mode and credits used. The text passes through the AI provider to be processed.
How do I buy credits?
On the My credits page, pick a pack and pay through our Gumroad store, PayPal, USDT on TRC20 or USDC on Solana. See the pricing page, credits terms and refund policy for details, and write to support@adwaty.net if you need help.
Last updated: