You are on page 1of 9

Normalizing and Denormalizing Data

Relational Database Management Systems

TVSN Murthy Assistant Professor – DFT NIFT Hyderabad

Disclaimer: These slides are just for the purpose of easy reading and are not comprehensive in nature. Thus the slides have to be read together with the class lectures, reading material, and statutes dealing with the subject

RDBMS/Slide 1 of 16

Normalizing and Denormalizing Data
Objectives
Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form (BCNF) Appreciate the need for denormalization

RDBMS/Slide 2 of 16

1

modifying.) Redundancy can lead to the following problems: Update anomalies—Inserting. disk I/O increases RDBMS/Slide 3 of 16 Normalizing and Denormalizing Data Understanding Data Redundancy (Contd. adding. and deleting data It also increases the utilization of disk space and hence.Normalizing and Denormalizing Data Understanding Data Redundancy Redundancy means repetition of data Redundancy increases the time involved in updating. and deleting data may cause inconsistencies Inconsistencies—Errors are more likely to occur when facts are repeated Unnecessary utilization of extra disk space RDBMS/Slide 4 of 16 2 .

Normalizing and Denormalizing Data Definition of Normalization 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 RDBMS/Slide 5 of 16 Normalizing and Denormalizing Data Normal Forms The most important and widely used normal forms are: First Normal Form (1 NF) Second Normal Form (2 NF) Third Normal Form (3 NF) Boyce Codd Normal Form (BCNF) RDBMS/Slide 6 of 16 3 .

and not just part of the key To ensure that a table is in 2 NF. 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 RDBMS/Slide 8 of 16 4 . attribute A is functionally dependent on attribute B if each value of A in R is associated with precisely one value of B RDBMS/Slide 7 of 16 Normalizing and Denormalizing Data Second Normal Form (2NF) A table is said to be in 2 NF when it is in 1 NF and every attribute in the row is functionally dependent upon the whole key.Normalizing and Denormalizing Data First Normal Form A table is said to be in the 1 NF 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.

Normalizing and Denormalizing Data Course Prof Room Room_Cap Limit FD’s are: Room Course Room_Cap Room_Cap Room Limit RDBMS/Slide 9 of 16 Normalizing and Denormalizing Data Course Prof Room Limit Room Room_Cap Course Room RDBMS/Slide 10 of 16 5 .

Normalizing and Denormalizing Data Third Normal Form (3NF) A relation is said to be in 3 NF when it is in 2 NF and every non-key attribute is functionally dependent only on the primary key To ensure that a table is in 3 NF. a new normal form—the Boyce-Codd Normal Form (BCNF) was introduced A relation is in the Boyce-Codd normal form (BCNF) if and only if every determinant is a candidate key RDBMS/Slide 12 of 16 6 . 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 RDBMS/Slide 11 of 16 Normalizing and Denormalizing Data Boyce-Codd Normal Form 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 Therefore.

you should: Find and remove the overlapping candidate keys Place the part of the candidate key and the attribute it is functionally dependent on.) In order to ensure that a table is in BCNF.Normalizing and Denormalizing Data Boyce-Codd Normal Form (Contd. 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 The decision to denormalize will obviously result in a tradeoff between performance and data integrity RDBMS/Slide 14 of 16 7 . in a different table Group the remaining items into a table RDBMS/Slide 13 of 16 Normalizing and Denormalizing Data Understanding Denormalization The end product of normalization is a set of related tables that comprise the database However.

Normalizing and Denormalizing Data Student ID S001 S002 Name Evan John Student ID S001 S001 S002 Course C001 C002 C002 Student ID S001 S001 S002 Name Evan Evan John Course C001 C002 C002 RDBMS/Slide 15 of 16 Normalizing and Denormalizing Data Normalize the following relation: Stud_No : Student’s ID number (unique) Name : Name of the student Address : Address of the student Inst_No : Instructor’s ID number Inst_Name : Instructor Name Date_Adm : Date of Admission RDBMS/Slide 16 of 16 8 .

RDBMS/Slide 17 of 16 9 .Normalizing and Denormalizing Data Normalize the following relation (Contd.): Course_ID : Course for which student registered (Can register for more than one course) Fees : Fees for a particular course Batch_No : Batch for a particular course (A course can have many batches) Batch_St_Dt : date on which a particular batch starts No_Courses : Number of courses a student has registered for..