ThatJeffSmith

Click vs Type – SQL

Sometimes I get a little preachy in my presentations. OK, maybe I get a LOT preachy. In exchange for being stuck with me for 90 minutes, I promise every person will receive at least one new technique or trick that will greatly affect their productivity when working with the database. Fortunately for me, most agree that this is a fair trade!

Things generally go at a pretty rapid pace until I bring up one of my favorite IDE utilities – the ability to click through a SQL statement instead of typing it out by hand. Most developers are first introduced to such a concept when they use Access. It’s not a great first experience, and I understand why this might add to the resistance. If you still don’t know what I’m talking about, here’s a couple of pictures.

Instead of typing this

A SELECT statement grabbing a few columns from 8 tables and joining them.

You should be able to click into this

I can build the same query in only a few clicks

Why Is This Bad?

I know most of us can’t type this fast. Why not let the tool automatically build the framework for our query? When we’re ready to code the ‘fancy stuff’, we can still do that.

For most of you I know it’s just a matter of habit. I’m not suggesting you change the way you work if that’s already working for you. But if you need to squeeze a few more minutes into your day, this may be the most direct path to that goal.

I posted this on Twitter the other day to get some feedback, and as always I had a lot of ‘yeah, you are wrong again Jeff’ replies. Thanks Twitter friends! In all seriousness though, I had a couple of really good constructive feedback, most notably from @Boneist and @senseware

Dawn – I hadn’t thought about that. I can definitely relate to having fingers on keyboard channeling some inner path to my conscience and enabling my ideas to take solid form.

Luke – This can still be important even in an Oracle database. That’s why a good IDE will allow you to specify your join order as needed!

So Why Else Am I Wrong Here?

Feel free to tell me why I’m right too :)

Why I Think I Am More Right Than Wrong

A few years ago, in a former life, I saw a survey of several thousand Oracle customers. The goal of the survey was to identity what our tool was doing right or wrong. One of the questions we asked focused on productivity and features. By a wide margin, the clear ‘winner’ was the ‘Query Builder’ feature. Respondents said that for every time they opened the window, they estimated savings of 3 to 5 minutes. Now think about that for a second. How often do you write a query that involves more than a couple of tables? How many of those queries have long or hard-to-type column names? Now multiply that by 5 minutes. I think the promise of that kind of time savings compels you to at least try what I’m talking about. Pretty please.

Of course I couldn’t pass up an opportunity to let you know that my new favorite Oracle IDE also has a Query Builder :)

Ok, sermon’s over. Now what’s for lunch?