Presentation is loading. Please wait.

Presentation is loading. Please wait.

Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization.

Similar presentations


Presentation on theme: "Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization."— Presentation transcript:

1 Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization for Relational Databases

2 Introduction to Databases 2 Outline Normal Forms Based on Primary Keys  First Normal Form  Second Normal Form  Third Normal Form

3 Introduction to Databases 3 Introduction to Normalization Normalization: Process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations Normal form: Condition using keys and FDs of a relation to certify whether a relation schema is in a particular normal form  2NF, 3NF, BCNF based on keys and FDs of a relation schema

4 Introduction to Databases 4 First Normal Form Disallows composite attributes, multivalued attributes, and nested relations; attributes whose values for an individual tuple are non-atomic. Considered to be part of the definition of relation

5 Introduction to Databases 5 Normalization into 1NF

6 Introduction to Databases 6 Examples First Normal Form EMP_PROJ (Ssn, Ename, {Phone#}) { } Mulitvalue attribute EMP_PROJ1 (Ssn, Ename) EMP_PROJ2 (Ssn, Phone#) ■EMP_PROJ (Ssn, Ename (Fname, Lname)) ( ) composite attribute EMP_PROJ (Ssn, Fname,Lname) ■EMP_PROJ (Ssn, Ename, {PROJS (Pnamber, Hours)}) EMP_PROJ1 (Ssn, Ename) EMP_PROJ2 (Ssn, Pnamber, Hours)

7 Introduction to Databases 7

8 8 Second Normal Form Uses the concepts of FDs, primary key Definitions:  Prime attribute - attribute that is member of the primary key K  Full functional dependency - a FD Y  Z where removal of any attribute from Y means the FD does not hold any more

9 Introduction to Databases 9 Examples Second Normal Form {SSN, PNUMBER}  HOURS is a full FD since neither SSN  HOURS nor PNUMBER  HOURS hold {SSN, PNUMBER}  ENAME is not a full FD (it is called a partial dependency ) since SSN  ENAME also holds A relation schema R is in second normal form (2NF) if every non-prime attribute A in R is fully functionally dependent on the primary key R can be decomposed into 2NF relations via the process of 2NF normalization

10 Introduction to Databases 10 Examples Second Normal Form

11 Introduction to Databases 11 Second Normal Form Note: The test for 2NF involves testing for functional dependencies whose left-hand side attributes are part of the primary key. If the primary key contains a single attribute, the test need not be applied at all.

12 Introduction to Databases 12 Third Normal Form Definition  Transitive functional dependency – a FD X  Y in R is a transitive dependency if there is a set of attributes Z that are neither a primary or candidate key and both X  Z and Z  Y holds. Examples:  SSN  DMGRSSN is a transitive FD since SSN  DNUMBER and DNUMBER  DMGRSSN hold  SSN  ENAME is non-transitive since there is no set of attributes X where SSN  X and X  ENAME

13 Introduction to Databases 13 3 rd Normal Form A relation schema R is in third normal form (3NF) if it is in 2NF and no non-prime attribute A in R is transitively dependent on the primary key

14 Introduction to Databases 14 Examples Third Normal Form

15 Introduction to Databases 15 SUMMARY OF NORMAL FORMS based on Primary Keys


Download ppt "Al-Imam University Girls Education Center Collage of Computer Science 1 nd Semester, 1432/1433H Chapter 10_part2 Functional Dependencies and Normalization."

Similar presentations


Ads by Google