Code
Best AI Model for SQL Generation (2026)
Writing correct, performant SQL from natural-language prompts.
Writing correct, performant SQL from natural-language prompts. Scored by capability match + benchmark data + pricing.
| # | Model | Score |
|---|---|---|
| 1 | Anthropic: Claude Sonnet 4.6 | 186 |
| 2 | Anthropic: Claude Opus 4.7 | 183 |
| 3 | OpenAI: GPT-5.4 | 178 |
| 4 | OpenAI: GPT-5 | 178 |
| 5 | Google: Gemini 3.1 Pro Preview | 176 |