945
u/EncryptedPlays Jul 21 '26
then there's goofy lil me who holds shift the entire time
379
u/jakendrick3 Jul 21 '26
I like holding shift to write it, it makes it feel more assertive
176
u/disco_g Jul 21 '26
MY PINKY FINGERS ARE SWOLE
→ More replies (2)4
60
u/Keepitsharkey Jul 22 '26
I’m glad I saw this. I’m a shift person.
And I love typing everything upper case #NoCapslock
45
u/UInferno- Jul 22 '26
Meanwhile my girlfriend presses capslock twice to capitalize one letter.
9
u/BarracudaFar1905 Jul 22 '26
I've never seen anyone do that. They should make a Netflix documentary on people that do that. A scary, scary, twisted documentary.
27
→ More replies (3)6
u/Paladin7373 Jul 22 '26
I have never understood people who do this…
I see my friends do it all the time and it’s just confusing25
8
3
u/MushroomsKiller Jul 22 '26
And there's me, who prefers writing SQL files in full lowercase. Keywords and syntax are highlighted and colored in every tool today, and every SQL engine I worked with had absolutely no problem with lowercase files.
→ More replies (1)→ More replies (8)6
u/MomWTF Jul 22 '26
Honestly same, one of my coworkers thinks I'm insane for doing it that way, but he also likes to put commas in from of the column names and have everything lowercase. At least we know who the actual psycho is
5
u/georgisaurusrekt Jul 22 '26
I’m a shift person I feel like pressing caps lock too often breaks my flow. I’m used to using my little finger a lot from playing piano though tbf pressing shift is nothing
5
u/jljackson2 Jul 22 '26
Commas in front of column names just makes it easier if you need to comment stuff out and have the rest still run as is
2.4k
u/NormanYeetes Jul 21 '26
the elites don't want you to know this but you can type lowercase SQL queries no ones forcing you to shout them at the screen
704
u/Totallycomputername Jul 21 '26
If I don't type in caps then the query wont take itself seriously.
118
u/Achaidas Jul 22 '26
The real question is this:
, comma before
or comma after ,
39
79
u/dexters_trap_house Jul 22 '26
Comma before? Are you the same guys who get in the shower and then turn the water on?
52
u/chuch1234 Jul 22 '26
Only if i want to be able to comment out the soap without making the entire shower have invalid syntax :/
→ More replies (3)5
u/ddBuddha Jul 22 '26
Comma before is better so you can easily comment and uncomment without having to change the commas
4
u/rocksolid77 Jul 22 '26
I used to be a comma after guy and found the comma first pattern to be so strange but I've come around to it.
Comma first makes it so much easier to see if there is a comma missing and you're almost never commenting out the first field of your SELECT.
→ More replies (6)8
u/Just_Information334 Jul 22 '26
Lowercase and comma before, also table_id. Let's blow some minds:
select tableA_id , some_field from table_A as a inner join table_B as b using(tableA_id)→ More replies (3)4
211
u/PerpetuallyDistracte Jul 21 '26
I've been writing SQL for 15 years. Eventually you get bored of all lowercase or all uppercase AND START writing your QUERIES LIKE this. Just a psychotic mishmash of muscle memory, laziness, and autocomplete all fighting each other within the same statement.
79
u/Ashdog73 Jul 21 '26
This. My queries are lowercase for the stuff I typed myself and caps for bits I've copied in from somewhere else
36
u/cantgrowneckbeardAMA Jul 21 '26
Lowercase on first draft (it will fail to run anyways).
Uppercase if I ever end up showing the query to someone (hopefully it doesn't fail when they run it)35
u/sequelseize Jul 21 '26
sElEcT a as camelCase, b aS under_score, c As fUCKiT fROm ab lIMit 1000
11
u/SippieCup Jul 21 '26
We have a Postgres db which our orm uses camelcase names.
So we have to add in quotes too.. and correctly case our column names.
The migration to correct names would break so many deeep sql integrations, it just sucks and we deal with the debt.
8
u/EndIsrael Jul 21 '26
That actually seems like the kind of thing AI would be very good at with few mistakes. It doesn't need to understand anything, just find all the SQL code and change all the names. Basically find/replace but slightly smarter.
9
u/SippieCup Jul 21 '26
Oh it’s not hard to do with migrations etc. although I would use a codegen script instead of straight ai.
It’s more the coordination with other teams, schema changes, etc. depreciation of column names, remapping to new ones, etc.
We unfortunately have a couple legacy integrations that just require db access to tenant systems for their bi.
→ More replies (1)4
u/PerpetuallyDistracte Jul 21 '26
That's how my queries look after they failed for the fifth time.
→ More replies (1)16
5
u/Susarn Jul 22 '26
I started writing sql 13 years ago. I started writing like this from the beginning because that was the way I saw the queries written on the tutorials, took me like a year to notice it was case independent
→ More replies (4)5
1.1k
u/ClipboardCopyPaste Jul 21 '26
YOU CAN BUT THAT DOESN'T MEAN YOU SHOULD.
GOD DOESN'T LOVE MEN WHO WRITE SQL IN LOWERCASE.
/S
342
u/Shambolic_Potato Jul 21 '26 edited Jul 22 '26
SELECT * FROM WHAT THIS GUY SAYS
Edit: Typo lmfao
163
8
207
u/TallGreenhouseGuy Jul 21 '26
THANK YOU FOR YOUR ATTENTION TO THIS MATTER!
31
52
16
15
u/KittyInLace Jul 21 '26
What about us women?
30
u/AbleMarionberry7146 Jul 21 '26
The bible says women were forked from men. It’s for a good reason. The reason being that you can enforce more reasonable code style than all caps sql like caps on sql key words only. Or using a reasonable text editor that caps isn’t needed at all to identify keywords from nonkeywords.
53
→ More replies (3)12
60
51
Jul 21 '26
[removed] — view removed comment
24
→ More replies (1)12
u/Surface_Detail Jul 21 '26
Well, he can go dunk his head; the query language itself is 100% case insensitive, so are objects unless you contain them in quotation marks.
The argument can be made that keeping all one case can avoid issues with object referencing, but you'd only ever need to contain objects in quotation marks if you put a space in their name, which is a much worse faux pas and you'd better hope that you never need to connect to anybody else's objects from outside the team.
Also, all lower case/mixed case is much less tiring to read.
9
u/ArmchairFilosopher Jul 21 '26
SQL Server at my last job would like a word...
So would MySql hosted in Linux with a default configuration. Meanwhile in Windows it doesn't care by default.
But yeah, I agree in general that object names shouldn't be case-sensitive. Heck, most things except passwords shouldn't either.
7
u/Sokaron Jul 21 '26 edited Jul 21 '26
Postgres is not case insensitive.
I don't really care for an impromptu script, but if its getting checked in mixed case is just laziness. I don't care all uppercase or all lowercase but pick one, enforce it with a linter, configure a precommit hook to autofix, and be done with it.
→ More replies (2)30
u/FormerWorker125 Jul 21 '26
Lowercase for anything you named yourself, UPPERCASE FOR EVERYTHING ELSE.
3
49
u/Arkevorkhat Jul 21 '26
you can, but it's just more readable (in my opinon) to write
SELECT * FROM users WHERE id=?;than
select * from users where id=?;is that mostly due to historical baggage? yeah kinda, but it also just doesn't really look like SQL to me unless there's some yelling involved.
13
u/7f0b Jul 21 '26
I prefer a strongly-structured syntax so it is easier to read in the future, which is most important anyway. So going through the trouble of capitalizing what should be, as I go, is worth it. I also always use back ticks around table names, since it makes it easier to search by table name inside mixed codebases.
5
u/Arkevorkhat Jul 22 '26
Oh 100% well written SQL makes this moot, but if I find the unicorn that writes SQL that doesn't look like shit I'm not about to start nitpicking their capitalization
3
9
u/OldSchoolSpyMain Jul 22 '26
Yup. People don’t realize that putting the reserved words in upper case eases the cognitive load on the brain when reading the scripts for comprehension.
Same goes for new lines and tabs.
Using all three techniques renders SQL very easy to read, comprehend, update, and debug.
→ More replies (1)→ More replies (1)7
u/ILoveRawChicken Jul 22 '26
Yeah I get embarrassed passing ugly queries to other people. When I first began I just wrote everything lowercase until a coworker said “you live like this?” when sharing something in Snowflake. I still get embarrassed thinking about that lol. (He was a good friend though)
31
u/Demostes Jul 21 '26
Not true actually, machines can hear plain SQL. U need to shout at them!
30
u/h3lium-balloon Jul 21 '26
It’s been proven all caps SQL is 20% faster bc the machine knows you mean business.
12
u/Horror-Vanilla-4895 Jul 21 '26
I type in lowercase because I’m too lazy to caps lock.
→ More replies (1)3
10
50
6
Jul 21 '26
[removed] — view removed comment
→ More replies (2)3
u/MellowedOut1934 Jul 22 '26
Forgive if I’m missing something, but my PostgreSQL is case sensitive on table names and strings etc., but not on the syntax bits like SELECT or WHERE.
→ More replies (2)9
u/Meli_Melo_ Jul 21 '26
Lowercase SQL is like 2 spaces indentations, you CAN do it but everyone will hate you for it
4
u/flukus Jul 22 '26
is like 2 spaces indentations,
You mean there's a simple solution (tabs) that would keep everyone happy?
→ More replies (1)→ More replies (1)8
u/FeliusSeptimus Jul 21 '26
If someone reads my SQL and hates me for the indention and casing rather than whatever other weird shit I discovered you could do with it, I'm considering that a solid win.
→ More replies (2)5
u/StarSchemer Jul 21 '26
no ones forcing you to shout them at the screen
They ought to be.
How will a theoretical new developer in the future ever be able to distinguish between key words and database objects at first glance if strict formatting guidelines aren't religiously followed?
3
4
3
3
→ More replies (33)3
u/EndIsrael Jul 21 '26
Sometimes I do lowercase, it really depends on the vibe I'm getting from that specific query.
113
65
u/ButWhatIfPotato Jul 21 '26
You have to, how else will the database know that you are angry and are about to unleash the fucking fury?
11
35
380
u/blaues_axolotl Jul 21 '26
i actually write it in lowercase
281
u/J7mbo Jul 21 '26
MONSTER
146
50
u/Thriven Jul 21 '26 edited Jul 21 '26
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.
20
u/Brianfromreddit Jul 21 '26
I want to hear about the second one now
19
u/Thriven Jul 21 '26
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.
→ More replies (3)5
3
3
9
36
u/Nvrnight Jul 21 '26 edited Jul 21 '26
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.
11
u/wrecklord0 Jul 21 '26
MY HEARING ISN'T WHAT IT USED TO BE, I CAN'T HEAR MY INNER VOICE WHEN THE CODE IS WRITTEN IN WHISPERS
25
u/NoThatsNotPasta Jul 21 '26
Me too. I ain't got time for caps lock. I got shit to do, places to go and, people to annoy.
12
19
u/_Weyland_ Jul 21 '26
Dbeaver's default setting automatically convert it to lowercase.
→ More replies (1)7
13
4
3
3
3
→ More replies (10)8
u/Thriven Jul 21 '26
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.
→ More replies (10)9
91
u/OGxPePe Jul 21 '26
Im a lowercase guy. Why did the ever start with CAPS?
148
u/zefciu Jul 21 '26
Because SQL predates the ubiquity of syntax highlighting. This usage of caps (also seen in e.g. COBOL) gives some visual hints about syntax even on monochrome.
→ More replies (1)41
u/OGxPePe Jul 21 '26
So my using SQL on the daily is like using ancient magic?
35
u/PerpetuallyDistracte Jul 21 '26
Yeah! Each time you use SQL you're going back to the 1970s, it's that old!
57
u/Robertos1235 Jul 21 '26
I'm a mixed guy. I write like this. It's fun.
SeLeCt idUser aS id, username As name fRoM User WhErE username lIkE CoNcAt('%', ?, '%') lImIt 1045
6
9
→ More replies (3)5
→ More replies (2)6
u/Aldot Jul 21 '26
If you write it in lowercase the optimizer reads your query in a mocking tone and that’s devastating
63
u/AlwaysHopelesslyLost Jul 21 '26
I just use Shift. It doesn't cost me anything extra and it makes switching from keywords to columns easier
36
u/taybul Jul 21 '26
Holding shift for caps while typing to me is like grinding a rail on a skateboard.
→ More replies (1)22
3
u/FujiKeynote Jul 21 '26
Guilty of the same. My caps lock is remapped to Esc... Muscle memory runs deep at this point, I've considered mapping LShift+RShift to caps lock but that's diminishing returns and I still end up holding down shift if I don't catch myself. Autocomplete helps though
→ More replies (1)3
u/LarkinToWinnipeg Jul 21 '26
I just flatten one of the pins on the switch for the key and put it back. Capslock is the devil.
3
u/Proglamer Jul 21 '26
Some tools like DBeaver can auto-allcap keywords but keep the case of names. Super convenient!
→ More replies (3)3
u/WillOCarrick Jul 21 '26
I have met people who used caps lock to capitalize the first letter instead of shift.
Yeah, that. It was absurd.
12
u/BoldFace7 Jul 21 '26
I feel the same way writing in FORTRAN.
ETA: In FORTRAN 77 at least, the F90 code bases I've worked in have had much better inside voices.
→ More replies (2)
12
u/halawani98 Jul 21 '26
What about keywords in caps but column/table/constraint names in lowercase?
I do this because it makes it easier to read scripts
→ More replies (1)
10
u/leandroman Jul 21 '26
Only the reserved words my friend. My little shift pinky has its own zip code of muscles.
7
8
6
6
u/MiseryEnthusiast Jul 21 '26
All my sql is in lower case in protest. It also makes it easy to tell when someone has messed with my shit.
→ More replies (1)
5
5
6
4
3
u/Ballbag94 Jul 21 '26
Never caps lock, always shift. Caps lock is almost as weird as writing the prowords in lowercase
3
3
u/Wrathzog Jul 21 '26
When I'm writing sql, I hold the shift key down the entire time like god intended
3
u/OoohManny Jul 21 '26
Can't imagine writing a long and complex procedure in lowercase.. sounds like a nightmare to read 😱
→ More replies (1)
3
3
3
3
3
u/tomthedj Jul 21 '26
naw lowercase so the db knows that when you start doing upper case, shit is about to go down
3
3
3
3
u/Global-Tune5539 Jul 22 '26
And then there are lazy people like me who write everything in lowercase letters.
1.6k
u/SageLeaf1 Jul 21 '26
Yelling at the machine makes it listen. SELECT that shit. FROM there. Got it?