{"id":79,"date":"2018-07-18T10:22:11","date_gmt":"2018-07-18T10:22:11","guid":{"rendered":"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=79"},"modified":"2018-08-01T08:42:07","modified_gmt":"2018-08-01T08:42:07","slug":"normalisation","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/chapter\/normalisation\/","title":{"rendered":"Normalisation"},"content":{"raw":"<strong>Anomalies in DBMS<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">There are three types of anomalies that occur when the database is not normalized. These are \u2013 Insertion, update and deletion anomaly. Let\u2019s take an example to understand this.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Example<\/strong>: Suppose a manufacturing company stores the employee details in a table named employee that has four attributes: emp_id for storing employee\u2019s id, emp_name for storing employee\u2019s name, emp_address for storing employee\u2019s address and emp_dept for storing the department details in which the employee works. At some point of time the table looks like this:<\/p>\r\n<img class=\"size-full wp-image-80 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22.png\" alt=\"\" width=\"305\" height=\"135\" \/>\r\n<div>\r\n<p style=\"text-align: justify\">The above table is not normalized. We will see the problems that we face when a table is not normalized.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Update anomaly<\/strong>: In the above table we have two rows for employee Rick as he belongs to two departments of the company. If we want to update the address of Rick then we have to update the same in two rows or the data will become inconsistent. If somehow, the correct address gets updated in one department but not in other then as per the database, Rick would be having two different addresses, which is not correct and would lead to inconsistent data.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Insert anomaly<\/strong>: Suppose a new employee joins the company, who is under training and currently not assigned to any department then we would not be able to insert the data into the table if emp_dept field doesn\u2019t allow nulls.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Delete anomaly<\/strong>: Suppose, if at a point of time the company closes the department D890 then deleting the rows that are having emp_dept as D890 would also delete the information of employee Maggie since she is assigned only to this department.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To overcome these anomalies we need to normalize the data. In the next section we will discuss about normalization.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">A functional dependency is an association between two attributes of the same relational database table. One of the attributes is called the determinant and the other attribute is called the determined. For each value of the determinant there is associated one and only one value of the determined.<\/p>\r\n<p style=\"text-align: justify\">If A is the determinant and B is the determined then we say that <em>A functionally determines B<\/em> and graphically represent this as A -&gt; B. The symbols A \u00e0 B\u00b7 can also be expressed as <em>B is functionally<\/em> <em>determined by <\/em>A.<\/p>\r\n\r\n<\/div>\r\n<strong>Example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-81 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23.png\" alt=\"\" width=\"493\" height=\"520\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Functional dependency can also be defined as follows:An attribute in a relational model is said to be functionally dependent on another attribute in the table if it can take only one value for a given value of the attribute upon which it is functionally dependent.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example: <\/strong>Consider the database having following tables:\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-82 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24.png\" alt=\"\" width=\"365\" height=\"422\" \/><\/p>\r\n\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<\/div>\r\n<div><\/div>\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0 Sno-<\/strong><strong>Supplier number of supplier that is unique<\/strong>\r\n\r\n<strong>Sname-Supplier name<\/strong>\r\n\r\n<strong>City-<\/strong><strong>City of the supplier<\/strong>\r\n\r\n<strong>Status-<\/strong><strong style=\"text-align: initial;font-size: 1em\">Status of the city e.g. A grade cities may have status 10, B grad cities\u00a0<\/strong><strong style=\"text-align: initial;font-size: 1em\">may\u00a0<\/strong><strong>have status 20 and so on.<\/strong>\r\n\r\n&nbsp;\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">Here, Sname is FD on Sno. Because, Sname can take only one value for the given value of Sno (e.g. S<\/span>\r\n\r\n<span style=\"font-size: 1em\">1) or in other words there must be one Sname for supplier number <\/span>\r\n\r\n<span style=\"font-size: 1em\">S1. FD is represented <\/span>\r\n\r\n<span style=\"font-size: 1em\">as:\u00a0<\/span><span style=\"text-align: initial;font-size: 1em\">Sno \u00e0 Sname<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">FD is shown by \u00e0 which means that Sname is functionally dependent on Sno.<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">Similarly, city and status are also FD on Sno, because for each value of Sno there will be only one city and status.<\/span>\r\n\r\n&nbsp;\r\n\r\nFD is represented as:\r\n\r\nSno\u00a0\u00a0 - City\r\n\r\nSno\u00a0\u00a0 - Status\r\n\r\ns<span style=\"font-size: 1em\">no - S (Sname, City, Status)<\/span>\r\n\r\n&nbsp;\r\n\r\nConsider another database of shipment with following attributes:\r\n\r\n<\/div>\r\nSno-Supplier number of the supplier\r\n\r\nPno-Part number supplied by supplier\r\n\r\nQty-Quantity supplied by supplier for a particular Part no\r\n<div>\r\n\r\nIn this case Qty is FD on combination of Sno, Pno because each combination of Sno and Pno results only for one Quantity.\r\n\r\n&nbsp;\r\n\r\nSP (Sno, Pno) --&gt; SP.QTY\r\n\r\n&nbsp;\r\n\r\n<strong>Dependency Diagrams<\/strong>\r\n\r\n&nbsp;\r\n\r\nA dependency diagram consists of the attribute names and all functional dependencies in a given table.\r\n\r\nThe dependency diagram of Supplier table is.\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-84 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26.png\" alt=\"\" width=\"659\" height=\"318\" \/><\/p>\r\n&nbsp;\r\n\r\nHere, following functional dependencies exist in supplier table\r\n\r\n-\u00a0 Sname\r\n\r\nSname\u00a0\u00a0\u00a0\u00a0\u00a0 -\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Sno\r\n\r\nSno -\u00a0 \u00a0 \u00a0 \u00a0 City\r\nSno - Status\r\nSname - City\r\nSname - Status\r\nCity - Status\r\n<table class=\"aligncenter\" style=\"border-collapse: collapse;width: 95.0243%;height: 98px\" border=\"1\">\r\n<tbody>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\r\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\r\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\r\n<td style=\"width: 50%;height: 14px\">City<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\r\n<td style=\"width: 50%;height: 14px\">Status<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\r\n<td style=\"width: 50%;height: 14px\">City<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\r\n<td style=\"width: 50%;height: 14px\">Status<\/td>\r\n<\/tr>\r\n<tr style=\"height: 14px\">\r\n<td style=\"width: 50%;height: 14px\">City<\/td>\r\n<td style=\"width: 50%;height: 14px\">Status<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\nThe FD diagram of relation P is\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-85 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27.png\" alt=\"\" width=\"555\" height=\"283\" \/><\/p>\r\nHere following functional dependencies exist in Part table:\r\n\r\n&nbsp;\r\n\r\nPno - Pname\r\n\r\nPno - Color\r\n\r\nPno - Wt\r\n\r\n<\/div>\r\n<img class=\"size-full wp-image-86 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28.png\" alt=\"\" width=\"415\" height=\"314\" \/>\r\n<div>\r\n<p style=\"text-align: justify\">The FD diagram of relation Shipment is\u00a0<span style=\"text-align: initial;font-size: 1em\">Here following functional dependencies exist in parts table SP (Sno, Pno) - SP.QTY<\/span><\/p>\r\n\r\n<\/div>\r\n<strong>Fully Functional Dependence (FFD)<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Fully Functional Dependence (FFD) is defined, as Attribute Y is FFD on attribute\" X, if it is FD on X and not FD on any proper subset of X. For example, in relation Supplier, different cities may have the same status. It may be possible that cities like Amritsar, Jalandhar may have the same status 10.<\/p>\r\nSo, the City is not FD on Status.\r\n\r\n&nbsp;\r\n\r\nSo, the City is not FD on Status.\r\n<p style=\"text-align: justify\">But, the combination of Sno, Status can give only one corresponding City ,because Sno\" is unique. Thus,<\/p>\r\n<p style=\"text-align: justify\">(Sno, Status) \u00e0 City<\/p>\r\n<p style=\"text-align: justify\">It means city is FD on composite attribute (Sno, Status) however City is not fully functional dependent on this composite attribute, which is explained below:<\/p>\r\n(Sno, Status) \u00e0 City\r\n\r\n&nbsp;\r\n\r\nX\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Y\r\n\r\n&nbsp;\r\n\r\nHere Y is FD on X, but X has two proper subsets Sno and Status; city is\u00b7 FD .on one proper subset .of X i.e. Sno\r\n\r\n&nbsp;\r\n\r\nSno \u00e0 City\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">According to 'FFD definition Y must not be FD .on any proper subset of X, but here City is FD in one subset .of X i.e. Sno, so City is not FFD on (Sno, Status)<\/p>\r\n&nbsp;\r\n\r\nConsider another case of SP table:\r\n\r\nHere, Qty is FD on combination of Sna, Pno.\r\n\r\n&nbsp;\r\n\r\n(Sno, Pno)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00e0\u00a0\u00a0\u00a0\u00a0\u00a0 Qty\r\n\r\n&nbsp;\r\n\r\nX\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Y\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here, X has two proper subsets Sno and Pna<\/p>\r\n<p style=\"text-align: justify\">Qty is not FD on Sno, because one Sna can supply mare than .one quantity.<\/p>\r\n<p style=\"text-align: justify\">Qty is also not FD on Pno, because .one Pna may be supplied many times by different suppliers with different .or same quantities.<\/p>\r\n<p style=\"text-align: justify\">So, Qty is FFD and composite attribute of (Sno, Pno) \u00e0 Qty.<\/p>\r\n&nbsp;\r\n\r\n<strong>Other Functional Dependencies<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">There are same rather types of functional dependencies, which play a vital rule during the process .of normalization of data.<\/p>\r\n&nbsp;\r\n\r\n<strong>Candidate Functional Dependency<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">A candidate functional dependency is a functional dependency that includes all attributes of the table. It should also be noted that a well-fanned dependency diagram must have at least one candidate functional dependency, and that there can be more than .one candidate functional dependency for a given dependency diagram.<\/p>\r\n&nbsp;\r\n\r\n<strong>Primary Functional Dependency<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">A primary functional dependency is a candidate functional dependency that is selected to determine the primary key. The determinant of the primary functional dependency is the primary key of the relational database table. Each dependency diagram must have one and only on primary functional dependency. If a relational database table has .only .one candidate functional dependency, then it automatically becomes the primary functional dependency<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Once the primary key has been determined, there will be three possible types of functional dependencies:<\/p>\r\n&nbsp;\r\n\r\n<strong>Description<\/strong>\r\n\r\n&nbsp;\r\n\r\nA \u00e0 B A key attribute functionally determines a non-key attribute.\r\n\r\nA \u00e0 B A non-key attribute functionally determines a non-key attribute.\r\n\r\nA \u00e0 B A non-key attribute functionally determines a key attribute.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">A <strong>partial functional dependency<\/strong> is a functional dependency where the determinant consists of key attributes, but not the entire primary key, and the determined consist~ of non-key attributes.<\/p>\r\n&nbsp;\r\n\r\nA <strong>transitive functional dependency<\/strong> is a functional dependency where the determinant consists of non-key attributes and the determined also consists of non-key attributes.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">A <strong>Boyce-Codd functional dependency<\/strong> is a functional dependency where the determinant consists of non-key attributes and the determined consists of key attributes.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">A <strong>Multi-Value Dependency (MVD)<\/strong> occurs when two or more independent multi valued facts about the same attribute occur within the same table. It means that if in a relation R having A, Band C as attributes, B and Care multi-value facts about A, which is represented as A \u00e0\u00e0B and A \u00e0\u00e0C ,then multi value dependency exist only if B and C are independent on each other.<\/p>\r\n&nbsp;\r\n\r\nA <strong>Join Dependency<\/strong> exists if a relation R is equal to the join of the projections X Z. where X, Y, Z projections of R.\r\n\r\n&nbsp;\r\n\r\n<strong>Closure of set of dependencies<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let a relation <em>R<\/em> have some functional dependencies <em>F<\/em> specified. The <em>closure of F<\/em> (usually written as <em>F<\/em>+) is the set of all functional dependencies that may be logically derived from<em> F. <\/em>Often<em> F <\/em>is the set of most obvious and important functional dependencies and. <em>F<\/em>+, the closure, is the set of all the functional dependencies including <em>F<\/em> and those that can be deduced from <em>F.<\/em> The closure is important and may, for example, be needed in finding one or more candidate keys of the relation.<\/p>\r\n&nbsp;\r\n\r\nFor example, the <em>student<\/em> relation has the following functional dependencies\r\n\r\n&nbsp;\r\n\r\n<em>sno <\/em>\u00e0<em> Sname<\/em>\r\n\r\n<em>cno <\/em>\u00e0<em> came<\/em>\r\n\r\n<em>sno <\/em>\u00e0<em> address<\/em>\r\n\r\n<em>cno <\/em>\u00e0<em> instructor<\/em>\r\n\r\n<em>Instructor \u00e0 office<\/em>\r\n\r\n&nbsp;\r\n<div>\r\n<p style=\"text-align: justify\">Let these dependencies be denoted by <em>F.<\/em> The closure of <em>F,<\/em> denoted by <em>F<\/em> +, includes <em>F<\/em> and all functional- dependencies that are implied by <em>F.<\/em><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To determine <em>F<\/em>+, we need rules for deriving all functional dependencies that are implied: by <em>F.<\/em> A set of rules that may be used to infer additional dependencies was proposed by Armstrong in 1974. These rules (or axioms) are a complete set of rules in\u00b7 that all possible functional dependencies may be derived from them. The rules are:<\/p>\r\n&nbsp;\r\n\r\n<em>1.\u00a0 <\/em><em>Reflexivity Rule - <\/em>If<em> X <\/em>is a set of attributes and Y is a subset of<em> X, <\/em>then<em> X \u00e0Y <\/em>holds.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The reflexivity rule is the simplest (almost trivial) rule. It states that each subset of <em>X<\/em> is functionally dependent on <em>X.<\/em> In other words trivial dependence is defined as follows:<\/p>\r\n&nbsp;\r\n\r\n<strong>Trivial functional dependency<\/strong>: A trivial functional dependency is a functional dependency of an attribute on a superset of itself.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>For example: <\/strong>{Employee ID, Employee Address} \u00e0 {Employee Address} is trivial, here {Employee\u00a0<span style=\"text-align: initial;font-size: 1em\">Address} is a subset of {Employee ID, Employee Address}.<\/span><\/p>\r\n\r\n<\/div>\r\n<ol start=\"2\">\r\n \t<li><em>Augmentation Rule - <\/em>If<em> X \u00e0 Y <\/em>holds and<em> W <\/em>is a set of attributes, and then<em> WX \u00e0 WY <\/em>holds.<\/li>\r\n<\/ol>\r\n<p style=\"text-align: justify\">The argumentation ('u rule is also quite simple. It states that if <em style=\"text-align: initial;font-size: 1em\">Y<\/em><span style=\"text-align: initial;font-size: 1em\"> is determined by <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> then a set of attributes <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">Y<\/em><span style=\"text-align: initial;font-size: 1em\"> together will be determined by <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> together. Note that we use the notation <\/span><em style=\"text-align: initial;font-size: 1em\">WX<\/em><span style=\"text-align: initial;font-size: 1em\"> to mean the collection of all attributes in <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> and write <\/span><em style=\"text-align: initial;font-size: 1em\">WX<\/em><span style=\"text-align: initial;font-size: 1em\"> rather than the more conventional <\/span><em style=\"text-align: initial;font-size: 1em\">(W,<\/em><\/p>\r\n\r\n<ol>\r\n \t<li><em>X) <\/em>for convenience.<\/li>\r\n<\/ol>\r\n&nbsp;\r\n\r\n<strong>For example<\/strong>: Rno - Name; Class and Marks is a set of attributes and act as\r\n\r\nThen\u00b7 {Rno, Class, Marks} -&gt; {Name, Class, Marks}\r\n\r\n<em>3. Transitivity Rule - <\/em>If<em> X -&gt; <\/em>Y and Y -&gt;<em> Z <\/em>hold, then<em> X -&gt; Z <\/em>holds.\r\n<p style=\"text-align: justify\">The transitivity rule is perhaps the most important one. It states that if <em>X<\/em> functionally determines Y and Y functionally determine <em>Z<\/em> then <em>X<\/em> functionally determines <em>Z.<\/em><\/p>\r\n&nbsp;\r\n\r\n<strong>For example: <\/strong>Rno -&gt; City and City -&gt; Status, then Rno -&gt; Status should be holding true.\r\n\r\n&nbsp;\r\n\r\nThese rules are called <em>Armstrong's Axioms.<\/em>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Further axioms may be derived from the above although the above three axioms are <em>sound and<\/em> <em>complete <\/em>in that they do not generate any incorrect functional dependencies (soundness) and they do generate all possible functional dependencies that can be inferred from <em>F<\/em> (completeness). The most important additional axioms are:<\/p>\r\n\r\n<ol>\r\n \t<li><em>Union Rule - <\/em>If<em> X -&gt; Y <\/em>and<em> X -&gt; Z <\/em>hold, then<em> X -&gt; YZ <\/em>holds.<\/li>\r\n \t<li><em>Decomposition Rule - <\/em>If<em> X \u00e0 YZ <\/em>holds, then so do<em> X \u00e0 Y <\/em>and<em> X \u00e0 <\/em>Z.<\/li>\r\n \t<li><em>Pseudotransitivity Rule - <\/em>If<em> X \u00e0 Y <\/em>and<em> WY \u00e0 <\/em>Z hold then so does<em> WX \u00e0Z.<\/em><\/li>\r\n<\/ol>\r\nBased on the above axioms and the .functional dependencies specified for relation <em>student,<\/em> we may write a large number of functional dependencies. Some of these are:\r\n\r\n&nbsp;\r\n\r\n<em>( sno, cno) \u00e0 sno <\/em>(Rule 1)\r\n\r\n<em>(sno, cno) \u00e0 cno <\/em>(Rule 1)\r\n\r\n<em>(sno, cno) \u00e0 (Sname, cname) <\/em>(Rule 2)\r\n\r\n<em>cno \u00e0 office <\/em>(Rule 3)\r\n\r\n<em>sno \u00e0 (Sname, address) <\/em>(Union Rule)\r\n\r\n&nbsp;\r\n\r\nEtc.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Often a very large list of dependencies can be derived from a given set <em>F<\/em> since Rule 1 itself will lead to a large number of dependencies. Since we have seven attributes <em>(sno, Sname, address, cno, cname,<\/em> <em>instructor, office), <\/em>there are 128 (that is, 2^7) subsets of these attributes. These 128 subsets could form 128 values of <em>X<\/em> in functional dependencies of the type <em>X ~ Y.<\/em> Of course, each value of <em>X<\/em> will then be associated with a number of values for <em>Y (Y<\/em> being a subset of x) Leading to several thousand dependencies. These large numbers of dependencies are not particularly helpful in achieving our aim of normalizing relations.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Although we could follow the present procedure and compute the closure of <em>F<\/em> to find all the functional dependencies, the computation requires exponential time and the list of dependencies is often very large and therefore not very useful. There are two possible approaches that can be taken to avoid dealing with the large number of dependencies in the closure. 'One' is to deal with one attribute or a set of attributes at a time and find its closure (i.e. all functional dependencies relating to them). The aim of this exercise is to find what attributes depend on a given set of attributes and therefore ought to be together. The other approach is to find the <em>minimal\u00b7 covers.<\/em><\/p>\r\n&nbsp;\r\n\r\n<strong>Minimal Functional Dependencies or Irreducible Set of Dependencies<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In discussing the concept of equivalent FDs, it is useful to define the concept of <em>minimal functional<\/em> <em>dependencies <\/em>or<em> minimal cover <\/em>which is useful in eliminating necessary functional dependencies so that only the minimal numbers of dependencies need to be enforced by the system. The concept of minimal cover of <em>F<\/em> is sometimes called <em>irreducible Set<\/em> of <em>F.<\/em><\/p>\r\n&nbsp;\r\n\r\nA functional depending set S is irreducible if the set has three following properties:\r\n\r\n&nbsp;\r\n\r\nEach right set of a functional dependency of S contains only one attribute.\r\n\r\nEach left set of a functional dependency of S is irreducible. It means that reducing anyone attribute from left set will change the content of S (S will lose some information).\r\n\r\nReducing any functional dependency will change the content of S.\r\n\r\n&nbsp;\r\n\r\nSets of functional dependencies with these properties are also called <em>canonical<\/em> or <em>minimal.<\/em>\r\n\r\nIf the value in a non-key attribute is determined by the value in another non-key attribute then that field has transitive dependency.\r\n\r\n&nbsp;\r\n\r\nFor example, look at the relation below:\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-87 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-29.png\" alt=\"\" width=\"225\" height=\"123\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The attribute <strong>teacher_name<\/strong> is determined by the non-key attribute <strong>teacher_id<\/strong>, and not the primary key of <strong>course_id<\/strong>. This means that teacher_name is transitively dependent on the primary key of course_id.<\/p>\r\nIn order to show a relation in 3NF, all transitive dependencies must be removed.\r\n\r\n&nbsp;\r\n\r\n<strong>Functional Dependency<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Functional dependency (FD) is a set of constraints between two attributes in a relation. Functional dependency says that if two tuples have same values for attributes A1, A2,..., An, then those two tuples must have to have same values for attributes B1, B2, ..., Bn.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Functional dependency is represented by an arrow sign (\u2192) that is, X\u2192Y, where X functionally determines Y. The left-hand side attributes determine the values of attributes on the right-hand side.<\/p>\r\n&nbsp;\r\n\r\n<strong>Armstrong's Axioms<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">If F is a set of functional dependencies then the closure of F, denoted as F+, is the set of all functional dependencies logically implied by F. Armstrong's Axioms are a set of rules, that when applied repeatedly, generates a closure of functional dependencies.<\/p>\r\n\r\n<ul>\r\n \t<li style=\"text-align: justify\"><strong>Reflexive rule <\/strong>\u2212 If alpha is a set of attributes and beta is_subset_of alpha, then alpha holds beta.<\/li>\r\n \t<li style=\"text-align: justify\"><strong>Augmentation rule <\/strong>\u2212 If a \u2192 b holds and y is attribute set, then ay \u2192 by also holds. That is adding attributes in dependencies, does not change the basic dependencies.<\/li>\r\n \t<li style=\"text-align: justify\"><strong>Transitivity rule <\/strong>\u2212 Same as transitive rule in algebra, if a \u2192 b holds and b \u2192 c holds, then a \u2192 c also holds. a \u2192 b is called as a functionally that determines b.<\/li>\r\n<\/ul>\r\n<strong>\u00a0 \u00a0 Trivial Functional Dependency<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\"><strong>Trivial <\/strong>\u2212 If a functional dependency (FD) X \u2192 Y holds, where Y is a subset of X, then it is called a trivial FD. Trivial FDs always hold.<\/li>\r\n \t<li style=\"text-align: justify\"><strong>Non-trivial <\/strong>\u2212 If an FD X \u2192 Y holds, where Y is not a subset of X, then it is called a non-trivial FD.<\/li>\r\n \t<li style=\"text-align: justify\"><strong>Completely non-trivial <\/strong>\u2212 If an FD X \u2192 Y holds, where x intersect Y = \u03a6, it is said to be a completely non-trivial FD.<\/li>\r\n<\/ul>\r\n<img class=\"size-full wp-image-88 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30.png\" alt=\"\" width=\"639\" height=\"314\" \/>","rendered":"<p><strong>Anomalies in DBMS<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">There are three types of anomalies that occur when the database is not normalized. These are \u2013 Insertion, update and deletion anomaly. Let\u2019s take an example to understand this.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Example<\/strong>: Suppose a manufacturing company stores the employee details in a table named employee that has four attributes: emp_id for storing employee\u2019s id, emp_name for storing employee\u2019s name, emp_address for storing employee\u2019s address and emp_dept for storing the department details in which the employee works. At some point of time the table looks like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-80 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22.png\" alt=\"\" width=\"305\" height=\"135\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22.png 305w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22-300x133.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-22-225x100.png 225w\" sizes=\"auto, (max-width: 305px) 100vw, 305px\" \/><\/p>\n<div>\n<p style=\"text-align: justify\">The above table is not normalized. We will see the problems that we face when a table is not normalized.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Update anomaly<\/strong>: In the above table we have two rows for employee Rick as he belongs to two departments of the company. If we want to update the address of Rick then we have to update the same in two rows or the data will become inconsistent. If somehow, the correct address gets updated in one department but not in other then as per the database, Rick would be having two different addresses, which is not correct and would lead to inconsistent data.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Insert anomaly<\/strong>: Suppose a new employee joins the company, who is under training and currently not assigned to any department then we would not be able to insert the data into the table if emp_dept field doesn\u2019t allow nulls.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Delete anomaly<\/strong>: Suppose, if at a point of time the company closes the department D890 then deleting the rows that are having emp_dept as D890 would also delete the information of employee Maggie since she is assigned only to this department.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To overcome these anomalies we need to normalize the data. In the next section we will discuss about normalization.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A functional dependency is an association between two attributes of the same relational database table. One of the attributes is called the determinant and the other attribute is called the determined. For each value of the determinant there is associated one and only one value of the determined.<\/p>\n<p style=\"text-align: justify\">If A is the determinant and B is the determined then we say that <em>A functionally determines B<\/em> and graphically represent this as A -&gt; B. The symbols A \u00e0 B\u00b7 can also be expressed as <em>B is functionally<\/em> <em>determined by <\/em>A.<\/p>\n<\/div>\n<p><strong>Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-81 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23.png\" alt=\"\" width=\"493\" height=\"520\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23.png 493w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23-284x300.png 284w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23-65x69.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23-225x237.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-23-350x369.png 350w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Functional dependency can also be defined as follows:An attribute in a relational model is said to be functionally dependent on another attribute in the table if it can take only one value for a given value of the attribute upon which it is functionally dependent.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example: <\/strong>Consider the database having following tables:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-82 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24.png\" alt=\"\" width=\"365\" height=\"422\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24.png 365w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24-259x300.png 259w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24-65x75.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24-225x260.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-24-350x405.png 350w\" sizes=\"auto, (max-width: 365px) 100vw, 365px\" \/><\/p>\n<div>\n<p>&nbsp;<\/p>\n<\/div>\n<div><\/div>\n<div>\n<p><strong>\u00a0 \u00a0 Sno-<\/strong><strong>Supplier number of supplier that is unique<\/strong><\/p>\n<p><strong>Sname-Supplier name<\/strong><\/p>\n<p><strong>City-<\/strong><strong>City of the supplier<\/strong><\/p>\n<p><strong>Status-<\/strong><strong style=\"text-align: initial;font-size: 1em\">Status of the city e.g. A grade cities may have status 10, B grad cities\u00a0<\/strong><strong style=\"text-align: initial;font-size: 1em\">may\u00a0<\/strong><strong>have status 20 and so on.<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">Here, Sname is FD on Sno. Because, Sname can take only one value for the given value of Sno (e.g. S<\/span><\/p>\n<p><span style=\"font-size: 1em\">1) or in other words there must be one Sname for supplier number <\/span><\/p>\n<p><span style=\"font-size: 1em\">S1. FD is represented <\/span><\/p>\n<p><span style=\"font-size: 1em\">as:\u00a0<\/span><span style=\"text-align: initial;font-size: 1em\">Sno \u00e0 Sname<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">FD is shown by \u00e0 which means that Sname is functionally dependent on Sno.<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">Similarly, city and status are also FD on Sno, because for each value of Sno there will be only one city and status.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>FD is represented as:<\/p>\n<p>Sno\u00a0\u00a0 &#8211; City<\/p>\n<p>Sno\u00a0\u00a0 &#8211; Status<\/p>\n<p>s<span style=\"font-size: 1em\">no &#8211; S (Sname, City, Status)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Consider another database of shipment with following attributes:<\/p>\n<\/div>\n<p>Sno-Supplier number of the supplier<\/p>\n<p>Pno-Part number supplied by supplier<\/p>\n<p>Qty-Quantity supplied by supplier for a particular Part no<\/p>\n<div>\n<p>In this case Qty is FD on combination of Sno, Pno because each combination of Sno and Pno results only for one Quantity.<\/p>\n<p>&nbsp;<\/p>\n<p>SP (Sno, Pno) &#8211;&gt; SP.QTY<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Dependency Diagrams<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A dependency diagram consists of the attribute names and all functional dependencies in a given table.<\/p>\n<p>The dependency diagram of Supplier table is.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26.png\" alt=\"\" width=\"659\" height=\"318\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26.png 659w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26-300x145.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26-65x31.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26-225x109.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-26-350x169.png 350w\" sizes=\"auto, (max-width: 659px) 100vw, 659px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Here, following functional dependencies exist in supplier table<\/p>\n<p>&#8211;\u00a0 Sname<\/p>\n<p>Sname\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Sno<\/p>\n<p>Sno &#8211;\u00a0 \u00a0 \u00a0 \u00a0 City<br \/>\nSno &#8211; Status<br \/>\nSname &#8211; City<br \/>\nSname &#8211; Status<br \/>\nCity &#8211; Status<\/p>\n<table class=\"aligncenter\" style=\"border-collapse: collapse;width: 95.0243%;height: 98px\">\n<tbody>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\n<td style=\"width: 50%;height: 14px\">City<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sno<\/td>\n<td style=\"width: 50%;height: 14px\">Status<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\n<td style=\"width: 50%;height: 14px\">City<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">Sname<\/td>\n<td style=\"width: 50%;height: 14px\">Status<\/td>\n<\/tr>\n<tr style=\"height: 14px\">\n<td style=\"width: 50%;height: 14px\">City<\/td>\n<td style=\"width: 50%;height: 14px\">Status<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The FD diagram of relation P is<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27.png\" alt=\"\" width=\"555\" height=\"283\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27.png 555w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27-300x153.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27-65x33.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27-225x115.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-27-350x178.png 350w\" sizes=\"auto, (max-width: 555px) 100vw, 555px\" \/><\/p>\n<p>Here following functional dependencies exist in Part table:<\/p>\n<p>&nbsp;<\/p>\n<p>Pno &#8211; Pname<\/p>\n<p>Pno &#8211; Color<\/p>\n<p>Pno &#8211; Wt<\/p>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-86 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28.png\" alt=\"\" width=\"415\" height=\"314\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28.png 415w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28-300x227.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28-65x49.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28-225x170.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-28-350x265.png 350w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/p>\n<div>\n<p style=\"text-align: justify\">The FD diagram of relation Shipment is\u00a0<span style=\"text-align: initial;font-size: 1em\">Here following functional dependencies exist in parts table SP (Sno, Pno) &#8211; SP.QTY<\/span><\/p>\n<\/div>\n<p><strong>Fully Functional Dependence (FFD)<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Fully Functional Dependence (FFD) is defined, as Attribute Y is FFD on attribute&#8221; X, if it is FD on X and not FD on any proper subset of X. For example, in relation Supplier, different cities may have the same status. It may be possible that cities like Amritsar, Jalandhar may have the same status 10.<\/p>\n<p>So, the City is not FD on Status.<\/p>\n<p>&nbsp;<\/p>\n<p>So, the City is not FD on Status.<\/p>\n<p style=\"text-align: justify\">But, the combination of Sno, Status can give only one corresponding City ,because Sno&#8221; is unique. Thus,<\/p>\n<p style=\"text-align: justify\">(Sno, Status) \u00e0 City<\/p>\n<p style=\"text-align: justify\">It means city is FD on composite attribute (Sno, Status) however City is not fully functional dependent on this composite attribute, which is explained below:<\/p>\n<p>(Sno, Status) \u00e0 City<\/p>\n<p>&nbsp;<\/p>\n<p>X\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Y<\/p>\n<p>&nbsp;<\/p>\n<p>Here Y is FD on X, but X has two proper subsets Sno and Status; city is\u00b7 FD .on one proper subset .of X i.e. Sno<\/p>\n<p>&nbsp;<\/p>\n<p>Sno \u00e0 City<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">According to &#8216;FFD definition Y must not be FD .on any proper subset of X, but here City is FD in one subset .of X i.e. Sno, so City is not FFD on (Sno, Status)<\/p>\n<p>&nbsp;<\/p>\n<p>Consider another case of SP table:<\/p>\n<p>Here, Qty is FD on combination of Sna, Pno.<\/p>\n<p>&nbsp;<\/p>\n<p>(Sno, Pno)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00e0\u00a0\u00a0\u00a0\u00a0\u00a0 Qty<\/p>\n<p>&nbsp;<\/p>\n<p>X\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Y<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here, X has two proper subsets Sno and Pna<\/p>\n<p style=\"text-align: justify\">Qty is not FD on Sno, because one Sna can supply mare than .one quantity.<\/p>\n<p style=\"text-align: justify\">Qty is also not FD on Pno, because .one Pna may be supplied many times by different suppliers with different .or same quantities.<\/p>\n<p style=\"text-align: justify\">So, Qty is FFD and composite attribute of (Sno, Pno) \u00e0 Qty.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Other Functional Dependencies<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">There are same rather types of functional dependencies, which play a vital rule during the process .of normalization of data.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Candidate Functional Dependency<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A candidate functional dependency is a functional dependency that includes all attributes of the table. It should also be noted that a well-fanned dependency diagram must have at least one candidate functional dependency, and that there can be more than .one candidate functional dependency for a given dependency diagram.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Primary Functional Dependency<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A primary functional dependency is a candidate functional dependency that is selected to determine the primary key. The determinant of the primary functional dependency is the primary key of the relational database table. Each dependency diagram must have one and only on primary functional dependency. If a relational database table has .only .one candidate functional dependency, then it automatically becomes the primary functional dependency<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Once the primary key has been determined, there will be three possible types of functional dependencies:<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Description<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A \u00e0 B A key attribute functionally determines a non-key attribute.<\/p>\n<p>A \u00e0 B A non-key attribute functionally determines a non-key attribute.<\/p>\n<p>A \u00e0 B A non-key attribute functionally determines a key attribute.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A <strong>partial functional dependency<\/strong> is a functional dependency where the determinant consists of key attributes, but not the entire primary key, and the determined consist~ of non-key attributes.<\/p>\n<p>&nbsp;<\/p>\n<p>A <strong>transitive functional dependency<\/strong> is a functional dependency where the determinant consists of non-key attributes and the determined also consists of non-key attributes.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A <strong>Boyce-Codd functional dependency<\/strong> is a functional dependency where the determinant consists of non-key attributes and the determined consists of key attributes.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">A <strong>Multi-Value Dependency (MVD)<\/strong> occurs when two or more independent multi valued facts about the same attribute occur within the same table. It means that if in a relation R having A, Band C as attributes, B and Care multi-value facts about A, which is represented as A \u00e0\u00e0B and A \u00e0\u00e0C ,then multi value dependency exist only if B and C are independent on each other.<\/p>\n<p>&nbsp;<\/p>\n<p>A <strong>Join Dependency<\/strong> exists if a relation R is equal to the join of the projections X Z. where X, Y, Z projections of R.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Closure of set of dependencies<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let a relation <em>R<\/em> have some functional dependencies <em>F<\/em> specified. The <em>closure of F<\/em> (usually written as <em>F<\/em>+) is the set of all functional dependencies that may be logically derived from<em> F. <\/em>Often<em> F <\/em>is the set of most obvious and important functional dependencies and. <em>F<\/em>+, the closure, is the set of all the functional dependencies including <em>F<\/em> and those that can be deduced from <em>F.<\/em> The closure is important and may, for example, be needed in finding one or more candidate keys of the relation.<\/p>\n<p>&nbsp;<\/p>\n<p>For example, the <em>student<\/em> relation has the following functional dependencies<\/p>\n<p>&nbsp;<\/p>\n<p><em>sno <\/em>\u00e0<em> Sname<\/em><\/p>\n<p><em>cno <\/em>\u00e0<em> came<\/em><\/p>\n<p><em>sno <\/em>\u00e0<em> address<\/em><\/p>\n<p><em>cno <\/em>\u00e0<em> instructor<\/em><\/p>\n<p><em>Instructor \u00e0 office<\/em><\/p>\n<p>&nbsp;<\/p>\n<div>\n<p style=\"text-align: justify\">Let these dependencies be denoted by <em>F.<\/em> The closure of <em>F,<\/em> denoted by <em>F<\/em> +, includes <em>F<\/em> and all functional- dependencies that are implied by <em>F.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To determine <em>F<\/em>+, we need rules for deriving all functional dependencies that are implied: by <em>F.<\/em> A set of rules that may be used to infer additional dependencies was proposed by Armstrong in 1974. These rules (or axioms) are a complete set of rules in\u00b7 that all possible functional dependencies may be derived from them. The rules are:<\/p>\n<p>&nbsp;<\/p>\n<p><em>1.\u00a0 <\/em><em>Reflexivity Rule &#8211; <\/em>If<em> X <\/em>is a set of attributes and Y is a subset of<em> X, <\/em>then<em> X \u00e0Y <\/em>holds.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The reflexivity rule is the simplest (almost trivial) rule. It states that each subset of <em>X<\/em> is functionally dependent on <em>X.<\/em> In other words trivial dependence is defined as follows:<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Trivial functional dependency<\/strong>: A trivial functional dependency is a functional dependency of an attribute on a superset of itself.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>For example: <\/strong>{Employee ID, Employee Address} \u00e0 {Employee Address} is trivial, here {Employee\u00a0<span style=\"text-align: initial;font-size: 1em\">Address} is a subset of {Employee ID, Employee Address}.<\/span><\/p>\n<\/div>\n<ol start=\"2\">\n<li><em>Augmentation Rule &#8211; <\/em>If<em> X \u00e0 Y <\/em>holds and<em> W <\/em>is a set of attributes, and then<em> WX \u00e0 WY <\/em>holds.<\/li>\n<\/ol>\n<p style=\"text-align: justify\">The argumentation (&#8216;u rule is also quite simple. It states that if <em style=\"text-align: initial;font-size: 1em\">Y<\/em><span style=\"text-align: initial;font-size: 1em\"> is determined by <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> then a set of attributes <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">Y<\/em><span style=\"text-align: initial;font-size: 1em\"> together will be determined by <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> together. Note that we use the notation <\/span><em style=\"text-align: initial;font-size: 1em\">WX<\/em><span style=\"text-align: initial;font-size: 1em\"> to mean the collection of all attributes in <\/span><em style=\"text-align: initial;font-size: 1em\">W<\/em><span style=\"text-align: initial;font-size: 1em\"> and <\/span><em style=\"text-align: initial;font-size: 1em\">X<\/em><span style=\"text-align: initial;font-size: 1em\"> and write <\/span><em style=\"text-align: initial;font-size: 1em\">WX<\/em><span style=\"text-align: initial;font-size: 1em\"> rather than the more conventional <\/span><em style=\"text-align: initial;font-size: 1em\">(W,<\/em><\/p>\n<ol>\n<li><em>X) <\/em>for convenience.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong>For example<\/strong>: Rno &#8211; Name; Class and Marks is a set of attributes and act as<\/p>\n<p>Then\u00b7 {Rno, Class, Marks} -&gt; {Name, Class, Marks}<\/p>\n<p><em>3. Transitivity Rule &#8211; <\/em>If<em> X -&gt; <\/em>Y and Y -&gt;<em> Z <\/em>hold, then<em> X -&gt; Z <\/em>holds.<\/p>\n<p style=\"text-align: justify\">The transitivity rule is perhaps the most important one. It states that if <em>X<\/em> functionally determines Y and Y functionally determine <em>Z<\/em> then <em>X<\/em> functionally determines <em>Z.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>For example: <\/strong>Rno -&gt; City and City -&gt; Status, then Rno -&gt; Status should be holding true.<\/p>\n<p>&nbsp;<\/p>\n<p>These rules are called <em>Armstrong&#8217;s Axioms.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Further axioms may be derived from the above although the above three axioms are <em>sound and<\/em> <em>complete <\/em>in that they do not generate any incorrect functional dependencies (soundness) and they do generate all possible functional dependencies that can be inferred from <em>F<\/em> (completeness). The most important additional axioms are:<\/p>\n<ol>\n<li><em>Union Rule &#8211; <\/em>If<em> X -&gt; Y <\/em>and<em> X -&gt; Z <\/em>hold, then<em> X -&gt; YZ <\/em>holds.<\/li>\n<li><em>Decomposition Rule &#8211; <\/em>If<em> X \u00e0 YZ <\/em>holds, then so do<em> X \u00e0 Y <\/em>and<em> X \u00e0 <\/em>Z.<\/li>\n<li><em>Pseudotransitivity Rule &#8211; <\/em>If<em> X \u00e0 Y <\/em>and<em> WY \u00e0 <\/em>Z hold then so does<em> WX \u00e0Z.<\/em><\/li>\n<\/ol>\n<p>Based on the above axioms and the .functional dependencies specified for relation <em>student,<\/em> we may write a large number of functional dependencies. Some of these are:<\/p>\n<p>&nbsp;<\/p>\n<p><em>( sno, cno) \u00e0 sno <\/em>(Rule 1)<\/p>\n<p><em>(sno, cno) \u00e0 cno <\/em>(Rule 1)<\/p>\n<p><em>(sno, cno) \u00e0 (Sname, cname) <\/em>(Rule 2)<\/p>\n<p><em>cno \u00e0 office <\/em>(Rule 3)<\/p>\n<p><em>sno \u00e0 (Sname, address) <\/em>(Union Rule)<\/p>\n<p>&nbsp;<\/p>\n<p>Etc.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Often a very large list of dependencies can be derived from a given set <em>F<\/em> since Rule 1 itself will lead to a large number of dependencies. Since we have seven attributes <em>(sno, Sname, address, cno, cname,<\/em> <em>instructor, office), <\/em>there are 128 (that is, 2^7) subsets of these attributes. These 128 subsets could form 128 values of <em>X<\/em> in functional dependencies of the type <em>X ~ Y.<\/em> Of course, each value of <em>X<\/em> will then be associated with a number of values for <em>Y (Y<\/em> being a subset of x) Leading to several thousand dependencies. These large numbers of dependencies are not particularly helpful in achieving our aim of normalizing relations.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Although we could follow the present procedure and compute the closure of <em>F<\/em> to find all the functional dependencies, the computation requires exponential time and the list of dependencies is often very large and therefore not very useful. There are two possible approaches that can be taken to avoid dealing with the large number of dependencies in the closure. &#8216;One&#8217; is to deal with one attribute or a set of attributes at a time and find its closure (i.e. all functional dependencies relating to them). The aim of this exercise is to find what attributes depend on a given set of attributes and therefore ought to be together. The other approach is to find the <em>minimal\u00b7 covers.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Minimal Functional Dependencies or Irreducible Set of Dependencies<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In discussing the concept of equivalent FDs, it is useful to define the concept of <em>minimal functional<\/em> <em>dependencies <\/em>or<em> minimal cover <\/em>which is useful in eliminating necessary functional dependencies so that only the minimal numbers of dependencies need to be enforced by the system. The concept of minimal cover of <em>F<\/em> is sometimes called <em>irreducible Set<\/em> of <em>F.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>A functional depending set S is irreducible if the set has three following properties:<\/p>\n<p>&nbsp;<\/p>\n<p>Each right set of a functional dependency of S contains only one attribute.<\/p>\n<p>Each left set of a functional dependency of S is irreducible. It means that reducing anyone attribute from left set will change the content of S (S will lose some information).<\/p>\n<p>Reducing any functional dependency will change the content of S.<\/p>\n<p>&nbsp;<\/p>\n<p>Sets of functional dependencies with these properties are also called <em>canonical<\/em> or <em>minimal.<\/em><\/p>\n<p>If the value in a non-key attribute is determined by the value in another non-key attribute then that field has transitive dependency.<\/p>\n<p>&nbsp;<\/p>\n<p>For example, look at the relation below:<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-87 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-29.png\" alt=\"\" width=\"225\" height=\"123\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-29.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-29-65x36.png 65w\" sizes=\"auto, (max-width: 225px) 100vw, 225px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The attribute <strong>teacher_name<\/strong> is determined by the non-key attribute <strong>teacher_id<\/strong>, and not the primary key of <strong>course_id<\/strong>. This means that teacher_name is transitively dependent on the primary key of course_id.<\/p>\n<p>In order to show a relation in 3NF, all transitive dependencies must be removed.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Functional Dependency<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Functional dependency (FD) is a set of constraints between two attributes in a relation. Functional dependency says that if two tuples have same values for attributes A1, A2,&#8230;, An, then those two tuples must have to have same values for attributes B1, B2, &#8230;, Bn.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Functional dependency is represented by an arrow sign (\u2192) that is, X\u2192Y, where X functionally determines Y. The left-hand side attributes determine the values of attributes on the right-hand side.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Armstrong&#8217;s Axioms<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">If F is a set of functional dependencies then the closure of F, denoted as F+, is the set of all functional dependencies logically implied by F. Armstrong&#8217;s Axioms are a set of rules, that when applied repeatedly, generates a closure of functional dependencies.<\/p>\n<ul>\n<li style=\"text-align: justify\"><strong>Reflexive rule <\/strong>\u2212 If alpha is a set of attributes and beta is_subset_of alpha, then alpha holds beta.<\/li>\n<li style=\"text-align: justify\"><strong>Augmentation rule <\/strong>\u2212 If a \u2192 b holds and y is attribute set, then ay \u2192 by also holds. That is adding attributes in dependencies, does not change the basic dependencies.<\/li>\n<li style=\"text-align: justify\"><strong>Transitivity rule <\/strong>\u2212 Same as transitive rule in algebra, if a \u2192 b holds and b \u2192 c holds, then a \u2192 c also holds. a \u2192 b is called as a functionally that determines b.<\/li>\n<\/ul>\n<p><strong>\u00a0 \u00a0 Trivial Functional Dependency<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\"><strong>Trivial <\/strong>\u2212 If a functional dependency (FD) X \u2192 Y holds, where Y is a subset of X, then it is called a trivial FD. Trivial FDs always hold.<\/li>\n<li style=\"text-align: justify\"><strong>Non-trivial <\/strong>\u2212 If an FD X \u2192 Y holds, where Y is not a subset of X, then it is called a non-trivial FD.<\/li>\n<li style=\"text-align: justify\"><strong>Completely non-trivial <\/strong>\u2212 If an FD X \u2192 Y holds, where x intersect Y = \u03a6, it is said to be a completely non-trivial FD.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-88 aligncenter\" src=\"http:\/\/csp4.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30.png\" alt=\"\" width=\"639\" height=\"314\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30.png 639w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30-300x147.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30-65x32.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30-225x111.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-content\/uploads\/sites\/47\/2018\/07\/a2-30-350x172.png 350w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/p>\n","protected":false},"author":4,"menu_order":9,"template":"","meta":{"_acf_changed":false,"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-79","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapters\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":4,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapters\/79\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapters\/79\/revisions\/323"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapters\/79\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/pressbooks\/v2\/chapter-type?post=79"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/wp\/v2\/contributor?post=79"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp4\/wp-json\/wp\/v2\/license?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}