Almost inevitably, this has been the longest chapter in the book. Even so, I haven't covered "all known" algebraic operators, nor have I explained every last detail of the ones I did cover; but I hope I have covered enough to give you a good sense of what the algebra is all about. To review briefly, here's a list of the operators I did discuss: rename, restrict, project (including the ALL BUT form), join, semijoin (MATCHING), intersection, union, disjoint union (D_UNION), difference, semidifference (NOT MATCHING), product, divide, theta-join (including equijoin), extend, summarize, group, and ungroup. I also discussed certain nonalgebraic operators: relational comparisons, INSERT, DELETE, and UPDATE (and relational assignment), and ORDER BY. Other topics I covered include: Closure: I explained the need for a set of relation type inference rules, so that we always know the type of the result of any given relational expression. Primitive operators: I showed that many of the operators are in fact shorthand for certain combinations of others. In particular, intersect and product are special cases of join, and difference is a special case of semidifference. Join: I also showed that thanks to the fact that join is both commutative and associative it was possible to define an n-adic or prefix version of the operator (where n is any integer greater than or equal to zero). The join of no relations at all is TABLE_DEE. SQL expressions: I gave a conceptual algorithm for evaluating SQL SELECT - FROM - WHERE expressions. I also suggested that the SELECT - FROM - WHERE template is sometimes too rigid. Summaries versus aggregate operators: I stressed the point (without getting into too much detail) that these are logically distinct constructs. Expression transformation: I briefly explained the distributive, commutative, and associative laws and described their role in optimization ("query rewrite"). WITH: I discussed the use of WITH in simplifying expression formulation by allowing names to be introduced for the results of subexpressions. |