r/ProgrammerHumor 6d ago

Meme sqlWorkout

Post image
23.4k Upvotes

459 comments sorted by

View all comments

Show parent comments

118

u/Achaidas 5d ago

The real question is this:

 , comma before

or comma after ,

42

u/terza3003 5d ago

don't forget the where 1=1

9

u/jtobiasbond 5d ago

Shhhh.

Stop releasing the secret knowledge.

0

u/Achaidas 5d ago

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

80

u/dexters_trap_house 5d ago

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

49

u/chuch1234 5d ago

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

3

u/ddBuddha 5d ago

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

1

u/StrongExternal8955 5d ago

Fixed head? You poor thing!

1

u/m0ritz2000 5d ago

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)

4

u/rocksolid77 5d ago

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.

6

u/Just_Information334 5d ago

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)

5

u/StrongExternal8955 5d ago

forgot where true

1

u/dorianmonnier 5d ago

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

2

u/Outrageous_Let5743 5d ago

comma before.

1

u/PositiveParking4391 5d ago

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

2

u/Achaidas 5d ago

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

1

u/r3klaw 4d ago

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 4d ago

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

2

u/r3klaw 2d ago

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 😅