Professional Documents
Culture Documents
Database Systems
Concepts, Languages and Architectures
Paolo Atzeni Stefano Ceri Stefano Paraboschi Riccardo Torlone McGraw-Hill 1999
To view these slides on-screen or with a projector use the arrow keys to move to the next or previous slide. The return or enter key will also take you to the next slide. Note you can press the escape key to reveal the menu bar and then use the standard Acrobat controls including the magnifying glass to zoom in on details.
To print these slides on acetates for projection use the escape key to reveal the menu and choose print from the file menu. If the slides are too large for your printer then select shrink to fit in the print dialogue box. Press the return or enter key to continue . . .
Chapter 8 Normalization
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
Functional dependencies
Given a relation r on a schema R(X) and two non-empty subsets Y and Z of the attributes X, we say that there is a functional dependency on r between Y and Z, if, for each pair of tuples t1 and t2 of r having the same values on the attributes Y, t1 and t2 also have the same values of the Z attributes. A functional dependency between the attributes Y and Z is indicated by the notation Y Z.
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
A relation r is in BoyceCodd normal form if for every (non-trivial) functional dependency X Y defined on it, X contains a key K of r. That is, X is a superkey for r. Anomalies and redundancies, as discussed above, do not appear in databases with relations in BoyceCodd normal form, because the independent pieces of information are separate, one per relation.
McGraw-Hill 1999
McGraw-Hill 1999
Budget 2 15 15
Employee Brown Green Green Hoskins Hoskins Hoskins Moore Moore Kemp Kemp
Project Mars Jupiter Venus Venus Jupiter Mars Mars Venus Venus Jupiter
Function technician designer designer manager consultant consultant manager designer designer manager
McGraw-Hill 1999
A relation to be decomposed
Employee Brown Green Green Hoskins Hoskins Project Mars Jupiter Venus Saturn Venus Branch Chicago Birmingham Birmingham Birmingham Birmingham
The relation satisfies the functional dependencies: Employee Branch Project Branch
McGraw-Hill 1999
McGraw-Hill 1999
The result is different from the original relation: the information can not be reconstructed.
McGraw-Hill 1999
Lossless decomposition
The decomposition of a relation r on X1 and X2 is lossless if the join of the projections of r on X1 and X2 is equal to r itself (that is, not containing spurious tuples). It is clearly desirable, or rather an indispensable requirement, that a decomposition carried out for the purpose of normalization is lossless.
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
Preservation of dependencies
A decomposition preserves the dependencies if each of the functional dependencies of the original schema involves attributes that appear all together in one of the decomposed schemas. It is clearly desirable that a decomposition preserves the dependencies since, in this way, it is possible to ensure, on the decomposed schema, the satisfaction of the same constraints as the original schema.
McGraw-Hill 1999
Qualities of decompositions
Decompositions should always satisfy the properties of lossless decomposition and dependency preservation: Lossless decomposition ensures that the information in the original relation can be accurately reconstructed based on the information represented in the decomposed relations. Dependency preservation ensures that the decomposed relations have the same capacity to represent the integrity constraints as the original relations and thus to reveal illegal updates.
McGraw-Hill 1999
Assume that the following dependencies are defined: Manager Branch: each manager works at a particular branch; Project Branch Manager: each project has more managers who are responsible for it, but in different branches, and each manager can be responsible for more than one project; however, for each branch, a project has only one manager responsible for it.
McGraw-Hill 1999
A problematic decomposition
The relation is not in BoyceCodd normal form because the left hand side of the first dependency is not a superkey. At the same time, no good decomposition of this relation is possible: the dependency Project Branch Manager involves all the attributes and thus no decomposition is able to preserve it. We can therefore state that sometimes, BoyceCodd normal form cannot be achieved.
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
McGraw-Hill 1999
Functional dependencies: Manager Branch Division: each manager works at one branch and manages one division; Branch Division Manager: for each branch and division there is a single manager; Project Branch Division: for each branch, a project is allocated to a single division and has a sole manager responsible.
McGraw-Hill 1999
Division 1 1 2
The decomposition is lossless and the dependencies are preserved. This example shows that often the difficulty of achieving BoyceCodd normal form could be due to an insufficiently accurate analysis of the application.
McGraw-Hill 1999
McGraw-Hill 1999
Code
PRODUCT
McGraw-Hill 1999
McGraw-Hill 1999
Code
PRODUCT
ProductName
(1,1)
SUPPLY
(0,N)
SUPPLIER
McGraw-Hill 1999
PROFESSOR
(0,N)
THESIS
(0,N)
(0,1)
STUDENT
PROGRAMME
DEGREE
McGraw-Hill 1999
McGraw-Hill 1999
PROFESSOR
(1,1)
(0,N)
THESIS
(0,N)
(0,1)
STUDENT
AFFILIATION
(0,N)
PROGRAMME
DEGREE
DEPARTMENT
McGraw-Hill 1999
PROFESSOR
(1,1)
THESIS
STUDENT
(1,1)
AFFILIATION
(0,N)
REGISTRATION
(0,N)
DEPARTMENT
PROGRAME
DEGREE
McGraw-Hill 1999
BRANCH
(0,N)
ASSIGNMENT
(0,N)
(0,N)
MANAGER
PROJECT
McGraw-Hill 1999
MANAGER
(1,1)
MANAGEMENT
(1,1)
Code
BRANCH
(0,N)
COMPOSITION
(1,1)
DIVISION
(1,N)
PROJECT
(0,N)
ASSIGNMENT
McGraw-Hill 1999
TEAM
(1,N)
COACH
(0,1)
COMPOSITION
(1,N)
(0,1)
PLAYER
CITY
McGraw-Hill 1999