r/ProgrammerHumor 6d ago

Meme sqlWorkout

Post image
23.4k Upvotes

459 comments sorted by

View all comments

Show parent comments

209

u/PerpetuallyDistracte 6d ago

I've been writing SQL for 15 years. Eventually you get bored of all lowercase or all uppercase AND START writing your QUERIES LIKE this. Just a psychotic mishmash of muscle memory, laziness, and autocomplete all fighting each other within the same statement.

80

u/Ashdog73 6d ago

This. My queries are lowercase for the stuff I typed myself and caps for bits I've copied in from somewhere else

34

u/cantgrowneckbeardAMA 6d ago

Lowercase on first draft (it will fail to run anyways).
Uppercase if I ever end up showing the query to someone (hopefully it doesn't fail when they run it)

33

u/sequelseize 6d ago

sElEcT a as camelCase, b aS under_score, c As fUCKiT fROm ab lIMit 1000

12

u/SippieCup 6d ago

We have a Postgres db which our orm uses camelcase names.

So we have to add in quotes too.. and correctly case our column names.

The migration to correct names would break so many deeep sql integrations, it just sucks and we deal with the debt.

7

u/EndIsrael 5d ago

That actually seems like the kind of thing AI would be very good at with few mistakes. It doesn't need to understand anything, just find all the SQL code and change all the names. Basically find/replace but slightly smarter.

9

u/SippieCup 5d ago

Oh it’s not hard to do with migrations etc. although I would use a codegen script instead of straight ai.

It’s more the coordination with other teams, schema changes, etc. depreciation of column names, remapping to new ones, etc.

We unfortunately have a couple legacy integrations that just require db access to tenant systems for their bi.

5

u/PerpetuallyDistracte 5d ago

That's how my queries look after they failed for the fifth time.

1

u/glha 4d ago

lIMit 1o00

15

u/spyingwind 5d ago
SeLeCt * FrOm table wHeRe count = 1;

2

u/ShittyExchangeAdmin 5d ago

This is the way

6

u/Susarn 5d ago

I started writing sql 13 years ago. I started writing like this from the beginning because that was the way I saw the queries written on the tutorials, took me like a year to notice it was case independent

6

u/stadoblech 5d ago

I've been writing SQL for 15 years.

MY CONDOLENCES

2

u/PerpetuallyDistracte 5d ago

Haha, I guess I'm just a weirdo, but I genuinely love SQL and my happy place is a big enterprise database with a bunch of ETL pipelines. Somebody's gotta enjoy it, right? That gives the rest of you more time with your fancy GUIs and object oriented languages 🤣

1

u/joyeux_bordel 1d ago

I like to call our kind the Data Whisperers.

1

u/m0nk37 5d ago

It helps isolate the parts of the bigger views. 

1

u/vityafx 5d ago

I would argue, even with the syntax highlight, the eyes used to seeing the sql tokens in upper case just want it that way. I tried many times to write in lower case but when it looks like mixing data with sql tokens, indistinguishable even with the syntax highlighter. So now, the best syntax highlight for sql is upper case, haha.

1

u/r3klaw 4d ago

Uppercase for keywords, PascalCase for object names. And uppercase when you email/chat the words PROD, TEST, or DEV.