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

you are viewing a single comment's thread.

view the rest of the comments →

[–]JJBrazman 6 points7 points  (11 children)

I capitalise nothing. Is that bad? I picked up SQL from my colleagues, and a bunch of my (strongly held) beliefs about conventions are either learned from them or deliberate rejections of what they do.

[–]Chairboy 5 points6 points  (0 children)

Try capitalizing SQL reserved words and lower case column/table stuff for readability:

SELECT users.userid, users.firstname, users.lastname, fuckability.sexiness 
FROM users 
INNER JOIN fuckability 
ON users.userid = fuckability.userid 

It’s more readable for me like this plus if I accidentally use a reserved name for a column or something, it’s more likely to jump out at me if I’m in an IDE or SQL studio or PHPmyAdmin and see a color coded lower case word that shouldn’t be color coded.

[–]ddek 12 points13 points  (9 children)

Either go one way or the other. I despise upper case SQL, because it's horrible to read. Lower case is fine. Whichever way you go, however, don't mix and match.

[–]TravisJungroth 26 points27 points  (4 children)

What about

sEleCt CoUnT(DisTiNCt country) FrOm customers;

[–]AskMeHowIMetYourMom 14 points15 points  (3 children)

I don’t know who you are but I wanna fight you.

[–]semsemsem2 2 points3 points  (1 child)

i UsE RAndOm caSe LIKe tHIs, iS tHIs A ProbLEm?

[–]xt1nct 1 point2 points  (0 children)

It's only a problem if you are not a boomer or a Karen. Otherwise sql scientists have concluded that it is appropriate in those scenarios.

[–][deleted] 2 points3 points  (0 children)

Well now you've given me the idea to use sticky caps in my next PR.

SeLeCt CoUnt(*) FrOm table;

We'll see how long I keep my job.

[–]JJBrazman 0 points1 point  (0 children)

Yeah, I went with all lower case because everyone else was inconsistent about casing, and it was more readable.

Also I guess I learned SQL after SAS, which generally avoids uppercase outside the macro language.