The quotient of two tables is not used often, but has a very specific use. It arises when we wish to select those rows of a table that are sufficient to provide all possible values in certain columns. As an example, imagine a business that makes furniture. The database for this business has a table on the types of wood that they use, as well as on suppliers of wood and which types they supply. Examples are shown in Table B-1 and Table B-2 (of course, these tables would include more columns, but this is just to illustrate the point).
Sname | Type |
Jones Wood Supply | mahogany |
Austin Hardwoods | red oak |
Orange Coast | mahogany |
Jones Wood Supply | poplar |
West Lumber | poplar |
Jones Wood Supply | walnut |
Austin Hardwoods | walnut |
Jones Wood Supply | red oak |
Orange Coast | walnut |
West Lumber | red oak |
Orange Coast | poplar |
Orange Coast | red oak |
Fred’s Woods | walnut |
Note that there are four types of wood. Suppose we want to know which suppliers supply all four types—a reasonable question. The answer, which is shown in Table B-3 is called the quotient of the table SUPPLIERS/TYPE by WOOD, written SUPPLIER/TYPE ÷ WOOD.
As you can see, the quotient can certainly come up in real-life situations. The reason for defining a specific operation for this purpose is that expressing the quotient in terms of the other relations is a bit complex. Let’s do it to illustrate the virtue of the quotient.
The idea is actually relatively simple. We first get a table, called T, containing all rows that are not in the SUPPLIER/TYPE table. This new table will involve only those suppliers who have not supplied all types of wood. (If a supplier supplies all four types of wood, then there will be four rows in the SUPPLIER/TYPE table and therefore no rows in T.) Then we subtract this from a table containing all (participating) suppliers. Here is the step-by-step procedure.
Form the table:
R = [projSName(SUPPLIER/TYPE) ↔ WOOD] -
SUPPLIER/TYPE
Table B-4, the table R, contains all rows of the form (SName,Type) that are not in the SUPPLIER/TYPE table. Put another way, it is the set of “missing possibilities” in the Cartesian product (which is the set of all possibilities).
Form the table:
projSName(R)
That is, project the table R onto the SName column, giving the SUPPLIERS that do not supply all types of wood, as shown in Table B-5.
Finally, form the table:
projSName(SUPPLIERS/TYPE) - projSName (R)
That is, subtract the table in Step 2 from the first column of the SUPPLIERS/TYPE table. This gives the suppliers that supply all four types of wood, as Table B-6 illustrates.
3.145.107.181