About This Title

Pages: 328
Published: June 2010
ISBN: 9781934356555
Out of Print

SQL Antipatterns

Avoiding the Pitfalls of Database Programming

by Bill Karwin

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.

Out of print

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.

What You Need



  • P4.0 2014/08/08
  • P3.0 2012/03/27
  • P2.0 2011/01/06
  • P1.0 2010/06/09

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


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.

Out of print

Related Titles:

About This Title

Pages: 328
Published: June 2010
ISBN: 9781934356555
Edition: 1
Out of Print