UNIT-3 Database Management System

Functional Dependencies:  It describes the relationship between attributes in a relation.  Example: A and B are attribute of relation R. B is functionally dependent on A that’s denoted by A  B. each value of A is associated with exactly 1 value of B. It is specified constraints between the attributes.

B is functionally A B Dependent on A

 Determinant- when a function dependency exists, the attribute or group of attributes on the left hand side of the arrow is called the determinant. Example: In above example A is determinant. Characteristics of functional dependencies:  One to one relationship b/w attributes on the both sides.  Hold for all time  Are nontrivial. A dependency is trivial if the right hand side is a subset of the left side. Example: of trivial dependencies for the staff relation 1. Trivial : StaffNo, SName  SName 2. Non trivial: StaffNo position , position attribute is functionally dependent to StaffNo but not true the reciprocal Inference rules for functional dependencies:A set of all functional dependencies that are implied by a given set of functional dependencies X is called closure of X. Armstrong’s axioms- set of inference rules. It specifies hoe new functional dependencies can be inferred from given ones. Take A, B, C and D are the subset of attributes of relation R. The Armstrong axioms are as follows, 1. Reflexivity : if B is a subset of A, then AB 2. Augmentation: if AB , then A,CB,C 3. Transitivity: if AB and BC, then AC 4. Self-determination: if AA 5. Decomposition: if AB,C then AB and AC 6. Union : if AB and AC, then AB,C 7. Composition: if AB and CD then A,CB,D Minimal sets of functional dependencies: A set of functional dependencies X is minimal if it satisfies the following conditions: 1. Every attribute in X has a single attribute on its right hand side. 2. Any dependency AB in X cannot be replaced with dependency CB, where C is a proper subset of A. 3. Any dependency cannot be removed from X.

Know more @ www.vidyarthiplus.com Powered by WR1334

Non loss decomposition and functional dependencies: The normalization procedure involves breaking down or decomposing of given data into several tables that will be connected to each other based on the data within them and more over that the decomposition is required to be reversible. So that no information is loss in the process is called loss or non loss decomposition. Heath’s theorem: Let R {A, B, C} be a relation, Where A, B, C is sets of attributes. If R satisfies the FD AB, then R is equal to the join of its projections on {A,B} and {A,C}. More on functional dependencies: 1. Left irreducible FDs- An FD is said to be left irreducible if its left hand side is “not too big” 2. FDs are a semantic notion. Normalization: Normalization is the process of efficiently organizing data in a database. There are two goals of the normalization process: 1. Eliminating redundant data (for example, storing the same data in more than one table). 2. Ensuring data dependencies make sense (only storing related data in a table). Both of these are worthy goals as they reduce the amount of space a database consumes and ensure that data is logically stored. The Normal Forms: The database community has developed a series of guidelines for ensuring that databases are normalized. These are referred to as normal forms. They are having 5 types, 1. or 1NF 2. or 2NF 3. or 3NF 4. Boyce-codd normal form(BCNF) 5. or 4NF 6. Fifth normal form or 5NF. 1. First Normal Form (1NF)(Multivalued attributes should be removed) First normal form (1NF) sets the very basic rules for an organized database. It is a relation in which the intersection of each row and column contains one and only one value. Rules:  Eliminate duplicative columns from the same table.  Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key).  The entire attribute are atomic.

Example: After normalized Before normalized Department Faculty Class subject Department Faculty Class subject Computer A B.E DS Computer A B.E {DS,OS} B M.B.A {SQM,ST} Computer A B.E OS Computer B M.B.A SQM Computer B M.B.A ST

Know more @ www.vidyarthiplus.com Powered by WR1334

2. Second Normal Form (2NF)(Partial dependency should be removed) Second normal form (2NF) further addresses the concept of removing duplicative data. It meets the following conditions,  Meet all the requirements of the first normal form.  Remove subsets of data that apply to multiple rows of a table and place them in separate tables.  It’s don’t have partial dependencies that’s means its having fully functional dependency. 3. Third Normal Form (3NF) Third normal form (3NF) goes one large step further:  Meet all the requirements of the second normal form.  Remove columns that are not dependent upon the primary key. It has no transitivity dependency. Dependency preservation: Decomposition must be lossless so that we do not lose any information from the relation that is decomposed. Dependency preservation is another important requirement since a dependency is a constraint on the database and if X -> Y holds than we know that the two (sets) attributes are closely related and it would be useful if both attributes appeared in the same relation so that the dependency can be checked easily. Boyce-codd normal form (BCNF): It requires that there be no non-trivial functional dependencies of attributes on something other than a superset of a candidate key (called a super key). Difference b/w 3NF & BCNF: AB i. If 3NF, ‘B’ is a primary key and A is not a candidate key. ii. If BCNF, ‘A’ must be a candidate key.\ Multi- valued dependencies and Fourth Normal Form (4NF): Multi- valued dependencies: MVD represents a dependency between attributes in a relation, such that each value of A Finally, fourth normal form (4NF) has one additional requirement: Meet all the requirements of the third normal form. A relation is in 4NF if it has no multi-valued dependencies. Example: A >B A >C

Department Faculty Class Computer A B.E Computer A B.E Computer B M.B.A Computer B M.B.A

Example:

Know more @ www.vidyarthiplus.com Powered by WR1334

Department >Faculty Department >Class Fourth normal form: Multivalued dependencies (MVD) are removed in 4NF. The normalization of BCNF relations to 4NF involves the removal of the MVD from the relation by placing the attributes in a new relation along with a copy of the determinant. Join dependencies and 5NF: Join dependencies: Lossless is a property of decomposition, which ensures that no spurious tuples are generated when relations are reunited through a join operation. Fifth normal form: A relation that has no join dependency is in fifth normal form. Consider the property item supplier relation. Item supplier Property no Item Supplier no description PG4 Bed S1 PG4 Chair S2 PG16 Bed S2 Item Description Supplier No Bed S1 Chair S2

Property item property supplier Property No Item Description PG4 Bed PG4 Chair PG16 Bed Property No Supplier No PG4 S1 PG4 S2 PG16 S2

In supplier relation table it contains a join dependency, it is therefore not in fifth normal form. To remove the join dependency, decompose the relation into three relations i.e. , property item, item supplier, property supplier.

Know more @ www.vidyarthiplus.com Powered by WR1334