EXERCISES

4.1 How many FDs hold in relvar SP? Which ones are trivial? Which are irreducible?

4.2 Is it true that the concept of FD relies on the notion of tuple equality?

4.3 Give examples from your own work environment of (a) a relvar not in 2NF; (b) a relvar in 3NF but not 2NF; (c) a relvar in BCNF but not 3NF.

4.4 Prove the two definitions of 2NF given in the body of the chapter are logically equivalent.

4.5 Is it true that if a relvar isn’t in 2NF, then it must have a composite key?

4.6 Is it true that every binary relvar is in BCNF?

4.7 (Same as Exercise 1.4.) Is it true that every “all key” relvar is in BCNF?

4.8 Write Tutorial D CONSTRAINT statements to express the FDs {SNO} → {SNAME} and {SNAME} → {SNO} that hold in relvar SNP (see the section BOYCE/CODD NORMAL FORM). Note: This is the first exercise in any chapter that asks you to give an answer in Tutorial D. Of course, I realize you might not be completely conversant with that language; in all such exercises, therefore—for example, Exercises 4.14 and 4.15 below—please just do the best you can. I do think it worth your while at least to attempt the exercises in question.

4.9 Let R be a relvar of degree n. What’s the maximum number of FDs that can possibly hold in R (trivial as well as nontrivial)? What’s the maximum number of keys it can have?

4.10 Given that X and Y in the FD XY are both sets of attributes, what happens if either is the empty set?

4.11 Can you think of a situation in which it really would be reasonable to have a base relvar with an RVA?

4.12 There’s a lot of discussion in the industry at the time of writing of XML databases. But XML documents are inherently hierarchic in nature; so do you think the criticisms of hierarchies in the body of the chapter apply to XML databases? (Well, yes, they do, as I indicated in a footnote earlier in the chapter. So what do you conclude?)

4.13 In Chapter 1, I said I’d be indicating primary key attributes, in tabular pictures of relations, by double underlining. At that point, however, I hadn’t properly discussed the difference between relations and relvars; and now we know that keys in general apply to relvars, not relations. Yet we’ve seen several tabular pictures since then that represent relations as such (I mean, relations that aren’t just a sample value for some relvar)—see, e.g., Figure 4-1 for three examples[44]—and I’ve certainly been using the double underlining convention in those pictures. So what can we say about that convention now?

4.14 (Repeated from the body of the chapter.) Give Tutorial D formulations of the following queries against the relation shown in Figure 4-1:

  1. Get part numbers for parts supplied by supplier S2.

  2. Get supplier numbers for suppliers who supply part P2.

4.15 Suppose we need to update the database to show that supplier S2 supplies part P5 in a quantity of 500. Give Tutorial D formulations of the required update against (a) the non RVA design of Figure 1-1, (b) the RVA design of Figure 4-1.

4.16 Here are some definitions of 1NF from the technical literature. In view of the explanations given in the body of the present chapter, do you have any comments on them?



[44] Yes, I do mean three.