Design sort-based and hash-based algorithms for computing the relational division operation (see Practice Exercise 2.9 for a definition of the division operation).


From Practice Exercise 2.9 we know that we can express the relational division operation as follows:

From section 15.6.2 we know how to implement projection.

From section 15.6.3 we know how to implement set difference.

And for the cartesian product we can use Block Nested-Loop Join discussed in section 15.5.2 (except that we don’t have any predicate to test.)

Thus to implement simply use pipelined evaluation (see section 15.7.2) on the following expression:

Note: For an alternative answer to the above you can read page 5 of https://www.db-book.com/Practice-Exercises/PDF-practice-solu-dir/15.pdf