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.
About this Book
- 328 pages
- Release: P3.0 (2012-03-27)
- ISBN: 978-1-93435-655-5
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.
Contents and Extracts
- Logical Database Design Antipatterns
- Naive Trees excerpt
- ID Required
- Keyless Entry
- 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
- Rules of Normalization
Comments and Reviews
Ask Felgall said:
A ‘must have’ book for anyone writing SQL who hasn’t done an SQL course and very useful even if you have.
I would highly recommend it to anyone who is interested in a good list of do’s and don’ts of database programming, explained clearly and with precise examples that relate very well to real-world examples.
Data and Technology Today said:
SQL Antipatterns should become a useful tool for DBAs and database programmers to help them create well-designed databases and applications…and to help us eliminate these common errors from our database implementations.
—Mike Naberezny Partner at Maintainable Software; Coauthor of "Rails for PHP Developers"
This book is obviously the product of many years of practical experience with SQL databases. Each topic is covered in great depth, and the attention to detail in the book was beyond my expectations. Although it’s not a beginner’s book, any developer with a reasonable amount of SQL experience should find it to be a valuable reference and would be hard-pressed not to learn something new.
Arjen Lentz said:
Executive Director of Open Query
I really like how Bill has approached this book; it shows his unique style and sense of humor. Those things are really important when discussing potentially dry topics. Bill has succeeded in making the teachings accessible for developers in a good descriptive form, as well as being easy to reference later. In short, this is an excellent new resource for your pragmatic bookshelf!
—Frederic Daoud Author of "Stripes: ...And Java Web Development Is Fun Again" and "Getting Started with Apache Click"
Bill has written an engaging, useful, important, and unique book. Software developers will certainly benefit from reading the antipatterns and solutions described here. I immediately applied techniques from this book and improved my applications. Fantastic work!
—Marcus Adams Senior Software Engineer
I am a strong advocate of best practices. I prefer to learn from other people’s mistakes. This book is a comprehensive collection of those other people’s mistakes and, quite surprisingly, some of my own. I wish I had read this book sooner.