Chapter 6. SQL and Relational Algebra I: The Original Operators

THIS IS THE FIRST OF TWO CHAPTERS ON THE OPERATORS OF THE RELATIONAL ALGEBRA; it discusses the original operators (i.e., the ones mentioned in Chapter 1) in depth, and it also examines certain ancillary but important issues—e.g., the significance of proper attribute (or column) naming once again. It also explains the implications of such matters for our overall goal of using SQL relationally.

Some Preliminaries

Let me begin by reviewing a few points from Chapter 1. First, recall that each algebraic operator takes at least one relation as input and produces another relation as output. Second, recall too that the fact that the output is the same kind of thing as the input—they’re all relations—is the closure property of the algebra, and it’s that property that lets us write nested relational expressions. Third, I gave outline descriptions in Chapter 1 of what I called “the original operators” (restrict, project, product, intersect, union, difference, and join); now I’m in a position to define those operators, and others, much more carefully. Before I can do that, however, I need to make a few more general points:

  1. The operators of the algebra are generic: They apply, in effect, to all possible relations. For example, we don’t need one specific join operator to join employees and departments and another, different, join operator to join suppliers and shipments. (Incidentally, do you think an analogous remark applies to object ...

Get SQL and Relational Theory 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.