I have a vast collection of SQL books. If it was published in the last 10 or so years, I probably have a copy. Some of them are very good, but there are quite a few similar-looking SQL books, with a similar purpose and a similar look-and-feel. So it takes some doing for a new SQL book to rise above the chaff… but SQL Antipatterns by Bill Karwin absolutely does!
This is not yet another book on SQL syntax or style. SQL Antipatterns is something altogether unique. The book is designed to point out the common things that SQL developers do, that they shouldn’t be doing. Each chapter assists the reader in identifying, explaining, and correcting dangerous practices – or antipatterns.
If you take the time to read through this thoughtful book I’m sure you’ll recognize some of the antipatterns. Some of you will have done them yourself, whereas others of you probably will have worked to undo some of them.
OK, many of you are still likely to be wondering what exactly is an antipattern is, right? Well, I’ll give you one of the examples from Karwin’s book –> Jaywalking. This is the first antipattern covered in the book and it is one of my favorites (err, I mean least favorites, I think). Jaywalking is when developers store comma-separated lists in a database column instead of redesigning the database structure in a normalized fashion. Karwin calls this jaywalking because both this practice and actual jaywalking on a street are acts of “avoiding an intersection.” Funny…
Each antipatterns is described along with a clear explanation as to why it is a bad practice and advice on building a better solution. Other antipatterns covered in the book are named almost as intriguingly, such as Pseudokey Neat-Freak, Keyless Entry, Magic Beans, See No Evil, and Metadata Tribbles.
The book is not just for unlearning what you shouldn’t be doing, it can also be helpful for learning new and improved development techniques. Reading SQL Antipatterns can help you to learn about current technology for full-text search, how to design code that is resistant to SQL injection attacks, and many other techniques for success.
The book is very well-organized into four parts grouping the antipatterns into the following categories: logical database design, physical database design, queries, and application development.
SQL Antipatterns should become a useful tool for DBAs and database programmers to help them create well-designed databases and applications… and to help us eliminate these common errors from our database implementations.
- SQL Antipatterns (2010, Pragmatic Bookshelf, ISBN 978-1-93435-655-5)