AI SQL Query Generator
Cloud AI first with on-device WebLLM fallback
Describe the query
Examples
Filter and sort by date
List users who signed up since January 1, 2026, newest firstA date filter plus sort order — verify the model used the literal date, not a guessed interval.
Aggregate with GROUP BY
Show total revenue per customer for orders placed in 2025, highest firstFilter + SUM + GROUP BY + ORDER BY in one prompt; naming the aggregation helps.
Join two tables
Find customers who have never placed an orderAnti-join pattern (LEFT JOIN … IS NULL); joins are where small models err most — review carefully.
Group by status
Count orders by status for the last 7 daysCOUNT + GROUP BY with a relative time filter; double-check the interval the model picks.
About this tool
Generate SQL from plain English with cloud AI and format it with sql-formatter. Your request and optional schema are sent to the DevTools server and a selected AI provider.
How to use
Describe the query
Write what you want in plain English; name tables and columns if you know them.
Choose a dialect
Select PostgreSQL, MySQL, SQLite, or SQL Server and optionally provide table schemas.
Generate and review
Check the SQL against the assumptions and warnings the model reports.
Adapt to your schema
The model guesses table names — rename them to your real schema before running.
Use cases
Exploring a schema
Ask in plain English while learning which tables and joins you need.
Drafting analytic queries
Get a starting SELECT for aggregations instead of a blank editor.
Learning SQL
Compare your mental model with the generated SQL and its stated assumptions.
Common mistakes
Mistake:Assuming the model knows your tables.
Fix:It invents plausible names — include table and column names in the prompt.
Mistake:Trusting date and interval math.
Fix:Small models frequently swap literals for NOW() - INTERVAL guesses; check every WHERE clause.
Mistake:Running generated SQL unreviewed.
Fix:Destructive statements are blocked, but wrong UPDATE or INSERT still destroys data — review first.
Mistake:Vague prompts like 'get stats'.
Fix:Name the metric, grouping and sort order; vague prompts produce vague SQL.
Frequently asked questions
References & standards
Related tools
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Commit Message Generator
Suggest Conventional Commits messages from a git diff using on-device WebLLM
AI Documentation Generator
Generate validated JSDoc/TSDoc blocks with cloud AI
AI Regex Generator
Turn natural language into a regex pattern with cloud AI
Context Assembler
Combine files and folders into one LLM-ready context block with XML tags, a project tree, ignore filters and a token estimate — like repomix or files-to-prompt, in your browser.
LLM Benchmarks
Compare LLM coding, reasoning, speed and cost benchmarks side-by-side and get a task-specific model recommendation