Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design Normalisation (2)

Similar presentations


Presentation on theme: "Database Design Normalisation (2)"— Presentation transcript:

1 Database Design Normalisation (2)
John Wordsworth Department of Computer Science The University of Reading Room 129, Ext 6544 April 2002 2CS3X

2 Lecture objectives To review the concept of functional dependence
To identify cases of transitive dependence To normalise a relation to third normal form To identify anomalies remaining in third normal form relations To normalise third normal form relation to Boyce-Codd normal form April 2002 2CS3X

3 Reminder LName LPhone SDegree SName SHall April 2002 2CS3X

4 Note LPhone is FD on LName which in turn is FD on SName, the primary key. This is known as Transitive Dependence. Care is needed to identify the real and the apparent dependencies. The more serious problem is missing out the intermediate attribute in analysing dependencies. April 2002 2CS3X

5 Third normal form In 3NF there are no transitive dependencies becomes:
LName LPhone SDegree SName SHall becomes: LName LName LPhone SDegree SName SHall April 2002 2CS3X

6 Like this Student1 Staff April 2002 2CS3X

7 Problems with 3NF The definition of 3NF excludes certain classes of functional dependency. It doesn’t guarantee that there are now no anomalies. When? Multiple candidate keys, and those keys composite, and those keys overlap April 2002 2CS3X

8 Boyce-Codd Normal Form
A relation R is in BCNF if and only if, for every nontrivial dependency A1 A2 A3 … An  B {A1, A2, A3, … An} is a superkey for R NB. It isn’t always possible to attain BCNF. April 2002 2CS3X

9 Decomposition It is possible to decompose a relation into two or more relations (using projection). Recombining these relations doesn’t necessarily yield the original. Lossless join a sequence of decomposition and re-combination that re-creates the original relation April 2002 2CS3X

10 Example Supp FDs in Supp: Supplier  Town Town  Status
Possible decompositions of Supp: A: S1(Supplier, Town); S2(Town, Status) N.B. Each of these can be updated independently of the other and they can be re-joined to form a valid (but different) Supp. April 2002 2CS3X

11 Alternatively Supp Alternative decomposition of Supp:
B: S1(Supplier, Town); S3(Supplier, Status) Here, S1 and S3 cannot be updated independently of one another, and cannot be rejoined (after update) to give a valid Supp. April 2002 2CS3X

12 Why not? Status c b Supplier a Town
Decomposition A uses dependencies a and b, while decomposition B uses dependencies a and c. The Status of a supplier is determined by its location That is: there is a transitive dependency: Supplier  Town  Status April 2002 2CS3X

13 Key points Transitive dependence can be eliminated to give third normal form relations. Third normal form relations can still display anomalies. Boyce-Codd normal form removes some of these. Boyce-Codd normal form is about as far as we usually go. April 2002 2CS3X


Download ppt "Database Design Normalisation (2)"

Similar presentations


Ads by Google