QUESTION BANK. SUBJECT CODE / Name: CS2255 DATABASE MANAGEMENT SYSTEM UNIT III. PART -A (2 Marks)

Size: px
Start display at page:

Download "QUESTION BANK. SUBJECT CODE / Name: CS2255 DATABASE MANAGEMENT SYSTEM UNIT III. PART -A (2 Marks)"

Transcription

1 QUESTION BANK DEPARTMENT: CSE SEMESTER: IV SUBJECT CODE / Name: CS2255 DATABASE MANAGEMENT SYSTEM UNIT III PART -A (2 Marks) 1. Explain the two conditions needed for the set difference operation (union Operation) to be valid. Two conditions are, Relations, r and s must be of the same arity i.e., they must have same number of attributes. Domains of the it attribute of r and the ith attribute of s must be same for all i. 2. Explain with one example why the additional operators are separated from the Fundamental operators? Additional operators are used instead of fundamental operators to reduce the complexity of long relational algebra expressions. E.g. r Ç s = r ( r s ) Intersection can be used for repeated set difference operations. 3. Explain theta join. (A.UMay/June 2008) Theta join is an extension to the natural join operation that allows combining a Selection operation with condition, q and a Cartesian product into as ingle operation. r q s = sq (r x s)r s = pr-s(r) - pr-s(pr-s(r) x s) -pr-s,s (r)) 4. Define how an expression can be expressed in tuple relational calculus and list out the notations used. A query or expression can be expressed in tuple relational calculus as {t P (t)} which means the set of all tuples t such that predicate P is true for t.notations used: t[a] the value of tuple t on attribute, A t Î r tuple t is in relation r $ there exists Definition for there exists ($): $ t Î r(q(t))which means there exists a tuple t in relation r such that predicate Q(t) is true. " for all Definition for for all ("):"t Î r(q(t))which means Q(t) is true for all tuples t in relation s. _ Implication Definition for Implication (_):P_Q means if P is true then Q must be true. 5. Write an expression to find the names of all customers who have a loan from the Perry ridge branch in tuple relational calculus. Expression in tuple relational calculus :{t $ s Î borrower ( t[cust_name] = s[cust_name] Ù $ u Î loan (u[loan_no] = s[loan_no] Ù u[branch_name] = perryridge ))}

