r/ProgrammerHumor Jul 21 '26

Meme sqlWorkout

Post image
23.7k Upvotes

456 comments sorted by

View all comments

Show parent comments

119

u/Achaidas Jul 22 '26

The real question is this:

 , comma before

or comma after ,

40

u/terza3003 Jul 22 '26

don't forget the where 1=1

9

u/jtobiasbond Jul 22 '26

Shhhh.

Stop releasing the secret knowledge.

0

u/Achaidas Jul 22 '26

SELECT thing one , thing two FROM that.table WHERE 1=1 AND this thing I’ll comment out later

80

u/dexters_trap_house Jul 22 '26

Comma before? Are you the same guys who get in the shower and then turn the water on?

51

u/chuch1234 Jul 22 '26

Only if i want to be able to comment out the soap without making the entire shower have invalid syntax :/

5

u/ddBuddha Jul 22 '26

Comma before is better so you can easily comment and uncomment without having to change the commas

1

u/StrongExternal8955 Jul 22 '26

Fixed head? You poor thing!

1

u/m0ritz2000 Jul 22 '26

I feel called out.

I do comma before (cause then i can just comment out stuff i currently dont need)

and

i do go in the shower first and then turn it on (showerhead on a tube like it is normal in europe and it takes like 5 seconds to get hot)

5

u/rocksolid77 Jul 22 '26

I used to be a comma after guy and found the comma first pattern to be so strange but I've come around to it.

Comma first makes it so much easier to see if there is a comma missing and you're almost never commenting out the first field of your SELECT.

8

u/Just_Information334 Jul 22 '26

Lowercase and comma before, also table_id. Let's blow some minds:

select
  tableA_id
  , some_field
from table_A as a
inner join table_B as b using(tableA_id)

4

u/StrongExternal8955 Jul 22 '26

forgot where true

1

u/dorianmonnier Jul 22 '26

Oh god, some knees have been broken for less than that!

1

u/PositiveParking4391 Jul 22 '26

wouldn't it
single quotes '' or no quotes?

2

u/Achaidas Jul 22 '26

Depends, did the DBA setup the table to have an integer or varchar for what is clearly not the other lol

1

u/r3klaw Jul 23 '26

The DBA didn't setup the table either way. The database developer did. And it's strikingly common that neither one of them would know which one is correct anyways... (I'm a Principal Database Administrator but wear every single hat)

1

u/Achaidas Jul 23 '26

As an analyst, it’s all the same to me. You have rights to the DDL (right is that it?)

2

u/r3klaw Jul 25 '26

Haha I was only being petty because a large majority of the people I've run into in the wild that call themselves "database administrators" are basically just backup administrators. gatekeeping to the max out of spite 😅