Relational Theory for Computer Professionals: What Relational Databases Are Really All About
C.J. Date
Beijing Cambridge Farnham Kln Sebastopol Tokyo
Download from Wow! eBook
To my wife Lindy and my daughters Sarah and Jennie with all my love
Special Upgrade Offer
If you purchased this ebook directly from oreilly.com, you have the following benefits:
DRM-free ebooksuse your ebooks across devices without restrictions or limitations
Multiple formatsuse on your laptop, tablet, or phone
Lifetime access, with free updates
Dropbox syncingyour files, anywhere
If you purchased this ebook from another retailer, you can upgrade your ebook to take advantage of all these benefits for just $4.99. to access your ebook upgrade.
Please note that upgrade offers are not available from sample content.
Mathematical science shows what is. It is the language of unseen relations between things.
Ada, Countess of Lovelace, quoted in Dorothy Stein (ed.): Ada: A Life and a Legacy (1985)
That is the essence of science: Ask an impertinent question, and you are on the way to a pertinent answer.
Jacob Bronowski: The Ascent of Man (1973)
Hofstadters Law: It always takes longer than you expect, even when you take into account Hofstadters Law.
Douglas R. Hofstadter: Gdel, Escher, Bach: An Eternal Golden Braid (1979)
About the Author
C. J. Date is an independent author, lecturer, researcher, and consultant, specializing in relational database technology. He is best known for his book An Introduction to Database Systems (8th edition, Addison-Wesley, 2004), which has sold nearly 900,000 copies at the time of writing and is used by several hundred colleges and universities worldwide. He is also the author of numerous other books on database management, including most recently:
From Ventus: Go Faster! The TransRelationalTM Approach to DBMS Implementation (2002, 2011)
From Addison-Wesley: Databases, Types, and the Relational Model: The Third Manifesto (3rd edition, coauthored with Hugh Darwen, 2007)
From Trafford: Logic and Databases: The Roots of Relational Theory (2007) and Database Explorations: Essays on The Third Manifesto and Related Topics (coauthored with Hugh Darwen, 2010)
From Apress: Date on Database: Writings 20002006 (2007) and The Relational Database Dictionary, Extended Edition (2008)
From OReilly: SQL and Relational Theory: How to Write Accurate SQL Code (2nd edition, 2012); Database Design and Relational Theory: Normal Forms and All That Jazz (2012); and View Updating and Relational Theory: Solving the View Update Problem (2013)
Mr. Date was inducted into the Computing Industry Hall of Fame in 2004. He enjoys a reputation that is second to none for his ability to explain complex technical subjects in a clear and understandable fashion.
Preface
The relational model of data is one of the great technical inventions of the last hundred years. Its the foundation of everything we do in the database field; indeed, its what made database management a science, instead of what it was formerly, viz., little more than an ad hoc collection of tricks, techniques, and rules of thumb. Thus, everyone professionally involved in database management, even to the smallest degree, owes it to himself or herself to acquire a reasonable knowledge and understanding of the relational modelfor without it, fully effective and productive job performance is impossible.
Unfortunately, it isnt as easy as it should be to come by the aforesaid reasonable knowledge and understanding. There are several reasons for this state of affairs, but one of the biggest is the language SQL, which is the official standard relational language[] and is supported in some shape or form by just about every database product on the market today. Its widely recognizedat least, it should be widely recognizedthat, considered as a concrete realization of the abstract ideas of the relational model, SQL is very deeply flawed (thats why I put relational in quote marks in the previous sentence). And since for obvious practical reasons everyone in the database world has to know something about SQL, the emphasis in almost all relational (or would-be relational) education tends to be on SQL as such, instead of on the underlying theory. As a consequence, its all too common for people to think that, just because they know SQL, they know relational theory. Sadly, however, the truth is that if you know only SQL as such, then you most certainly dont know that theory. And what you dont know can hurt you.
The principal aim of this book, then, is to teach relational theory, very carefully (indeed, as carefully as I can). A secondary aim is to describe SQLor what might be regarded as the core features of SQL, at any ratefrom the standpoint of that theory. Which brings me to another point ... Some readers will be aware that not all that long ago I published another book on such matters, with the title SQL and Relational Theory: How to Write Accurate SQL Code (2nd edition, OReilly, 2012). Unlike the present book, however, that earlier book was aimed at database practitioners specifically, meaning, typically, people with at least three or four years experience working in the trenches with a database system and using it regularly as part of their normal job (and therefore certainly having a working knowledge of SQL). What that book tried to do was show how to apply relational principles to the use of SQL, thereby making SQL behave almost as if it were a truly relational language (a discipline I referred to in that book as using SQL relationally). Now, theres unavoidably some overlap between that book and the present one; indeed, there are places in the present book where text has been copied and pasted from the earlier book, sometimes almost verbatim. Nonetheless, what youre looking at now is definitely a different book, in part because its aimed at a different audience (see further explanation below). Of necessity, however, there are frequent references in what follows to that earlier book, and in the interest of brevity all such references are given in the form of the abbreviated title alone (viz., SQL and Relational Theory ). Whats more, I think its only fair to say that if youre familiar with that earlier book, then you probably wont have much to gain from the present one. Of course, I dont want to discourage you from reading it!but if you do, I doubt whether youll find much thats really new to you.
Who Should Read This Book
My target audience is computer professionals. Thus, I assume you know something about computers and programming in general, and I assume youre reasonably familiar with at least one conventional programming language. But I dont assume you know anything about databases, relational or otherwise, nor about SQL in particular. Of course, you very likely do at least know that modern database systems are almost all supposed to be relational (whatever that might mean), but I wont rely even on that assumption. Please note, however, that if you do happen to know something about databases already, then you probably need to pay extra careful attention to what this book has to say!you might find you have some