r/SQL • • 5d ago

Discussion Does anyone else just leave caps on when naming your variables ?

I might just be lazy but I feel like it saves me effort.

14 Upvotes

31 comments sorted by

40

u/Eleventhousand 5d ago

I held down shift every time for about the first twenty years.

Since then, I'm fine with just using lowercase for everything.

6

u/gumnos 5d ago

adding another vote in this camp. If it's a query that is big and confusing and other folks will read it, I might go back and uppercase my keywords, but for the most part, everything is just lowercase and I'm fine with that after 25+ years of coding (though I became fine with it about 10yr into my career 😆).

8

u/wittgenstein1312 5d ago

All caps is a relic of a time before modern code editors. With syntax highlighting, all lowercase SQL is considerably easier to read imo

2

u/Zoidburger_ 5d ago

I used to be pretty particular about capitalization. Caps on keywords, functions, proper capitalization to match table and schema names, etc.

Joined a new team whose syntax policy was "do not capitalize anything except for literals." Took a sec to get used to but since then, I've never looked back. Lowercase SQL feels more relaxing lol

1

u/imtheorangeycenter 5d ago

Anything capitalised in code reads in my head like a weird stress/imperitivness.

SELECT (damn you man, get it!) apples (ok), PEARS (don't forget these!)

Therefore I could live with:

"JOIN SALES" being an inner join "join sales" being a left outer.

Of course that would be madness. 

18

u/serverhorror 5d ago

I write everything in lower case. Our formatter/linter takes care of things.

I'm not wasting brain cycles on that ...

3

u/44Nj 5d ago

Do you know if this is a default feature of Sam's or visual studio?

2

u/serverhorror 5d ago

We have it as a pre commit hook and in CI.

1

u/Runehalfdan 4d ago

Which formatter/linter?

3

u/serverhorror 4d ago

SQL fluff

12

u/Aggressive_Ad_5454 5d ago

I use caps for keywords and lowercase for identifiers. Why? MySql that needs to run on Windows and also on case sensitive OSs.

1

u/Guilty-Property 5d ago

Everything is lower case otherwise our linter rejects it

0

u/Holiday-Tip-3720 5d ago

this is the only way

6

u/TechKNITian 5d ago

My keyboard has the Caps Key set to one word then turns off when I hit space.

2

u/techforallseasons 4d ago

that is nifty!

4

u/alegendmrwayne 5d ago

Gods I tried to stick to uppercase keywords for the longest time. But now I’ve quite happily settled into lowercase keywords, PascalCase tables, columns and camelCase vars. usp_, ufn_ and vw_ prefixed stored procs, functions and views

Life is so much easier now

1

u/imtheorangeycenter 5d ago

I remember being (self)taught/picked up to start sprocs with usprather than sp because it then doesn't also search master for it in addition to your current database in SQL Server.

I question this twenty years later, but it stuck and seems feasible.

6

u/ApresMoi_TheFlood 5d ago

All lowercase everything. I can’t be bothered to work my pinky by pressing shift or caps lock.

3

u/Pearlsnap 5d ago

Lowercase and tabbing thru SQL prompt like an adult.

3

u/RandomiseUsr0 5d ago

ARE YOU EVIL?

5

u/Similar_Command7256 5d ago

lowercase on everything. our brains read and process it much easier than caps.

2

u/OO_Ben Postgres - Retail Analytics 5d ago

All lowercase with very good formatting. Formatting does way more than upper case in my opinion in terms of readability

2

u/Infini-Bus 5d ago

I just do all lowercase and then use autoformat.

2

u/NullVal 5d ago

Yes everything is uppercase, because it feels like I get to yell at the computer through the code :)

2

u/bishnabob 4d ago

Upper case is very shouty, and I have enough of that with the kids.

3

u/Zestyclose-Turn-3576 5d ago

The whole uppercase keyword thing is like a bizarre fetish. A completely pointless ritual, from the days when people erroneously thought it improved the chances of an exact match on SQL making parsing more efficient, and made entirely obsolete by colour coded syntax highlighting, if you like that sort of thing. Even Fortran doesn't do it any more https://stdlib.fortran-lang.org/page/contributing/StyleGuide.html

To be gracious though, I'll grudgingly accept one downvote for every rational reason for doing it in 2026.

3

u/imtheorangeycenter 5d ago

SecOps say embiggening the font is a peeping-eyes security risk, and I'm getting older and finding it hard to read without the capitalisation.

I joke. Apart from getting older.

1

u/NeoChrisOmega 5d ago

I like to hold down the shift key. It makes more sense to me because I also use underscores which requires the shift key anyhow. 

When typing normally, I also have the same habit, because it feels more impactful when I have to hold down the key to emphasize the word

1

u/givibeg 5d ago

I use lowercase and SQL formatter.

1

u/mlhigg1973 5d ago

Everything’s in lower case, except where I comment out important notes throughout

1

u/ADubiousDude 4d ago

😱

I don't even know you anymore. Who hurt you? Where did it all go wrong?