Goodreads helps you keep track of books you want to read.
Start by marking “SQL Antipatterns” as Want to Read:
SQL Antipatterns
Enlarge cover
Rate this book
Clear rating
Open Preview

SQL Antipatterns

3.98  ·  Rating details ·  366 ratings  ·  47 reviews
Bill Karwin has helped thousands of people write better SQL and build stronger relational databases. Now he's sharing his collection of antipatterns--the most common errors he's identified in those thousands of requests for help.

Most developers aren't SQL experts, and most of the SQL that gets used is inefficient, hard to maintain, and sometimes just plain wrong. This
Paperback, 328 pages
Published July 2nd 2010 by Pragmatic Bookshelf (first published June 25th 2010)
More Details... Edit Details

Friend Reviews

To see what your friends thought of this book, please sign up.

Reader Q&A

To ask other readers questions about SQL Antipatterns, please sign up.

Be the first to ask a question about SQL Antipatterns

This book is not yet featured on Listopia. Add this book to your favorite list »

Community Reviews

Showing 1-30
Average rating 3.98  · 
Rating details
 ·  366 ratings  ·  47 reviews

More filters
Sort order
Start your review of SQL Antipatterns
Anton Antonov
Oct 18, 2015 rated it it was amazing  ·  review of another edition
Shelves: technical
The book that every modern developer should read. As we all know, databases are an essential part of software development. With the rise of NoSQL databases, the relational ones start to get less attention than they deserve, but that all comes right whenever you read about the next big project/company deciding to store their relational data in a non-relational NoSQL solution *cough* *cough* *cough* MongoDB followers *cough* *cough*.

And here we are. You stopped to read this review and possibly
Aug 02, 2011 rated it really liked it
I'm a software developer who gets paid mostly for working on the back end portion of solutions and I've worked in both small and large companies. I am not an SQL guru and I am more than happy to let somebody else review and fine tune any SQL that the solution uses. If I'm lucky, I'll be working in an organization large enough to have full-time SQL experts who can help me out. More times than not, however, the development team has to craft the SQL ourselves. As of late, I've been letting ...more
Apr 02, 2010 rated it really liked it
Recommends it for: Novice-to-Intermediate Developers
First, this is based on B6.0 printing, version 2010-4-1.

I was hoping to get a little more out of this book. I bought it because I saw the excerpt from the chapter "Naive Trees" and the statement "most developers aren’t SQL experts, and most of the SQL that gets used is inefficient, hard to maintain, and sometimes just plain wrong," on PragProg Bookshelf. Not wanting to create poor SQL, I knew I needed this book.

I struggled for a long time with a database that had a large tree structure, so I'm
David Lindelof
Sep 25, 2011 rated it really liked it
This is a catalog of what the author considers widespread bad practices in the use of relational databases and SQL programming.

Most antipatterns are about misunderstandings on good database design; for example, the author discusses such timeless classics as implementing many-to-many relationships by putting multiple comma-separated values in a row. For instance, the database backing a blog whose posts can have an arbitrary number of tags would have a column TAGS with entries such as 'tag1, tag2,
Michael Gaudet
Feb 14, 2018 rated it really liked it
I thought this book was ok. All the “anti patterns” are good to be aware of, but I’d say they vary in likelihood. Some are mistakes I would expect only a real newbie to make. Others, like SQL injection, are useful sections that try to dispel myths believed by experienced users even now.

