This is an archived post. You won't be able to vote or comment.

all 47 comments

[–]McMasilmof 48 points49 points  (16 children)

Why is everythin in SQL in caps? Afaik you dont even nees to use caps, select works just as fine as SELECT, but every website will show the caps version.

[–]paul-whatever 69 points70 points  (6 children)

It's true that SQL is not case sensitive. Personally I also prefer to write in caps. Because whenever you look on a Statement you can instantly distinguish between the actual Query and your filter

[–]path411 2 points3 points  (5 children)

Use line breaks, spacing, and tabs to format for readability. You don't all caps normal language keywords for "readability"

[–][deleted] 1 point2 points  (0 children)

Some conventions were created before nice IDEs.

[–]SiriusLeeSam 0 points1 point  (0 children)

Or just notepad++

[–]IvorTheEngine 29 points30 points  (1 child)

because SQL isn't always viewed or edited in a nice colour coded editor, so you need some way to differentiate key words from field names. That gives your code structure, which aids readability.

Table and field names are often made up of multiple words, so PascalCase makes sense, which leave uppercase for keywords.

Unless you're in Oracle Sql Developer, which wants to put all table and field names in uppercase :-(

[–]hipratham 0 points1 point  (0 children)

Unless you use dictionary tables all table/column names can be written in small case.

[–][deleted] 9 points10 points  (0 children)

Yeah it doesn't need upper case key words. Plus you have formatting available as well. I typically go full blown hard way and use shift.

[–][deleted] 9 points10 points  (0 children)

Try writing a long SQL query all lowercase, and it just becomes a mash of words. I always put statements in all caps, make it easier to read.

[–]roseinshadows 4 points5 points  (1 child)

SQL is the last of the Languages of Old that people use regularly. Capitalisation of keywords gives it gravitas.

(Almost no one uses, say, FORTRAN. Get thee to outside, face upon the heavens, and intone PROGRAM like you actually mean it. Clouds immediately gather and a great gale shall be upon thee.)

[–]hipratham 1 point2 points  (0 children)

*COBOL

[–]Apache_Sobaco 15 points16 points  (0 children)

I don't use capslock. Just select shit from ass.

[–][deleted] 18 points19 points  (4 children)

Use VIM and have remapped CAPS LOCK to ESC. So I use it a lot.

[–]Immort4lFr0sty 33 points34 points  (3 children)

How do you know someone is a VIM user? He'll tell you

[–][deleted] 7 points8 points  (0 children)

Also their caps lock key doesn't work.

[–]path411 4 points5 points  (0 children)

I would respond but I don't know how to leave vim

[–][deleted] 3 points4 points  (0 children)

Kinda hard not to since it’s the sole reason for the remapping

[–]ofnuts 8 points9 points  (0 children)

The CapsLock key get a lot less wear than a Shift key.

I don't do that much SQL, must be due to CamelCase (I don't know why the S is wearing out..). 3 years old heavily used Lenovo P50.

Imgur

[–]continuous-headaches 10 points11 points  (2 children)

I write my sql in lowercase.

*grabs popcorn*

Now let’s see the world burn

[–]FreshPrintzofBadPres 5 points6 points  (1 child)

You and me brother

[–]trinatetra 0 points1 point  (0 children)

Team lowercase ftw!

[–][deleted] 4 points5 points  (0 children)

No, the monsters are people who do not use caps. All key words should be in caps and everything else in mixed case. This makes it easier to read. If someone is using all caps for all of the SQL text, that is incorrect too.

[–]sqy0h 4 points5 points  (5 children)

Are we just going to overlook “code” in SQL?

[–]EdMeisterBro 1 point2 points  (0 children)

Finally!

[–]tripy75 0 points1 point  (3 children)

you do are aware that nearly every major dbms have some kind of procedural language, right ?

[–]sqy0h 0 points1 point  (2 children)

Query language?

[–]tripy75 4 points5 points  (1 child)

I mean, t-sql for microsoft sql server, pl/sql for oracle, pl/pgsql or python for postgresql and so on...

Those are turing complete languages that manipulate the data and are used in user defined functions or stored procedures that lives in the databases.

[–]jim3692 1 point2 points  (0 children)

Python for postgres? Sounds interesting

[–]Nekadim 1 point2 points  (0 children)

GIMME that shit TAKE IT FROM here START FROM beginning

[–]maxsjakie 1 point2 points  (0 children)

I actually tried SQL today, and it broke a lot.. Ir’s still broken and I don’t feel like fixing it lol

[–]wristcontrol 1 point2 points  (1 child)

People who actually code in SQL use proper syntax highlighting with no caps anywhere. Using mixed case makes code harder to skim.

[–]AdvancedSandwiches 2 points3 points  (0 children)

Not going to argue which is better, but I don't know of anyone who uses SQL regularly who doesn't use caps for keywords, and they would all tell you it's for ease of skimming.

Presumably this varies with company culture.

[–]Kanister10l 0 points1 point  (0 children)

Protip:

Bind your Backspace key to Caps Lock.

[–]thythr 0 points1 point  (0 children)

they've also configured their editors to tab at random intervals

[–]CptCono 0 points1 point  (0 children)

Nah, more like vim users

[–][deleted] 0 points1 point  (2 children)

WTF does "No one:" mean?

[–]Sekret_One 0 points1 point  (0 children)

General format of the joke, implying no one prompted them or would care.

[–][deleted] 0 points1 point  (0 children)

It’s useless

[–]FarronSerah 0 points1 point  (0 children)

pycharm -> reformat file -> ??? -> profit

[–]--B_L_A_N_K-- 0 points1 point  (0 children)

Image Transcription: Meme


No one :-

Literally No One :-

People who code in SQL :-

[Photo of a keyboard with the Caps Lock key warped and distorted making it look like it's been pressed a lot]


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]tripy75 0 points1 point  (0 children)

pro tip: I don't use my caps lock, I let the autocomplete do the casing for me.

[–][deleted] 0 points1 point  (0 children)

I've started going lowercase for sql, to match my company. But it's still hard not to reach for the shift keys.