T-SQL Fundamentals (Microsoft Press)

Author: Itzik Ben-Gan
Publisher: Microsoft Press
Pages: 608
ISBN: 978-0138102104
Print: 0138102104
Kindle: B0BTLBXF8V
Audience: T-SQL developers
Rating: 5
Reviewer: Kay Ewbank

Itzik Ben-Gan is a highly respected Microsoft Data Platform MVP, and the earlier editions of this book were already very good. This edition has been updated to cover recent versions of SQL Server, including SQL Server 2022, and Azure SQL Database.

The book opens with a look at the background to T-SQL querying and programming, both the theoretical background based on set theory and predicate logic, and the practicalities of the SQL Server architecture and use of tables.

Banner

Chapter 2 introduces T-SQL through single-table queries. As with other chapters, this chapter lays out the material being introduced, then has a set of exercises and their solutions. Joins are the next topic to be introduced, specifically cross joins, inner joins, composite, non-equi and multi-joins. Outer joins are also covered, with information on including missing values, and filtering attributes from the non-preserved side of an outer join.

Subqueries are the next topic to be considered, including good explanations of the Exists predicate and the problems that you can encounter with Null.

By Chapter 5, Ben-Gan has moved on to table expressions and how to work with CTEs - common table expressions, including using column aliases and arguments. This opening part of the book concluded with a chapter on Set operators - Union, Intersect and so on.

Ben-Gan then moves on to looking at the wider topic of T-SQL for data analysis, and how to achieve this using Window functions, pivoting data, grouping sets and time series. This is followed by a chapter on data modification, with sections and exercises on the various Insert options, Delete, Truncate, Merge and Update.

A useful chapter on temporal tables follows. These are tables with two columns showing how long the row is valid for, with a linked history tables holding the older states of rows that have been modified. Next comes a strong chapter on transactions and concurrency, with a clear discussion of the different options for isolation levels.

A chapter on SQL Graph is new in this edition. SQL Graph was introduced in SQL Server 2017, and Ben-Gan explains the use of specialized node and edge tables to store the data, then goes on to look at the uses of graph modeling, and how to use it to query data.

The final chapter of the book is titled Programmable objects, and it includes discussions of variables, batches, If..Else and While, Cursors, Routines and Dynamic SQL (i.e. Exec).

I'm a fan of Ben-Gan's writing, and this updated edition of a good book reinforces this. The writing is clear, the examples and exercises are well thought out. Personally I'd have liked more on the programming aspects, but any reader of this book would end up with a good working knowledge of T-SQL.

Highly recommended.

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Core Java for the Impatient, 3rd Ed

Authors:  Cay S. Horstmann 
Publisher: Addison Wesley
Pages: 576
ISBN: 9780138052102
Print: 0138052107
Kindle: B0B8RZZBDJ
Audience: Smart programmers wanting in-depth coverage
Rating: 4.8
Reviewer: Mike James

The key to this book is the word "impatient" in the title. What does this m [ ... ]



Street Coder (Manning)

Author: Sedat Kapanoglu
Publisher: Manning
Date: February 2022
Pages: 272
ISBN: 978-1617298370
Print: 1617298379
Kindle: B09Q3PJQC5
Audience: General
Rating: 4
Reviewer: Ian Elliot
Street Coder - sounds sort of tough but messy at the same time.


More Reviews

Related Reviews