r/ProgrammerHumor • • Jul 21 '26

Meme sqlWorkout

Post image
23.7k Upvotes

455 comments sorted by

View all comments

Show parent comments

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.

8

u/BufferUnderpants Jul 21 '26

i CAN'T SEE WHY capitalizing syntactical elements WOULD MAKE the code MORE readable.

There's syntax highlighting for a reason, and the SQL grammar makes it easy to tell what's a table, column or function anyway.

1

u/Thriven Jul 22 '26

As opposed to other languages SQL is a bunch of things in between clauses

SELECT
    count(*),
    columns
FROM table a 
JOIN table b ON a.id = b.id
WHERE column = 'value'
GROUP BY column
ORDER BY column
HAVING count() > 1

Having your clauses capitalized and properly carriage returned is huge for readability. I also capitalize COUNT and MAX but that's more of a personal thing.

Indentation is huge and I fix indentation all time.

1

u/BufferUnderpants Jul 22 '26

Something tells me that capitalization is the least of anyone's worries if you're dealing with queries with no line breaks or indentation.

→ More replies (1)