Appendix B. SQL Departures from the Relational Model

In this appendix I summarize, mainly for purposes of reference and with little by way of additional commentary, some of the ways in which SQL—by which I mean, as always in this book, the standard version of that language except where otherwise noted—departs from the relational model. Now, I know there are those who will quibble over specific items in this list; it’s not easy to compile such a list, especially if it’s meant to be orthogonal (i.e., if an attempt is made to keep the various items all independent of one another). But I don’t think such quibbling is important. What’s important is the cumulative effect, which quite frankly I think is overwhelming.[189]

  • SQL fails to distinguish adequately between table values and table variables.

  • SQL tables aren’t the same as relations (or relvars), because they either permit or require, as the case may be, (a) duplicate rows; (b) nulls; (c) left to right column ordering; (d) anonymous columns; (e) duplicate column names; (f) pointers; and—at least in some products, though not in the standard as such—(g) hidden columns. Note that most if not all of these differences constitute violations of The Assignment Principle.

  • SQL has no proper table literals.

  • SQL often seems to think views aren’t tables.

  • SQL tables (views included!) must have at least one column.

  • SQL has no explicit table assignment operator.

  • SQL has no explicit multiple table assignment a fortiori (nor does it have an INSERT/DELETE ...

Get SQL and Relational Theory, 2nd Edition 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.