Claude Sonnet is the strongest choice for writing SQL queries against an unfamiliar schema. You can paste in whatever schema fragments you do have, describe the tables in plain English, and it will generate well-structured queries while explaining its reasoning so you learn as you go. It handles complex joins, subqueries, and dialect differences across PostgreSQL, MySQL, and others with high accuracy. Deepseek Coder is a strong free alternative if cost is a concern, since it is purpose-built for code tasks including SQL. ChatGPT o-series edges ahead for especially tricky multi-step query logic where extended reasoning helps, and GitHub Copilot is worth considering if you are already writing queries inside an IDE and want inline suggestions as you type.
I need help writing SQL queries when I don't know the database schema very well
Recommended: Claude Sonnet
Comparison
| Tool | Vendor | Pricing | Action |
|---|---|---|---|
| Claude Sonnet | Anthropic | Pro $20/mo or per-token API | Try Claude Sonnet |
| Deepseek Coder | Deepseek | Free in app, low-cost API | Try Deepseek Coder |
| ChatGPT o-series | OpenAI | Plus $20/mo (o3-mini) or Pro $200/mo (o1-pro) | Try ChatGPT o-series |
| GitHub Copilot | GitHub | Individual $10/mo, Business $19/mo | Try GitHub Copilot |
Want this done for you instead?
Get this done now on Obrari