SQL Antipatterns Review: The Best Book on Database Design Mistakes?

Most database books teach you what to do. SQL Antipatterns by Bill Karwin is about what not to do: the comma-separated list in a column, the “attribute/value” table that can store anything, the FLOAT column for money, the LIKE '%word%' search, the password stored in plain text. Every one of them looks like a clever shortcut on day one and turns into a painful rewrite a year later.

If you’ve ever inherited a database and thought “why on earth did they do it this way?”, this is the book that explains it, and shows the better design. Here’s what’s inside the current edition, who it’s for, and whether it’s worth buying.

Disclosure: some links on this page are affiliate links. If you buy through them, SimplifyDatabase may earn a small commission at no extra cost to you. It helps keep the site free. As an Amazon Associate I earn from qualifying purchases.

SQL Antipatterns Volume 1 by Bill Karwin with six antipatterns from the book: Jaywalking, Naive Trees, Entity-Attribute-Value, Rounding Errors, Keyless Entry and Poor Man's Search Engine

At a glance

DetailInfo
AuthorBill Karwin
PublisherPragmatic Bookshelf
EditionSQL Antipatterns, Volume 1 (October 2022), the updated version of the 2010 original
LengthAbout 380 pages
ExamplesMostly MySQL, with Python for the application code; the ideas apply to every SQL database
LevelIntermediate: you should be comfortable with SELECT, JOIN and CREATE TABLE
VerdictThe best book on database design mistakes, and how to fix them

The big idea

An antipattern is a common solution that seems to work but causes more problems than it solves. Karwin collected the mistakes he saw again and again in years of answering database questions, and gave each one a memorable name, so a team can say “that’s Jaywalking” instead of arguing from scratch.

Every chapter follows the same structure:

  1. Objective: what the developer was trying to do (it’s always reasonable).
  2. Antipattern: the shortcut they took.
  3. How to recognise it: the phrases you hear (“we just need to store a list of tags…”).
  4. Legitimate uses: when the shortcut is actually fine.
  5. Solution: the better design, with SQL.

That “legitimate uses” section is what makes the book fair rather than preachy. Karwin admits that most rules have exceptions, and tells you what they are.

What the book covers

The 24 main antipatterns are grouped into four parts.

Logical database design, the table structure:

  • Jaywalking: storing a comma-separated list of IDs in one column instead of using a separate table.
  • Naive Trees: storing a hierarchy (categories, org charts, comment threads) with only a ParentID, and the alternatives for querying deep trees.
  • ID Required: giving every table a surrogate id column even when a natural or compound key would be better.
  • Keyless Entry: leaving out foreign keys “for flexibility”.
  • Entity-Attribute-Value: one generic table of name/value pairs that can store anything (and query nothing well).
  • Polymorphic Associations: one column that refers to different parent tables depending on another column.
  • Multicolumn Attributes (Tag1, Tag2, Tag3) and Metadata Tribbles (Sales2025, Sales2026 tables).

Physical database design: FLOAT for money (Rounding Errors), lists of allowed values hard-coded in the column definition (31 Flavors), storing files outside the database without a plan (Phantom Files), and indexing without a plan (Index Shotgun).

Queries: treating NULL as an ordinary value (Fear of the Unknown), selecting columns that aren’t in the GROUP BY (Ambiguous Groups), ORDER BY RAND() on big tables, LIKE '%word%' as a search engine, one giant query for everything (Spaghetti Query), and SELECT * (Implicit Columns).

Application development: plain-text passwords, SQL injection, “filling the gaps” in ID numbers, ignoring error messages, treating SQL as second-class code with no version control or tests, and stored procedures adopted (or banned) by habit.

The second edition adds about a dozen short mini-antipatterns (such as NOT IN with a NULL in the list, and “is BIGINT big enough?”), two bonus chapters of common foreign key mistakes, and an appendix that explains normalisation clearly.

What I like

1. The names stick. Once you’ve read the Jaywalking chapter, you’ll never look at a Tags VARCHAR(500) column the same way. The names give a team a shared vocabulary for design reviews.

2. It explains the cost, not just the rule. The Jaywalking chapter shows exactly what breaks: you can’t join on the list, can’t enforce that each ID exists, can’t count or index the values, and the column has a length limit. Seeing the queries you’d have to write is more convincing than “it’s not normalised”.

3. The Naive Trees chapter alone is worth the price. It compares four ways to store a hierarchy (adjacency list, path enumeration, nested sets and closure tables) with the trade-offs of each. Anyone building a chart of accounts, a product category tree or a bill of materials will use it.

4. It’s honest about exceptions. Entity-Attribute-Value is sometimes the right answer; SELECT * is fine in an ad-hoc query. The book says so.

5. Short, independent chapters. You can read the chapter for the problem in front of you today and come back to the rest later.

What could be better

  • The examples are MySQL-first. SQL Server and PostgreSQL readers will need to translate some syntax (and a few MySQL-specific points, like the ENUM type, matter less elsewhere). The design lessons transfer completely.
  • The application code is Python. It’s simple enough to follow, but it won’t feel native to Delphi, C# or PHP developers.
  • It’s not a performance book. “Index Shotgun” is a good chapter, but for indexing in depth read SQL Performance Explained.
  • Not for complete beginners. It assumes you already design tables and write joins.

First edition or Volume 1?

Buy Volume 1 (2022). It keeps all the original antipatterns, updates the examples to current MySQL and Python, and adds the mini-antipatterns and foreign-key chapters. The 2010 edition is still sound, but there’s no reason to choose it unless you find it very cheap.

Should you buy it?

Yes, if you design tables for business applications, review other people’s database designs, or maintain a database you inherited. It’s especially useful for developers who learned SQL on the job and never had formal database design training.

Not yet, if you’re still learning the basics. Start with our beginner SQL books and the Database Normalization guide, then come back.

Our verdict: the most practical database design book you can read after the basics. It will save you from at least one design you’d regret.

Practise what you learn

Several antipatterns in the book have their own guides on this site:

For more books on table design, see the 5 best database design books.

Free SQL book for beginners

Prefer to start with something free? My own beginner book, Simplify SQL for Absolute Beginners, puts the basics in order on one practice database, with exercises and answers. Chapters 1–3 are free as a PDF and EPUB.

Related articles

Scroll to Top