SQL Antipatterns

Reviewed by Major Keary

The sub-title of this book is Avoiding the Pitfalls of Database Programming, which nicely encapsulates its purpose: to present good and practical advice. In his introduction the author defines an antipattern as: … a technique that is intended to solve a problem but often leads to other problems. The concept of antipatterns has been around for a long time; a book, Antipatterns [William J. Brown et al., John Wiley and Sons] was published in 1998, and there is documentation in the Portland Pattern Repository [http://c2.com/cgi-bin/wiki?AntiPattern].

David Karwin has been a software engineer for over twenty years and since 1992 has worked with SQL in a range of contexts: developing applications, technical support, and development of libraries for SQL programming in Perl and PHP. In the introduction to SQL Antipatterns he says, "I've answered thousands of questions on Internet mailing lists and newsgroups. I see a lot of repeat business—frequently asked questions that show that software developers make the same mistakes over and over again". He brings that vast store of experience to this detailed discussion of SQL antipatterns.

The content is in four parts, each of which groups topics:

  • Logical Database Design Antipatterns
  • Physical Database Design Antipatterns
  • Query Antipatterns
  • Application Development Antipatterns


Each antipattern chapter follows a common format:

  • Objective (the task)
  • The Antipattern (nature of the common solution and unforeseen consequences)
  • How to Recognise the Antipattern
  • Legitimate Uses of the Antipattern
  • Solution (describes preferred solutions)


Example code is used to illustrate discussions, and there are useful diagrams. The author is able to maintain technical depth without resort to techspeak. The focus is on practical application with discussions of issues on both the development and administration sides of database technology. A narrative style makes for easy reading; however, readers are expected to 'speak SQL', but not necessarily to be fluent.

An important resource that brings together information that would otherwise be spread over many texts and documents—or, perhaps, not recorded at all.

David Karwin: SQL Antipatterns
ISBN 978-1-93435-655-5
Published by ragmatic Bookshelf, 333 pp., RRP AU$ 50.95

Woodslane. This title can be purchased from the Australian distributor at
A discount can be redeemed by entering the following code at the checkout:


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <dd> <dl> <dt> <i> <img> <li> <ol> <u> <ul> <pre> <br> <blockquote> <hr> <code><sup><sup><p><em><strong> <h2> <cite> <code> <tt> <h1><table><tr><th><td>
  • Lines and paragraphs break automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.