Escolar Documentos
Profissional Documentos
Cultura Documentos
1. Insertion anomalies: occurs during the Insertion of new data values to a relation.
2. Deletion anomalies: occurs during the Deletion of a tuple, namely, a row of a relation.
3. Modification anomalies: occurs during updating a value of an attribute in a tuple.
FUNCTIONAL DEPENDENCIES
i. Definition:
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.
Attribute Y is functionally dependent on attribute X, if each value determines exactly one value
of Y, which is represented as:
XY
XY does not YX
Example: Marks Grade
Rno Name
FD2
FD3
iii. Types:
a) Full Functional Dependency
b) Partial Functional Dependency
c) Transitive Functional Dependency
1
Prepared By: M.FARHANA SATHATH - MCA
Marks
Course-no
Marks is fully functionally dependent on Student_no and Course_no together and not on subset
of {Student_no,Course_no}.
i.e. Marks cannot be determined either by Student_no or Coourse-no.
Course-no
Instructor_name
For example: Course_name,Instructor_name are partially dependent on composite attributes
{Student_no,Course_no}, because Course_no alone defines Course_name,Instructor_name.
Y Z
Example:
Marks Grade
Grade Remark
Marks Remark
Functional Dependency Theory:
Let R be a relation schema. The Greek letters ,, and .are used to denote set of attributes.
Then ,
R and R
The functional dependency holds on R if and only if for any legal relations r(R),
whenever any 2 tuples t1 and t2 of r agree on the attributes , they also agree on the attribute .
DECOMPOSITION
The process of decomposing the universal relation schema R into a set of relation schemas
D={R1,R2,,Rm} by using the functional dependencies, that will become the relational database
schema D is called decomposite of R.
2
Prepared By: M.FARHANA SATHATH - MCA
U Ri=R
i =1
Properties of decomposition:
i. Dependency preservation
ii. Lossless (or non additive) join property
i. Dependency preservation:
definition: Given a set of dependencies Fon R, the projection of F on Ri, denoted by Ri(F),
where Ri subset of R, is the set of dependencies XY in F+ such that the attributes in XY are all
contained in Ri.
(i.e) when the decomposition of a relational schema preserve the associated set of functional
dependencies.
Formal definition: {F1 U F2 U..Fn}+ = F+
DATABASE NORMALIZATION
Database normalization is the process of removing redundant data from your tables in to
improve storage efficiency, data integrity, and scalability.
In the relational model, methods exist for quantifying how efficient a database is. These
classifications are called normal forms (or NF), and there are algorithms for converting a given
database between them.
Normalization generally involves splitting existing tables into multiple ones, which must be re-
joined or linked each time a query is issued.
NORMAL FORM
The normal forms break down large tables into smaller subsets.
Edgar F. Codd originally established three normal forms: 1NF, 2NF and 3NF. There are now
others that are generally accepted, but 3NF is widely considered to be sufficient for most
applications. Most tables when reaching 3NF are also in BCNF (Boyce-Codd Normal Form).
3
Prepared By: M.FARHANA SATHATH - MCA
There are two non-key fields. So, here are the questions:
If I know just Description, can I find out Cost? No, because we have more than one supplier for the
same product.
If I know just Supplier, and I find out Cost? No, because I need to know what the Item is as well.
Therefore, Cost is fully, functionally dependent upon the ENTIRE PK (Description-Supplier) for its
existence.
Inventory
Description Supplier Cost
Inventory
4
Prepared By: M.FARHANA SATHATH - MCA
If I know just Description, can I find out Supplier Address? No, because we have more than one
supplier for the same product.
If I know just Supplier, and I find out Supplier Address? Yes. The Address does not depend
upon the description of the item.
Therefore, Supplier Address is NOT functionally dependent upon the ENTIRE PK (Description-
Supplier) for its existence.
Supplier
Name Supplier Address
So putting things together:
Inventory
Inventory
Supplier
Name Supplier Address
The above relation is now in 2NF since the relation has no non-key attributes.
Author
Name Non-de Plume
Boyce-Codd Normal Form (BCNF)
A relation is in BCNF, if and only if, every determinant is a candidate key.
5
Prepared By: M.FARHANA SATHATH - MCA
The difference between 3NF and BCNF is that for a functional dependency A B, 3NF allows
this dependency in a relation if B is a primary-key attribute and A is not a candidate key, whereas
BCNF insists that for this dependency to remain in a relation, A must be a candidate key.
Assume that a relation has more than one possible key. Assume further that the composite keys
have a common attribute. If an attribute of a composite key is dependent on an attribute of the other
composite key, a normalii-ation called BCNF is needed.
Consider an example, the relation Professor:
Professor (Professor Code, Dept, Head of Dept, Parent time)
It is assumed that
1. A professor can work in more than one department
2. The percentage of the time he spends in each department is given.
3. Each department has only one Head of Department.
The relationship diagram for the above relation is given in figure 8. Table 6 gives the
relation attributes. The two possible composite keys are professor code and Dept. or Professor Code and
Hcad of Dept. Observe that department as well as Head of Dept. are not non-key attributes. They are a
part of a composite key.
The relation given in table 6 is in 3NF. Observe, however, that the names of Dept. and Head of
Dept. are duplicated. Further, if Professor P2 resigns, rows 3 and 4 are deleted. We lose the information
that Rao is the Head of Department of Chemistry.
The normalization of the relation is done by creating a new relation for Dept. and Head of Dept.
and deleting Head of Dept. From Professor relation. The normalized relations areshown in the
following table 7.
MULTIVALUED DEPENDENCY:
6
Prepared By: M.FARHANA SATHATH - MCA
Looking at it intuitively, theres a lot of duplication of information. If the school decided to drop Basic
Mechanics in favor of Introduction to Mechanics, youd have a lot of work to update everything.
The solution, again, is to break the table in two:
Table: Course-Teacher Table: Course-Text
Course Teacher Course Text
Physics Jones Physics Basic Mechanics
Physics Smith Physics Principles of Optics
Math Jones Math Basic Mechanics
Math Vector Analysis
Math Trigonometry
JOIN-DEPENDENCY:
A relation R satisfies join dependency (R!,R2,,Rn) if and only if R is equal to the join of
R1, R2, , Rn where Ri are subsets of the set of attributes of R.
7
Prepared By: M.FARHANA SATHATH - MCA
Normalized relations:
First normal form (1NF) Table faithfully represents a relation and has no repeating groups
No non-prime attribute in the table is functionally dependent on a
Second normal form (2NF)
proper subset of any candidate key
Every non-prime attribute is non-transitively dependent on every
Third normal form (3NF)
candidate key in the table
Every non-trivial functional dependency in the table is either the
Elementary Key Normal Form
dependency of an elementary key attribute or a dependency on a
(EKNF)
superkey
BoyceCodd normal form Every non-trivial functional dependency in the table is a
(BCNF) dependency on a superkey
Every non-trivial multivalued dependency in the table is a
Fourth normal form (4NF)
dependency on a superkey
Every non-trivial join dependency in the table is implied by the
Fifth normal form (5NF)
superkeys of the table
Domain/key normal form Every constraint on the table is a logical consequence of the table's
(DKNF) domain constraints and key constraints
Table features no non-trivial join dependencies at all (with
Sixth normal form (6NF)
reference to generalized join operator)