Code · Best AI for
SQL and databases
Writing and fixing queries, designing tables, and explaining what a slow query is doing.
Answer: Gemini 4 Neon (Google)

Gemini 4 Neon from Google is the best pick today (91/100), followed by Claude Fable 5.2 and Gemini 4 Carbon. None of the public tests we track is about SQL alone, so this mixes general coding (most of the weight) with a little math and office-style data work.
Honest note: No benchmark here tests SQL directly. Treat this as 'strong all-round coder', which is what matters most for SQL anyway.
Top 15 for SQL and databases
Score = share of today's AI models it beats on the tests below (100 = best of all).
- 1Gemini 4 NeonGoogle · a few tests91
- 2Claude Fable 5.2Anthropic · a few tests91
- 3Gemini 4 CarbonGoogle · a few tests89
- 4GPT-6 AstraOpenAI · plenty of tests88
- 5Claude Opus 5.5Anthropic · plenty of tests85
- 6GPT-6.1 SolOpenAI · a few tests83
- 7Gemini 4 HydrogenGoogle · a few tests82
- 8Claude Opus 5Anthropic · a few tests80
- 9Claude Sonnet 5.5Anthropic · a few tests80
- 10Claude Fable 5.1Anthropic · a few tests79
- 11Claude Fable 5Anthropic · a few tests78
- 12Gemini 4 ArgonGoogle · plenty of tests74
- 13GPT-6 SolOpenAI · a few tests73
- 14Muse WonderMeta · a few tests69
- 15Claude Opus 4.8Anthropic · a few tests66
Best overall
Score 91 · Google · $0.033 per job
Best under $1
Score 62 · Anthropic · $0.0011 per job
Best open source
Score 58 · DeepSeek · <$0.001 per job
What it costs to write one tricky query from a schema
≈ 6K tokens read and 1K written per job, at each model's list API price. Monthly chat-app plans don't charge per job.
| Model | Score | Per job | Per 1,000 jobs | Memory |
|---|---|---|---|---|
| Gemini 4 Neon | 91 | $0.033 | $33.00 | 1M |
| Claude Fable 5.2 | 91 | $0.088 | $88.00 | 1M |
| Gemini 4 Carbon | 89 | $0.022 | $22.00 | 1M |
| GPT-6 Astra | 88 | $0.11 | $110 | 1.1M |
| Claude Opus 5.5 | 85 | $0.044 | $44.00 | 1M |
| GPT-6.1 Sol | 83 | $0.022 | $22.00 | 1.1M |
| Gemini 4 Hydrogenbest value | 82 | $0.017 | $16.50 | 1M |
| Claude Opus 5 | 80 | $0.055 | $55.00 | 1M |
| Claude Sonnet 5.5 | 80 | $0.022 | $22.00 | 1M |
| Claude Fable 5.1 | 79 | $0.11 | $110 | 1M |
| Claude Fable 5 | 78 | $0.11 | $110 | 1M |
| Gemini 4 Argon | 74 | $0.022 | $22.00 | 1M |
| GPT-6 Sol | 73 | $0.022 | $22.00 | 1.1M |
| Muse Wonder | 69 | $0.044 | $44.00 | 1M |
| Claude Opus 4.8 | 66 | $0.055 | $55.00 | 1M |
Highlighted: the cheapest model within 15% of the top score.
Tests behind this ranking
Share = how much each test counts towards the score.
| FrontierCodeWould a project's real owner actually accept the AI's code? | 10% |
| FrontierSWECan it finish huge engineering projects that take most of a day? | 9% |
| DeepSWECan it build big new features in code nobody has solved online? | 9% |
| CursorBenchHow well does it help real coders inside the Cursor code editor? | 8% |
| SWE-bench MultilingualCan it fix real bugs in projects written in many coding languages? | 7% |
| MirrorCodeCan it rebuild a whole program just by watching what it does? | 6% |
| Terminal-BenchCan it get real jobs done by typing commands in a terminal? | 5% |
| GDPvalIs its work as good as a real expert's? | 5% |
| GDP.pdfCan it really read the tricky PDFs people use at work? | 5% |
| FrontierMath Tiers 1–3 (v2)Can it crack hard, brand-new math problems (fixed edition)? | 4% |
| FrontierMath Tier 4 (v2)Can it solve research-level math problems (fixed edition)? | 4% |
| APEX-AgentsCan it do the work of a banker, consultant or lawyer? | 4% |
Tips
- Paste your table definitions (CREATE TABLE …) into the chat. Guessed column names are the #1 source of wrong queries.
- Ask it to explain the query plan when something is slow. It's good at that.
Quick answers
What's the best AI for writing SQL?
Gemini 4 Neon from Google is the best pick today (91/100), followed by Claude Fable 5.2 and Gemini 4 Carbon.
About Gemini 4 Neon →What's the best cheap AI for SQL and databases?
Claude Haiku 5.5: 62/100 for about $0.2 per million tokens. One job (write one tricky query from a schema) costs about $0.0011.
See the details →What's the best open-source AI for SQL and databases?
DeepSeek V4.1 Flash from DeepSeek, scoring 58/100. You can download it and run it yourself.
See the details →How much does it cost to write one tricky query from a schema with AI?
With Gemini 4 Neon, about $0.033 (≈ 6K tokens read, 1K written, at list API prices). Gemini 4 Hydrogen scores nearly as well for $0.017. Chat apps on a monthly plan don't charge per job.
How is this decided?
None of the public tests we track is about SQL alone, so this mixes general coding (most of the weight) with a little math and office-style data work. No benchmark here tests SQL directly. Treat this as 'strong all-round coder', which is what matters most for SQL anyway.
How scores work →