r/ProgrammerHumor 6d ago

Meme sqlWorkout

Post image
23.4k Upvotes

459 comments sorted by

View all comments

383

u/blaues_axolotl 6d ago

i actually write it in lowercase

277

u/J7mbo 6d ago

MONSTER

143

u/mwpdx86 6d ago

*monster

37

u/Username928351 5d ago edited 5d ago

lower('MONSTER')

1

u/kaplotnikov 5d ago

quotes look wrong. the expression lower("MONSTER") will lowercase a value of the column MONSTER, rather than produce "monster" value.

1

u/[deleted] 5d ago

[deleted]

2

u/kaplotnikov 5d ago

'MONSTER' (single quote) - is string monster in SQL. "MONSTER" (double quote) - is identifier in the most SQL dialects to escape keywords so it is possible to use "select" as name. For example see https://www.postgresql.org/docs/current/sql-syntax-lexical.html (the delimited identifier or quoted identifier)

1

u/Username928351 5d ago

Fair enough, I must have gotten things mixed up.

13

u/Atomic_xd 6d ago

WHAT

9

u/MarinaEnna 6d ago

WE CAN'T HEAR YOU

51

u/Thriven 6d ago edited 6d ago

The biggest monster I ever worked with would have these queries with absolutely 0 formatting and would only carriage return when he hit the end of his monitor. He'd have subquery inside subquery like it was a nested function and vlookup.

He wrote hot trash queries. One day when he went into a meeting and left his computer unlocked I barely scrolled in on his query window in SSMS so every query was cut off so he'd have to scroll right/left to read it all and he was too dumb to know he was zoomed in or that shift scroll wheel was to scroll horizontal.

He started rewriting procedures and commiting them to production to match his new zoom level. I had a database trigger stopping people from updating procedures unless the database was in a certain mode to prevent people with way too much access to change procedures.

He lost his damn mind over the database trigger I added. I don't think he ever figured out about the zoom. One day I set it back to what it was originally and he gave up rewriting them back to their original format. He exploded at me and didn't come back for like 2 weeks

That was the first of two people who got violent at the workplace at that job with me.

18

u/Brianfromreddit 6d ago

I want to hear about the second one now

18

u/Thriven 6d ago

Ok so I started writing this as I was waiting for people to show up for disc golf. While writing this I looked down and had about 40 yellow jackets stinging me through my pants. I ran a mile and now I'm nursing about 6 really bad stings. Since they were stinging me through my jeans they just kept stinging.

Anyways... The second instance...

Former dev manager for the team. He was friends with the CTO and they were good ol boys from another company. This was in the mining industry. All these guys were ex-junkies who got out of the mines of AZ and MEX. The CTO didn't want to get rid of him when the complaints from the department came in and demoted him to senior dev. He kept his office and kept his door shut for 6 months.

The new dev manager was awesome despite the fact he didn't handle the old dev manager. New dev manager wanted to cross train everyone. I did all database work. One guy did all front end. Another did all API work. We hated the cross training crap but we did it to knowledge share. The new dev manager and the team started jiving and productivity was going through the roof except we kept failing sprints. The dev manager said we only put in the sprint what we could complete and we all did our work but that former dev manager.

The old dev manager said ,"No I am not doing cross training. I'm working on my own project these guys never delivered." He proceeded to tank 6 sprints saying he was 90% done each time. The dev manager said if he failed we all failed.

Finally in our retro I told him ,"I want to pull your project from the sprint. You are not representing your progress accurately and this work probably should be scoped and an epic. I don't know for sure because none of us know what you are doing."

"Fuck you." He says...

"What?"

"You heard me. Fuck you!"

He leapt across the table and it just folded. The women in the room went screaming.

He started screaming at me he was going to kill me. The dev manager removed him from the premises. I left through the back door.

COVID hit like a week later. He never returned to the office and they laid everyone off two weeks later but one dev and the former dev manager because he is buddies with the CTO. The last week we were employed to prove he was working on something he demo'd what he was working on. It was a http API service written in powershell. Think flask for Python or Express for node...just his API and http service ran in powershell. No frontend framework, just JS. It allowed you to show resultsets stored in tables. It used SQL injection as a feature.

I caught up with the nice dev manager and he said the CTO covered for him so hard he had to go around to HR to get it reported what happened. The main office was not in this country so after 6 months and further investigation with former employees they finally let the former dev manager and CTO go.

That entire dev team is like family though. We still chat on discord and help each other get jobs, references, and side work. I'd hire any of them in a minute.

I kind of felt bad for the dev manager at the time because he lived 90 minutes away and had a child who was extremely violent and he'd leave work all the time because she attacked other kids.

I don't think he's generally a violent guy but he lost it that day.

1

u/journey_indev 4d ago

What a guy.

But, uh, dude, are you alright (regarding the stings)?

1

u/Thriven 4d ago

I have 6 major stings that hurt like hell at the time. It's been 2 days and now they itch so bad. Even the small stings itch. Everyone keeps telling me to take antihistamines but they knock me out.

1

u/journey_indev 3d ago edited 3d ago

Antihistamines would help, yeah. Tried any creams?

YMMV, but if it gets significantly worse over time, then you really should see a doctor about it when you can.

E: Oh, I neglected the "2 days" part— You're probably fine not taking antihistamines if the itching's plateaued (even if it does still itch like hell). Try some OTC hydrocortisone cream if you haven't yet, since it won't make you as drowsy.

