small medium large xlarge

SQL Antipatterns: Avoiding the Pitfalls of Database Programming


Cover image for SQL Antipatterns
Pages 328
Release P4.0 (2014-08-08)
ISBN 978-1-93435-655-5

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 book shows you all the common mistakes, and then leads you through the best fixes. What’s more, it shows you what’s behind these fixes, so you’ll learn a lot about relational databases along the way.

Choose Your Format(s)
  • $44.95 In Stock

    Save $15.00 on the combo pack.

  • $34.95 In Stock
  • $25.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About This Book

Each chapter in this book helps you identify, explain, and correct a unique and dangerous antipattern. The four parts of the book group the antipatterns in terms of logical database design, physical database design, queries, and application development.

The chances are good that your application’s database layer already contains problems such as Index Shotgun, Keyless Entry, Fear of the Unknown, and Spaghetti Query. This book will help you and your team find them. Even better, it will also show you how to fix them, and how to avoid these and other problems in the future.

SQL Antipatterns gives you a rare glimpse into an SQL expert’s playbook. Now you can stamp out these common database errors once and for all.

Whatever platform or programming language you use, whether you’re a junior programmer or a Ph.D., SQL Antipatterns will show you how to design and build databases, how to write better database queries, and how to integrate SQL programming with your application like an expert. You’ll also learn the best and most current technology for full-text search, how to design code that is resistant to SQL injection attacks, and other techniques for success.

Read the reviews .

You Might Also Like

  • Cover Image For Release It!…
  • Cover Image For Pragmatic Version Control Using Git…
  • Cover Image For Debug It!…


Each of our books has its own dedicated discussion area, where readers help each other out. Many authors also choose to drop by.

Join in…

Here are some recent topics:

Contents & Extracts

Full Table of Contents


  • Logical Database Design Antipatterns
    • Jaywalking
    • Naive Trees excerpt
    • ID Required
    • Keyless Entry
    • Entity-Attribute-Value
    • Polymorphic Associations
    • Multi-Column Attributes
    • Metadata Tribbles
  • Physical Database Design Antipatterns
    • Rounding Errors
    • 31 Flavors
    • Phantom Files
    • Index Shotgun
  • Query Antipatterns
    • Fear of the Unknown
    • Ambiguous Groups
    • Random Selection excerpt
    • Poor Man’s Search Engine
    • Spaghetti Query
    • Implicit Columns
  • Application Development Antipatterns
    • Readable Passwords
    • SQL Injection excerpt
    • Pseudokey Neat-Freak
    • See No Evil
    • Diplomatic Immunity
    • Magic Beans
  • Appendixes
    • Rules of Normalization
    • Bibliography

Brought to You By

Bill Karwin has been a software engineer for over twenty years, developing and supporting applications, libraries, and servers such as Zend Framework for PHP 5, the InterBase relational database, and the Enhydra Java application server. Throughout his career, Bill has shared his knowledge to help other programmers achieve success and productivity. Bill has answered thousands of questions, giving him a unique perspective on SQL mistakes that most commonly cause problems.