Chapter eleven Relational Database Design Methods and Further Dependencies Chapter Describe???? 0. Developing a Set of Contact 1 . Homes of Relational Decompositions installment payments on your
Algorithms to get Relational Database Schema several. Multivalued Dependencies and Fourth Normal Type 4. Become a member of Dependencies and Fifth Normal Form 5. Inclusion Dependencies 6. Additional Dependencies and Normal Varieties DESIGNING SOME RELATIONS? Desired goals:? Lossless sign up for property (a must)? Algorithm 11. one particular tests to get general losslessness. Algorithm eleven. decomposes a relation in to BCNF parts by compromising the dependency preservation. 4NF (based about multi-valued dependencies) 5NF (based on sign up for dependencies)? Addiction preservation house? Additional normal forms? 1 ) Properties of Relational Decompositions? Relation Decomposition and Insufficiency of Usual Forms:? General Relation Schizzo:? A relationship schema 3rd there’s r = A2, A2, ¦, An that includes each of the attributes of the database. Every single attribute brand is unique.? Widespread relation assumption:? (Cont)? Decomposition:? Attribute preservation condition:?
The process of decomposing the universal relation schema R into a set of relation schemas D = R1,R2, ¦, Rm that will become the relational database schema by using the functional dependencies. Each attribute in R will appear in at least one relation schema Ri in the decomposition so that no attributes are “lost. (Cont)? Another goal of decomposition is to have each individual relation Ri in the decomposition D be in BCNF or 3NF. Additional properties of decomposition are needed to prevent from generating spurious tuples (Cont)? Dependency Preservation Property of a Decomposition:? Definition: Given a set of dependencies F on R, the projection of F on Ri, denoted by pRi(F) where Ri is a subset of R, is the set of dependencies X >Y in F+ such that the attributes in X U Y are all contained in Ri. Hence, the projection of F on each relation schema Ri in the decomposition D is the set of functional dependencies in F+, the closure of F, such that all their left- and right-hand-side attributes are in Ri. (Cont. )? Dependency Preservation Property of a Decomposition (cont. ):? Dependency Preservation Property:? A decomposition D = R1, R2, , Rm of R is dependency-preserving with respect to F if the union of the projections of F on each Ri in D is equivalent to F, that is ((? R1(F)) U . . . U (? Rm(F)))+ = F+ (See examples in Fig 10. 12a and Fig 10. 11)? Claim 1:? It is always possible to find a dependency-preserving decomposition D with respect to F such that each relation Ri in D is in 3NF. Projection of F on Ri Given a set of dependencies F on R, the projection of F on Ri, denoted by? Ri(F) where Ri is a subset of R, is the set of dependencies X >Con in F+ such that the attributes in X?
Y are all contained in Ri. Dependency Preservation Condition Given R(A, B, C, D) and F = A >B, B >C, C >D Let D1=R1(A,B), R2(B,C), R3(C,D)? R1(F)=A >B? R2(F)=B >C? R3(F)=C >D FDs are preserved. (Cont. )? Lossless ( nonadditive ) Sign up for Property of the Decomposition:? Explanation: Lossless become a member of property: a decomposition Deb = R1, R2, , Rm of Ur has the lossless ( non-additive ) join property with regards to the set of dependencies F about R in the event, for every relation state r of L that complies with F, this holds, exactly where * is a natural join of all the relations in Deb: (? R1(r), ,? Rm(r)) = 3rd there’s r? Note: The phrase loss in lossless identifies loss of information, not to loss of tuples. In fact , for “loss of information a better term is “addition of spurious information Case in point S s1 s2 s3 P p1 p2 p1 D d1 d2 d 3 = T s1 s2 s3 S p1 p2 p1 5. P p1 p2 p1 D d1 d2 d 3 Lossless Sign up for Decomposition? NOT ANY (Cont. ) Lossless ( nonadditive ) Join Property of a Decomposition (cont. ): Algorithm 11. 1: Testing for Lossless Join Real estate Input: A universal regards R, a decomposition Deb = R1, R2, , Rm of R, and a set Farrenheit of functional dependencies. 1 .
Create an initial matrix S with one row i for each relation Ri in D, and one column j for each attribute Aj in R. 2. Set S(i,j):=bij for all matrix entries. (/* each bij is a distinct symbol associated with indices (i,j) */). 3. For each row i representing relation schema Ri for each column j representing attribute Aj if (relation Ri includes attribute Aj) then set S(i,j):= aj,,? (/* each aj is a distinct symbol associated with index (j) */)? CONTINUED on NEXT SLIDE (Cont. ) 4. Repeat the following loop until a complete loop execution results in no changes to S the particular, 5.
When a row is made up entirely of “a icons, then the decomposition has the lossless join real estate, otherwise it does not. (Cont. ) Lossless ( non-additive ) join test out for n-ary decompositions. (a) Case one particular: Decomposition of EMP_PROJ in to EMP_PROJ1 and EMP_LOCS neglects test. (b) A decomposition of EMP_PROJ that has the lossless become a member of property. (Cont. ) Lossless ( nonadditive ) become a member of test for n-ary decompositions. (c) Case 2: Decomposition of EMP_PROJ into EMP, PROJECT, and WORKS_ON satisfies test. (Cont. )? Screening Binary Decompositions for Lossless Join Home?
Binary Decomposition: Decomposition of any relation Ur into two relations. REAL ESTATE LJ1 (lossless join test out for binary decompositions): A decomposition M = R1, R2 of 3rd there’s r has the lossless join house with respect to some functional dependencies F about R in the event that and only if either? The FD ((R1? R2) >? (R1- R2)) is in F+, or The FD ((R1? R2) >? (R2 , R1)) is in F+. 2 . Methods for Relational Database Schizzo Design Formula 11. a few: Relational Decomposition into BCNF with Lossless ( non-additive ) sign up for property Input: A common relation 3rd there’s r and a set of functional dependencies F within the attributes of L. 1 . Arranged D: = 3rd there’s r, installment payments on your
While there can be described as relation schema Q in D which is not in BCNF do pick a relation programa Q in D which is not in BCNF, find a functional dependency By >Y in Q that violates BCNF, replace Q in M by two relation schemas (Q , Y) and (X U Y), , Assumption: No null beliefs are allowed for the join attributes. Algorithms for Relational Database Schema Design Criteria 11. four Relational Synthesis into 3NF with Addiction Preservation and Lossless ( Non-Additive ) Join Home Input: A universal relation R and a set of useful dependencies N on the advantages of R. 1 . Find a nominal cover G for Farreneheit (Use Algorithm 10. ). 2 . For each and every left-hand-side Back button of a efficient dependency that appears in G, build a relation programa in D with characteristics X U A1 U A2 , U O ve, where X >? A1, X >? A2, , Back button >Ak will be the only dependencies in G with Back button as left-hand-side (X is vital of this relation). 3. If perhaps non-e with the relation schemas in G contains the of 3rd there’s r, then generate one more regards schema in D that contains attributes that form the of Ur. (Use Algorithm 11. 4a to find the key of R) 4. Remove redundant associations from the effect. A regards R is considered redundant if R can be described as projection of another relation S
Algorithms for Relational Database Schizzo Design Formula 11. 4a Finding a Essential K intended for R Given a arranged F of Functional Dependencies Input: A universal connection R and a set of functional dependencies Farrenheit on the attributes of R. 1 ) Set K: = L, 2 . For each attribute A in T Compute (K , A)+ regarding F, In the event that (K , A)+ includes all the qualities in L, then collection K: sama dengan K , A, (Cont. ) 3. Multivalued Dependencies and Fourth Normal Contact form (a) The EMP regards with two MVDs: ENAME “>, >, PNAME and ENAME “>, >, DNAME. (b) Decomposing the EMP relation into two 4NF relations EMP_PROJECTS and EMP_DEPENDENTS. (Cont. ) c) The relation SOURCE with no MVDs is in 4NF but not in 5NF whether it has the JD(R1, R2, R3). (d) Decomposing the regards SUPPLY in the 5NF contact R1, R2, and R3. (Cont. ) Definition:? A multivalued habbit (MVD) By “>, >, Y specific on regards schema Ur, where X and Sumado a are both subsets of L, specifies the following constraint about any connection state l of 3rd there’s r: If two tuples t1 and t2 exist in r in a way that t1[X] sama dengan t2[X], then two tuples t3 and t4 should also are present in ur with the subsequent properties, in which we work with Z to denote (R -(X U Y)):? t3[X] sama dengan t4[X] = t1[X] = t2[X]. t3[Y] = t1[Y] and t4[Y] = t2[Y]. t3[Z] sama dengan t2[Z] and t4[Z] = t1[Z].
An MVD X “>, >, Y in L is called a trivial MVD if (a) Y can be described as subset of X, or perhaps (b) By U Y = 3rd there’s r.?? Multivalued Dependencies and Next Normal Contact form Definition:? A relation programa R is within 4NF with respect to a set of dependencies F (that includes efficient dependencies and multivalued dependencies) if, for every non-trivial multivalued dependency X “>, >, Y in F+, By is a superkey for R.? Informally, when 2 tuples that have different Y principles but same X beliefs, exists, then if these kinds of Y ideals get repeated in distinct tuples jointly distinct ideals of Unces Unces = Ur ” (X U Y) that develops with the same X worth. Cont. ) (Cont. ) Lossless ( Non-additive ) Join Decomposition into 4NF Relations:? HOME LJ1′? The relation schemas R1 and R2 form a lossless ( non-additive ) become a member of decomposition of R with respect to a arranged F of functional and multivalued dependencies if and only if? (R1? R2) “>, >, (R1 , R2) (R1? R2) “>, >, (R2 , R1)).? or? (Cont. ) Algorithm 11. 5: Relational decomposition in 4NF relationships with nonadditive join house? Input: A universal relationship R and a set of useful and multivalued dependencies N.
Set D: = R , While there is actually a relation programa Q in D that is not in 4NF do pick a relation schema Q in D that is not in 4NF, find a nontrivial MVD X “>, >, Y in Q that violates 4NF, replace Q in Deb by two relation schemas (Q , Y) and (X U Y), , 1 . installment payments on your 4. Join Dependencies and Fifth Usual Form Description:? A sign up for dependency (JD), denoted by JD(R1, R2, , Rn), specified on relation programa R, specifies a constraint on the claims r of R.? The constraint says that every legal state r of R should have a nonadditive join decomposition in R1, R2, , Registered nurse, that is, for each such r we have 2. (? R1(r),? R2(r), ,? Rn(r)) sama dengan r (Cont. ) Classification:? A connection schema 3rd there’s r is in fifth normal contact form (5NF) (or Project-Join Normal Form (PJNF)) with respect to a set Farreneheit of efficient, multivalued, and join dependencies if,? for each and every non-trivial sign up for dependency JD(R1, R2, , Rn) in F+ (that is, intended by F),? every Ri is a superkey of 3rd there’s r. Recap??? Building a Set of Relationships Properties of Relational Decompositions Algorithms to get Relational Data source Schema Multivalued Dependencies and Fourth Typical Form Sign up for Dependencies and Fifth Normal Form
Tutorial/Quiz 4 Q1) Consider a relation R with 5 qualities ABCDE, You are given the subsequent dependencies: A >B, BC >E, IMPOTENCE >A a) List every one of the keys, b) Is R in 3 NF c) Is R in BCNF Q2) Consider the following decomposition for the relation programa R sama dengan A, B, C, D, E, F, G, H, We, J plus the set of useful dependencies F = A, B >C, A >D, E, N >N, Farrenheit >G, H, D ->, I, J . Preserves Lossless Join and Dependencies? a) D1 sama dengan R1, R2, R3, R4, R5, R1= A, B, C R2= A, D, Elizabeth, R3= N, F, R4 = Farreneheit, G, H, R5 sama dengan M, I, J b) D2 = R1, R2, R3 R1 = A, B, C, D, At the R2 sama dengan B, F, G, H, R3 = D, I, M