modelgrep

Best LLMs for SQL & Data Analysis

Match · Updated July 2026

The best LLM for SQL and data analysis is GPT-5.6 Sol, with a 77.4 Coding Index and structured-output support for valid, parseable queries. GPT-5.6 Terra (76.7) and Claude Fable 5 (76.5) round out the top three.

77.4Coding
58.9Intelligence
74 t/sSpeed
$5.00Input /M
1.1MContext

The best AI models for writing SQL, analyzing data and powering analytics workflows — ranked by the Artificial Analysis Coding Index among models with structured-output support, so query generation comes back as valid, parseable SQL and JSON.

  1. 1openai logo
    gpt-5.6-sol
    ReasoningToolsJSON+158.9 intel · $5.00/M · 74 t/s
    77.4
    Coding
  2. 2openai logo
    gpt-5.6-terra
    ReasoningToolsJSON+155.0 intel · $2.50/M · 96 t/s
    76.7
    Coding
  3. 3anthropic logo
    claude-fable-5
    ReasoningToolsJSON+159.9 intel · $10.00/M · 1M ctx
    76.5
    Coding
  4. 4moonshotai logo
    kimi-k3
    ReasoningToolsJSON+157.1 intel · $3.00/M · 1.0M ctx
    76.2
    Coding
  5. 5openai logo
    gpt-5.5
    ReasoningToolsJSON+154.8 intel · $5.00/M · 100 t/s
    74.9
    Coding
  6. 6anthropic logo
    claude-opus-4.8
    ReasoningToolsJSON+155.7 intel · $5.00/M · 1M ctx
    74.3
    Coding
  7. 7anthropic logo
    claude-opus-4.7
    ReasoningToolsJSON+153.5 intel · $5.00/M · 1M ctx
    73.6
    Coding
  8. 8x-ai logo
    grok-4.5
    ReasoningToolsJSON+153.8 intel · $2.00/M · 500K ctx
    72.4
    Coding
  9. 9anthropic logo
    claude-sonnet-5
    ReasoningToolsJSON+153.4 intel · $2.00/M · 1M ctx
    71.5
    Coding
  10. 10openai logo
    gpt-5.6-luna
    ReasoningToolsJSON+151.2 intel · $1.00/M · 97 t/s
    71.4
    Coding
  11. 11M
    muse-spark-1.1
    ReasoningToolsJSON+250.6 intel · $1.25/M · 1.0M ctx
    71.3
    Coding
  12. 12openai logo
    gpt-5.4
    ReasoningToolsJSON+151.4 intel · $2.50/M · 79 t/s
    71.1
    Coding
  13. 13google logo
    gemini-3.5-flash
    ReasoningToolsJSON+250.2 intel · $1.50/M · 189 t/s
    70.1
    Coding
  14. 14google logo
    gemini-3.6-flash
    ReasoningToolsJSON+250.1 intel · $1.50/M · 111 t/s
    69.2
    Coding
  15. 15z-ai logo
    glm-5.2
    ReasoningToolsJSON51.1 intel · $0.808/M · 1.0M ctx
    68.8
    Coding
  16. 16google logo
    gemini-3.1-pro-preview
    ReasoningToolsJSON+246.5 intel · $2.00/M · 122 t/s
    68.8
    Coding
  17. 17qwen logo
    qwen3.7-max
    ReasoningToolsJSON46.0 intel · $1.48/M · 1M ctx
    66.0
    Coding
  18. 18moonshotai logo
    kimi-k2.6
    ReasoningToolsJSON+144.2 intel · $0.684/M · 262K ctx
    61.8
    Coding
  19. 19moonshotai logo
    kimi-k2.7-code
    ReasoningToolsJSON+141.9 intel · $0.710/M · 262K ctx
    60.8
    Coding
  20. 20xiaomi logo
    mimo-v2.5-pro
    ReasoningToolsJSON42.2 intel · $0.435/M · 1.1M ctx
    60.2
    Coding
  21. 21kwaipilot logo
    kat-coder-pro-v2
    ToolsJSON33.7 intel · $0.300/M · 262K ctx
    59.5
    Coding
  22. 22deepseek logo
    deepseek-v4-pro
    ReasoningToolsJSON44.3 intel · $0.435/M · 1.0M ctx
    59.4
    Coding
  23. 23tencent logo
    hy3
    ReasoningToolsJSON41.2 intel · $0.132/M · 262K ctx
    58.8
    Coding
  24. 24minimax logo
    minimax-m3
    ReasoningToolsJSON+144.4 intel · $0.300/M · 1.0M ctx
    58.6
    Coding
  25. 25xiaomi logo
    mimo-v2.5
    ReasoningToolsJSON+237.2 intel · $0.140/M · 1.1M ctx
    56.8
    Coding

Frequently asked

Which LLM writes the best SQL?

The best LLM for SQL and data analysis is GPT-5.6 Sol, with a 77.4 Coding Index and structured-output support for valid, parseable queries. GPT-5.6 Terra (76.7) and Claude Fable 5 (76.5) round out the top three.

Which AI is best for data analysis?

The best AI model for SQL and data analysis is GPT-5.6 Sol, with a 77.4 Coding Index and structured-output support for valid, parseable queries. GPT-5.6 Terra (76.7) and Claude Fable 5 (76.5) round out the top three.

What's a good alternative to GPT-5.6 Sol?

GPT-5.6 Terra (76.7) is the closest alternative on this metric, followed by Claude Fable 5 (76.5). See the full ranking above for the tradeoffs.

By maker

All rankings