Sonntag, 22. Juli 2012


Microsoft® SQL Server® 2012 T-SQL Fundamentals

Publisher: Microsoft Press
Released: June 2012
Pages: 448

A succinct introduction for beginners and a profound reference for experienced users.

This is a fresh book about T-SQL. Its title references SQL-Server version 2012, but it is well suited to work with older versions, say back to SQL-Server 2005. Features not present in all versions are clearly tagged.

The book targets at beginners, but I can can assure you, that even after more than 10 years practise with  sql-scripts, it is an excellent reading.

Let us look at the contents, which is currently missing on O'Reilly's link below.

Chapter 1 Background to T-SQL Querying and Programming
Beside some theoretical background, here you learn what is new, like the ABC. These are acronyms standing for the flavors of SQL Server: Appliance, Box and Cloud. Box is the new name for what I knew as SQL Server from versions 6.0 to 2008. Now I know about A and C too.

Chapter 2 Single-Table Queries.
I didn't learn new features, but a better presentation of the order of the logical steps, which are done, when a query is executed. This helps later to understand some restrictions, which I though of a bit artificial until now.

Chapters 3 Joins
No new features since SQL Server 2005. But rather exhaustive, well suited for beginners.

Chapter 4 Subqueries
Here the section Dealing with Misbehaving Subqueries contains stuff I had learned the hard way, i.e. by doing.

Chapter 5 Table Expressions
I got the confirmation that some coding variants perform equally well and it is best to choose the most readable. For example Common Table Expressions (CTEs) often increase the readability and no measurable impact on the performance.

Chapter 6 Set Operators 
Here the understanding of the logical steps from chapter 2 bear fruits.

Chapter 7 Beyond the Fundamentals of Querying
This starts with Window Functions. Obviously a new name, for something I knew as Analytical functions. And there are a few new functions here to learn with SQL Server 2012. You also find Pivoting, Unpivoting and Grouping Sets here.

Chapter 8 Data Modification
Besides INSERT, UPDATE and DELETE, you find truncate, bulk insert and merge here too.

Chapter 9 Transactions and Concurrency. 
I have to reread this later again. Just found out, that I have some gaps here.

Chapter 10 Programmable Objects 
This is about batches, functions and store procedures.

And there is an appendix showing how to do an install, to try all the things out.

Let me resume in 10 chapters, you have all the basic stuff to write correct T-SQL scripts. Even some hints concerning performance are included.

If T-SQL is new to you, you find lots of exercises and solutions in the book. 
I only threw a short look on them.

To me this is a valuable reference book and a resource to fill some gaps.

I got my team leader to order a copy of the book for my two younger co-workers. I think it is good to have things in place in one book we all have read, than having to collect each bit from the web when need arises.

More info about the book you find here:
I review for the O'Reilly Blogger Review Program