this post was submitted on 29 Dec 2024
29 points (100.0% liked)

Programmer Humor

22250 readers
453 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

'; UPDATE countries SET great = true WHERE name = 'America'; --

More based: '; UPDATE countries SET great = true; --

(this is not an endorsement of donald trump)

top 10 comments
sorted by: hot top controversial new old
[–] AngryishHumanoid@reddthat.com 22 points 3 months ago (1 children)

No country dim table I've ever seen would just have "America" as the country name, but now I'm just being a pedantic asshole, which is my default setting.

[–] dullbananas@lemmy.ca 17 points 3 months ago (1 children)

well that explains why donald trump failed to make a country great again

[–] AngryishHumanoid@reddthat.com 5 points 3 months ago (1 children)

We could do name LIKE '%AMERICA%' but that would grab a few extra countries. Course that faction of the political spectrum would be all in favor of "acquiring" more countries anyway.

[–] xmunk@sh.itjust.works 5 points 3 months ago (1 children)

Ahem pushes glasses up nose arch, umm ackshually you would need to use ILIKE if you're feeding in America in all caps unless you have a custom caseless collation set on that column.

[–] AngryishHumanoid@reddthat.com 4 points 3 months ago (1 children)

I haven't used a database that required me to specify case in 15 years, and I'll be cold dead in the grave before I do it again... only because I assume that's what they use IN HELL.

[–] xmunk@sh.itjust.works 3 points 3 months ago (1 children)

All string comparisons are case insensitive by default? Is that an Oracle thing?

Postgres absolutely supports case based string diffentiation in data (by default all DB identifiers are case insensitive though which I absolutely appreciate).

[–] nogooduser@lemmy.world 1 points 3 months ago

Microsoft SQL Server is most commonly set up as case insensitive in my (limited) experience (it does support case sensitivity too).

[–] xmunk@sh.itjust.works 11 points 3 months ago* (last edited 3 months ago)

Alternative:

UPDATE country
SET great = true
WHERE name = 'America';update money set owner=account.id from account where account.name='Donald Trump';'

And that's why we use bound parameters.

(Also, if it's unclear I also don't support Donald Trump)

[–] nick@midwest.social 6 points 3 months ago
[–] mp3@lemmy.ca 5 points 3 months ago* (last edited 3 months ago)

Gigachad

'; UPDATE countries SET shithole = true WHERE name = '%United States%'; --