Book Review: Transact-SQL Cookbook

Transact-SQL Cookbook, by Ales Spetic & Jonathan Gennick

This is the second book about SQL read from my coworker’s collection [1], and even though I will have to give it back to him, this is a book I want to add to my own collection. This is not only because this book has some fantastic code for writing elegant and efficient queries, a skill that seriously needs to be developed, but also because the book is written in such an elegant fashion as well, and also is written with the approach of demonstrating the fundamental logic of SQL and how the language can be used to solve a variety of tasks. It is a rare example of a book written with very technical matters in mind that not only aims at conveying practical knowledge about how to use SQL as a tool, but also is written with such an elegant style that where the codes is not prominent, the book is enjoyable to read on its own sense of style. This is a remarkable accomplishment that deserves high praise.

In terms of its content, this book is nearly 300 pages long, somewhere between the short introductory books that serve to introduce SQL and longer guides for those who are already experts. It has eight chapters, each of them dealing with a conceptual problem in designing tables and queries, and each of them divided into smaller sections, all of which feature a problem, a solution query, and a helpful discussion that explains why the query is written as it is, including notes (on occasion) giving credit to the programmer who first developed that particular type of solution. Included in its chapters are introductory explanations of pivot tables (something familiar to skilled excel users), sets, data structures (like regions, lists, stacks, queues, arrays, and matrices), hierarchical data (which is a challenge for a relational database), temporal data (dates and times), audit logging (both activity-level and row logging), importing and transforming data, and a short conclusion on statistics in SQL. Each of the chapters deals with its material thoughtfully.

A few qualities in particular make this book stand out among its peers. For one, this book is quirky, being written originally by a very adept Slovenian SQL programmer, translated by an American writer and SQL programmer with a great deal of modesty and appreciation for Slovene culture. Not only is this book written in a true spirit of friendship between its coauthors, it is written in such a fashion that it provokes reflection not only on the issue of writing code, but about more complicated and nuanced issues that inform the design of tables and queries. Sometimes there is no single best solution, and multiple approaches are chosen with different strengths and weaknesses that are ideal based on different conditions for the use and performance and constraints on a given database. Likewise, other solutions are elegant and easy on the front end but require a great deal of processing power on the back end, and others are immensely efficient in terms of memory and processing usage but require substantial work on the front end in skillfully designing tables and procedures (for logging, for example). This book is not only skilled in the technical matters of writing elegant and effective SQL queries, but also serves to remind the reader that programming is an art that requires skill, a creative mind that is capable of reframing problems and shifting one’s perspective, and also one where there can be great beauty and elegance as a result of acquiring skill in the technical and conceptual aspects of database design.

[1] https://edgeinducedcohesion.wordpress.com/2015/04/21/book-review-sql-in-easy-steps/

Unknown's avatar

About nathanalbright

I'm a person with diverse interests who loves to read. If you want to know something about me, just ask.
This entry was posted in Book Reviews and tagged , , , . Bookmark the permalink.