Database Reference
In-Depth Information
Division
The division process is best illustrated by considering the division of a table with two columns by a table with
a single column, which is the most common situation in which this operation is used. Consider the first two
tables shown in Figure 2-44. The first table contains two columns: OrderNum and PartNum. The second table
contains only a single column, PartNum.
65
Result of dividing
OrderLine by Part
OrderLine
Part
OrderNum
PartNum
PartNum
DR93
DW11
OrderNum
21610
21608
AT94
21610
DR93
21610
DW11
21613
KL62
21614
KT03
21617
BV06
21617
CD52
21619
DR93
21623
KV29
FIGURE 2-44
Dividing one table by another
The quotient (the result of the division) is a new table with a single column named OrderNum (the col-
umn from table A that is not in table B). The rows in this new table contain those order numbers from the
OrderLine table that
all the parts appearing in the Part table. For an order number to appear in the
quotient, a row in the OrderLine table must have that order number in the OrderNum column and DR93 in
the PartNum column. Also, the OrderLine table must have a row with this same order number in the
OrderNum column and DW11 in the PartNum column. It doesn
match
t matter if other rows in the OrderLine table
contain the same order number as long as the rows with DR93 and DW11 are present. With the sample data,
only order number 21610 qualifies. Thus, the result is the final table shown in the figure.
'
Search WWH ::




Custom Search