2 6. Write an expression to find all customers who have an account at all branches Located in Brooklyn in tuple relational calculus. {t " u Î branch ( u[branch_city] = Brooklyn _ $ s Î depositor (t[cust_name] = s[cust_name] Ù $ w Î account ( w[acc_no] =s[acc_no] Ùw[branch_name] = u[branch_name])))} 7. Define safety of expression in tuple relational calculus. (A.UNov/Dec 2010) Query or expression { t P(t)} is safe if all values that appear in the result are values from Dom(p), where Dom(p) is domain of P. Else it is unsafe. For example, the tuples selected in the tuple relational calculus are unsafe. 8. Define domain relational calculus. (A.UNov/Dec 2008) Domain relational calculus uses domain variables that take on values from an attribute s domain rather than values for an entire tuple.an expression in the domain relational calculus is of the form{<x1,xn, xn> (P(x1,xn, xn))}where x1,xn, xn represents domain variables.p represents a formula composed of atoms or domain variables. 9. Write an expression to find all customers who have an account, a loan or both at The Perry ridge branch in domain relational calculus. { <c> $ l (<c,l> Î borrower Ù $ b,a (<l,b,a> Î loan Ù b = Perry ridge ))Ú $ a (<c,a> Î depositor Ù $ b,bal (<a,b,bal> Î account Ù b = Perry ridge ))} 10. Define and give the general format used for generalized projection. Give one Example expression to illustrate the same. Generalized projection extends the projection operation by allowing arithmetic functions to be used in the projection list. General format used for Generalized projection ispf1 F2 Fn(E)where is the relational algebra expression.f1 F2 Fn are the arithmetic expressions involving constants and attributes in the schema of E. Special case these can be simply an attribute or a constant. Example expression for illustration: pacc_no, branch_name, balance (account) 11. What is the use of outer join and list out the three types of outer join with the Notations used in relational algebra?( A.UApril/May2010) Natural join combines only the common columns. So some information will be lost, if it has no common column. So outer join is used. It avoids this loss of information. Three types of outer join: Left outer join ( ) Right outer join ( ) Full outer join ( ) 12. Write a relational algebraic expression to delete all accounts at branches located inbrooklyn. r1 sbranch_city = Brooklyn (account branch) r2 pbranch_name, acc_no, balance (r1) Account account r2where r1 and r2 are temporary relations.

3 PART - B 1. Explain about Functional Dependencies in details. Functional dependencies are constraints on the set of legal relations. The functional dependency holds on R if and only if for any legal relations r(r), whenever any two tuples t1 and t2 of r agree on the attributes, they also agree on the attributes. That is, t1[] = t2 [] t1[ ] = t2 [ ] It requires that the value for a certain set of attributes determines uniquely the value for another set of attributes. In a given relation R, X and Y are attributes. Attributes Y is functionally dependent on attribute X if each value of X determines exactly one value of Y, which is represented as X > Y Types Full functional dependency Partial functional dependency Transitive functional dependency 1. Full dependencies In a relation R, X and Y are attributes. X functionally determines Y. Subset of X should not functionally determine Y. Course_no Marks Student_no Figure 3.1. Full dependencies In the above example marks is fully functionally dependent on student_no and course_no together and not on subset of {student_no, course_no}. This means marks cannot be determined either by student_no or course_no alone.it can be determined only using student_no and course_no together. Hence marks are fully functionally dependent on {student_no, course_no}. 2. Partial dependencies attribute X. Attribute Y is partially dependent on the attribute X only if it is dependent on a subset of For example course_name, Instructer_name are partially dependent on composite attributes {student-no,course_no} because course_no alone defines course_name, Instructor_name. 3. Transitive dependencies

4 X, Y and Z are 3 attributes in the relation R. X Y Y Z X Z For example, grade depends on marks and in turn mark depends on {student_no, course_no}, hence Grade depends fully transitively on {student_no & course_no} Use of Functional Dependencies We use functional dependencies to: Test relations to see if they are legal under a given set of functional dependencies. If a relation r is legal under a set F of functional dependencies, we say that r satisfies F. specify constraints on the set of legal relations We say that F holds on R if all legal relations on R satisfy the set of functional dependencies F Closure of a set of functional dependencies Given a set of functional dependencies F, there are certain other functional dependencies that are logically implied by F. For example: If A B and B C, then we can infer that A C The set of all functional dependencies logically implied by F is the closure of F. We denote the closure of F by F +. We can find all F + by applying Armstrong s Axioms: Reflexivity Rule If α is a set of attributes and, then α β holds. Augmentation Rule

5 Ifα β, then γ is a set of attributes, then γα γβ holds. Transitivity Rule If α β holds and β γ holds then α γ holds. Sound (generate only functional dependencies that actually hold) and Complete (generate all functional dependencies that hold). were the rules. In addition to these three basic rules there are three additional rules to simplify manual computation of F +. Union Rule If α β holds and α γ holds, then α βγ holds Decomposition Rule If α βγ holds, then α β holds and α γ holds Pseudotransitivity Rule If α β holds and γβ δ holds, then αγ δ holds Example: Consider the schema R = (A, B, C, G, H, I) Set of functional dependency F = {A B, A C, CG H, CG I, B H} Some members of F + A H By transitivity from A B and B H then A H holds. AG I By augmenting A C with G, to get AG CG and then transitivity with CG I we get AG I. CG HI By union rule of CG H and CG I, CG HI holds. The left-hand and right-hand sides of a functional dependency are both subsets of R. Procedure for Computing F+: To compute the closure of a set of functional dependencies F: F + = F repeat for each functional dependency f in F+ apply reflexivity and augmentation rules on f add the resulting functional dependencies to F + for each pair of functional dependencies f1and f2 in F +

6 if f1 and f2 can be combined using transitivity then add the resulting functional dependency to F + until F + does not change any further A set of size n has 2n subsets, there are a total of 2 2n = 2n+1 possible functional dependencies, where n is the number of attributes in R. Each iteration of the loop except the last iteration adds at least one functional dependency to F Closure of attributes sets An attribute is functionally determined by α if α Β holds. Given a set of attributes, define the closure of (+) under F as the set of attributes that are functionally determined by under F Algorithm to compute α+, the closure of under F result := a; while (changes to result) do for each β γ in F do begin if result then result := result end Example of Attribute Set Closure is R = (A, B, C, G, H, I) F = {A B,A C, CG H,CG I,B H} To compute closure of A, (AG)+ The algorithm start with result = AG result = AG A B includes B in result. Since A B is in F and A result, so result: = result B result = ABCGH (CG H and CG AGBC) result = ABCG (A C ) result = ABCGHI (CG I and CG AGBCH) Uses of Attribute Closure There are several uses of the attribute closure algorithm: Testing for super key: To test if is a super key, we compute +, and check if + contains all attributes of R. Testing functional dependencies

7 To check if a functional dependency holds ( in other words, is in F+), just check if +. That is, we compute + by using attribute closure, and then check if it contains. Is a simple and cheap test, and very useful CANONICAL COVER If a relational schema R has a set of functional dependencies. Whenever a user performs an update on the relation, the database system must ensure that the update does not violate any functional dependencies. The system must roll back the update if it violates any functional dependencies in the set F. The violation can be checked by testing a simplified set of functional dependencies. If simplified set of functional dependency is satisfied then the original functional dependency is satisfied and vice versa. Sets of functional dependencies may have redundant dependencies that can be inferred from the others. A canonical cover of F is a minimal set of functional dependencies equivalent to F, having no redundant dependencies or redundant parts of dependencies Extraneous Attributes An attribute of a functional dependency is said to be extraneous if we can remove it without changing the closure of the set of functional dependencies. Consider a set F of functional dependencies and the functional dependency in F. Attribute A is extraneous in if A and F logically implies (F { }) {( A) } Attribute A is extraneous in β if A β the set of functional dependencies (F { }) { ( A)} Example: Given as F={A C,AB C} B is extraneous in AB C because {A C,AB C} logically implies A C. Example: Given F={A C,AB CD} C is extraneous in AB CD since AB C can be inferred even after deleting C. Testing if an Attribute is Extraneous Consider a set F of functional dependencies and the functional dependency in F. To test if attribute A is extraneous in Compute ({α} - A) + using the dependencies in F Check that ({α} - A) + contains A; if it does, A is extraneous in α To test if attribute A is extraneous in β. Compute α + using only the dependencies in (F { }) { ( A)},

8 Check that α + contains A; if it does, A is extraneous in β Example: F contains AB CD, A E and E C. to check C is extraneous in AB CD, we compute the attribute closure of AB under F = {AB CD, A E, E C} The closure is ABCDE, which includes CD. So C is extraneous. Definition of Canonical Cover A canonical cover for F is a set of dependencies Fc such that F logically implies all dependencies in Fc, and Fc logically implies all dependencies in F, and No functional dependency in Fc contains an extraneous attribute, and Each left side of functional dependency in Fc is unique. To compute a canonical cover for F: Fc =F Use the union rule to replace any dependencies in F, α1 β1 and α1 β2 with α1 β1β2 Find a functional dependency with an extraneous attribute either in β or α. If an extraneous attribute is found, delete it from α β until F does not change Computing a Canonical Cover R = (A, B, C) F = {A BC, B C, A B, AB C} By union rule combine A BC and A B into A BC. Set is now {A BC, B C, AB C} A is extraneous in AB C Check if the result of deleting A from AB C is implied by the other dependencies After deleting A from AB C the resultant set will be {A BC, B C, B C} B C is already present in the set. So the resultant set is now {A BC, B C} C is extraneous in A BC. Removing C from A BC we get {A B, B C} The canonical cover is: A B & B C, Canonical cover might not be unique.

9 2. Explain about Normalization in detail. Normalization of data is a process of analyzing the given relational schema based on their functional dependencies and primary key to achieve the desirable properties of Minimize redundancy Minimize insert, delete and update anomalies during database activities Normalization is an essential part of database design. The concept of normalization helps the designer to built efficient design. 1. Purpose of Normalization Minimize redundancy in data. Remove insert, delete and update anomaly during database activities. Reduce the need to reorganize data when it is modified or enhanced. Normalization reduces a complex user view to a set of small and stable subgroups of fields/relations. This process helps to design a logical data model known as conceptual data model Normalization Forms Different normalization forms are: First normal form (1NF): A relation is said to be in the first normal form if it is already in unnormalized form and it has no repeating group. Second normal form (2NF): A relation is said to be in second normal form if it is already in the first normal form and it has no partial dependency. Third normal form (3NF): A relation is said to be in third normal form if it is already in second normal form and it has no transitive dependency. Boyce-codd normal form(bcnf): A relation is said to be in Boyce-codd normal form if it is already in third normal form and every determinant is a candidate key. It is a stronger version of 3NF Fourth normal form (4NF) : A relation is said to be in fourth normal form if it is already in BCNF and it has no multivalued dependency. Fifth normal form (5NF) : A relation is said to be in 5NF if it is already in 3NF and has no join dependency.

10 3.4. FIRST NORMAL FORM (1NF) 1NF does not allow multi valued attribute or composite attribute and their combinations. It states that domain of the attribute includes only single value, atomic or indivisible 1NF does not allow relation within relation. Example: Consider the following schema Department Table 3.2 Department Relation Dname Dnumber Dmgr_ssn Dlocation Research {Bellaire,Sugsrland,Houston} Administration Stafford Headquarters Houston In our example Department relation is not in 1NF because D location has multi valued attributes. There are 3 main techniques to achieve 1NF for such relation. Remove the D-location that violates 1NF and place it in a separate relation Dept_location along with primary key D number of department. The primary key of this relation is the combination of {D number, D location}. Dnumber Table 3.3 Department Relation Dept_location Dlocation 5 Bellaire 5 Sugsrland 5 Houston 4 Stafford 1 Houston Expand the key so that there will be separate tuple in the original department relation. The primary key becomes {D number, D location}. This solution has the

11 disadvantage of introducing redundancy in the relation. Table 3.4 Department Table Dname Dnumber Dmgr_ssn Dlocation Research Bellaire Research Sugsrland Research Houston Administration Stafford Headquarters Houston If a maximum number of values is known for the attribute. For example, if it is known that at most three locations can exist for a department, and then replace D-location by Dlocation1, D-location 2, and Dlocation3. This solution has the disadvantage of introducing null values if most departments have fewer than three locations. Table 3.5 Department Table Dname Dnumber Dmgr_ssn Dlocation_1 Dlocation_2 Dlocation_3 Research Bellaire Sugsrland Houston Administration Stafford Null Null Headquarters Houston Null Null 1NF does not allow nested relation EMP_P ROJ. PROJS This schema can also be represented as Eid Ename Pnumber Hours Figure NF EMP_PROJ (Eid, Ename, {PROJS (Pnumber, Hours)})

12 EMP_PROJ(Eid,Ename,{PROJ(Pnumber,Hour s)}) EMP_PROJ1 EMP_PROJ2 Eid Ename Eid Pnumber Hours Figure NF schema To normalize this nested relation into 1NF, we remove the nested relation attributes into a new relation and propagate the primary key into it. Primary key of the new relation will be the partial key with the primary key of the original relation SECOND NORMAL FORM (2NF) 2NF is based on the concept of full functional dependency. A functional dependency XY is fully functional dependency if removal of any attribute A from X means that the dependency does not hold any more. i.e., any attribute A X, (X-{A}) does not functionally determine Y. A functional dependency XY is partial functional dependency if some attribute A X removed from X and the functional dependency still holds, for some A X, (X-{A})Y holds Example {eid, Pnumber}hours is partial functional dependency, {eid, Pnumber}Ename is partial functional dependency because eid Ename holds The test for 2NF involves testing for FDs whose LHS attribute are parts of the PK. If the PK contains a single attribute, the test need not be applied at all. A relational schema R is in 2NF if every nonprime attribute A in R is fully functional dependent on the PK of R. Prime attribute: An attribute of a relational schema R is called a Prime attribute of R if it is a member of some candidate key of R. Nonprime attribute: An attribute is called a nonprime attribute if it is not a prime attribute. i.e., if it is not a member of any candidate key.

13 Example EMP_PROJ Ssn Pnumber Hours Ename Pname Plocation Figure 3.4. Nonprime attribute EMP_PROJ Ssn Pnumber Hours Ename Pname Plocation FD1 FD2 FD3 EP1 Ssn Pnumber Hours FD1 EP2 Ssn Ename FD2

14 EP3 Pnumber Pname Plocation F D3 Figure 3.5 Nonprime attribute schema In the above example EMP_PROJ. Ssn and Pnumber are primary key. The table is in 1NF. FD1 is in 2NF but FD2 and FD3 violates 2Nf. The Ename, Pname, Plocation in FD2 and FD3 are partially dependent on the primary key attributes Ssn and Pnumber. A relation which is not in second normal form can be made to be in 2NF by decomposing the relation into a number such that each nonprime attribute is fully functional dependent on the primary key. So the above table can be decomposed in to three tables THIRD NORMAL FORM (3NF) Third Normal Form is based on the concept of transitive dependency. A relational schema R is in 3NF if it satisfies 2NF and no nonprime attribute in relation R is transitively dependent on the primary key. A functional dependency XY in a relational schema R is a transitive dependency if there is a set of attributes Z that is neither a candidate key or a subset of any key R, and both XZ and ZY hold. Example: EMP_DEPT Ename Eid DOB Address Dnumber Dname DMGRid ED1 Ename Eid DOB Address Dnumber ED2 Dnumber Dname DMGRid Figure NF

15 The dependency EidDMRid is transitive through Dnumber in EMO_DEPT, because both the dependencies EidDnumber and Dnumber and DMGRid hold. Dnumber is neither a key itself nor a subset of key of EMP_DEPT. therefore the EMP_DEPT relational schema is not in 3NF. The relation is in 2NF because there is no partial dependencies on the key attribute. We can normalize EMP_DEPT by decomposing it into two 3NF relational schemas ED1 and ED2. Summary of Normal Forms Normal form Test Remedy 1NF Relation should have no Forms new relations for each multivalued attributes or multivalued attributes or nested relations. nested relations 2NF For relations where primary Decomposes and set up a new key contains multiple relation for each partial key attribute, no non key attribute with its dependent attributes. should be functionally Make sure to keep a relation dependent on a pert of primary with the original primary key key. and any attributes that are fully FD on it. 3NF Relations should not have a Decompose and set up a non key attribute functionally relation that includes the non determined by another non key attributes that functionally key attribute. i.e., there should determines other non-key be no transitive dependency of attributes. a non key attribute on the primary key DECOMPOSITION We can avoid update anomalies by decomposition of the original relation. The relation schema R is decomposed into relation schemas:

16 {R1,R2,,Rn} R1 R2 Rn = R In the desirable properties of decomposition, there are 2 important properties associated with decomposition LOSS LESS DECOMPOSITION Let R be a relational schema and F be a set of functional dependencies on R. Let R1 and R2 form a decomposition of R. Let r(r) be a relation with schema R. The decomposition is lossless decomposition If natural join is computed on R1 and R2 then we get the relation r. A decomposition that is not a lossless decomposition is called lossy decomposition. The lossless join decomposition is also called lossless decomposition and the lossy join decomposition is called lossy decomposition. R1 and R2 form a lossless decomposition of R if at least one of the following functional dependency is in F+ R1 R2 R1 R1 R2 R2 If R1R2 forms a super key of either R1 or R2, the decomposition of R is a lossless decomposition. Attribute closure can be used to calculate super key. Example: Consider the following schema bor_loan = (customer_id, loan_number, amount) If it is decomposed into borrower = (customer_id, loan_number) loan = (loan_number, amount) Here borrower = loan_number and loan_number_amount, satisfies lossless decomposition rule DEPENDENCY PRESERVATION Let F be a set of functional dependencies on a schema R, and let R1, R2,..., Rn be a decomposition of R.

17 The restriction of F to Ri is the set Fi of all functional dependencies in F+ that include only attributes of Ri. Example F = {A B, B C} The restriction of F is A C, since A C is in F+, even though it is not in F. Even though F F, F +=F+ where F =F1F2F3 Fn. The decomposition having the property F +=F+ is a dependency-preserving decomposition. Algorithm to test dependency preservation: compute F+; for each schema Ri in D do begin Fi : = the restriction of F+ to Ri; End F : =θ for each restriction Fi do begin F = F Fi end compute F +; if (F += F+) then return (true) else return (false); The input to the algorithm is a set of decomposed relational schemas D = {R1, R2, R3, Rn} and a set F of functional dependencies. This algorithm is expensive since it requires the computation of F+ The second alternative method to calculate dependency preservation is as follows. The test is applied to each { } in F result = α while (changes to result) do for each Ri in the decomposition t = (result Ri)+ Ri result = result t If result contains all attributes in β, then the functional dependency α β is preserved.

18 3. Explain about Boyce-Codd Normal Form. A relational schema R is in BCNF with respect to a set F of functional dependencies, if for all FD in F+ of the form α β at least one of the following holds α β is a trivial dependency α β. α is a super key for the schema R. BCNF Decomposition Algorithm result := {R}; done := false; compute F+; while (not done) do if (there is a schema Ri in result that is not in BCNF) then begin let α β be a nontrivial functional dependency that holds on Ri such that α Ri is not in F+, and ; result : (result Ri) (Ri ) (, ); end else done := true; Example: Consider the following relational schema. Customer-schema = (customer-name, customer-street, customer-city) Customer-name customer-street, customer-city Branch-schema = (branch-name, assets, branch-city) Branch-name assets, branch-city Loan-info-schema = (branch-name, customer-name, loan-number, amount) Loan-number amount, branch-name Customer-schema is in BCNF. Since customer-name is a candidate key, functional dependencies with customer-name on the left side do not violate the definition of BCNF. Similarly, the relation schema Branch-schema is also in BCNF. The schema Loan-infoschema is not in BCNF. First, note that loan-number is not a superkey for Loan-infoschema, since we can have a pair of tuples with a single loan for example, loannumber is not a candidate key

19 However, the functional dependency loan-number amount is nontrivial. Therefore, Loaninfo-schema does not satisfy the definition of BCNF. If several customer names are associated with a loan, then branch name and the amount is repeated once for each customer. This can be eliminated by redesigning the database such that all schemas are in BCNF. One approach to this problem is to take the existing non- BCNF design as a starting point, and to decompose those schemas that are not in BCNF. Consider the decomposition of Loan-info-schema into two schemas: Loan-schema = (loan-number, branch-name, amount) Borrower-schema = (customer-name, loan-number) The decomposition is based on the following expression R1=(α,β)& R2=(Ri-β) This decomposition is loss less-join decomposition. To determine whether these schemas are in BCNF, we need to determine what functional dependencies apply to them. n this example, it is easy to see that loan-number amount, branch-name applies to the Loan-schema, and that only trivial functional dependencies apply to Borrower-schema. Although loan-number is not a superkey for Loan-info-schema, it is a candidate key for Loan-schema. Thus, both schemas of our decomposition are in BCNF. Testing Decomposition for BCNF To test if a relation is in BCNF the following can be done: To check if a nontrivial dependency α β causes a violation of BCNF, compute α+ and verify that it includes all attributes of R; that is, it is a superkey of R. To check if a relation schema R is in BCNF, it sufficient to check only if the dependencies in the set F do not violate BCNF, rather than to check all dependencies in F+. If none of the dependencies in F causes a violation of BCNF, then none of the dependencies in F+ will cause a violation of BCNF either. It is not true when a relation is decomposed. An alternative BCNF test to check if a relation Ri, decomposition of R is in BCNF, the following test can be applied:.

20 For every subset α of attributes in Ri, check that α+ either includes no attribute of Ri-α, or includes all attributes of Ri. 4. Explain about Multi-Valued Dependencies (Mvd). A Multi-valued Dependencies X Y on relation schema R, where X and Y are both subset of R, specifies the following constraints any relation state r of R. If two tuples t1 and t2 exist in r such that t1[x] = t2[x], then two tuples t3 and t4 should exist in r with the following properties t3[x] = t4[x] = t1[x] = t2[x] t3[y] = t1[y] and t4[y] = t2[y] t3[z] = t2[z] and t4[z] = t1[z] where Z is used to denote (R- (X Y)) X Y holds, we say that X multidetermines Y. A MVD is trivial Multi-valued Dependencies if Y is a subset of X. X Y = R In MVD X Y, X Z can be written as X Y/Z. Inference rules for functional and multivalued dependencies IR1 (reflexive rule for FDs) : If XY, then X Y IR2 (augmentation rule for FDs): {X Y}=XZ YZ IR3 (transitive rule for FDs) : {X Y, Y Z}=X Z IR4 (complementation rule for FDs) : { X Y} = {X (R-XY))} IR5 (augmentation rule for MVDs) : if X Y and wz, then wx YZ IR6 (transitive rule for MVDs) : if { X Y, X Z } = X (Z-Y) IR7 (replication rule for MVDs) : { X Y}={ x y} IR8 (coalescence rule for FDs and MVDs) : if { X Y} and there exists w with the properties that wy is empty wz and y z, then xz

