Chapter 7. SQL and Relational Algebra II : Additional Operators

Algebra is the part of advanced mathematics that is not calculus.

John Derbyshire: Unknown Quantity: A Real and Imaginary History of Algebra (2006)

As I’ve said several times already, an operator of the relational algebra is an operator that takes one or more relations as input and produces another relation as output. As I observed in Chapter 1, however, any number of operators can be defined that conform to this simple characterization. Chapter 6 described the original operators (join, project, etc.); the present chapter describes some of the many additional operators that have been defined since the relational model was first invented. It also considers how those operators might best be realized in SQL.

Note: By its nature, this chapter is necessarily something of a miscellany. Thus, you might want just to skim it lightly on a first pass, and come back to it later if you need to gain a deeper understanding of any of the topics discussed. Perhaps it would help to say that from a practical point of view, the most important topics are probably these:

  • Semijoin and semidifference (MATCHING and NOT MATCHING)

  • EXTEND

  • Image relations

  • Aggregate operators

But I’ll begin with a brief discussion of exclusive union.

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.