Microsoft SQL Server 2012 T-SQL Fundamentals – A Review

I’ve just picked up a copy of Itzik Ben-Gan’s latest book, Microsoft SQL Server 2012 T-SQL Fundamentals, published by Microsoft Press. If you’ve ever researched anything about SQL you’re probably already familiar with the author. Mr Ben-Gan is well-respected in the SQL field and is one of the top experts. He has written or co-written many of the must-have books going back through previous versions of SQL. His book, Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions was published earlier this year.

This is a book for anyone who works with T-SQL, at any skill level, though you’ll get more from it if you already have at least a bit of SQL experience. The first chapter goes through some of the basics, like creating tables and constraints, but not in great depth. It also discusses normalization, set theory, the relational model, and explains what a data warehouse is. Since this edition covers SQL 2012 he also describes Windows Azure SQL Database, the cloud based version of SQL.

Where the book really shines is from the second chapter on. Chapter 2 is all about simple queries against a single table. He goes through the SELECT statement syntax and how SQL processes a query. He explains how to work with different data types; all the built-in functions available for string manipulation and the different date and time functions. Chapter 3 goes into joins; what the difference is between an inner and outer join and when you want to use each. By Chapter 5 you’re getting into sub-queries and Common Table Expressions. The rest of the book covers so much more; locking and concurrency, data modification, cursors and temp tables, variables, and on and on.

And since this is the SQL 2012 edition he covers the new T-SQL features. For instance, when he writes about using the TOP keyword in a SELECT statement he also describes the new OFFSET and FETCH function and how they’re useful in limiting the number of records. The section on IDENTITY is matched by one on the new SEQUENCE object. The new Windows functions are described and demoed here as well.

This edition is similar to earlier editions of T-SQL Fundamentals. At the end of each chapter are a list of exercises that covers what you just learned. This is followed by the solutions, where you get not just the answer but a further explanation of why this is the right solution. If multiple solutions are available each is explained.

I highly recommend this book to everyone who works with SQL Server. It’s not just for SQL 2012, as most of what the book covers is also valid against earlier versions. I plan on using this as a reference again and again.

m4s0n501