There’s nothing like a relation to do the business.
—with apologies to William Makepeace Thackeray: Vanity Fair (1847-1848)
In this chapter, I want to explain exactly what it means for data to “look relational,” as I put it in Chapter 1; in other words, I want to explain exactly what relations are (among other things). First, however, I need to remind you of something else I said in that chapter: namely, (a) that the relational model is, above all, precise; (b) that such precision requires precise or formal terminology; and (c) that such formal terminology can be a little daunting (indeed, it can act as a barrier to understanding). But the concepts the terminology refers to are really quite straightforward, once you’ve struggled through the formalism, and I hope you’re ready now to make the necessary effort.
Consider the suppliers-and-parts database once again (see Figure 2-1, a repeat of Figure 1-1 from Chapter 1). From a relational point of view, what I previously called the “files” or “tables” in that database are really relations. Now, a relation is a mathematical construct, and it has a very precise mathematical definition, which I’ll give at the very end of the chapter—but for the moment it’s sufficient to know that a relation can be thought of, and depicted, as a certain kind of table. Moreover, every relation consists of a heading and a body, where:
The heading consists of a set of attributes (represented as columns in those tabular ...