My edition was published in 2010, so I shouldn’t be surprised that the non-SQL code examples (such as for dynamic SQL) are in PHP. I also can’t fault the book’s age for having such a small section on relational
Nov 25, 2017 rated it really liked it
Shelves: software
It's a pretty good book on SQL. It is aimed at people with beginner-medium SQL experience.
Beginners will not really understand what's happening there.
And if you've written the database interface layer for 3-5 apps, it might be partially interesting for you.
If you're advanced with SQL, you already know these patterns.
Jul 08, 2013 rated it liked it
Shelves: technical, sql
This book was recommended by some programmer friends of mine, and proved to be a good read. It is not about TSQL thought. The book is mainly about some basic ideas that people should have in mind when designing database models. It’s a fast read.
Ispiriants Volodymyr
Jun 24, 2016 rated it it was amazing
Shelves: database
It's a very good book for the people, who just learned SQL. I regret that I did not read it before, because it will resolve some of issues during my work.
Matias Fernandez
Sep 09, 2016 rated it it was amazing
As someone struggling to design my website's database, this book hit the spot. I couldn't have imagined all the things I had wrong. I'm so glad I found this gem.
May 10, 2018 rated it it was ok
With many relational database systems available in the market, I find there is not much need to design a RDBMS product to the level this book gives. Working with data analytics, I found part 3 to be the most useful with Query Antipatterns. Majority of the issues are addressed with proper training so I can see this book would be good for those who are self learners who may not have many opportunities for formal training. The book is written in a format that gives the antipattern as an example, ...more
Phil Eaton
Oct 29, 2017 rated it really liked it
This enjoyable read covers many anti-patterns, clearly and with compelling reason, that I've both been thrust into and put myself into. It is the first book I've read on database design and optimization after 5 years of professional software development. It is a great jumping point for the topic with the numerous other books it cites.
Viraj Bhosle
Jul 13, 2019 rated it it was amazing
Shelves: database
I loved this book and my data engineer friend too. For intermediate, advance users of database, few chapters will appear to be quite basic. For beginners, there is a lot to learn from this book. It explains pros and cons behind every database design trade off, which helps you make wise choices.
Oct 15, 2018 rated it it was amazing
If in one way or another you are involved with databases you should read this book. Developers and DBAs alike would benefit from this read. It is very well written, great content and easy to follow. Also, no superfluous content in this one.
Kiril Kirilov
Jul 23, 2019 rated it it was amazing
Really pleasant book. Of course, it is not anything extraordinary.
Jun 22, 2019 rated it it was amazing
Shelves: programming
Obligatory reading for every software engineer out there who deal with databases in daily basis.
Mar 02, 2017 rated it really liked it
While I enjoyed reading this book, I found most of the example trivial from the RoR best practices and conventions, I would recommend it if you want to level up your sql game.
Feb 23, 2017 rated it liked it
The book was easy to read and well explained. However, I haven't seen very many of his anti-patterns in practice with actual projects that I've worked on in the past. Maybe I'm just lucky to work on things that were well built or I'm more experienced than the target audience for the book. However, I didn't learn too much that I didn't already know.
Mar 04, 2015 rated it really liked it
In the world of SQL you can do many mistakes. This will not only result in slow queries but in hours wasted to figure out what you try to achieve. Bill Karwin collected the most uses anti-patterns and explains how you can do a better job. His solutions are not only shorter to write and faster to execute, but they are simpler to maintain as well.
The catalogue of anti-patterns follows a bit the one from Refactoring: Improving the Design of Existing CodeRefactoring in which every (anti-) pattern
Eric Wisdahl
Feb 05, 2011 rated it really liked it
Shelves: textbooks, tech-books
SQL Antipatterns: Avoiding the Pitfalls of Database Programming reads a heck of a lot like it sounds it would. This book is full of good examples of bad practices (including some that SEEM like they would help you out) and ways that you can avoid them. As a few examples, multi-valued columns, multi-column attributes, too many indexes, replacing null values with a different known value, etc.

I'd say that this book is best read by a junior / mid-level DBA or developer as it will provide a lot of
Simon Fermor
Apr 27, 2015 rated it really liked it
This is a very readable book covering best practice in relational database design and some related areas of interest to software developers. The book provides examples of bad practice (anti-patterns), explains the impact of bad decisions and provides alternative solutions to the situations discussed.

There is an appendix covering the principles of relational databases, which is useful as a reminder. For the reader with no experience in database design another book should be read first to gain a
Eric Hogue
This books describes common errors developers make when dealing with databases. It's a good book even though I haven't learn that much from it.

Sadly I have made many of the errors described in the book. And I have fixed quite a few in code from other. So I knew most of the anti patterns and their solution.

