Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596100124/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Foreword
I remember clearly the first time I didn't buy a book by Chris Date . That's right, I said "didn't buy." It was late 1991 or early 1992. I was in a small bookstore in the Saginaw, Michigan mall, looking for a book on SQL. I found one, too, by some guy named C. J. Date, whom I'd never heard of. The book looked good, the writing was clear, half of me wanted to buy it, but... oh, the price! I stood there holding a book in my hands that was about 1/4-inch thick, had less than 200 pages, yet it cost $30--a lot for me back in those days. I struggled with myself for a bit, then, reluctantly, I put the book back on the shelf and walked away.
What a mistake! A career was in the balanceI just didn't know it at the time.
I redeemed myself, though, by convincing my boss that the company should buy the book for me. It took them a month to get around to ordering the book, but it finally arrived, and I read it, not once, but several times. One of the best and most educational parts of the book (for me) was an appendix with Chris's critique of the then-current SQL language.
I learned a lot from Chris, from that book. I became enamored of working with databases, and fascinated by the idea of a declarative language like SQL: I could just describe the results I was after, and the database engine would do the work of deriving those results for me. I also learned more about Chris, and about his role working with Codd from almost the very beginning of the relational era. For several years I subscribed to a magazine called Database Programming and Design for the sole reason that Chris wrote a column in it.
The knowledge I gained about SQL from Chrisbeginning with that one thin, expensive little book that I was so reluctant to buyhas had a ripple effect down through the years until today. My introduction to databases at that time was a major turning point in my career, and Chris's clarity and rigor had a profound effect on the way in which I viewed SQL and database technology in general. Ever since, SQL has been one of my favorite things to write, to learn about, and, more recently, to write about.
I shudder to think of what my career might be today had I not gotten my hands on Chris's book. Don't make the same mistake I almost made. Don't put this book back on the shelf. Read it! Learn from someone who helped to invent and refine the relational model on which your career depends. You may not agree with everything Chris has to say, and you don't need to, but do understand what he says. Take the time to understand his vision of the relational model today. Take the time to understand the issues he raises with respect to how vendors (sometimes wrongly) implement that model in their products. Do these things, and you'll find yourself standing head-and-shoulders above your peers who haven't taken the time to ground themselves in the fundamentals.
If I can leave you with one thought, it's on the importance of enthusiasm for learning. It's been a great honor for me to edit this book by Chris Date, and an honor I never even remotely expected to have. I learned a lot from talking with Chris and reading his drafts. How did my work on this book come about? It was the indirect result of intense discussion of subquery optimization in SQL with several very smart people on the Oracle-L list whom I'm humbled to call colleagues. Even more indirectly, I suppose, my work on this book is a result of my reading Chris's writings for the first time, so very many years ago. Curiosity and a love for learning have taken me a lot further in my career than I ever used to dream of going, and they can do the same for you.
Jonathan Gennick
Munising, Michigan
March 2005
Preface
After many years working in the database community in various capacities , I've come to realize there's a real need for a book for practitioners (not novices) that explains the basic principles of relational theory in a way not tainted by the quirks and peculiarities of existing products, commercial practice, or the SQL standard. I wrote this book to fill that need. My intended audience is thus experienced database practitioners or other database professionals who are honest enough to admit they don't understand the theory underlying their own field as well as they might, or should. That theory is, of course, the relational modeland while it's true that the fundamental ideas of that theory are all quite simple, it's also true that they're widely misrepresented, or underappreciated, or both. Often, in fact, they don't seem to be understood at all. For example, here are a few relational questions. How many of them can you answer?
What exactly is first normal form?
What's the connection between relations and predicates?
What's semantic optimization?
What's a join dependency?
Why is semidifference important?
Why doesn't deferred integrity checking make sense?
What's a relation variable?
What's nonloss decomposition?
Can a relation have an attribute whose values are relations?
What's the difference between SQL and the relational model?
Why is The Information Principle important?
How does XML fit with the relational model?
This book provides answers to these and many related questions. Overall, it's meant to help database practitioners understand relational theory in depth and make good use of that understanding in their professional day-to-day activities.