Posts

Showing posts from April, 2017

Canonical Cover

Canonical Cover :             Canonical cover or minimal cover is the way of reducing the functional dependencies without changing the meaning of it. Why we go for canonical cover is because it takes time when all functional dependencies are applied on DBMS. Let us work with an example to make it clear : A->BC AB->C A->C There are 3 steps involved in converting to canonical cover  Step 1 :  All the FD's should be in the form X->a where "X" is a set of attribute or a single attribute and "a" must be single attribute. So for the above example  it reduces as follows  A->B A->C AB->C A->C (write it as such this will be dealt in step 3) Step 2:  Remove redundant attributes that is try to remove X if it has more than one attribute. So for the above example AB-> C To reduce this what we must do is we must answer the question if A-...

Axioms in Normalisation

Axioms : 1. Reflexive Property : For any attribute X and Y if Y is a proper subset of X, then X-> Y 2. Augumentive Propery : For any attribute A,B,C,D if A->B and C->D then AC->BD 3. Transitive property : For any attribute A,B,C if A->B and B->C then A->C 4. Union Property : For any attribute A,B,C if A->B and A->C then A->BC 5. Decomposition Property : For any attribute A,B,C if  A->BC then A->B and A->C

Super and Candidate Key

Super Key : In order to understand super key in DBMS we must understand what is closure of an attribute.  Closure of an attribute :         We defined Functional dependency here Functional Dependency . Closure of an attribute is nothing but the set of Axioms that are applied to get all the implied rules from the given rules. You can study about the Axioms here Axioms Let us take an example A->B B->C A+=Closure of A ={A,B,C} (using transitive property and reflexive property) B+=Closure of B ={B,C} (using reflexive property) C+=Closure of C ={C} (reflexive property) AB+=Closure of AB={A,B,C} (using transitive property and reflexive property) AC+=Closure of AC={A,B,C} (using reflexive property) Super Key :       Having understood closure let us define what is superkey. Superkey is an attribute or set of attributes that define all attributes. we find superkey using closure. If closure of any set of attributes ...

Anomalies In detail

Let us take an example In employee table attributes are eid,ename,car,parea (eid is the primary key) Insertion Anomaly :           Let us say for each car there is an allocated parking area. In order to hold that we need to make in an entry in table like this                                                               null,null,Swift, A Since null cannot assigned for eid. We call this as Insertion Anomaly. Deletion Anomaly :          Let us say that we have  only one entry for swift  car that is also associated with employee id 5. Suppose he leaves the company we have to remove him from the table.                                         ...

Functional Dependency

Functional Dependency in Normalisation : Before we begin let us know why we need normalisation.  To overcome anomalies we go for normalisation. There are three kinds of anomalies that can appear in DBMS. 1) Insertion Anomaly 2) Deletion Anomaly 3) Updation Anomaly To read more about Anomalies read this Anomalies Let us define Functional Dependency if for any tuple t1 and t2                                   if t1[A]==t2[A] then                                           t2[B] should be equal to t1[B]. Let us take an example A                 B             C            1                 Arun         3 ...