This action might not be possible to undo. Are you sure you want to continue?

1

**CHAPTER 10: FUNCTIONAL DEPENDENCIES AND NORMALIZATION FOR RELATIONAL DATABASES
**

Answers to Selected Exercises 10.17 Suppose we have the following requirements for a university database that is used to keep track of students transcripts: (a) The university keeps track of each student's name (SNAME), student number (SNUM), social security number (SSSN), current address (SCADDR) and phone (SCPHONE), permanent address (SPADDR) and phone (SPPHONE), birthdate (BDATE), sex (SEX), class (CLASS) (freshman, sophomore, ..., graduate), major department (MAJORDEPTCODE), minor department (MINORDEPTCODE) (if any), and degree program (PROG) (B.A., B.S., ..., Ph.D.). Both ssn and student number have unique values for each student. (b) Each department is described by a name (DEPTNAME), department code (DEPTCODE), office number (DEPTOFFICE), office phone (DEPTPHONE), and college (DEPTCOLLEGE). Both name and code have unique values for each department. (c) Each course has a course name (CNAME), description (CDESC), code number (CNUM), number of semester hours (CREDIT), level (LEVEL), and offering department (CDEPT). The value of code number is unique for each course. (d) Each section has an instructor (INSTUCTORNAME), semester (SEMESTER), year (YEAR), course (SECCOURSE), and section number (SECNUM). Section numbers distinguish different sections of the same course that are taught during the same semester/year; its values are 1, 2, 3, ...; up to the number of sections taught during each semester. (e) A grade record refers to a student (Ssn), refers to a particular section, and grade (GRADE). Design an relational database schema for this database application. First show all the functional dependencies that should hold among the attributes. Then, design relation schemas for the database that are each in 3NF or BCNF. Specify the key attributes of each relation. Note any unspecified requirements, and make appropriate assumptions to make the specification complete. Answer: From the above description, we can presume that the following functional dependencies hold on the attributes: FD1: {SSSN} -> {SNAME, SNUM, SCADDR, SCPHONE, SPADDR, SPPHONE, BDATE, SEX, CLASS, MAJOR, MINOR, PROG} FD2: {SNUM} -> {SNAME, SSSN, SCADDR, SCPHONE, SPADDR, SPPHONE, BDATE, SEX, CLASS, MAJOR, MINOR, PROG} FD3: {DEPTNAME} -> {DEPTCODE, DEPTOFFICE, DEPTPHONE, DEPTCOLLEGE} FD4: {DEPTCODE} -> {DEPTNAME, DEPTOFFICE, DEPTPHONE, DEPTCOLLEGE} FD5: {CNUM} -> {CNAME, CDESC, CREDIT, LEVEL, CDEPT}

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.

