AI SQL Query Generator
NL to SQL with on-device WebLLM — formatted with sql-formatter
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 and format with sql-formatter — on-device WebLLM.
How to use
Describe the query
Write what you want in plain English; name tables and columns if you know them.
Pick a model
Quality (1.5B) is recommended for joins and date filters.
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 on-device WebLLM
AI Commit Message Generator
Suggest Conventional Commits messages from a git diff using on-device WebLLM
AI Documentation Generator
Generate JSDoc/TSDoc blocks from code with on-device WebLLM
AI Regex Generator
Turn natural language into a regex pattern with on-device WebLLM
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 Token Counter
Visualize BPE tokens with color blocks, model selector, and per-request cost estimate