Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Objectives
Ver. 1.0
Session 3
Slide 1 of 15
Redundancy means repetition of data. Redundancy increases the time involved in updating, adding, and deleting data. It also increases the utilization of disk space and hence, disk I/O increases. Redundancy can lead to the following problems:
Inserting, modifying, and deleting data may cause inconsistencies Errors are more likely to occur when facts are repeated Unnecessary utilization of extra disk space
Ver. 1.0
Session 3
Slide 2 of 15
Normalization is a scientific method of breaking down complex table structures into simple table structures by using certain rules. It allows you to reduce redundancy in a table and eliminate the problems of inconsistency and disk space usage. Normalization results in the formation of tables that satisfy certain specified rules and represent certain normal forms. The most important and widely used normal forms are:
First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF)
Ver. 1.0
Session 3
Slide 3 of 15
A table is said to be in the 1NF when each cell of the table contains precisely one value. Functional Dependency:
The normalization theory is based on the fundamental notion of functional dependency. Given a relation R, attribute A is functionally dependent on attribute B if each value of A in R is associated with precisely one value of B.
Ver. 1.0
Session 3
Slide 4 of 15
A table is said to be in 2NF when it is in 1NF and every attribute in the row is functionally dependent upon the whole key, and not just part of the key. To ensure that a table is in 2NF, you should:
Find and remove attributes that are functionally dependent on only a part of the key and not on the whole key and place them in a different table. Group the remaining attributes.
Ver. 1.0
Session 3
Slide 5 of 15
A relation is said to be in 3NF when it is in 2NF and every non-key attribute is functionally dependent only on the primary key. To ensure that a table is in 3NF, you should:
Find and remove non-key attributes that are functionally dependent on attributes that are not the primary key and place them in a different table. Group the remaining attributes.
Ver. 1.0
Session 3
Slide 6 of 15
The original definition of 3NF was inadequate in some situations. It was not satisfactory for the tables:
that had multiple candidate keys where the multiple candidate keys were composite where the multiple candidate keys overlapped
Ver. 1.0
Session 3
Slide 7 of 15
Ver. 1.0
Session 3
Slide 8 of 15
Answer:
2. Each table should have an identifier.
Ver. 1.0
Session 3
Slide 9 of 15
For which normal form you need to remove non-key attributes that are functionally dependent on attributes that are not primary key?
Solution:
Third normal form
Ver. 1.0
Session 3
Slide 10 of 15
The end product of normalization is a set of related tables that comprise the database. However, in the interests of speed of response to critical queries, which demand information from more than one table, it is sometimes wiser to introduce a degree of redundancy in tables. The intentional introduction of redundancy in a table to improve performance is called denormalization.
Ver. 1.0
Session 3
Slide 11 of 15
cContractRecruiterCode
cName vAddress cCity siPercentageCharge
cSourceCode
mAmount cChequeNo dDate
Since the size of the Payment table is large, the join between the two tables takes time to generate the required output. It is, therefore, necessary to improve the performance of this query.
Ver. 1.0
Session 3
Slide 12 of 15
Answer:
Denormalize the tables. Add a column called mTotalPaid to the ContractRecruiter table.
ContractRecruiter cContractRecruiterCode cName vAddress cCity siPercentageCharge mTotalPaid
Ver. 1.0
Session 3
Slide 13 of 15
Ver. 1.0
Session 3
Slide 14 of 15
The intentional introduction of redundancy in a table in order to improve performance is called denormalization. The decision to denormalize results in a trade-off between performance and data integrity. Denormalization increases disk space utilization.
Ver. 1.0
Session 3
Slide 15 of 15