Chapter 14. SQL vs. the Relational Model

Between the idea And the reality ... Falls the Shadow

T. S. Eliot: The Hollow Men (1925)

Well, it should be very clear from the last few chapters that SQL and the relational model aren’t the same thing—or, to state the matter more precisely, it should be clear that SQL, considered as a concrete relational language, fails in all too many ways to realize the ideas and potential of the abstract relational model. Indeed, SQL suffers from both sins of omission and sins of commission: There are aspects of the relational model it doesn’t support properly (or at all), and there are constructs it does support that don’t correspond to anything relational. (Of course, I’m limiting my attention here, as elsewhere throughout the book, to what I’ve been calling the “core features” of SQL.) Some examples of omissions are proper support for equality; proper support for table types; and proper support for the operators of the relational algebra. And some examples of nonrelational features are nulls, duplicate rows, and left to right column ordering.

Now, my principal aim in this book has been to describe and explain the relational model, not SQL. But given SQL’s ubiquitous nature—more particularly, given the fact that, for better or worse, every database professional does need to come to grips with it—I think it’s important for such professionals to have some idea of the multifarious ways in which SQL departs from the prescriptions of the abstract model. In ...

Get Relational Theory for Computer Professionals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.