this post was submitted on 24 Feb 2024
27 points (96.6% liked)

technology

23218 readers
2 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 5 years ago
MODERATORS
 

I admittedly have very little professional experience with SQL (just single table databases with SFW queries and inserts) but I've been learning more lately, and I find I strongly prefer writing it with lowercase keywords. It's easier to type since I don't have to keep pressing caps lock or holding down shift, and I don't find uppercase keywords to be any more readable (but like I said, I don't have much professional experience, and maybe it's different at that level) largely due to the syntax highlighting that pretty much every editor of the last 20 years provides. The only reason I can think of for using uppercase keywords is if you're working with a legacy codebase with existing SQL code that uses uppercase keywords.

It's not really an argument per se, but one other point I'd make is that so many programming languages have been invented over the years and afaik pretty much none of them use (all) uppercase keywords, in fact the only mainstream language I can think of off the top of my head that does that is COBOL, which is older than SQL. Did the creators of all those languages make a mistake by using lowercase keywords?

all 19 comments
sorted by: hot top controversial new old
[–] zifnab25@hexbear.net 22 points 2 years ago (2 children)

Uppercase initially and then gradually start introducing lower case letters farther down the statement, in an effort to gaslight the guy who has to debug your code later

[–] someone@hexbear.net 8 points 2 years ago

You're a monster.

[–] comrade_pibb@hexbear.net 3 points 2 years ago

i don't remember posting this at all

[–] wesker@lemmy.sdf.org 21 points 2 years ago* (last edited 2 years ago) (1 children)

Queries can quickly get complex, and I find that using caps increases readability quite a bit.

[–] invalidusernamelol@hexbear.net 2 points 2 years ago

Editing in something that does blocking and syntax highlighting helps a lot too

[–] FunkyStuff@hexbear.net 11 points 2 years ago

I use uppercase for keywords in my database console/script editor mostly because it helps me find the identifiers faster for figuring out where the parameters need to go once I port it to the server code. Very lo-fi way of coding but whatever vivian-shrug

[–] supafuzz@hexbear.net 7 points 2 years ago* (last edited 2 years ago)

lowercase if I'm just typing ad hoc one off queries, but always uppercase if it's something anyone will have to read later, including myself in six months

[–] space_comrade@hexbear.net 6 points 2 years ago

Lowercase because if I do uppercase I feel like a crusty old COBOL dude patching a 50 year old financial system.

[–] hexaflexagonbear@hexbear.net 5 points 2 years ago

I do lowercase, too lazy to switch casing for the commands and most editors do syntax highlighting for sql so I don't think there's really much readibility loss.

[–] CoolYori@hexbear.net 4 points 2 years ago* (last edited 2 years ago)

Generally if a gray beard does it I will as well. While I dont follow their advice blindly there is a reason why boomer programmers stick around in some spaces.

[–] RamrodBaguette@hexbear.net 3 points 2 years ago

Upper. Just convention.

[–] Thordros@hexbear.net 3 points 2 years ago (1 children)

Better question: "Ess Queue Elle" , or "Sequel"?

[–] oscardejarjayes@hexbear.net 3 points 2 years ago

UPPER, because usually when I'm writing SQL it's because I'm working on someone else's code. Usually when it's fresh code I abstract, so the actual DB used can change.

[–] flan@hexbear.net 2 points 2 years ago

just use the formatter and go with whatever it does

[–] Flyberius@hexbear.net 2 points 2 years ago

Honestly, whatever I feel like.

Lower case, easier to type and just run it through a formatter. And no implicit joins.

[–] aaaaaaadjsf@hexbear.net 2 points 2 years ago

Uppercase keywords so you can actually read your code

[–] Maoo@hexbear.net 1 points 2 years ago

Use a formatter and free up your brain space.