It's still a good read. It puts names on errors that lots of developers do. It gives solutions to those errors. Even better, it explains in dept why they are errors and the problems you might
Sep 25, 2010 rated it really liked it
A very good book for younger developers, but I've learned most of these solutions already so I wanted a bit more out of this book. I picked it up because of its premise (common mistakes) and the chapter on trees, which while interesting (and useful to others I've recommended the book to) wasn't as insightful as I'd hoped. Having a strong background in this topic, I was able to skim through it easily in one afternoon. The book is well-written, and I will likely require it of my students if I ever ...more
Miloš Milivojević
Feb 11, 2015 rated it really liked it  ·  review of another edition
Shelves: professional
Very well written - concise and to the point text interspersed with both SQL and general software development bits of wisdom, followed by simple but not simplistic examples. Although I've rarely seen any of the antipatterns in practice, the greatest benefit from reading this book has been in the solution sections which always listed several approaches to thwarting the antipattern and thus never failed to gave me a new perspective on doing things.
Vasil Todorov
Feb 06, 2016 rated it it was amazing  ·  review of another edition
A great book, that is easy to read, and includes many important topics. I would say it is an intermediate book about databases, so if you are a database expert there won't be much to learn from it. I didn't like the usage of php inside the book. Also in the sections "regognizing the antipattern" the given examples did sound a bit stupid. I still give it 5 stars, the ratio between what's learnt / time spent is really good.
Jan 18, 2015 rated it liked it
A sound coverage of typical SQL schema mistakes, with a useful exposition of the choices available in implementing inheritance. Less useful to a practitioner than I was hoping because he shies away from taxing the reader too much - thus normal forms are vaguely explained and no precise meaning is ascribed to them. Dinged also for nothing on de normalization and what you need to be careful about when doing tbis, after all de normalization can look like an anti pattern.
Vasil Kolev
Jul 27, 2012 rated it really liked it
Shelves: tech
The book is good and has a good explanation of some very common errors and stupidities (especially the chapter on trees was very interesting for me, as I haven't seen some of the solutions). The bad side is that the book is bit bloated, and the last part on application-related anti-patterns doesn't really fit in.
Zlatin Stanimirov
Mar 29, 2015 rated it really liked it
A very good book which highlights all of the common anti patterns which are met when designing and querying a database. If you are working with relational databases definitely give it a read. The book also tries to give examples of when it may be acceptable to use the anti-patterns.
Mar 19, 2016 rated it really liked it
Well structured and written. Some chapters felt a bit too obvious, but that is very subjective. I would recommend it especially to young web developers and all the "rockstar ninjas", who think they do not need to read it.
Jul 22, 2013 rated it really liked it
Shelves: sql-server, database
Great examples and very well written.
I am sure that I will get back to the examples during future discussions.
Apr 29, 2013 rated it it was ok
A must-read for beginners, good for intermediate. Advanced SQL programmers should know all this already.
« previous 1 next »
There are no discussion topics on this book yet. Be the first to start one »

Readers also enjoyed

  • The Pragmatic Programmer: From Journeyman to Master
  • Design Patterns: Elements of Reusable Object-Oriented Software
  • Clean Code: A Handbook of Agile Software Craftsmanship
  • The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in Technology Organizations
  • How to Take Smart Notes: One Simple Technique to Boost Writing, Learning and Thinking – for Students, Academics and Nonfiction Book Writers
  • King Solomon's Mines (Allan Quatermain, #1)
  • Building Microservices: Designing Fine-Grained Systems
  • JavaScript: The Definitive Guide
  • Stargate
  • Maven: The Definitive Guide
  • Os Maias
  • Top Dog: Impress and Influence Everyone You Meet
  • The Plot to Scapegoat Russia: How the CIA and the Deep State Have Conspired to Vilify Putin
  • The Personal MBA: Master the Art of Business
  • Designing Data-Intensive Applications
  • High Performance JavaScript
  • Scala for the Impatient
  • Bébé Day by Day: 100 Keys to French Parenting
See similar books…

Goodreads is hiring!

If you like books and love to build cool products, we may be looking for you.
Learn more »