Hacker News new | past | comments | ask | show | jobs | submit login

> You had to use upper case only. It may not sounds a big deal, but you'll get tired of it eventually when working with lots of fortran code.

Fun fact: Nowadays people are doing the same with SQL - even though there is absolutely no reason to do so.

   select * from mytable
is as good as:

   SELECT * FROM MYTABLE
Nowadays, upper case SQL seems to be a sign that the code is either 1) auto-generated by an ORM, or 2) written by a novice, or 3) written by a project with very strange coding styles (the last two seems to be some kind of cargo culting).



A third variant:

SELECT * FROM my table

has a purpose, which is to visually separate SQL statements from table and column names.


Which is how you should write SQL in my opinion (and many others) it makes it much clearer and easier to understand.

The other advantage it makes bugs where you use a Reserved word where you should not much easier to see visually


Pretty much this - hence my upvote for you.

I also like to stylistically indent my SQL to make it easier to follow. This works well for most typically use cases, but it can fail horribly when you start to certain kinds of JOINs and such - the indenting will make things more difficult to read.

Of course, once you start doing really wild things with SQL, no amount of casing or indentation will save you.


Indeed, this is a common workaround when your editor has no proper syntax highlighting. Still, in today's world nobody would write in that style in other programming languages.

You see the same issue with other relicts, for example, Pascal back in the 90s. Old text books wrote Pascal in uppercase style:

  PROGRAM HelloWorld(output);
  BEGIN
     ...
  END.
But in reality, everybody using e.g. the Turbo Pascal IDE wrote lowercase instead, because it easier to type and because of proper syntax highlighting:

  program HelloWorld(output);
  begin
     ...
  end.
Maybe this is not so much about the maturity of the developers (as I assumed in the previous comment), but about the maturity of the tooling.


There's also a good argument for not relying on "proper" syntax highlighting which is not always available -- especially not for such a divergent language family as SQL.

Every RDBMS has its own set of keywords and reserved words, so it's pretty much impossible to maintain a "proper" syntax highlighting mode.


you do know that some SQL's are case sensitive for table names etc ?


Hence I found it easier to keep all lowercase to avoid headaches.


Had a purpose. Now we have syntax highlighting.


I personally like using uppercase for all the keywords, e.g. "SELECT * FROM mytable". I think it makes it more readable.

EDIT: Missed that the sibling comment said the same thing...


I like standards. Seriously, is this woefully out of date: http://www.sqlstyle.guide/ ?





Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: