this post was submitted on 19 Oct 2023
1581 points (98.8% liked)

Programmer Humor

32410 readers
1 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] umbraroze@kbin.social 143 points 2 years ago (7 children)

Technically, SQL is case-insensitive.

Practically, you want to capitalise the commands anyway.

It gives your code some gravitas. Always remember that when you're writing SQL statements you're speaking Ancient Words of Power.

Does that JavaScript framework that got invented 2 weeks ago by some snot-nosed kid need Words of Power? No. Does the database that has been chugging on for decades upon decades need Words of Power? Yes. Words of Power and all the due respect.

[–] hakunawazo@lemmy.world 17 points 2 years ago

Reminds me a bit of Skyrim. You are... the query-born.

[–] manny_stillwagon@mander.xyz 9 points 2 years ago

I'm going to print this out and frame it on the wall of my office.

[–] Nahdahar@lemmy.world 5 points 2 years ago

SeLEct uSERnaMe frOm usERs WhErE fiRStnAmE = 'John';

load more comments (4 replies)
[–] bappity@lemmy.world 65 points 2 years ago (1 children)

UM ACKSHULLY SQL ISN'T CASE SENSITIVE ☝️🤓

[–] Queuewho@lemmy.world 13 points 2 years ago (1 children)

Please tell that to the git overlords at my work. They won't approve a merge with even a single unnecessary capitalization.

load more comments (1 replies)
[–] rwhitisissle@lemmy.ml 41 points 2 years ago* (last edited 2 years ago) (11 children)

The phrase "SQL programmers" is so fucking weird. SQL isn't a programming language. It's a query language. You don't "program" things with SQL. You utilize SQL as a component of programs for data insertion and lookup, but the actual logic of execution is done in a programming language. Unless you're doing Oracle PL/SQL, in which case why are you giving money to Oracle?

Edit: Damn, this comment made people mad.

[–] oce@jlai.lu 39 points 2 years ago (1 children)

Your knowledge of data engineering may be limited. SQL is predominant in data processing nowadays. FOSS tools such as DBT allows to write efficient data processing pipelines with SQL and some YAML config without the need for a general purpose coding language.
Why would anyone want that? Because SQL has the interesting property of describing the result you want rather than describing how to compute it. So you can put inside the database, a query engine with decades of optimizations, that will make a much better job at finding the best execution plan than the average developer.
It also means it's easier to train people for data processing nowadays.

load more comments (1 replies)
[–] KarmaPolice@lemmy.world 35 points 2 years ago (1 children)

Most database engines support stored procedures. You don't need to give money to oracle, you can give it to Microsoft instead.

[–] fmstrat@lemmy.nowsci.com 18 points 2 years ago* (last edited 2 years ago) (1 children)

Or not at all? Postgres? MariaDB? I think I missed the /s. I'm slow hah

[–] KarmaPolice@lemmy.world 4 points 2 years ago

Yes, those work :-) giving money to MS was more of a joke.

[–] SomeNewThing@reddthat.com 31 points 2 years ago* (last edited 2 years ago) (1 children)

T-SQL is turing complete. While the MS SQL server has limitations on OS level operations, if you allow yourself some leeway with CLR wrappers for the win32 API, there's no reason I can think of you wouldn't be able to get the database engine to be a webserver reacting to incoming requests on port 80, or drawing GUIs based off of table state.

It's be slow and terrible, but doable.

[–] Wojwo@lemmy.ml 4 points 2 years ago

It's doable. Personal experience

[–] fmstrat@lemmy.nowsci.com 28 points 2 years ago (4 children)

This doesn't make sense to me. SPs and functions are in every major database. If I wrote a bash script that runs like a program, and sounds like a program, did I program it? Script it?

And lots of systems have nested logic in the DB, optimization often leads to that to reduce overhead. Unless you're being lazy with an ORM like prisma that can't even join properly.

Getting high performing queries is just as difficult as any other programming language, and should be treated as such. Even Lemmy's huge performance increases to .18ish came from big PG optimizations.

[–] mbp@lemmy.sdf.org 10 points 2 years ago

It seems to be about yelling at others that "you're not a real programmer!!!" mixed with being so "technically correct" my eyes can no longer roll the same way they used to.

load more comments (3 replies)
[–] corship@feddit.de 20 points 2 years ago* (last edited 2 years ago) (6 children)
load more comments (6 replies)
[–] dan@upvote.au 19 points 2 years ago* (last edited 2 years ago) (2 children)

You don't "program" things with SQL

Why not? It sounds like you haven't written any OLAP queries :)

I've written ETL data pipelines using a system similar to Apache Airflow, where most of the logic is in SQL (either Presto or Apache Spark) with small pieces of Python to glue things together. Queries that are thousands of lines long that take ~30 minutes to run and do all sorts of transformations to the data. They run once per day, overnight. I'd definitely call that programming.

Most database systems support stored procedures, which are just like functions - you give them some input and they give you some output and/or perform some side effects.

