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 | 184 |
| 2 | Anthropic: Claude Opus 4.7 | 182 |
| 3 | OpenAI: GPT-5.4 | 175 |
| 4 | Z.ai: GLM 5.2 | 174 |
| 5 | DeepSeek: DeepSeek V4 Pro | 172 |