EXAMPLE 7

Consider a company in which every employee is required to be in exactly one department and every department is required to have at least one employee. Figure 15-5 shows sample values (in outline) for an RM/T design for this situation:[161]

Employees and departments—sample values

Figure 15-5. Employees and departments—sample values

With reference to those sample values, however, we see there are exactly five employees and exactly three departments. Since every employee must be in exactly one department and every department must have at least one employee, why not define one department—D3, say—to be the “default” one, and adopt a rule that says any employee mentioned in EMP and not EMPDEPT is in that default department? In terms of Figure 15-4, this rule would allow us to omit the tuples (E4,D3) and (E5,D3) from EMPDEPT. Note that if we don’t adopt such a rule, then the design clearly involves some redundancy once again—to be specific, it’s subject to the following equality dependencies:

     CONSTRAINT EVERY_EMP_HAS_A_DEPT  EMP { ENO }  = EMPDEPT { ENO } ;
     CONSTRAINT EVERY_DEPT_HAS_AN_EMP DEPT { DNO } = EMPDEPT { DNO } ;

There seem to me to be at least two factors that militate against adopting such a “default department” design, however. The first is that the choice of which department to make the default is likely to be arbitrary. The second is that now we need to be extremely careful over the meaning of relvar EMPDEPT! The obvious predicate Employee ENO is in department DNO doesn’t work. Why not? Because, under that predicate (and assuming department D3 is the default), omitting the tuple (E5,D3), say, would mean—thanks to The Closed World Assumption—that employee E5 isn’t in department D3! So the predicate has to be something like this:

Employee ENO is in department DNO (which is not the default department number D3).

Now, this predicate does work (I think!), but it’s pretty tricky. Suppose the tuple (E1,D1) appears in the relvar, as shown in Figure 15-5. Then the corresponding proposition is:

Employee E1 is in department D1 (which is not the default department number D3).

And of course this proposition evaluates to TRUE. OK so far. However, now suppose there’s no tuple in the relvar for employee E5. The intended interpretation is, of course, that employee E5 is in department D3; but what does The Closed World Assumption actually say? Well, first of all, observe that, e.g., the specific tuple (E5,D1) doesn’t appear. By The Closed World Assumption, then, the following must be a true proposition:

It’s not the case that employee E5 is in department D1 (which is not the default department number D3).

Or a little more formally:

NOT ( E5 is in D1 AND D1 ≠ D3 )

By De Morgan’s laws, this expression is equivalent to:

E5 is not in D1 OR D1 = D3

Since D1 = D3 is false, this expression reduces to just “E5 is not in D1,” which is what we want (I mean, it’s a true proposition).

A similar analysis shows that we can infer that E5 certainly isn’t in any department that’s not the default one, D3. But what about that default one? Well, the tuple (E5,D3) doesn't appear, and so the following must be a true proposition:

NOT ( E5 is in D3 AND D3 ≠ D3 )

Equivalently:

E5 is not in D3 OR D3 = D3

Since D3 = D3 is true, this expression reduces to just TRUE. Note, however, that this proposition doesn't actually tell us E5 is in D3! Now, perhaps we can infer this latter fact, given that E5 does exist and certainly isn’t in any other department (?). But I seriously doubt whether users would want to have to deal with such convoluted, logic-chopping arguments in practice.



[161] Is EMPDEPT in that figure a P-relvar for employees, departments, or both? Justify your answer! To pursue the point a moment longer: An RM/T design might not be the best option in this example, because there’s necessarily a one to one correspondence between EMP and EMPDEPT, and there seems little reason not to collapse those two relvars into one.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset