Book Review: Learning SQL, Second Edition by Alan Beaulieu

Hi there…

Do you ever run across those books that you really wish you had found when you were starting out in one field or another? For the last several years I’ve been working on a software project that forced me to get down into the nitty gritty of JDBC development and SQL statement execution. And, as I tend to do, I found a resource that I felt adequately described a particular area of technology and stuck with it.

The book that I’ve been using for years now is SQL for Dummies. It has existed beside my work desk and referenced to the point where it’s dog-eared and looking like something one of my dogs dragged in from the back yard. SQL for Dummies taught me the fundamentals of using SELECT, INSERT, UPDATE, and DELETE statements at a high level, which was enough for me at the time.

Did it teach me everything I needed to know? Not really, but that wasn’t its goal. SQL for Dummies was enough to get me started in the right direction. Other online resources (courtesy of Google) would provide more specific examples of various vendor-specific SQL dialects or more complex statements.

So when I finally started looking at Learning SQL, Second Edition by Alan Beaulieu, I had a foundation in the basics of SQL but had no idea about the background, theory, or the how’s or why’s one method should be used over another. This book starts out with the basics and within the first 50 pages begins to go way past what SQL for Dummies covered.

Beaulieu provides examples that he develops over a period of chapters. Initially he covers the history of databases and the transition from nonrelational data to relational models. The most interesting fact I learned early on in the book was that SQL is not an acronym for “Structured Query Language,” even though many people (including myself before learning that it’s not true) would swear it does. It’s just the name a group at IBM came up with to describe this language over the course of a few iterations – it was first DSL/Alpha, then SQUARE, SEQUEL, and finally SQL.

As we progress through those first couple of chapters, we learn how to create objects in a relational database such as tables, insert data into those objects, and then query the database to get the data back out in a variety of forms. For example, you can in a query reformat the order of columns from a table or sort the data in particular ways.

And then Beaulieu builds on those basic blocks to explain how to use the different clauses of a query, from affecting query results using the “group by” and “order by” clauses to filtering queries down to only the data we want to see using the “where” and “having” clauses. Each section builds on what came before it. But what made this book flow for me was the fact that he gave reasons for why you’d use different parts of SQL syntax. For instance, I’d seen the “distinct” keyword used, but didn’t really understand why. Now I know that the “distinct” keyword filters out any duplicates for the column with which it is used in a query. Very straightforward and easy to understand.

He also talks about how and why to use subqueries, which are queries contained within other queries. I’ve seen many extremely complex queries and always shied away from them because it was simply too much information to comprehend in most cases. But if you look at each subquery as a building block creating a virtual table that is in turn consumed by the query that calls it, it makes a lot more sense.

Beaulieu walks through joins, data, grouping, and so much more in this book. Each chapter and section makes sense on its own, but in the larger context it has managed to fill many of the holes in my understanding of SQL in a straightforward manner.

I would strongly recommend Beaulieu’s Learning SQL, Second Edition for anyone doing database development. I can with certainty say that it takes care of so many of the mysteries of using SQL that it will quickly become indispensible on my own shelf.


p.s. Click below to pick up Learning SQL, Second Edition or SQL for Dummies at Amazon!

Reblog this post [with Zemanta]

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.