He is right that lots has been said about coding standards in other languages and even right out holy wars have been launched on the
subject, but as far as SQL goes, not quite enough has been said on the subject for us to have a great war to end all wars.

I was also happy to see that we agreed with all his points except his first one. Yes I felt dissed, and thought hmm
if someone as important as Josh thinks our aliases should be very descriptive and we should use the table name rather than
the alias where possible, surely there must be something wrong with me for not believing in this fundamental philosophy.

In the rest of this excerpt I shall make fun of Josh and also set forth some of our own SQL Coding guidelines. Hopefully
Josh won't take too much offense at this small jibe.

Getting back to Josh. Imagine a world filled with Josh Berkus wannabies taking his advice to its logical conclusion and what you
get is this.

I found a great cartoon depicting this somewhere, but don't seem to find this at the moment.

Yes we would be those disrespectful people who would be guilty of writing that statement as follows
because those extra characters are not only more to type, but they actually get in the way of
targetting join mistakes and where is the indentation. INDENTATION is the most important thing:

Indenting, uppercasing SQL keywords, and using AS are the most important conventions we try to hold to.

Of course this is no offense to Josh - just a little nit-pick. Kind of reminds me of
working on PostGIS, and one day to my disbelief I discovered the philosophies of 2 people I have great respect for
look like this.

Paul

if ( lots_of_spaces_and_lots_of_under_scores && !camels ){
yeah();
}

Mark

if(!one) scream();

and of course all I could think -- What barbarians! How could I even share the same planet with these people?

When all is said and done, probably the most important thing when working on a team, is that everyone grudgingly agrees to
follow the same sane standard and the code created done by 20 programmers looks like it was done by the same person.

Log Buffer #129: a Carnival of the Vanities for DBAs
Welcome, readers, to the 129th edition of Log Buffer, the weekly review of database blogs. Welcome also to 2009, so fresh it still has that wonderful new year smell. Let&#8217;s take &#8216;er out on the road and see what she can do.
Starting with Or...

I have to agree with you that variable naming is pretty important, but I also think consistency in basic style is important too.

Have you ever worked on a code-base where half the people indent one way and other half indent another? For me it doesn't matter one way or another but seeing 2 different styles confuses new people coming into the project (should I do it this way or that way?) and just reading the code requires a sort of non-sensical context switching (at least for me anyway).

I guess its kind of hard to explain and maybe I'm just more sensitive to those kinds of things.

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.Enter the string from the spam-prevention image above: