The document discusses database normalization and describes several normal forms including second normal form (2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF). It provides examples of relations that violate or satisfy these normal forms and explains how decomposing relations can eliminate anomalies by ensuring determinants are keys.
The document discusses database normalization and describes several normal forms including second normal form (2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF). It provides examples of relations that violate or satisfy these normal forms and explains how decomposing relations can eliminate anomalies by ensuring determinants are keys.
The document discusses database normalization and describes several normal forms including second normal form (2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF). It provides examples of relations that violate or satisfy these normal forms and explains how decomposing relations can eliminate anomalies by ensuring determinants are keys.
Second Normal Form A relation is in 2nd normal form iff it is in the first normal form and all non key attributes are fully functionally dependent on key, that is, there is no partial dependency
Second Normal Form Relation is decomposed based on the FDs CLASS(crId, stId, stName, fId, room, grade) crId, stId stName, fId, room, grade stId stName crId fId, room STD(stId, stName) COURSE(crId, fId, room) CLASS(crId, stId, grade)
By: Yasir Awan 6
Second Normal Form
Each of these tables is in second normal
form Free of anomalies due to partial dependency
By: Yasir Awan 7
Third Normal Form A table is in third normal form (3NF) iff it is in 2NF and there is no transitive dependency, that is, no non-key attribute is dependent on another non-key attribute
Third Normal Form STD(stId, stName, stAdr, prName, prCrdts) stId stName, stAdr, prName, prCrdts prName prCrdts STD (stId, stName, stAdr, prName) PROGRAM (prName, prCrdts)
By: Yasir Awan 11
3NF Relations
Each of the table is in 3NF
Free of all anomalies
By: Yasir Awan 12
Boyce-Codd Normal Form A general form of 3NF Every relation in BCNF is in 3NF vice-versa is not always true
By: Yasir Awan 13
BCNF Situation when table in 3NF is not in BCNF A non-key determines a part of the composite primary key In other words, Each determinant must be a key / candidate key.
By: Yasir Awan 14
BCNF STUDENT_ADVISOR(SID, Major, Advisor, Maj_GPA) SID, Major Advisor, Maj_GPA Advisor Major Table is in 3NF, not in BCNF since the Advisor is not a candidate key
Anomalies Suppose that in S/E the advisor Yasir is to be replaced by Einstein. This change must be made in two (or more) rows in the table. (Update anomaly) Suppose we want to insert a row with the information that Bill Gates advises in Computer Science. This, of course, cannot be done until at least one student majoring in Computer Science is assigned Bill Gates as and advisor. (Insertion Anomaly) Finally, if student number 789 withdraws from university, we lose the information that Usman advises in T/E. (Deletion Anomaly).
By: Yasir Awan 16
BCNF We decompose the table to bring it into BCNF in the following way The determinant advisor becomes part of the composite primary key. The attribute Major, which is functionally dependent on Advisor, becomes a nonkey attribute. STUDENT (SID, Advisor , Maj_GPA) ADVISOR (Advisor, Major)