› ChatGPT Plus with GPT-6.1 Sol was the best option for writing SQL queries in my test: it wrote three queries for a tricky database, and all three returned exactly the expected results.
› If you only write SQL occasionally, free ChatGPT or Gemini should be enough.
› If you’re working across a whole project with migrations and files, Claude Code on the Claude Pro plan is a better fit.This is one of the quick answers in the Which AI for what?
› I tested the tools on 8 October 2026.Three options: free, best overall and for advanced workMy quick testI built a SQLite shop database with 40 customers and 89 orders, including two traps: a guest order with no customer, which can make the common “NOT IN” pattern return an empty list, and a join that inflates the customer count unless you use DISTINCT.