r/SQL • • Sep 09 '26

Discussion How much SQL do you still write manually?

With AI getting better at writing SQL, I’ve been wondering how much SQL analysts actually write from scratch these days.
Do you still write most of your queries manually, or do you use AI for things like joins, CTEs, debugging, optimization, etc.?
And has your use of AI actually changed how much SQL you need to know?

115 Upvotes

240 comments sorted by

View all comments

Show parent comment

3

u/metric_skeptic Sep 09 '26

But you can also ask it to find a shorter alternative. Sometimes it comes up with a surprisingly elegant solution that I wouldn’t have thought of myself. I still review the logic, but that’s one of the things I find really useful about AI.

9

u/Ginger-Dumpling Sep 09 '26

As someone who knows a couple dialects pretty well who sometimes uses AI to figure out equivalents/differences when porting over to other DB flavors/versions, I'm regularly presented SQL that is not syntactically valid for the targets I ask about.

I would say that I 95% write everything myself. I'm in an environment where I can't upload schema details, and even if I did, I would probably still have to document all the data anomalies I know I have to deal with before I could remotely consider generating sql from prompts. Pair that with an editor that has templating and auto-complete, I can churn out reliable SQL faster. Stuff that has to be repeated is in views, functions/procedures, materialized in some way, etc.

1

u/RICHUNCLEPENNYBAGS Sep 09 '26

You really want to have a way it can self-verify to iron out that kind of stuff if you want to have AI writing stuff for you. Otherwise it’ll just waste your time.

7

u/ElHombrePelicano Sep 09 '26

Ya, I’ve tried. It’s simply not smarter than me in any way.

0

u/rali3gh Sep 09 '26

Just to say, I wouldn't say it's 'smart' at all. I know this probably sounds pedantic, but I only say it because when I use it, I find I have to keep reminding myself of this.

The more I'm able to approach it as a tool to complement my own 'smarts' rather than mindlessly anthropomorphize it, the more productive I am while using it.

0

u/ElHombrePelicano Sep 09 '26

Wow… that’s deep.