DEV Community

Discussion on: SQL tips for beginners; what I learned after 10+ years of occasionally writing queries and schemas as a web dev

Collapse
 
hungluong profile image
Hung Luong

This could be just a personal quirk but I'd really prefer SQL keywords and functions to be uppercase, while table and column names as lowercase as that help me to easily distinguish the boilerplate from actual data

Collapse
 
redhap profile image
HAP

I always used spacing for that. I find that it's easier (for me) to keep case changes to a minimum.
I prefer writing statements in this fashion:

select col,
       col2, 
       col3
  from table
  join table_2
    on table_2.col = table.col
 where table.col2 = 'value'
   and table.col3 > other_value;
Enter fullscreen mode Exit fullscreen mode

This way I always have my actions on the left and my columns, values, expressions on the right.

But that's just me, possibly. I find it neat and clean and easier to focus on instead of case changes confusing my attention.