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


Domain Storytelling (Pearson)

Author: Stefan Hofer
Publisher: Pearson
Pages: 288
ISBN:978-0137458912
Print:0137458916
Kindle:B099ZNXCJT
Audience: software architects
Rating: 4.5
Reviewer: Kay Ewbank

This book sets out to be a practical guide to database domains, bringing together domain experts, software developers, designers and bus [ ... ]



The Rust Programming Language, 2nd Ed

Author: Steve Klabnik and Carol Nichols
Publisher: No Starch Press
Date: June 2023
Pages: 560
ISBN: 978-1718503106
Print: 1718503105
Kindle: B0B7QTX8LL
Audience: Systems programmers
Rating: 4.8
Reviewer: Mike James

There's a new edition of what has become the standard text on Rust. Has it matured along with [ ... ]


More Reviews

Related Reviews