CNUM GRADES.2 Chapter 10: Functional Dependencies and Normalization for Relational Databases FD6: {SECCOURSE.CDEPT -> DEPARTMENT.(SECCOURSE.MINOR -> DEPARTMENT. YEAR. The foreign keys will be as follows: STUDENT.18 Prove or disprove the following inference rules for functional dependencies. FD5 defines COURSE attributes. YEAR. with either DEPTNAME or DEPTCODE as primary key. SSSN} -> {GRADE} These are the basic FDs that we can define from the given requirements.SNUM Note: We arbitrarily chose SNUM over SSSN for primary key of STUDENT. YEAR. Inc. SEMESTER. but not according to the definitions of Section 14.3 since both relations have secondary keys. The COURSE.4 and 14.(SECCOURSE. COURSE. SEMESTER. 10. SECTION. SEMESTER. we can define a relation STUDENT and choose either SSSN or SNUM as its primary key. and GRADES as shown below. and DEPTCODE over DEPTNAME for primary key of DEPARTMENT. Publishing as Pearson Addison-Wesley. SECNUM) -> SECTION. . we can deduce many others. using inference rules IR1 to IR3. A proof can be made either by a proof argument or by using inference rules IR1 through IR3. The STUDENT and DEPARTMENT relations are in 3NF and BCNF according to the general definition given in Sections 14. FD3 and FD4 refer to department attributes. SECNUM) GRADES. A disproof should be done by demonstrating a relation instance that satisfies the conditions and functional dependencies in the left hand side of the inference rule but do not satisfy the conditions or dependencies in the right hand side. SECNUM} -> {INSTRUCTORNAME} FD7: {SECCOURSE.MAJOR -> DEPARTMENT. SECNUM. Copyright © 2007 Pearson Education. and GRADES relations are in 3NF and BCNF if no other dependencies exist. YEAR.5. DEPARTMENT.SECCOURSE -> COURSE. and FD6 SECTION attributes. FD7 defines GRADES attributes. SECTION. We can create one relation for each of STUDENT. Similarly.DEPTCODE COURSE.SNUM -> STUDENT. Finally. where the primary keys are underlined. SEMESTER.DEPTCODE SECTION. FD1 and FD2 refer to student attributes.DEPTCODE STUDENT.

WY ->Z} |= {X ->Z} (d) {XY ->Z. knowing that Y subset-of YX) (5) WX ->Y (using IR3 (transitivity) on (3) and (4)) (b) Proof: (1) X ->Y (given) (2) Y ->Z (using IR1 (reflexivity). E ->AH}. X ->Z} |= {WX ->Y } (b) {X ->Y} and Z subset-of Y |= { X ->Z } (c) { X ->Y. given that Z subset-of Y) (3) X ->Z (using IR3 (transitivity) on (1) and (2)) (c) Proof: (1) X ->Y (given) (2) X ->W (given) (3) WY ->Z (given) (4) X ->XY (using IR2 (augmentation) to augment (1) with X) (5) XY ->WY (using IR2 (augmentation) to augment (2) with Y) (6) X ->WY (using IR3 (transitivity) on (4) and (5)) (7) X ->Z (using IR3 (transitivity) on (6) and (3)) (d) Disproof: X Y Z W t 1 =x 1 y 1 z 1 w 1 t 2 =x 1 y 2 z 2 w 1 The above two tuples satisfy XY ->Z and Y ->W but do not satisfy XW ->Z (e) Disproof: X Y Z t 1 =x 1 y 1 z 1 t 2 =x 1 y 2 z 1 The above two tuples satisfy X ->Z and Y ->Z but do not satisfy X ->Y (f) Proof: (1) X ->Y (given) (2) XY ->Z (given) (3) X ->XY (using IR2 (augmentation) to augment (1) with X) (4) X ->Z (using IR3 (transitivity) on (3) and (2)) 10. X ->W. Publishing as Pearson Addison-Wesley. Check whether or not they are Copyright © 2007 Pearson Education.19 Consider the following two sets of functional dependencies F= {A ->C. Inc. Y ->Z} |= {X ->Y} (f) {X ->Y. AC ->D.Chapter 10: Functional Dependencies and Normalization for Relational Databases 3 (a) {W ->Y. E ->H} and G = {A ->CD. . XY ->Z} |= {X ->Z} Answer: (a) Proof: (1) W ->Y (given) (2) X ->Z (given) (3) WX ->YX (using IR2 (augmentation) to augment (1) with X) (4) YX ->Y (using IR1 (reflexivity). Y ->W} |= {XW ->Z} (e) {X ->Z. E ->AD.

For example. which covers A ->CD in G {E} + = {E. we prove that G is covered by F and F is covered by G. PLOCATION} can cause anomalies.SSN ->{BDATE}. if a PROJECT temporarily has no Copyright © 2007 Pearson Education. which covers E ->AH in G Proof that F is covered by G: {A} + = {A. The set F is an equivalent minimal set: F= {SSN ->{ENAME}. DNAME. which covers DNUMBER ->{DNAME. Publishing as Pearson Addison-Wesley. D. DNUMBER. ADDRESS.21 Is the set of functional dependencies G in Exercise 10. D} (with respect to G). DMGRSSN} (with respect to F). C. ENAME. C} (with respect to F). D} (with respect to G). BDATE. DNAME. D} (with respect to G). SSN ->{DNUMBER} . DNAME. H. DMGRSSN} 10. C. H. the partial dependencies {SSN}->{ENAME} and {PNUMBER}->{PNAME. because it violates rule 1 of minimality (every FD has a single attribute for its right hand side). DNUMBER} in G {DNUMBER} + ={DNUMBER. which covers SSN ->{ENAME}. BDATE. DNUMBER->{DMGRSSN}} To show equivalence. A. DMGRSSN} }.3 and 10. BDATE. ADDRESS. SSN ->{ADDRESS}. C} + = {A. which covers A ->C in F {A. SSN-> {ADDRESS}.20 is not minimal. DMGRSSN} in G Proof that F is covered by G: {SSN} + = {SSN. which covers SSN ->{ENAME. A. DMGRSSN} (with respect to F). which covers DNUMBER ->{DNAME} and DNUMBER->{DMGRSSN} in F 10. DMGRSSN} (with respect to G). Inc.4? Answer: In EMP_PROJ. Answer: To show equivalence. C. ENAME. D} (with respect to F). and SSN ->{DNUMBER} in F {DNUMBER} + ={DNUMBER. DNUMBER} . DNAME. Answer: {SSN} + ={SSN. DMGRSSN} {DNUMBER} + ={DNUMBER.22 What update anomalies occur in the EMP_PROJ and EMP_DEPT relations of Figure 10. ADDRESS. DNUMBER ->{DNAME}. Proof that G is covered by F: {SSN} + = {SSN. DMGRSSN} (with respect to G). DNUMBER. which covers AC ->D in F {E} + = {E. SSN ->{BDATE}. DNUMBER ->{DNAME. .20 minimal? If not. DNUMBER. Calculate the closures {SSN} + and {DNUMBER} + with respect to G. BDATE. Prove that your set is equivalent to G. Proof that G is covered by F: {A} + = {A.4 Chapter 10: Functional Dependencies and Normalization for Relational Databases equivalent.20 Consider the relation schema EMP_DEPT in Figure 10. try to find an minimal set of functional dependencies that is equivalent to G. DNAME. ENAME. we prove that G is covered by F and F is covered by G. BDATE. which covers E ->AD and E ->H in F 10. C. ADDRESS. Answer: The set G of functional dependencies in Exercise 14. DNAME. ADDRESS.3(a) and the following set G of functional dependencies on EMP_DEPT: G = {SSN ->{ENAME.

Inc. the key is {A. and at the same time represents information concerning EMPLOYEE and PROJECT entities. Publishing as Pearson Addison-Wesley. Answer: Consider a relation schema R={A. For example. we get an update anomaly. . for example. DMGRSSN} can cause anomalies. There are four possible cases: (i) No FD holds in R. Inserting a new tuple relating an existing EMPLOYEE to an existing PROJECT requires checking both partial dependencies. and PROPERTY_ID# ->AREA ->PRICE. if we take all keys into account and use the general definition of 2NF and 3NF. since there are the following two transitive dependencies on the primary key: PROPERTY_ID# ->COUNTY_NAME ->TAX_RATE. In this case. 10. Inserting a new tuple relating a new EMPLOYEE to an existing DEPARTMENT requires checking the transitive dependencies. any relation with two attributes is in BCNF. PLOCATION) will not be represented in the database when the last EMPLOYEE working on it is removed (deletion anomaly). we get an update anomaly. A new DEPARTMENT cannot be added unless at least one EMPLOYEE is assigned to work on it (insertion anomaly). (iv) Both {A} ->{B} and {B} ->{A} hold. The reason is that EMP_DEPT represents the relationship between EMPLOYEEs and DEPARTMENTs. if a DEPARTMENT temporarily has no EMPLOYEEs working for it. PNUMBER. (iii) Only {B} ->{A} holds. However. its information (DNAME. In this case.23 In what normal form is the LOTS relation schema in Figure 10. if a different value is entered for PLOCATION than those values in other tuples with the same value for PNUMBER. B} and the relation satisfies BCNF. the transitive dependency {SSN}->{DNUMBER}->{DNAME. DMGRSSN) will not be represented in the database when the last EMPLOYEE working on it is removed (deletion anomaly). Copyright © 2007 Pearson Education. there are two keys {A} and {B} and the relation satisfies BCNF.Chapter 10: Functional Dependencies and Normalization for Relational Databases 5 EMPLOYEEs working on it.24 Prove that any relation schema with two attributes is in BCNF. the key is {B} and the relation satisfies BCNF. DNUMBER. 10. In this case. A new PROJECT cannot be added unless at least one EMPLOYEE is assigned to work on it (insertion anomaly). it is not in 3NF. LOT#}. The only possible (non-trivial) FDs are {A} ->{B} and {B} ->{A}. the LOTS relation schema will only be in 1NF because there is a partial dependency COUNTY_NAME ->TAX_RATE on the secondary key {COUNTY_NAME. In EMP_DEPT. if a different value is entered for DMGRSSN than those values in other tuples with the same value for DNUMBER. the LOTS relation schema in Figure 14. Hence. which violates 2NF. (ii) Only {A} ->{B} holds.11(a) with the respect to the restrictive interpretations of normal form that take only the primary key into account? Would it be in the same normal form if the general definitions of normal form were used? Answer: If we only take the primary key into account. Now. the key is {A} and the relation satisfies BCNF. its information (PNAME. Similar comments apply to EMPLOYEE information. B} with two attributes. and at the same time represents information concerning EMPLOYEE and DEPARTMENT entities.11 (a) will be in 2NF since there are no partial dependencies on the primary key . The reason is that EMP_PROJ represents the relationship between EMPLOYEEs and PROJECTs. for example. In this case.

a tuple (e. H}: R2 = {F. H}. R3} 10. G.6)? Answer: In EMP_LOCS. a tuple (s. one key of R is {A. B}. B}+ = R. I} and the set of functional dependencies F = { {A.26 for the following different set of functional dependencies G = { {A. These are attributes that are functionally dependent on either parts of the key. F. G. B.4a (see chapter 15 in the textbook)).25 Why do spurious tuples occur in the result of joining the EMP_PROJ1 and EMPLOCS relations of Figure 10. J}. R3 are underlined. When we join EMP_LOCS with EMP_PROJ1. E. The remaining attributes are kept in a relation R12. Hence {A} -> {D. I. {A} -> {D. {B} -> {F}. p. D. H. J}. pn. In EMP_PROJ1.26 Consider the universal relation R = {A. Answer: A minimal set of attributes whose closure includes all the attributes in R is a key. F}. {A} or {B}. H} ({B} -> {B} is a trivial dependency) To normalize into 2NF. we take the following steps (alternatively. Next. we look for transitive dependencies in R1.6 Chapter 10: Functional Dependencies and Normalization for Relational Databases 10. E}. resulting in spurious tuples. E. F} The final set of relations in 3NF are {R11. D. R2. B} -> {C}. J} }. we can apply the algorithms discussed in Chapter 15): First. alone. {D} -> {I. then 3NF relations. R12. l) signifies that employee with name e works on some project located in location l. along with the part of the key they depend on (A or B). Publishing as Pearson Addison-Wesley. B. we remove the attributes that are functionally dependent on part of the key (A or B) from R and place them in separate relations R1 and R2. R2 = {B. {A. The relation R1 has the transitive dependency {A} -> {D} -> {I. 10. R21. F. The lossless join property (see Chapter 13) can determine whether or not spurious tuples may result based on the FDs in the two relations being joined. B} -> {C}. To normalize R intuitively into 2NF then 3NF. C} The new keys for R1. a tuple (e.5 (result shown in Figure 10. (One can also apply algorithm 15. D} -> {G. R2 = {B. D} -> {E.27 Repeat exercise 10. F. D. J} from R1 into a relation R11 and copy the attribute D they are dependent on into R11. l) in EMP_PROJ1 where e is the name of some employee and s is the social security number of a different employee. We can calculate the closures {A}+ and {B}+ to determine partially dependent attributes: {A}+ = {A. H}. E} The relation R2 is similarly decomposed into R21 and R22 based on the transitive dependency {B} -> {F} -> {G. Hence. Inc. R2. it is the only key). R22. D. I. E. I. I. G. E. C. H}. R3. R1 is decomposed into R11 and R12 as follows: R11 = {D. G. h. {A} -> {I}. l) signifies that employee with social security number s works on project p that is located at location l. R3 = {A. l) in EMP_LOCS can be joined with a tuple (s. so we remove the transitively dependent attributes {I. {H} -> {J} }. Answer: Copyright © 2007 Pearson Education. G. pn. H}. hence {A} -> {F. J} ({A} -> {A} is a trivial dependency) {B}+ = {B. What is the key for R? Decompose R into 2NF. h. identify partial dependencies that violate 2NF. {B. H}. B} (in this case. {F} -> {G. p. J}. . Since the closure of {A. which are copied into each of these relations but also remains in the original relation. J}. R12 = {A. which we call R3 below: R1 = {A. {A.

D. {D}+ -> {D}. J}. Days_Hours. B.D. {H}+ -> {H. SecNo} Try to determine which sets of attributes form keys of R. CreditHours. B. R2 = {B. we next calculate the closures of pairs of attributes that are possible keys: {A. J}. D. But the union of the three closures includes all the attributes: {A. OfferingDept. F}. C.26. CourseNo. R4 = {A. D. I}. I}.29 Given relation R(A. J} None of these pairs are keys either since none of the closures includes all attributes. R4 = {A. I}. R2. D}+ -> {A. E. CourseLevel} {CourseNo. {A. AB+ = {A. C. {G}+ -> {G}. J}. B. E. {A. is ABD? Explain your answer. which has attributes that hold schedules of courses and sections at a university. G. (Note: Algorithm 15.C. E. G. Semester. F. D} -> {E. Days_Hours. {A.Chapter 10: Functional Dependencies and Normalization for Relational Databases 7 To help in solving this problem systematically. Semester. H} The final set of 3NF relations is {R1. R3 = {A. B. R32 = {A. {B}+ -> {B}. B. C. J}. H. D.B. C. R3 = {A. D. I}.4a (see chapter 15 in the textbook) can be used to determine a key).C}.E} Yes. CreditHours. E. I} Hence. {C}+ -> {C}. D}+ -> {A. D. G. I. R5 = {A. {J}+ -> {J} Since none of the single attributes is a key.C. Suppose that the following functional dependencies hold on R: {CourseNo} -> {OfferingDept. E. in a similar manner to problem 14. D} Additional partial dependencies exist in R1 and R3 because {A} -> {I}. Answers: No. G. F}. C}.C. Year} -> {Days_Hours. Publishing as Pearson Addison-Wesley. InstructorSSN} {RoomNo. starting with the following relation R: R = {A.B. D}. F}. Year. B. D} is a key. B} -> {C. {F}+ -> {F}. H. R = {CourseNo.B. R is decomposed into R1. Hence. RoomNo. H. H. How would you normalize this relation? Copyright © 2007 Pearson Education. . D. G. R2.28 Solution to come 10. SecNo.E) with dependencies AB -> C CD -> E DE -> B is AB a candidate key of this relation? If not. {B. D}+ -> {G. Semester. CourseLevel. so it is decomposed into R31 and R32 as follows: R31 = {H.D. I. I. B. D. J} Hence. G. R31. H. D.E} 10. R2 = {B. RoomNo. we can first find the closures of all single attributes to see if any is a key on its own as follows: {A}+ -> {A.B. D} -> {H} -> {J}. B.30 Consider the relation R. B}+ -> {A. {B. {E}+ -> {E}. Based on the above analysis. ABD+ = {A. Only R3 has a transitive dependency {A. so the following relations are the result of 2NF decomposition: R1 = {A.a proper subset of {A. F. D}+ -> {B. Inc. NoOfStudents}. R4. SecNo. we remove {I} into R5. R3. NoOfStudents. R5} 10. I} Next. we check for transitive dependencies in each of the relations (which violate 3NF). D. we decompose as follows. I} The first-level partial dependencies on the key (which violate 2NF) are: {A. B. {I}+ -> {I}. R4 (keys are underlined): R1 = {A. InstructorSSN. H. F}. R32. Year} -> {InstructorSSN.

S. Hence. SN. Cust#. SN}. D. S = Semester. Total_amt) Order_Item(O#. I = InstructorSSN. CH. D. SN. S. SN. since these sets of attributes are the candidates to be keys: (1) {C}+ = {C. OD.I#. The Total_price refers to one item. both K1 = {C. Odate. Qty_ordered. Y. D = Days_Hours. CH. NS. S. D. It has functional dependencies Copyright © 2007 Pearson Education.) Answer: Given relations Order(O#. what does the resulting relation schema look like? What will be its key? Show the FDs in this resulting relation. CL}. Discount%) Assume that each item has a different discount. SN. 10. I#. Publishing as Pearson Addison-Wesley. S. Y}+ contains {NS} (from (2) above). CL} is a partial dependency for K1 (since C is included in K1). SN}. D. CL} (2) Since {C. If we apply a natural join on the relations Order-Item and Order in this database. Odate is the date on which the order was placed. NS} with candidate keys K1 and K2 Since neither R1 nor R2 have transitive dependencies on either of the candidate keys. I}. NS. S. . Y} -> {I. CH. ORDER (O#.I#. SN. Y} are now all in {RM. Cust#. C. S. we get: {C.31 Consider the following relations for an order-processing application database at ABC.8 Chapter 10: Functional Dependencies and Normalization for Relational Databases Answer: Let us use the following shorthand notation: C = CourseNo. S. CL = CourseLevel. D. NS. OD. I. Total_amount. R = {C. C. C. Y}+ since C is already there. OD. Y} -> {D. Y} -> {D. S. CH. S. Qty_ordered. Y = Year. CH. NS} = R Hence. I. C. CL. SN. S. Qty_ordered. C. and the Total_amount is the amount of the order. RM. Finally. we find that the functional dependency {C} -> {OD. we get: {RM. the schema of Order * Order_Item looks like T1(O#. OD. RM. S. since {C. NS = NoOfStudents Hence. S. RM = RoomNo. S. Discount%) and its key is O#. Y. OD. D. S. Discount%). Odate. RM. Total_price. CL} = R (3) Since {RM. Y. Y} are (candidate) keys of R. CL} so these are also contained in {RM. SN. Y. RM. They also both satisfy the definition of BCNF. Total_amount) ORDER-ITEM (O#. S. I} {RM. D. OD = OfferingDept. By applying the general definition of 2NF. NS}. S. OD. Y}+ = {C. and {C}+ = {C. Y} and K2 = {RM. But {C}+ contains {OD. CH. D. D. D. I. Y}+ contains {RM. D. SN = SecNo. I. SN. Total_price. SN. CH = CreditHours. S. D. and the following functional dependencies hold: {C} -> {OD. CL} {C.Odate. Total_price. Inc. CL. Cust#. SN. Y} -> {I. Is it in 2NF? Is it in 3NF? Why or why not? (State any assumptions you make. CL} R2 = {RM. R1 and R2 are in 3NF also. R is normalized into R1 and R2 as follows: R1 = {C. we know that {RM. S. Inc. I. Y}+ and {C. SN} First. CH. Y. CH. Y}+ = {RM. CH. I#. we can calculate the closures for each left hand side of a functional dependency.

as a 2NF is a requirement for 3NF. Inc.Chapter 10: Functional Dependencies and Normalization for Relational Databases 9 O#I# . Publisher) Author_affil referes to the affiliation of the author. Discount_amt) Car_Sale2(Car#. Salesman#.Cust# O# . Author_affil.Total_amount It is not in 2NF. as attributes Odate.Total_price O#I# . To normalize.Discount% O# . Date_sold. Additional dependencies are: Date_sold ->Discount_amt and Salesman# ->commission% Based on the given primary key. 2NF: Car_Sale1(Car#. Salesman#) Car_Sale3(Salesman#. Publishing as Pearson Addison-Wesley. Discount_amt) with the functional dependencies Date_sold Discount_amt Salesman# Commission% Car# Date_sold This relation satisfies 1NF but not 2NF (Car# Date_sold and Car# Discount_amt so these two attributes are not FFD on the primary key) and not 3NF. Qty_ordered O#I# .Commission%) 3NF: Car_Sale1-1(Car#. Commission%. Listprice. Commision%. 10.Commission%) 10. Copyright © 2007 Pearson Education.33 Consider the following relation for published books: BOOK (Book_title. Discount_amt Assume that a car may be sold by multiple salesmen and hence {CAR#. Authorname. O#I# Nor is it in 3NF. Book_type. 2NF. or 3NF? Why or why not? How would you successively normalize it completely? Answer: Given the relation schema Car_Sale(Car#. is this relation in 1NF. Odate O# . Salesman#.32 Consider the following relation: CAR_SALE(Car#. Book_type Book_type -> Listprice Author_name -> Author-affil (a) What normal form is the relation in? Explain your answer. SALESMAN#} is the primary key. . Cut#. Date_sold. Suppose the following dependencies exist: Book_title -> Publisher. Discount_amt) Car_Sale2(Car#. Date_sold. and Total_amount are only partially dependent on the primary key. Date_sold) Car_Sale1-2(Date_sold. Salesman#) Car_Sale3(Salesman#.

765234. CompUSA) specifies that WesternDigital made a disk drive with serial number 1978619. (b) 2NF decomposition: Book0(Book_title. retailer b.10 Chapter 10: Functional Dependencies and Normalization for Relational Databases (b) Apply normalization until you cannot decompose the relations further. batch → model d. the manufacturer and serial number uniquely identifies the drive b. batch. manufacturer. Book_type. It is also not in 3NF. Write each of the following dependencies as an FD: Suggestion: a. State the reasons behind each decomposition. model. model number A2235X in batch 765235 with 500GB that is sold by CompUSA. manufacturer. Author_affil) This decomposition eliminates the transitive dependency of Listprice 10. made by a manufacturer. This relation is in 1NF and not in 2NF as no attributes are FFD on the key. and is sold by a certain retailer. Answer: a. Authorname) Book1(Book_title. All disk drives of a particular model of a particular manufacturer have exactly the same capacity. capacity. Book_type) Book1-2(Book_type. Answer: Given the relation Book(Book_title. Listprice. c. WesternDigital. A2235X. Publishing as Pearson Addison-Wesley.” There is nothing in the question that suggests we should “optimize” our FDs by assuming the other requirements) Copyright © 2007 Pearson Education. For example. capacity. which has a certain storage capacity. Listprice) Book2(Authorname. manufacturer → capacity. Listprice) Book2(Authorname. manufacturer. Inc.Authorname. batch.34 This exercise asks you to converting business statements into dependencies. d. model → manufacturer c. released in a certain batch. Author_affil) This decomposition eliminates the partial dependencies. retailer). Consider the following relation DiskDrive(serialNumber. Publisher) and the FDs Book_title Publisher.35. with a particular model. .d can be “model. the tuple DiskDrive(1978619. All disk drives in a particular batch are the same model. Each tuple in the relation DiskDrive contains information about a disk drive with a unique serialNumber. Publisher. Publisher. A model number is registered by a manufacturer and hence can’t be used by another manufacturer. Book_type Book_type Listprice Authorname Author_affil (a)The key for this relation is Book_title. model → capacity (Comment: 10. 3NF decomposition: Book0(Book_title. Authorname) Book1-1(Book_title. Author_affil. serialNumber → model. Authorname. 500. Book_type.

argue using the generalized definition of the 3NF that this relation is not in 3NF. Treat_code. Option_Listprice. Treat_code) R1 (Treat_code.Pseudotransitive rule) {AB→D} (Trivial simplification) 10. Assume that diagnosis is determined (uniquely) for each patient by a doctor.cruise control) that were sold at a dealership and the list and discounted prices for the options.36 Consider the following relation: R (Doctor#. . Option_type → Discounted_price. Answer: From the question’s text. Copyright © 2007 Pearson Education. Charge) In this relation. Diagnosis.37 Consider the following relation: CAR_SALE (CarID. Charge) We could further infer that the treatment for a given diagnosis is functionally dependant. Patient#.g. Assume that each treatment code has a fixed charge (regardless of patient).Chapter 10: Functional Dependencies and Normalization for Relational Databases 11 10. Inc. Discounted_price) This relation refers to options installed on cars (e. why it is not in 2NF. Patient#. and if so. Publishing as Pearson Addison-Wesley. all of the nontrivial functional dependencies must both be fully functional and nontransitive on every key of the relation. Treat_code. Diagnosis.Pseudotransitive rule) {AB→C} (Given) {ABA→D} (IR6 . 10. the given relation is in 2NF already. Then argue from your knowledge of 2NF. However. If CarID → Sale_date and Option_type→ Option_Listprice. Then argue whether further normalization to 3NF is necessary. Date}→{Diagnosis. Patient#. CE→ D. Date. Both of these dependencies are partial and transitive. and CarID. perform it. Is this relation in 2NF? Justify your answer and decompose if necessary.35 Show that AB→ D is in the closure of {AB→ C. Option_type. This however is not 3NF because the Charge is a nonkey attribute that is determined by another nonkey attribute. a tuple describes a visit of a patient to a doctor along with a treatment code and daily charge. Sale_date. A→ E} Answer: {A→E} (Given) {CE→D} (Given) {CA→D} (IR6 . Date. We must decompose further: R (Doctor#. Answer: For this relation to be in 3NF. in this relation we have two dependencies (CarID → Sale_date and Option_type → Option_Listprice) that violate these requirements. Treat_code. we can infer the following functional dependencies: {Doctor#. Charge} {Treat_code}→{Charge} Because there are no partial dependencies.. but we should be sure to allow the doctor to have some flexibility when prescribing cures.

Option_type} → Discounted_price}. Again. Inc. Option_type → Option_Listprice.1) . determine if this decomposition is indeed lossless. S R1 R2 R3 CarID Option_type Option_Listprice Sale_date Discounted_price 2) Set S(i. R2. then the decomposition has the lossless join Copyright © 2007 Pearson Education. Option_Listtprice ) Using the algorithm for lossless decomposition checking (Algorithm 11. Answer: Let R = CAR_SALE. set S(i. 1) Create matrix S. (Only one iteration is required for this problem) S R1 R2 R3 CarID a1 a1 b31 Option_type a2 b22 a2 Option_Listprice a3 b23 a3 Sale_date a4 a4 b34 Discounted_price a5 b25 b35 5) If a row of S contains all “a” symbols. . R1 = ACTUAL_OPTION_PRICING. mark Y based on X. F = {CarID → Sale_date. Publishing as Pearson Addison-Wesley.Discounted_price) CAR (CarID. Sale_date ) OPTION (Option_type. R2 = CAR. {CarID. R3}.12 Chapter 10: Functional Dependencies and Normalization for Relational Databases For this relation to be in 2NF. this relation has two partial dependencies that violate this requirement. as was discussed about 3NF. j) = bij S R1 R2 R3 CarID b11 b21 b31 Option_type b12 b22 b32 Option_Listprice b13 b23 b33 Sale_date b14 b24 b34 Discounted_price b15 b25 b35 3) For Aj in Ri. all of the nontrivial functional dependencies must be fully functional on every key of the relation. 10. j) = aj S R1 R2 R3 CarID a1 a1 b31 Option_type a2 b22 a2 Option_Listprice b13 b23 a3 Sale_date b14 a4 b34 Discounted_price a5 B25 b35 4) Until no changes in S: For all X → Y in F. D = {R1. R3 = OPTION.38 Consider a decomposed version of the above relation: ACTUAL_OPTION_PRICING (CarID. Option_type.

Based on the FDs presented earlier. b.13 be decomposed into equivalent relations that are in BCNF? b. one can’t reasonably decompose into equivalent relation without losing the {STUDENT.13 presents one example of a relation that is in 3NF but not in BCNF. We can possibly solve the issue if FD2 were eliminated in consideration that most colleges and universities require instructors to teach more than one course every term. Based on the FDs presented earlier. Copyright © 2007 Pearson Education. Inc.39 (optional) Figure 10. Explain in English what modifications can you reasonably make in the assumptions so that the relation is in BCNF as well? Answer: a. you cannot reasonably decompose it into an equivalent relation.Chapter 10: Functional Dependencies and Normalization for Relational Databases 13 property. However. 10. Yes. thus we have the lossless join property. COURSE} -> INSTRUCTOR functional dependency. this will restrict the use of the database to such colleges. we have a row of all “a” symbols. Publishing as Pearson Addison-Wesley. Why can’t the relation in Figure 10. a. .

- Elm04_13
- Lab Manual
- Answers to Assignment 1
- CH 8 Answers
- Dbs Textex2 Solutions 3
- Ch10navathe Sol
- Elmasri 6e_ISM 04
- Elmasri 6e_ISM 01
- Normalization Assignment
- 2 - Recursive Definition
- SQL Questions
- Process Scheduling problems
- Database Systems Solutions
- Sheet 5
- -Chapter 3-Danial I. A Cohen-Computer Theory
- Theory of Automata by Cohen
- Theory of Automata - Solved Assignments - Semester Spring 2010
- Systems Analysis and Design - Dennis
- The Manuals.com Solution Manual for Principle of Measurement Systems 4th Edition Manual
- 04 Constraints and Updates
- Database systems Thomas Connolly ch03
- ch03-The_Relational_Model
- ENACh05final Sham
- Mid Final_sham RDBMS
- The Relational Data Model and Relational Database Constraints
- 7th relational data model.pptx
- 10 - Relational Model Concepts
- ENACh05
- Constraints and Their Affect on SQL Stats
- Relational Model
- Elm04 10Solutions.doc 0

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd