Arthur Reviews: T-SQL Fundamentals Third Edition by Itzik Ben-Gan
I was looking for an advanced-level book on SQL Server. I purchased a collection of three books by the author (Itzik Ben-Gan) as an amazon frequently bought together package. Although I was looking for an advanced book, I decided to read this one first for the sake of completeness. My expectations were for it to be a fast and easy review of the basics. I was pleasantly surprised. This book graciously offers much more. If I could use only one word to describe this book it would be: Invaluable.
A Light Emphasis on Theoretical Concepts
Rather than focusing only on SQL Server, the author takes time to touch on SQL’s origins in set theory and predicate logic. While not needed to query a database, it provides the reader with a strong foundation. This foundation comes in handy as more topics are introduced.
Early on, the reader is introduced to “logical query processing”. The author will take an example query and step through the logical processes required to return the query results. Putting an x-ray to the black box of SQL magic early on in the book allows the reader to gain experience by logically stepping thru many examples. This wasn’t my introduction to SQL, but after reading, I wish it was.
Engaging Knowledge Checks
Almost every chapter has review questions to test the readers knowledge of the chapter. There were many times I had to refer back to the chapter to go over a concept again to be able to complete the query. Other times I would complete the query differently than the answer. While I received the desired results, I would spend time thinking: “Why did Itzik do it that way instead of my way”. The challenge they provided was enjoyable but not overwhelming.
Covers Common Pitfalls
While he is covering a subject, Itzik makes time to stop and address common pitfalls users will encounter. A sample of pitfalls addressed are:
- The various troubles one can get into with null values.
- Unintended consequences of inner and outer joins.
- Issues encountered with subqueries
I encountered a specific bug shortly after reading about it. I was excited to refer back to that section of the book to get a better handle on the situation
More Than Just the “Fundamentals”
Although this is a fundamentals book, when the material is heading in the direction of more advanced topics it will have an optional reading section. At my skill level, I got the most out of these sections. There are sections on correlated sub-queries, window functions, recursive CTEs, Isolation levels, dead locks, temporal tables, and dynamic sql (even how to write a dynamic pivot query).
My Takeaway
My major takeaway was to further implement set-based thinking in my day to day work. Before reading this book, I would write loops and cursors often. I now see that the things I am trying to accomplish can be done faster and cleaner with a set-based approach. Thinking in a set based manner can still be challenging. Despite this, I am excited to be growing and changing my thinking for the better. I recommend this book to anyone using SQL Server.
You can learn more about the book on Itzik’s website.