{"id":149,"date":"2014-04-04T04:17:32","date_gmt":"2014-04-04T12:17:32","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=149"},"modified":"2017-02-12T22:41:38","modified_gmt":"2017-02-13T06:41:38","slug":"database-normalization","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=149","title":{"rendered":"Database Normalization"},"content":{"rendered":"<p>Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anamolies. It is a multi-step process that puts data into tabular form by removing duplicated data from the relation tables.<\/p>\n<p>Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy. Normalization usually involves dividing large tables into smaller tables and defining relationships between them. It also deals with the insertion, update and deletion anomalies.<\/p>\n<p><strong>First Normal Form:<\/strong><br \/>\nDeals with atomicity. Columns should not have multiple values. <\/p>\n<pre>\r\nStudent       Age      Subject \r\nAdam          15       Biology, Maths \r\nAlex          14       Maths\r\n<\/pre>\n<p><strong>Second Normal Form:<\/strong><br \/>\nRemoves partial dependency.<br \/>\na table is in 2NF if and only if it is in 1NF and no non-prime attribute is dependent on any proper subset of any candidate key of the table.  <\/p>\n<p>As per the Second Normal Form there must not be any partial dependency of any column on primary key. It means that for a table that has concatenated primary key, each column in the table that is not part of the primary key must depend upon the entire concatenated key for its existence. If any column depends only on one part of the concatenated key, then the table fails Second normal form.<\/p>\n<pre>\r\nStudent    Age    Subject \r\nAdam       15     Biology \r\nAdam       15     Maths \r\nAlex       14     Maths \r\n<\/pre>\n<p>Candidate Key is {Student, Subject}.  Age is dependent only on Student. <\/p>\n<p><strong>Third Normal Form:<\/strong><br \/>\nRemoves transitive dependency. Table is in 3NF if<br \/>\n&#8211; It is in second normal form<br \/>\n&#8211; There is no transitive functional dependency<br \/>\nBy transitive functional dependency, we mean we have the following relationships in the table: A is functionally dependent on B, and B is functionally dependent on C. In this case, C is transitively dependent on A via B<\/p>\n<pre>\r\nStudent_id    Student_name  Student_DOB Student_Zip  City State \r\n<\/pre>\n<p>Student Zip is dependent on Student_id and City \/ State are dependent on Zip. <\/p>\n<p>BCNF (Boyce Codd Normal Form):<br \/>\n&#8211; Strict form of 3NF<br \/>\n&#8211; <\/p>\n<p>Fourth Normal Form:<br \/>\n-Under fourth normal form, a record type should not contain two or more independent multi-valued facts about an entity. In addition, the record must satisfy third normal form.<\/p>\n<p>Consider employees, skills, and languages, where an employee may have several skills and several languages. We have here two many-to-many relationships, one between employees and skills, and one between employees and languages. Under fourth normal form, these two relationships should not be represented in a single record such as<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n| EMPLOYEE | SKILL | LANGUAGE |<br \/>\n===============================<\/p>\n<p>Fifth Normal Form: <\/p>\n<p><a href=\"http:\/\/www.studytonight.com\/dbms\/database-normalization.php\">http:\/\/www.studytonight.com\/dbms\/database-normalization.php<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anamolies. It is a multi-step process that puts data into tabular form by removing duplicated data from the relation tables. Database normalization is the process of organizing the fields and tables of a relational database &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=149\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Database Normalization<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=149"}],"version-history":[{"count":14,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":680,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/149\/revisions\/680"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}