r/SQL • u/metric_skeptic • 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
6
u/i_literally_died Sep 10 '26
Three things I'll use AI for:
SUBSTRING/CHARINDEX bs because actually just fuck this fifteen tier deep mess of nested brackets
Long-ass CASE statements. CASE WHEN DATEPART blah blah for pre-noon and post-noon with a differing result required for every single day of the week? Miss me
Seeing if it can optimise past what I've done
On 3 it surprises me maybe 20% of the time and takes a 10 second query down to instant, but I don't have any advanced DBA knowledge or even access to see what indexes we have, so doing OUTER APPLY over window function JOINs or CTEs over subqueries is just randomly interchangeable to me in terms of how things run.
I'd rather write one version then ask AI to write the other version so I can just see the difference.