21 FOURTH NORMAL FORM A relational schema R is in 4NF with respect to a set of dependency F if for every non trivial multivalve dependency X Y in F+, X is a super key for R. Example Table 3.6. Employee Table EMP Ename Pname Dname Smith X John Smith Y Anna Smith X Anna Smith Y John Table 3.7. Tables After Fourth Normal Form EMP_PROJECTS Ename Pname Smith X Smith Y EMP_DEPENDENTS Ename Dname Smith John Smith Anna If the relation has nontrivial MVDs, then insert, delete and update operations on single tuples may cause additional tuples to be modified. To overcome these anomalies the relation is decomposed into 4NF. Procedure for 4NF: Input: A universal relation R and a set of functional and multivalve dependencies F Set D :={ R} While there is a relation schema Q in D that is not in 4NF, do { Choose a relation schema Qin D that is not in 4NF; Fine a nontrivial MVD X Y that violates 4NF;

22 Replace Qin D by two relation schemas (Q-Y) and (X Y); }; FIFTH NORMAL FORM A relational schema R is in fifth normal form or Project Join Normal Form (PJNF) with respect to a set F of functional, multivalve and join dependency if, for every nontrivial join dependency JD (R1, R2, R3 Rn) in F+, every Ri is a super key of R. Table 3.8 Tables for Fifth Normal Form Sname Part_name Sname Part_name Proj_name Smith Bolt Smith Bolt X Smith Nut Smith Nut Y Adamsky Bolt Adamsky Bolt Y Walton Nut Walton Nut Z Adamsky Nail X Adamsky Bolt X Smith Bolt Y The supply relation is decomposed into three relations R1, R2, R3 that are in 5NF. Table 3.9 Results After Fifth Normal Form Adamsky Nail Sname Proj_name Part_name Proj_name Smith X Bolt X Smith Y Nut Y

