[dba-SQLServer] SQL Antipatterns (Book)

Alan Lawhon lawhonac at hiwaay.net
Tue Aug 14 21:50:32 CDT 2012


I was in Barnes & Noble this afternoon browsing SQL Server books when I came
across this gem.

  http://tinyurl.com/8paqt25

In the very first chapter, the author starts off with a quote attributed to
the great physicist Niels Bohr: "An expert is a person who has made every
possible mistake in a very specific area."  (This is a paraphrase, not a
verbatim quote.)  Bill Karwin has an interesting and novel approach with
this idea of SQL "antipatterns".  First, he starts off with the definition
of an antipattern.  A SQL antipattern is a flawed technique or a flawed
solution, (in other words a "mistake"), designed to solve one problem that
has the unintended side effect of creating a host of other problems -
usually because the flawed solution or flawed technique violates a basic
tenet of relational database theory.  (This book is the rare gem - a book
that shows how "theory" relates to practice.)

Karwin starts off in the very first chapter with probably the most common
"mistake" in poor database design: Non-atomic fields - or a field consisting
of multiple data values separated by commas.  This, of course, is a
violation of First Normal Form.  He cleverly calls this common mistake
"Jaywalking" as the offender is attempting to avoid an intersection.  (Ha!
Ha!  Get the joke?)  Karwin goes on from there to introduce a number of
other SQL antipatterns, why they are bad, and how to avoid them.  I only had
time to read through one or two chapters, but what I did read convinced me
that this book is a treasure trove - especially if your job is database
design and development.  (A major section of his book - approximately 25
percent of the text - deals with query antipatterns.)

That's the real value of Karwin's approach - he shows you the way to good
design and good practice by showing you the undesirable consequences of
doing things the wrong way.  As an example, I spent some time this afternoon
reading Karwin's chapter on nulls and how NULL can be used (and misused) in
SQL.  That one chapter was all that was needed to convince me to buy the
book.  (One reviewer on Amazon.com calls Kerwin's discussion of NULLs a
masterpiece.  I went online and ordered my copy as soon as I got home.)

The real value of this book is as a supplement to a class (or another good
book) on sound database design.  This book does an incredibly good job of
tying theory to practice.  I'm curious if any of the rest of you have read
this book - and your thoughts and impressions if you have read the book?

Alan C. Lawhon

  



More information about the dba-SQLServer mailing list