The 6-Year-Old T-SQL Book That Never Goes Out of Style

T-SQL
23 Comments

You’ve been working with Microsoft SQL Server for yeeears, and you’re pretty confident that you know how to write a query.

So when I tell you about a book called T-SQL Fundamentals, you’re all, “nah, man, I got this covered.”

You are incorrect.

Sure, the first 5 chapters of the book are about 1-2 table queries, CTEs, subqueries, etc, and you’ve probably got that stuff down cold. But here’s where chapter 6 and 7 go:

  • UNION, INTERSECT, EXCEPT
  • Windowing functions
  • Pivoting data
  • GROUPING SETS, ROLLUP

And subsequent chapters only get more detailed from there: how to properly modify data with transactions in mind, temporal tables, and more.

When you start your 3rd year of working with T-SQL, this is the book your manager should hand you. By that point, you’ve learned enough about querying that you’re getting cocky, and yet there are so many more awesome possibilities available to you.

And if you’re the one who’s the manager – if you have junior folks on your team – then it’s your responsibility to hand Itzik Ben-Gan’s book T-SQL Fundamentals to your team. They’re not getting any smarter on their own, and every day that they don’t read this, they’re producing more inefficient technical debt that you’re going to have to go back and fix later.

Previous Post
Office Hours Speed Round: Text Edition
Next Post
I’m Speaking at the PASS Data Community Summit This Year!

23 Comments. Leave new

  • chad.baldwin
    May 12, 2022 1:59 pm

    I bought this book after having 9 years of experience….I figured what the heck, might as well give it a read, maybe I’ll pick up a few nuggets. I was certainly incorrect. lol.

    I learned SO MUCH from that book even after spending hours upon hours upon hours of watching Pluralsight courses, other blog posts, your training courses, etc.

    Then I bought T-SQL Querying and I’m still trying to get through that a year later. lol. Those two books along with the windowing functions one are all so densely packed with information, you need to read them at least 1 time to really grok it.

    Reply
  • This book actually gets read. The tech book I got before that holds up my left monitor.

    ’nuff said

    Reply
  • gonna have to pick up a copy. Thought I was doing alright being excited when I am able to use a HAVING in something, but I had never even heard of grouping sets or rollup before

    Reply
  • That’s the same category as articles about dynamic SQL and stored procedures written by the guy that had probably forgot more about these topics than I would ever know – Erland Sommarskog. 🙂

    Reply
  • Jyoti Sankaran
    May 12, 2022 4:18 pm

    I am familiar with Itzik-Ben-Gan’s articles and blog posts on TSQL. Simply top class! One of the first to warn about problems with MERGE. He used to run a monthly TSQL quiz competition on the ITPro website which I entered a few times without success.

    Reply
  • If every developer read this book I’m sure I’d have a lot less grey hair.

    Reply
  • Douglas Osborne
    May 12, 2022 4:41 pm

    Mastering GROUPING SETS is a game-changer.

    Reply
  • Steven Howes
    May 12, 2022 4:51 pm

    Been doing the DBA thing for about 13 years now but I know I am being lazy about keeping my skills up. Which book would be better? this one or the “T-SQL Querying” Book?

    Reply
  • I read Ben’s earlier book ( Querying Microsoft SQL Server 2012 ) which was an eye opener. Seems like they would overlap a fair bit.

    Do you think Fundamentals has enough new material to be worth getting?

    Reply
    • If only there was some kind of listing of a book’s contents

      Perhaps presented in a tabular format

      One might call it a book’s Table of Contents

      And then you could compare books to see whether they were similar or different

      Wonder if that might be useful

      But then again

      If people aren’t smart enough to read a simple Table of Contents

      Then they surely wouldn’t read the whole book

      Nah, it’d probably never catch on

      Reply
  • Patrick Clough
    May 12, 2022 5:03 pm

    Thanks Brent for brining up this book! I’ll be buying it if you answer yes to this question, or maybe buying a couple books if you also have an “advanced T-SQL” recommendation.

    If you had to buy one book with similar focus as “T-SQL Fundamentals” , would this be this book?

    Reply
  • Got the book, it’s in my Kindle library.

    Reply
  • dave mortimer
    May 13, 2022 7:44 am

    absolutely spot on Brent… as a stand-alone dba your stuff, midnightdba, itzik are my go to places when I get stuck…. which is often 🙂 good job really sql server is best supported product on the planet…. take care & thanks again…

    Reply
  • Itzik always produced great articles for SQL Server Magazine. I have 6 of his books and he’s been my recommended T-SQL author since his “Inside SQL Server 2005” books

    Reply
  • Michelle Poolet
    May 13, 2022 4:30 pm

    It’s hard to find anyone who knows SQL better than Itzik, and he explains it in such a way that you can understand what’s going on! Highly recommend this book.

    Reply
  • Rich Mechaber
    May 17, 2022 2:34 pm

    One of my favorite T-SQL books is his “2012 High-Performance T-SQL Using Window Functions”. I still dip into it, b/c there are times I either can’t remember which function is best for an application or I want to re-read about indexing strategies to support them. Windowing functions are one of my favorite “recent” additions to SQL Server and I feel I still have much to learn. Great balance of concepts, overview, how-to, and practical use cases.

    One caveat if his Window Functions book hasn’t been updated/revised since the 2014 second printing: there are numerous instances where MS SQL does not fully implement the ANSI standards, yet he gives extensive page space to the ANSI implementation. That’s great for context and completeness, but he or the publisher did not do much to highlight which features were not available in T-SQL: you have to look for the sentence at the beginning of several paragraphs stating “SQL Server 2012 doesn’t support this option” or some such.

    Reply
  • Matt Shoemaker
    May 23, 2022 6:24 pm

    I love this book. I learned about MERGE {table} USING {table} which is great for data warehouses.

    Reply
  • Ronnie Holmes
    November 2, 2022 4:25 am

    I have ‘lost’ 5 copies of this book. I keep buying new copies. If you are wanting your development teams to be the best at SQL, expect this book to go missing. Keep a spare copy at home.

    Reply
  • According to Itzik Ben-Gan’s website, the 4th edition of this book will be available 1Q23.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.