23 R1 R2 R3 Adamsky Walton Adamsky Y Z X Bolt Nut Nail Y Z X 3. ANOMALIES IN DATABASES There are three types of anomalies. They are Insert Anomalies Update Anomalies Delete Anomalies Insert Anomalies: The inability to insert part of information into a relational schema due to the unavailability of part of the remaining information is called Insert Anomalies. Example: If there is a guid having no registered under him, then we cannot insert the guide s information in the schema project. Update Anomalies: Updation of relation schema with redundancy may lead to update anomalies. Example: If a person changes his address then the updating should be carried out wherever the copies occur. If it is not updated properly then data inconsistency arises. Delete Anomalies: If the deletion of some information leads to loss of some other information, then we say there is a deletion anomaly. Example: If a guide guides one student and if the student discontinues the course then the information about the guid will be lost.

UNIT 3 DATABASE DESIGN

UNIT 3 DATABASE DESIGN UNIT 3 DATABASE DESIGN Objective To study design guidelines for relational databases. To know about Functional dependencies. To have an understanding on First, Second, Third Normal forms To study about

More information

MODULE: 3 FUNCTIONAL DEPENDENCIES

MODULE: 3 FUNCTIONAL DEPENDENCIES MODULE: 3 (13 hours) Database design: functional dependencies - Inference Rules for Functional Dependencies - Closure -- Minimal Cover -Normal forms First-second and third normal forms Boyce- Codd normal

