Exercises 257 Given table R(A,B,C) and the set {R1(A,B), R2(B,C)} satisfies the loss- less decomposition property: 1. Does the multivalued dependency B->>C hold? 2. Is B a candidate key? 3. Is R in 4NF? Given a table “skills_available” with attributes empno, project, and skill, in which the semantics of “skills_available” state that every skill an employee has must be used on every project that employee works on: 1. Is the level of normalization of “skills_available” at least 4NF? 2. Given table R(A,B,C) with actual data shown below: a. Does the multivalued dependency B->>C hold? b. Is R in 5NF? R: A B C wxp wxq zxp zxq wyq zyp Logical Database Design (Generic Problem) Problem 7-1 Design and implement a small database that will be useful to your com- pany or student organization. 1. State the purpose of the database in a few sentences. 2. Construct an ER or UML class diagram for the database. 3. Transform your ER or UML diagram into a working database with five to ten rows per table of data you can make up to fit the data- Teorey.book Page 257 Saturday, July 16, 2005 12:57 PM 258 Exercises base schema. You should have at least four tables, enough to have some interesting queries. Use Oracle, DB2, SQL Server, Access, or any other database system. 4. Show that your database is normalized (BCNF) using FDs derived from your ER diagram and from personal knowledge of the data. Analyze the FDs for each table separately (this simplifies the pro- cess). 5. Demonstrate your working database by displaying the results of four queries. Pick interesting and complex queries (impress us!). OLAP Problem 8-1 As mentioned in Chapter 8, hypercube lattice structures are a specializa- tion of product graphs. Figure 8.16 shows an example of a three-dimen- sional hypercube lattice structure. Figure 8.13 shows an example of a two-dimensional product graph. Notice that the two figures are written using different notations. Write the hypercube lattice structure in Figure 8.16 using the product graph notation introduced with Figure 8.13. Keep the same dimension order. Don’t worry about carrying over the view sizes. Assume the Customer, Part, and Supplier dimensions are keyed by “customer id,” “part id,” and “supplier id,” respectively. Shade the nodes representing the fact table and the views selected for materialization as indicated in Section 8.2.4. Teorey.book Page 258 Saturday, July 16, 2005 12:57 PM 259 Solutions to Selected Exercises Problem 2-2 Teorey.book Page 259 Saturday, July 16, 2005 12:57 PM 260 Solutions to Selected Exercises Problem 4-1 Connect Movie to Video-copy as a 1-to-N relationship (Video-copy at the N side); or, use a generalization from Movie to Video-copy, with Movie being the supertype and Video-copy as the subtype. Problem 6-1 Given the table R1(A, B, C) with FDs A -> B and B -> C: 1. Is A a superkey for this table? Yes 2. Is B a superkey for this table? No 3. Is this table in 3NF, BCNF, or neither? Neither 3NF nor BCNF Problem 6-3 Problem 6-5 Given these FDs, begin Step 1 (LHS reduction): 1. J -> KLMNP 2. JKL -> MNP First, eliminate K and L since J -> KL in (1); merge with (1) Table FDs Level of Normalization customer cid -> cname, caddress BCNF order orderno -> cid BCNF department NONE BCNF salesperson sid -> deptno BCNF item itemno -> deptno, itemname, size BCNF order-dept-sales orderno, sid -> deptno BCNF orderno, deptno -> sid BCNF order-item-sales orderno, itemno -> sid BCNF Teorey.book Page 260 Saturday, July 16, 2005 12:57 PM Solutions to Selected Exercises 261 3. K -> MQ 4. KL -> MNP Third, eliminate L since K -> MNP from merged (3), (4) is redundant 5. KM -> NP Second, eliminate M since K -> M in (3); merge with (3) 6. N -> KP End of Step 1, begin Step 2 (RHS reduction for transitivities): 1. J -> KLMNP First, reduce by eliminating MNP since K -> MNP 2. K -> MQNP Second, reduce by eliminating P since N -> P 3. N -> KP End of Step 2 and consolidation in Step 3: 1. J -> KL 2. K -> MNQ (or K -> MNPQ) First, merge (2) and (3) for superkey rules 1 and 2 3. N -> KP (or N -> K) Steps 4 and 5: 1. J -> KL Candidate key is J (BCNF) 2. K -> MNPQ and N -> K Candidate keys are K and N (BCNF) Problem 6-7 Given these FDs: 1. ABC -> H Step 1: B is extraneous due to AC -> B in (3) 2. ACDF -> BG Step 1: EF are extraneous due to AC -> DF in (3) 3. AC -> BDEFG Step 2: eliminate F from RHS due to B -> F from (5) 4. AW-> BG Step 2: eliminate G from RHS due to B -> AC -> G from (3) and (5) 5. B -> ACF Teorey.book Page 261 Saturday, July 16, 2005 12:57 PM . K -> MNQ (or K -> MNPQ) First, merge (2) and (3) for superkey rules 1 and 2 3. N -> KP (or N -> K) Steps 4 and 5: 1. J -> KL Candidate key is J (BCNF) 2. K -> MNPQ and N ->. 261 3. K -> MQ 4. KL -> MNP Third, eliminate L since K -> MNP from merged (3), (4) is redundant 5. KM -> NP Second, eliminate M since K -> M in (3); merge with (3) 6. N -> KP End. -> KLMNP First, reduce by eliminating MNP since K -> MNP 2. K -> MQNP Second, reduce by eliminating P since N -> P 3. N -> KP End of Step 2 and consolidation in Step 3: 1. J ->