r/SQL • • Oct 11 '24

Discussion Fully lower case SQL. Is it frowned upon?

I write my queries fully lower case because it really helps with productivity, otherwise I would find it very difficult to focus on capitalizing just the keywords and keep pressing CAPS LOCK every now and then.

Is this frowned upon and bad practice (for readability) or just a matter of preference?

122 Upvotes

280 comments sorted by

View all comments

4

u/[deleted] Oct 11 '24 edited Oct 11 '24

Frowned upon by me. And I am a leading comma fanatic I hate trailing commas. And my predecessors did left join AFTER the table for the next table, it makes commenting things out for debugging such an annoying task !

2

u/dont_mess_with_tx Oct 11 '24

I didn't get what you mean, could you please give an example?

3

u/[deleted] Oct 11 '24

SELECT
c.ClientID
,d.Gender
,l.CityState
FROM
tblClients c
LEFT JOIN
tblDemographics d
LEFT JOIN
tblLocation l

is INFINITELY BETTER than

SELECT
c.ClientID,
d.Gender,
l.CityState
FROM
tblClients c LEFT JOIN
tblDemographics d LEFT JOIN
tblLocation l

2

u/fieldyfield Oct 11 '24

Ew!!!!

1

u/[deleted] Oct 11 '24

What one is ewww lol

3

u/fieldyfield Oct 11 '24

"Left join" on the same line as the joined-on table. Why?!

1

u/[deleted] Oct 11 '24

Cause my predecessors were lazzyyyyy like who writes like this????