More information

Functional Dependencies and Normalization for Relational Databases Design & Analysis of Database Systems

Functional Dependencies and Normalization for Relational Databases Design & Analysis of Database Systems Functional Dependencies and Normalization for Relational Databases 406.426 Design & Analysis of Database Systems Jonghun Park jonghun@snu.ac.kr Dept. of Industrial Engineering Seoul National University

More information

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant

More information

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases Chapter 10 Functional Dependencies and Normalization for Relational Databases Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant

More information

UNIT -III. Two Marks. The main goal of normalization is to reduce redundant data. Normalization is based on functional dependencies.

UNIT -III. Two Marks. The main goal of normalization is to reduce redundant data. Normalization is based on functional dependencies. UNIT -III Relational Database Design: Features of Good Relational Designs- Atomic Domains and First Normal Form- Second Normal Form-Decomposition Using Functional Dependencies- Functional-Dependency Theory-Algorithms

More information

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.) Chapter 10 Normalization Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information in Tuples and Update Anomalies 1.3 Null

More information

Informal Design Guidelines for Relational Databases

Informal Design Guidelines for Relational Databases Outline Informal Design Guidelines for Relational Databases Semantics of the Relation Attributes Redundant Information in Tuples and Update Anomalies Null Values in Tuples Spurious Tuples Functional Dependencies

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases Slide 14-2 Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1 Semantics of the Relation Attributes

More information

Relational Database design. Slides By: Shree Jaswal

Relational Database design. Slides By: Shree Jaswal Relational Database design Slides By: Shree Jaswal Topics: Design guidelines for relational schema, Functional Dependencies, Definition of Normal Forms- 1NF, 2NF, 3NF, BCNF, Converting Relational Schema

More information

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies Chapter 14 Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies Copyright 2012 Ramez Elmasri and Shamkant B. Navathe Chapter Outline 1 Informal Design Guidelines

More information

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys) 1 / 13 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant d Information in Tuples and Update Anomalies 1.3 Null Values in Tuples 1.4 Spurious Tuples

More information

Chapter 8: Relational Database Design

Chapter 8: Relational Database Design Chapter 8: Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 8: Relational Database Design Features of Good Relational Design Atomic Domains

More information

Chapter 7: Relational Database Design

Chapter 7: Relational Database Design Chapter 7: Relational Database Design Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains

More information

Unit 3 : Relational Database Design

Unit 3 : Relational Database Design Unit 3 : Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Content Relational Model: Basic concepts, Attributes and Domains, CODD's Rules, Relational

More information

Dr. Anis Koubaa. Advanced Databases SE487. Prince Sultan University

Dr. Anis Koubaa. Advanced Databases SE487. Prince Sultan University Advanced Databases Prince Sultan University College of Computer and Information Sciences Fall 2013 Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases Anis Koubaa SE487

More information

Functional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT

Functional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT Functional Dependencies & Normalization for Relational DBs Truong Tuan Anh CSE-HCMUT 1 2 Contents 1 Introduction 2 Functional dependencies (FDs) 3 Normalization 4 Relational database schema design algorithms

More information

Chapter 14 Outline. Normalization for Relational Databases: Outline. Chapter 14: Basics of Functional Dependencies and

Chapter 14 Outline. Normalization for Relational Databases: Outline. Chapter 14: Basics of Functional Dependencies and Ramez Elmasri, Shamkant B. Navathe(2016) Fundamentals of Database Systems (7th Edition), pearson, isbn 10: 0-13-397077-9;isbn-13:978-0-13-397077-7. Chapter 14: Basics of Functional Dependencies and Normalization

More information

Relational Database Design (II)

Relational Database Design (II) Relational Database Design (II) 1 Roadmap of This Lecture Algorithms for Functional Dependencies (cont d) Decomposition Using Multi-valued Dependencies More Normal Form Database-Design Process Modeling

More information

