06 May

SQL Cookbook

SQL Cookbook

The SQL Cookbook, Available At Amazon.com.

I’m overdue on this book as I’ve been reading, and posting about it, for several days now.  In fact, it’s pretty much replaced my desire to write about the SAS Advanced certification.  Frankly, it’s exactly the kind of thing I’ve been looking for in a SQL book, slightly exotic queries and approaches, from a variety of platforms.  Outside of a couple of bugs, and the fact that it’s slightly dated (published in 2006) it’s an excellent book.

In fact, I’ll start the review process by giving it 5 stars.  It’s rare that I read a tech book, outside of certification books, from start to finish.  Usually, I get part way in, get bored, and stop.  This book has kept me plugging through it.

What this book does is present a series of problems / questions that it solves with SQL.  It shows variants for the following platforms: SQL Server, MySQL, Oracle, PostgreSQL and DB2.  Frankly, I think this is awesome.  One of the problems I’ve run into over the years, and it’s something I’ve tried to discuss on this site, is that people don’t understand that different platforms do things differently.  That it covers multiple platforms, is by far, the best part of this book.

The problems / questions, for the most part, range from really basic, to more complex variations on the problem.  This is useful in a couple of ways.  First, a novice won’t know the basic approach so showing it allows the book to be useful for even relative beginners.  The more complex problems, while not often things you would do on a job, are the kinds of things some wanker would ask in an interview.  And, unless you are exceptionally good, or lucky, scrambling to throw together a SQL solution, to a problem that might take a while to even get clear in your head won’t happen in an interview.  This book can help you be prepared for that sort of thing.  It’s a terrible approach to interviewing but I can attest that it will happen.

The book also moves at a really fluid pace.  If you’ve written SQL in the past you don’t need to plow each example so you can skip around to pick the areas you don’t know that well or are curious about.  It doesn’t need a thorough reading.

While I grade the book at 5 stars, there are a few problems with it.

First, the book, is kind of written as a reference.  But, truthfully, with the internet, and places like Stackoverflow, you can almost always get a workable answer, somewhere.  However, despite that, I would still trust what I find here more than what I might find online.  Books, even as bad as O’Reilly has been with a few recent books, should still have an editing process.  Online, who knows what you might stumble on, and who knows if it’s the best way.

Second, because the book was published in 2006 it doesn’t include some things that have been added in later versions.  However, I believe, and would encourage people, to rely on basic SQL as a general rule.  The catch with the tricks is that they are almost always version specific and if you ever switch, or wind up working with some other platform, then you could be in trouble.  I think, mostly, the author tends towards this approach and I appreciate it.

Finally, the book does have a couple of errors or less than ideal approaches.  I’ve written posts about a couple of those.  Unfortunately, O’Reilly has gotten sloppy with their QA, although it’s a lot worse today than it was when this book was written.  I’ve had some terrible experiences with them, see my reviews on the Microsoft Training Kits, for example.  Overall though, I’m not that bothered by what I’ve noticed, or not noticed, and the Errata, especially on a book 6 years old, is decent.

Overall, I’ve really enjoyed this book.  I’m not quite finished (2/3rds of the way) but it’s the rare technical book that I will take all the way home, and I can’t help but recommend it.   I wish I’d found it a few years ago.  It would have helped to save me some grief in a few cases.  So, if you are learning SQL, or want to dabble in some more exotic approaches to problems, get this book, and get it now.

You can get this book at Amazon.com.

Leave a Reply

Your email address will not be published. Required fields are marked *