expanding a default value An apple farmer has several farms and at them, numbered boxes to hold
the fruit. The boxes can be numbered 1-99. The farmer has two
tables to keep track of the fruit, one that tells what fruit the box
is supposed to carry, and the other to tell how much fruit weight the
box is carrying. Since almost every box that contains fruit contains
apples, that is the default fruit indicated by box number 0. There
isn't a box 0, but every box that is not listed for some other fruit
is assumed to be for apples. Sometimes he has one or two plum and
pear boxes. His table of boxes, then is as follows:
BOX-FRUIT TABLE:
FARM BOX FRUIT
1 0 macintosh
1 59 pear
1 60 pear
1 91 plum
1 92 plum
1 96 pear
2 0 golden_del
2 60 pear
2 71 plum
2 91 plum
2 98 pear
3 0 red_del
3 1 plum
3 2 plum
3 96 pear
So every box on farm 1 except for 59,60,91,92, and 96 will contain
macintosh if it contains fruit. The following table tells if the box
actually contains fruit by the fact that there is weight value. A box
that is designated for a fruit does not necessarily have fruit in it.
A box that has a fruit weight but is not designated with a type of
fruit actually has the 0 box fruit in it (some type of apple).
BOX WEIGHT TABLE:
FARM BOX WEIGHT
1 1 13
1 2 12
1 3 13
1 59 14
1 65 15
1 91 10
1 96 17
1 99 19
2 1 12
2 2 14
3 1 17
3 2 13
3 3 14
The question is, how do I join the box_fruit table to the box_weight
table so that the box_weight table as a forth column indicating the
fruit type?
Thanks for your help.
Greg |