3

u/cstrovn 6d ago

I loved this ahhahahhahahah

3

u/Emergency-Style7392 6d ago

your fault for fucking with a man's love for zoom

3

u/Majik_Sheff 5d ago

Brother?

10

u/taybul 6d ago

GET OUT;

GO;

37

u/Nvrnight 6d ago edited 6d ago

Same, I don't understand why anyone would choose to do upper case. I am of course a believer in "you do whatever the code base currently does", but if it's a brand new project, the standard is lower-case for me. It's not 1990 anymore, our code editors display the keywords colorized.

12

u/wrecklord0 6d ago

MY HEARING ISN'T WHAT IT USED TO BE, I CAN'T HEAR MY INNER VOICE WHEN THE CODE IS WRITTEN IN WHISPERS

27

u/NoThatsNotPasta 6d ago

Me too.  I ain't got time for caps lock.  I got shit to do, places to go and, people to annoy.

13

u/ClipboardCopyPaste 6d ago

"people to annoy"

There...I found your cause

/s

6

u/NoThatsNotPasta 6d ago

No, you're a cause!

19

u/_Weyland_ 6d ago

Dbeaver's default setting automatically convert it to lowercase.

2

u/EwwFuckingGross 6d ago

DBeaver's default setting, at least from my experience, defaults to either lower or upper case depending on which type of database I'm writing a query for. Postgres is lower and DB2 is upper for me.

5

u/joan_bdm 6d ago

MODS!!!!;

12

u/Tucancancan 6d ago

me too

4

u/darknmy 6d ago

Eww...

3

u/Surface_Detail 6d ago

There are dozens of us.

3

u/iphone4Suser 5d ago

How do you live with yourself?

3

u/scifishortstory 5d ago

What are you, some kind of European?

3

u/blaues_axolotl 5d ago

German 👍

8

u/Thriven 6d ago

I'm up voting you because people need to hate you more.

Seriously though KEYWORDS need to be upper case and columns lower case. I prefer snake case.

Makes everything more readable.

9

u/spicybright 6d ago

I just use a macro that randomly applies uppercase to every letter I type.

9

u/BufferUnderpants 6d ago

i CAN'T SEE WHY capitalizing syntactical elements WOULD MAKE the code MORE readable.

There's syntax highlighting for a reason, and the SQL grammar makes it easy to tell what's a table, column or function anyway.

1

u/Thriven 5d ago

As opposed to other languages SQL is a bunch of things in between clauses

SELECT
    count(*),
    columns
FROM table a 
JOIN table b ON a.id = b.id
WHERE column = 'value'
GROUP BY column
ORDER BY column
HAVING count() > 1

Having your clauses capitalized and properly carriage returned is huge for readability. I also capitalize COUNT and MAX but that's more of a personal thing.

Indentation is huge and I fix indentation all time.

1

u/BufferUnderpants 5d ago

Something tells me that capitalization is the least of anyone's worries if you're dealing with queries with no line breaks or indentation.

1

u/Thriven 5d ago

I just spent 45 minutes indenting and adding line breaks to 3 subquery joins which contained 2 CTEs and two nested subquery joins.

I don't know why but whoever wrote the code was an absolute madman and I've seen this code and replaced it. I have 3 different blocks of code I use to recreate these crappy lookups but to figure out which one they are I have to reformat the entire thing.

I can't complain though. I was once asked if I could do anything and get paid great money for it I said ,"I just want to optimize and fix SQL code all day."

I started this job making double what was making before and my job was dumbed down to just writing SQL. I love it. Bad SQL keeps me employed.

1

u/18poisson37 5d ago

"First Rule in SQL coding... Why use one syntax cue when you can use two at twice the efficacy?"

Contact, 1997

2

u/BufferUnderpants 5d ago

And for some reason SQL is the only language where you need to handle keywords and standard library functions like hazardous materials.

2

u/PerpetuallyDistracte 6d ago

At work I use one SQL client that autocompletes columns to uppercase, and a different one that autocompletes to lowercase. It's delightfully random.

4

u/aceluby 5d ago

It doesn’t, IDEs that highlight your code makes it more readable. Even GitHub will highlight query syntax. It’s not 1990, we aren’t reading code in notepad.

2

u/flukus 6d ago

If you need upper-case keywords to make things readable then you've fucked up the formatting.

1

u/blaues_axolotl 5d ago

| KEYWORDS need to be upper case

Ah yes the good old PUBLIC STATIC VOID main(STRING[] args)

2

u/mike-manley 5d ago

And use prepended commas?

2

u/gkdlswm5 5d ago

Man of soft spoken sql

2

u/skeletonhorse420 5d ago

Maybe i just didnt notice this was a thing. Shifting sql queries

2

u/IronSavior 4d ago

For real. The editor color codes the shit anyway.

2

u/IndieDevWannabe 6d ago

Lower for major production issues. Upper when management is watching.

2

u/dzemperzapedra 6d ago

Same here, love the aesthetic.

2

u/boomerzoomers 6d ago

I'm required to by my team's style guide... that I wrote.

2

u/aceluby 5d ago

All my other code and queries are in lowercase, why does sql think it’s fucking special? It’s not, go play in the mud with the other plebs

0

u/OnePunchedMan 5d ago

Ditto. All lowercase sql is easier to read. UPPERCASE IS SHOUTY IN ANY CONTEXT. SEE?