customer = (customer_id, _ customer_name, customer_street,

customer = (customer_id, _ customer_name, customer_street, Relational Database Design COMPILED BY: RITURAJ JAIN The Banking Schema branch = (branch_name, branch_city, assets) customer = (customer_id, _ customer_name, customer_street, customer_city) account = (account_number,

More information

Relational Design: Characteristics of Well-designed DB

Relational Design: Characteristics of Well-designed DB 1. Minimal duplication Relational Design: Characteristics of Well-designed DB Consider table newfaculty (Result of F aculty T each Course) Id Lname Off Bldg Phone Salary Numb Dept Lvl MaxSz 20000 Cotts

More information

Database Design Theory and Normalization. CS 377: Database Systems

Database Design Theory and Normalization. CS 377: Database Systems Database Design Theory and Normalization CS 377: Database Systems Recap: What Has Been Covered Lectures 1-2: Database Overview & Concepts Lecture 4: Representational Model (Relational Model) & Mapping

More information

Functional Dependencies

Functional Dependencies Functional Dependencies Redundancy in Database Design A table Students-take-courses (stud-id, name, address, phone, crs-id, instructor-name, office) Students(stud-id, name, address, phone, ) Instructors(name,

More information

Functional Dependencies CS 1270

Functional Dependencies CS 1270 Functional Dependencies CS 1270 Constraints We use constraints to enforce semantic requirements on a DBMS Predicates that the DBMS must ensure to be always true. Predicates are checked when the DBMS chooses

More information

The strategy for achieving a good design is to decompose a badly designed relation appropriately.

The strategy for achieving a good design is to decompose a badly designed relation appropriately. The strategy for achieving a good design is to decompose a badly designed relation appropriately. Functional Dependencies The single most important concept in relational schema design theory is that of

More information

Chapter 6: Relational Database Design

Chapter 6: Relational Database Design Chapter 6: Relational Database Design Chapter 6: Relational Database Design Features of Good Relational Design Atomic Domains and First Normal Form Decomposition Using Functional Dependencies Second Normal

More information

COSC Dr. Ramon Lawrence. Emp Relation

COSC Dr. Ramon Lawrence. Emp Relation COSC 304 Introduction to Database Systems Normalization Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Normalization Normalization is a technique for producing relations

More information

Database Design Principles

Database Design Principles Database Design Principles CPS352: Database Systems Simon Miner Gordon College Last Revised: 2/11/15 Agenda Check-in Design Project ERD Presentations Database Design Principles Decomposition Functional

More information

CS 2451 Database Systems: Database and Schema Design

CS 2451 Database Systems: Database and Schema Design CS 2451 Database Systems: Database and Schema Design http://www.seas.gwu.edu/~bhagiweb/cs2541 Spring 2018 Instructor: Dr. Bhagi Narahari Relational Model: Definitions Review Relations/tables, Attributes/Columns,

More information

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design 1 Normalization What and Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update Normalization uses concept of dependencies Functional

More information

Schema Refinement: Dependencies and Normal Forms

Schema Refinement: Dependencies and Normal Forms Schema Refinement: Dependencies and Normal Forms Grant Weddell David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2012 CS 348 (Intro to

More information

Functional Dependencies and Finding a Minimal Cover

Functional Dependencies and Finding a Minimal Cover Functional Dependencies and Finding a Minimal Cover Robert Soulé 1 Normalization An anomaly occurs in a database when you can update, insert, or delete data, and get undesired side-effects. These side

More information

Schema Refinement: Dependencies and Normal Forms

Schema Refinement: Dependencies and Normal Forms Schema Refinement: Dependencies and Normal Forms Grant Weddell Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2016 CS 348 (Intro to DB Mgmt)

More information

Schema Refinement: Dependencies and Normal Forms

Schema Refinement: Dependencies and Normal Forms Schema Refinement: Dependencies and Normal Forms M. Tamer Özsu David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Fall 2012 CS 348 Schema Refinement

More information

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise CSC 74 Database Management Systems Topic #6: Database Design Weak Entity Type E Create a relation R Include all simple attributes and simple components of composite attributes. Include the primary key

More information

Unit IV. S_id S_Name S_Address Subject_opted

Unit IV. S_id S_Name S_Address Subject_opted Page no: 1 Unit IV Normalization of Database Database Normalizations is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data

More information

Lecture 11 - Chapter 8 Relational Database Design Part 1

Lecture 11 - Chapter 8 Relational Database Design Part 1 CMSC 461, Database Management Systems Spring 2018 Lecture 11 - Chapter 8 Relational Database Design Part 1 These slides are based on Database System Concepts 6th edition book and are a modified version

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to

More information

Chapter 3: Relational Model

Chapter 3: Relational Model Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational Calculus Extended Relational-Algebra-Operations Modification of the Database

More information

We shall represent a relation as a table with columns and rows. Each column of the table has a name, or attribute. Each row is called a tuple.

We shall represent a relation as a table with columns and rows. Each column of the table has a name, or attribute. Each row is called a tuple. Logical Database design Earlier we saw how to convert an unorganized text description of information requirements into a conceptual design, by the use of ER diagrams. The advantage of ER diagrams is that

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to this

More information

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016 CS34800 Information Systems The Relational Model Prof. Walid Aref 29 August, 2016 1 Chapter: The Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational

More information

In Chapters 3 through 6, we presented various aspects

In Chapters 3 through 6, we presented various aspects 15 chapter Basics of Functional Dependencies and Normalization for Relational Databases In Chapters 3 through 6, we presented various aspects of the relational model and the languages associated with it.

More information

Databases Tutorial. March,15,2012 Jing Chen Mcmaster University

Databases Tutorial. March,15,2012 Jing Chen Mcmaster University Databases Tutorial March,15,2012 Jing Chen Mcmaster University Outline 1NF Functional Dependencies BCNF 3NF Larger Schema Suppose we combine borrower and loan to get bor_loan - borrower = (customer_id,

More information

Databases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24

Databases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24 Databases -Normalization I (GF Royle, N Spadaccini 2006-2010) Databases - Normalization I 1 / 24 This lecture This lecture introduces normal forms, decomposition and normalization. We will explore problems

More information

This lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization.

This lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization. This lecture Databases -Normalization I This lecture introduces normal forms, decomposition and normalization (GF Royle 2006-8, N Spadaccini 2008) Databases - Normalization I 1 / 23 (GF Royle 2006-8, N

More information

TDDD12 Databasteknik Föreläsning 4: Normalisering

TDDD12 Databasteknik Föreläsning 4: Normalisering What is Good Design TDDD12 Databasteknik Föreläsning 4: Normalisering Can we be sure that the translation from the EER diagram to relational tables results in a good database design? Or: Confronted with

More information

Chapter 2: Relational Model

Chapter 2: Relational Model Chapter 2: Relational Model Database System Concepts, 5 th Ed. See www.db-book.com for conditions on re-use Chapter 2: Relational Model Structure of Relational Databases Fundamental Relational-Algebra-Operations

More information

CS352 Lecture - Conceptual Relational Database Design

CS352 Lecture - Conceptual Relational Database Design CS352 Lecture - Conceptual Relational Database Design Objectives: last revised September 20, 2006 1. To define the concepts functional dependency and multivalued dependency 2. To show how to find the closure

More information

CS352 Lecture - Conceptual Relational Database Design

CS352 Lecture - Conceptual Relational Database Design CS352 Lecture - Conceptual Relational Database Design Objectives: last revised September 16, 2004 1. To define the concepts functional dependency and multivalued dependency 2. To show how to find the closure

More information

V. Database Design CS448/ How to obtain a good relational database schema

V. Database Design CS448/ How to obtain a good relational database schema V. How to obtain a good relational database schema Deriving new relational schema from ER-diagrams Normal forms: use of constraints in evaluating existing relational schema CS448/648 1 Translating an E-R

More information

UNIT 8. Database Design Explain multivalued dependency and fourth normal form 4NF with examples.

UNIT 8. Database Design Explain multivalued dependency and fourth normal form 4NF with examples. UNIT 8 Database Design -2 1. Explain multivalued dependency and fourth normal form 4NF with examples. (JUN/JULY 2013 / JAN 2014) A multivalued dependency (MVD) X Y specified on R, where X, and Y are both

More information

CS411 Database Systems. 05: Relational Schema Design Ch , except and

CS411 Database Systems. 05: Relational Schema Design Ch , except and CS411 Database Systems 05: Relational Schema Design Ch. 3.1-3.5, except 3.4.2-3.4.3 and 3.5.3. 1 How does this fit in? ER Diagrams: Data Definition Translation to Relational Schema: Data Definition Relational

More information

Relational Design 1 / 34

Relational Design 1 / 34 Relational Design 1 / 34 Relational Design Basic design approaches. What makes a good design better than a bad design? How do we tell we have a "good" design? How to we go about creating a good design?

More information

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation! Chapter 3: Formal Relational Query Languages CS425 Fall 2013 Boris Glavic Chapter 3: Formal Relational Query Languages Relational Algebra Tuple Relational Calculus Domain Relational Calculus Textbook:

More information

Relational Design Theory

Relational Design Theory OpenStax-CNX module: m28252 1 Relational Design Theory Nguyen Kim Anh This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 3.0 Abstract One important theory

More information

Relational Database Design Theory. Introduction to Databases CompSci 316 Fall 2017

Relational Database Design Theory. Introduction to Databases CompSci 316 Fall 2017 Relational Database Design Theory Introduction to Databases CompSci 316 Fall 2017 2 Announcements (Thu. Sep. 14) Homework #1 due next Tuesday (11:59pm) Course project description posted Read it! Mixer

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Logical Design Lecture 03 zain 1 Database Design Process Application 1 Conceptual requirements Application 1 External Model Application 2 Application 3 Application 4 External

More information

Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See   for conditions on re-use Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Structure of Relational Databases! Fundamental Relational-Algebra-Operations! Additional

More information

Desirable database characteristics Database design, revisited

Desirable database characteristics Database design, revisited CMPT 354 Desirable database characteristics Database design, revisited Normal Forms First Normal Form Second Normal Form Third Normal Form Boyce-Codd Normal Form Normal forms and functional dependencies

More information

CS 338 Functional Dependencies

CS 338 Functional Dependencies CS 338 Functional Dependencies Bojana Bislimovska Winter 2016 Outline Design Guidelines for Relation Schemas Functional Dependency Set and Attribute Closure Schema Decomposition Boyce-Codd Normal Form

More information

Database Management System

Database Management System Database Management System Lecture 4 Database Design Normalization and View * Some materials adapted from R. Ramakrishnan, J. Gehrke and Shawn Bowers Today s Agenda Normalization View Database Management

More information

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database? DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS Complete book short Answer Question.. QUESTION 1: What is database? A database is a logically coherent collection of data with some inherent meaning, representing

More information

CSE 562 Database Systems

CSE 562 Database Systems Goal CSE 562 Database Systems Question: The relational model is great, but how do I go about designing my database schema? Database Design Some slides are based or modified from originals by Magdalena

More information

Unit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra)

Unit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra) Unit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra) Important questions Section A :(2 Marks) 1.What is Functional Dependency? Functional dependency (FD)

More information

Chapter 6: Formal Relational Query Languages

Chapter 6: Formal Relational Query Languages Chapter 6: Formal Relational Query Languages Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 6: Formal Relational Query Languages Relational Algebra Tuple Relational

More information

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS SCHEMA DESIGN & RELATIONAL ALGEBRA A database schema is the skeleton structure that represents the logical view of the entire database Logical design of

More information

Redundancy:Dependencies between attributes within a relation cause redundancy.

Redundancy:Dependencies between attributes within a relation cause redundancy. Normalization Normalization: It is the process of removing redundant data from your tables in order to improve storage efficiency, data integrity and scalability. This improvement is balanced against an

More information

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 19 Relational Database Design (Contd.) Welcome to module

More information

CSCI 127 Introduction to Database Systems

CSCI 127 Introduction to Database Systems CSCI 127 Introduction to Database Systems Integrity Constraints and Functional Dependencies Integrity Constraints Purpose: Prevent semantic inconsistencies in data e.g.: cname svngs check total Joe 100

More information

Combining schemas. Problems: redundancy, hard to update, possible NULLs

Combining schemas. Problems: redundancy, hard to update, possible NULLs Handout Combining schemas Problems: redundancy, hard to update, possible NULLs Problems? Conclusion: Whether the join attribute is PK or not makes a great difference when combining schemas! Splitting schemas,

More information

Steps in normalisation. Steps in normalisation 7/15/2014

Steps in normalisation. Steps in normalisation 7/15/2014 Introduction to normalisation Normalisation Normalisation = a formal process for deciding which attributes should be grouped together in a relation Normalisation is the process of decomposing relations

More information

Functional Dependencies and Normalization

Functional Dependencies and Normalization Functional Dependencies and Normalization Jose M. Peña jose.m.pena@liu.se Overview Real world Databases DBMS Model Physical database Queries Processing of queries and updates Access to stored data Answers

More information

Fundamentals of Database Systems

Fundamentals of Database Systems Fundamentals of Database Systems Assignment: 3 Due Date: 23st August, 2017 Instructions This question paper contains 15 questions in 6 pages. Q1: Consider the following relation and its functional dependencies,

More information

To overcome these anomalies we need to normalize the data. In the next section we will discuss about normalization.

To overcome these anomalies we need to normalize the data. In the next section we will discuss about normalization. Anomalies in DBMS There are three types of anomalies that occur when the database is not normalized. These are Insertion, update and deletion anomaly. Let s take an example to understand this. Example:

More information

Chapter 8: Relational Algebra

Chapter 8: Relational Algebra Chapter 8: elational Algebra Outline: Introduction Unary elational Operations. Select Operator (σ) Project Operator (π) ename Operator (ρ) Assignment Operator ( ) Binary elational Operations. Set Operators

More information

DATABASE MANAGEMENT SYSTEMS

DATABASE MANAGEMENT SYSTEMS www..com Code No: N0321/R07 Set No. 1 1. a) What is a Superkey? With an example, describe the difference between a candidate key and the primary key for a given relation? b) With an example, briefly describe

More information

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms Schema Refinement and Normal Forms Chapter 19 Quiz #2 Next Wednesday Comp 521 Files and Databases Fall 2010 1 The Evils of Redundancy Redundancy is at the root of several problems associated with relational

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems L06: Relational Database Design BCNF Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,

More information

Normalisation. Normalisation. Normalisation

Normalisation. Normalisation. Normalisation Normalisation Normalisation Main objective in developing a logical data model for relational database systems is to create an accurate and efficient representation of the data, its relationships, and constraints

More information

Lecture5 Functional Dependencies and Normalization for Relational Databases

Lecture5 Functional Dependencies and Normalization for Relational Databases College of Computer and Information Sciences - Information Systems Dept. Lecture5 Functional Dependencies and Normalization for Relational Databases Ref. Chapter14-15 Prepared by L. Nouf Almujally & Aisha

More information

Functional dependency theory

Functional dependency theory Functional dependency theory Introduction to Database Design 2012, Lecture 8 Course evaluation Recalling normal forms Functional dependency theory Computing closures of attribute sets BCNF decomposition

More information

NORMAL FORMS. CS121: Relational Databases Fall 2017 Lecture 18

NORMAL FORMS. CS121: Relational Databases Fall 2017 Lecture 18 NORMAL FORMS CS121: Relational Databases Fall 2017 Lecture 18 Equivalent Schemas 2 Many different schemas can represent a set of data Which one is best? What does best even mean? Main goals: Representation

More information

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called Q.1 Short Questions Marks 1. Considering functional dependency, one in which removal from some attributes must affect dependency is called 01 A. full functional dependency B. partial dependency C. prime

More information

CSCI 403: Databases 13 - Functional Dependencies and Normalization

CSCI 403: Databases 13 - Functional Dependencies and Normalization CSCI 403: Databases 13 - Functional Dependencies and Normalization Introduction The point of this lecture material is to discuss some objective measures of the goodness of a database schema. The method

More information

FUNCTIONAL DEPENDENCIES CHAPTER , 15.5 (6/E) CHAPTER , 10.5 (5/E)

FUNCTIONAL DEPENDENCIES CHAPTER , 15.5 (6/E) CHAPTER , 10.5 (5/E) FUNCTIONAL DEPENDENCIES CHAPTER 15.1-15.2, 15.5 (6/E) CHAPTER 10.1-10.2, 10.5 (5/E) 4 LECTURE OUTLINE Design guidelines for relation schemas Functional dependencies Definition and interpretation Formal

More information

Lecture 6a Design Theory and Normalization 2/2

Lecture 6a Design Theory and Normalization 2/2 CompSci 516 Data Intensive Computing Systems Lecture 6a Design Theory and Normalization 2/2 Instructor: Sudeepa Roy 1 HW1 deadline: Announcements Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal

More information

Relational Model and Relational Algebra A Short Review Class Notes - CS582-01

Relational Model and Relational Algebra A Short Review Class Notes - CS582-01 Relational Model and Relational Algebra A Short Review Class Notes - CS582-01 Tran Cao Son January 12, 2002 0.1 Basics The following definitions are from the book [1] Relational Model. Relations are tables

More information

Database Systems. Basics of the Relational Data Model

Database Systems. Basics of the Relational Data Model Database Systems Relational Design Theory Jens Otten University of Oslo Jens Otten (UiO) Database Systems Relational Design Theory INF3100 Spring 18 1 / 30 Basics of the Relational Data Model title year

More information

Chapter 5: Other Relational Languages

Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 5: Other Relational Languages Tuple Relational Calculus Domain Relational Calculus

More information

Normal Forms. Winter Lecture 19

Normal Forms. Winter Lecture 19 Normal Forms Winter 2006-2007 Lecture 19 Equivalent Schemas Many schemas can represent a set of data Which one is best? What does best even mean? Main goals: Representation must be complete Data should

More information

DATABASE DESIGN I - 1DL300

DATABASE DESIGN I - 1DL300 DATABASE DESIGN I - 1DL300 Spring 2013 An Introductory Course on Database Systems http://www.it.uu.se/edu/course/homepage/dbastekn/vt13/ Uppsala Database Laboratory Department of Information Technology,

More information

Normalization 03. CSE3421 notes

Normalization 03. CSE3421 notes Normalization 03 CSE3421 notes 1 Example F: A B (1) ABCD E (2) EF G (3) EF H (4) ACDF EG (5) Calculate the minimal cover of F. 2 Step 1: Put F in standard form FDs (1) (4) are already in standard form.

More information

FUNCTIONAL DEPENDENCIES

FUNCTIONAL DEPENDENCIES FUNCTIONAL DEPENDENCIES CS 564- Spring 2018 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Database Design Theory: Functional Dependencies Armstrong s rules The Closure Algorithm

More information

Typical relationship between entities is ((a,b),(c,d) ) is best represented by one table RS (a,b,c,d)

Typical relationship between entities is ((a,b),(c,d) ) is best represented by one table RS (a,b,c,d) Mapping ER Diagrams to a relational database.. Binary relationships: Three possible configurations: 1. One table.. 2. Two tables.. 3. Three tables.. 1-1 relationships R(AB) - S(CD) Typical relationship

More information

Babu Banarasi Das National Institute of Technology and Management

Babu Banarasi Das National Institute of Technology and Management Babu Banarasi Das National Institute of Technology and Management Department of Computer Applications Question Bank (Short-to-Medium-Answer Type Questions) Masters of Computer Applications (MCA) NEW Syllabus

More information

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU Relational Algebra 1 Structure of Relational Databases A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a table represents a relationship among

More information

Database Management Systems Paper Solution

Database Management Systems Paper Solution Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

More information

Relational Design Theory. Relational Design Theory. Example. Example. A badly designed schema can result in several anomalies.

Relational Design Theory. Relational Design Theory. Example. Example. A badly designed schema can result in several anomalies. Relational Design Theory Relational Design Theory A badly designed schema can result in several anomalies Update-Anomalies: If we modify a single fact, we have to change several tuples Insert-Anomalies:

More information

Database Management System 15

Database Management System 15 Database Management System 15 Trivial and Non-Trivial Canonical /Minimal School of Computer Engineering, KIIT University 15.1 First characterize fully the data requirements of the prospective database

More information