load more comments (2 replies)
[–] vrighter@discuss.tchncs.de 8 points 2 years ago (1 children)
load more comments (1 replies)
[–] Heavybell@lemmy.world 4 points 2 years ago

MS SQL Server has this thing called Replication. It's a feature to keep tables in sync between databases, and even database servers. There's merge replication (two way), snapshot replication (one way scheduled publishing), and transaction replication (one way live-ish publishing).

And the logic is all implemented in T-SQL stored procedures.

I fucking hate it.

load more comments (3 replies)
[–] Cold_Brew_Enema@lemmy.world 35 points 2 years ago (2 children)

As a senior query writer, I use caps for begin and end and some other commands, but all caps makes my head hurt. It's like the sql is screaming at me. I think it's more important to have good looking queries with proper indentation.

[–] corship@feddit.de 4 points 2 years ago

This.

Highlight important aspects of the worry with caps

load more comments (1 replies)
[–] AlexWIWA@lemmy.ml 19 points 2 years ago (1 children)

Writing SQL on Mac sucks so bad. I hate their caps lock time out

[–] icedterminal@lemmy.world 22 points 2 years ago (2 children)

macOS has a caps lock timeout? The fuck...

[–] st0v@lemmy.zip 14 points 2 years ago (2 children)

capslock drains the battery too quickly

[–] swab148@startrek.website 6 points 2 years ago
load more comments (1 replies)
[–] AlexWIWA@lemmy.ml 9 points 2 years ago (9 children)

Timeout was the wrong word. It has to be held for like a quarter second or something like that. It's annoying as hell.

[–] icedterminal@lemmy.world 7 points 2 years ago (1 children)

That's even worse IMO. Lol.

load more comments (1 replies)
load more comments (8 replies)
[–] HiddenLayer5@lemmy.ml 18 points 2 years ago* (last edited 2 years ago) (2 children)

MySQL gives you a half-hearted "Bye" when you exit the console.

[–] dan@upvote.au 16 points 2 years ago

My favourite MySQL error is "MySQL server has gone away", like MySQL decides "nah I don't want to run this" and runs off.

(it happens when no data is sent over the connection for a while, like if the query is taking too long to run and times out)

load more comments (1 replies)
[–] VantaBrandon@lemmy.world 17 points 2 years ago (1 children)

I know a Perl programmer who exclusively writes all SQL in pure lowercase with atypical indentation.

He's also a die-hard InfoWars follower, apparently his go to source, so... maybe there is a connection there.

[–] trolololol@lemmy.world 5 points 2 years ago

Unlawful chaotic evil

[–] Random_user@lemmy.world 12 points 2 years ago (1 children)

Wait, you guys aren't just writing code and then hitting the FORMAT button?

load more comments (1 replies)
[–] MargotRobbie@lemm.ee 12 points 2 years ago

THANKS, NOW I DON'T HAVE TO HOLD DOWN THE SHIFT KEY WHEN I TYPE ANYMORE!

[–] uis@lemmy.world 11 points 2 years ago (1 children)
load more comments (1 replies)
[–] Album@lemmy.ca 10 points 2 years ago (1 children)

If you guys think that's cool you should see what I can do with a double negative.

[–] Skedule@lemmy.ml 6 points 2 years ago (3 children)

What you can't not do with a double negative?

load more comments (3 replies)
[–] tentaclius@lemm.ee 10 points 2 years ago (3 children)

Nobody knows (/s) but you don't have to write keywords in upper case (for most DB's default settings anyway).

[–] dylanTheDeveloper@lemmy.world 9 points 2 years ago

You can even write them sarcastically like this:

sElEcT * fRoM dUaL

load more comments (2 replies)
[–] attero@feddit.de 6 points 2 years ago

MAKING SQL QUERIES IN CAPITAL LETTERS MAKES DATABASE TO SENSE URGENCY AND RUN FASTER.

[–] fmstrat@lemmy.nowsci.com 5 points 2 years ago* (last edited 2 years ago)

It's tabs vs spaces for SQL. Notice how I capped.

[–] ryn@lemmy.ml 5 points 2 years ago* (last edited 2 years ago)

I stopped doing SQL (the language/syntax) because I use ORMs now. They make the job a bit easier, especially when doing table relations.

[–] darkpanda@lemmy.ca 5 points 2 years ago (1 children)

I always remap my tab key to ctrl. Where is your god now…

load more comments (1 replies)
[–] sounddrill@lemmy.antemeridiem.xyz 5 points 2 years ago (1 children)

The mental gymnastics needed to understand joins 😂

[–] TeenieBopper@lemmy.world 7 points 2 years ago (1 children)

It's basically just a VLOOKUP is how I explain it to my friends who might be familiar with excel but not a real database.

[–] shortly2139@lemmy.world 6 points 2 years ago* (last edited 2 years ago)

If you know vlookup, you should checkout xlookup. Even more similar, relatively speaking of course. No longer do I have to count my columns

load more comments
view more: next ›